You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ComboBoxOnSmallScreen.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2000-2014 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.combobox;
  17. import com.vaadin.server.VaadinRequest;
  18. import com.vaadin.tests.components.AbstractTestUI;
  19. import com.vaadin.ui.Alignment;
  20. import com.vaadin.ui.ComboBox;
  21. import com.vaadin.ui.VerticalLayout;
  22. /**
  23. * Test UI for issue #11929 where ComboBox suggestion popup hides the ComboBox
  24. * itself obscuring the text input field.
  25. *
  26. * @author Vaadin Ltd
  27. */
  28. public class ComboBoxOnSmallScreen extends AbstractTestUI {
  29. private static final String PID = "captionPID";
  30. @Override
  31. protected void setup(VaadinRequest request) {
  32. addComponents(createComboBox(), createComboBox());
  33. VerticalLayout vl = getLayout();
  34. vl.setHeight(300, Unit.PIXELS);
  35. vl.setComponentAlignment(vl.getComponent(1), Alignment.BOTTOM_LEFT);
  36. }
  37. @Override
  38. protected String getTestDescription() {
  39. return "Combobox hides what you are typing on small screen";
  40. }
  41. @Override
  42. protected Integer getTicketNumber() {
  43. return 11929;
  44. }
  45. private ComboBox createComboBox() {
  46. ComboBox cb = new ComboBox();
  47. cb.addContainerProperty(PID, String.class, "");
  48. cb.setItemCaptionPropertyId(PID);
  49. for (int i = 1; i < 21; ++i) {
  50. final String v = "Item #" + i;
  51. cb.getItem(cb.addItem()).getItemProperty(PID).setValue(v);
  52. }
  53. return cb;
  54. }
  55. }