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.

TableScrollOnFocus.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.vaadin.tests.components.table;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.CheckBox;
  4. import com.vaadin.v7.ui.Table;
  5. public class TableScrollOnFocus extends TestBase {
  6. @Override
  7. protected void setup() {
  8. final Table table = new Table();
  9. final CheckBox chkSelectable = new CheckBox("selectable");
  10. chkSelectable.addValueChangeListener(
  11. event -> table.setSelectable(chkSelectable.getValue()));
  12. table.addContainerProperty("row #", String.class, "-");
  13. table.setColumnWidth("row #", 150);
  14. for (int i = 1; i < 200; i++) {
  15. table.addItem(new String[] { "" + i }, null);
  16. }
  17. table.setSortDisabled(true);
  18. chkSelectable.setValue(true);
  19. addComponent(chkSelectable);
  20. addComponent(table);
  21. }
  22. @Override
  23. protected String getDescription() {
  24. return "The table scrolls up 2 pages after loosing and regaining the focus!</b><p>"
  25. + "Drag scrollbar to top then to the bottom of the table.<br>"
  26. + "Click somewhere beside the table to take away the focus,<br>"
  27. + "then click back on the table (header or scrollbar) to give back the focus<br>"
  28. + "(Pressing Tab and Shift-Tab does the same job).<p>"
  29. + "If the table is set to non-selectable-mode, no self-scrolling occurs.";
  30. }
  31. @Override
  32. protected Integer getTicketNumber() {
  33. return 6774;
  34. }
  35. }