Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ComboBoxOnSmallScreen.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package com.vaadin.tests.components.combobox;
  2. import com.vaadin.server.ClassResource;
  3. import com.vaadin.server.VaadinRequest;
  4. import com.vaadin.tests.components.AbstractReindeerTestUI;
  5. import com.vaadin.v7.data.Item;
  6. import com.vaadin.v7.ui.ComboBox;
  7. /**
  8. * Test UI for issue #11929 where ComboBox suggestion popup hides the ComboBox
  9. * itself obscuring the text input field.
  10. *
  11. * @author Vaadin Ltd
  12. */
  13. public class ComboBoxOnSmallScreen extends AbstractReindeerTestUI {
  14. private static final String PID = "captionPID";
  15. @Override
  16. protected void setup(VaadinRequest request) {
  17. addComponents(createComboBox());
  18. }
  19. @Override
  20. protected String getTestDescription() {
  21. return "Combobox hides what you are typing on small screen";
  22. }
  23. @Override
  24. protected Integer getTicketNumber() {
  25. return 11929;
  26. }
  27. private ComboBox createComboBox() {
  28. ComboBox cb = new ComboBox();
  29. cb.addContainerProperty(PID, String.class, "");
  30. cb.setItemCaptionPropertyId(PID);
  31. Object selectId = null;
  32. for (int i = 1; i < 22; ++i) {
  33. final String v = "Item #" + i;
  34. Object itemId = cb.addItem();
  35. if (i == 9) {
  36. selectId = itemId;
  37. }
  38. Item item = cb.getItem(itemId);
  39. item.getItemProperty(PID).setValue(v);
  40. int flagIndex = i % 3;
  41. cb.setItemIcon(itemId,
  42. new ClassResource(flagIndex == 0 ? "fi_small.png"
  43. : flagIndex == 1 ? "fi.gif" : "se.gif"));
  44. }
  45. cb.select(selectId);
  46. return cb;
  47. }
  48. }