Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

AbstractSingleSelectTestUI.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.components.abstractlisting;
  17. import java.util.LinkedHashMap;
  18. import com.vaadin.ui.AbstractSingleSelect;
  19. public abstract class AbstractSingleSelectTestUI<T extends AbstractSingleSelect<Object>>
  20. extends AbstractListingTestUI<T> {
  21. @Override
  22. protected void createActions() {
  23. super.createActions();
  24. createSelectionMenu();
  25. createListenerMenu();
  26. }
  27. protected void createListenerMenu() {
  28. createListenerAction("Selection listener", "Listeners", c -> c
  29. .addSelectionListener(e -> log("Selected: " + e.getValue())));
  30. }
  31. protected void createSelectionMenu() {
  32. LinkedHashMap<String, String> options = new LinkedHashMap<>();
  33. options.put("None", null);
  34. options.put("Item 0", "Item 0");
  35. options.put("Item 1", "Item 1");
  36. options.put("Item 2", "Item 2");
  37. options.put("Item 10", "Item 10");
  38. options.put("Item 100", "Item 100");
  39. createSelectAction("Select", "Selection", options, "None",
  40. (component, selected, data) -> component.setValue(selected));
  41. }
  42. }