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.

TableScrollUpOnSelect.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package com.vaadin.tests.components.table;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractReindeerTestUI;
  4. import com.vaadin.ui.VerticalLayout;
  5. import com.vaadin.ui.Window;
  6. import com.vaadin.v7.ui.Table;
  7. import com.vaadin.v7.ui.TextField;
  8. /**
  9. * Test to see if Table appears to scroll up under an obscure set of conditions
  10. * (Scrolled down, set to expand, selecting updates a TextField that precedes
  11. * the Table in a VerticalLayout.) (#10106)
  12. *
  13. * @author Vaadin Ltd
  14. */
  15. public class TableScrollUpOnSelect extends AbstractReindeerTestUI {
  16. public TextField text = null;
  17. @Override
  18. protected void setup(VaadinRequest request) {
  19. text = new TextField();
  20. text.setImmediate(true);
  21. final Table table = new Table(null);
  22. table.addContainerProperty("value", Integer.class, 0);
  23. for (int i = 0; i < 50; ++i) {
  24. table.addItem(new Object[] { i }, i);
  25. }
  26. table.setSizeFull();
  27. table.setSelectable(true);
  28. table.setImmediate(true);
  29. table.setEditable(false);
  30. final VerticalLayout layout = new VerticalLayout();
  31. table.addValueChangeListener(event -> {
  32. if (table.getValue() != null) {
  33. text.setValue(table.getValue().toString());
  34. }
  35. });
  36. table.setCurrentPageFirstItemIndex(49);
  37. layout.setSizeFull();
  38. layout.addComponent(text);
  39. layout.addComponent(table);
  40. layout.setExpandRatio(table, 1.0f);
  41. Window window = new Window();
  42. window.setHeight("600px");
  43. window.setWidth("400px");
  44. window.setModal(true);
  45. window.setContent(layout);
  46. getUI().addWindow(window);
  47. }
  48. @Override
  49. protected String getTestDescription() {
  50. return "Table scrolls up when selecting a row";
  51. }
  52. @Override
  53. protected Integer getTicketNumber() {
  54. return 13358;
  55. }
  56. }