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.

TableRowScrolledBottom.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.vaadin.tests.components.table;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.shared.ui.label.ContentMode;
  4. import com.vaadin.tests.components.AbstractTestUI;
  5. import com.vaadin.ui.Button;
  6. import com.vaadin.ui.Label;
  7. import com.vaadin.ui.Table;
  8. public class TableRowScrolledBottom extends AbstractTestUI {
  9. final static String part1 = "This is a test item with long text so that there is something to see Nr. ";
  10. final static String part2 = ". This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE";
  11. @Override
  12. protected void setup(VaadinRequest request) {
  13. final Table table = new Table();
  14. table.setSizeFull();
  15. table.addContainerProperty("Test", Label.class, null);
  16. table.setHeight("100%");
  17. Button button = new Button("Add 100 items");
  18. button.addClickListener(new Button.ClickListener() {
  19. int i = 0;
  20. @Override
  21. public void buttonClick(Button.ClickEvent event) {
  22. for (int j = 0; j < 100; j++) {
  23. ++i;
  24. table.addItem(new Object[] { new Label(part1 + "<b>" + i
  25. + "</b>" + part2, ContentMode.HTML) }, i);
  26. table.setCurrentPageFirstItemIndex(table
  27. .getContainerDataSource().size() - 1);
  28. }
  29. }
  30. });
  31. addComponent(table);
  32. addComponent(button);
  33. getLayout().setExpandRatio(table, 1f);
  34. }
  35. @Override
  36. protected String getTestDescription() {
  37. return "Table should be scrolled to bottom when adding rows and updating currentPageFirstItemIndex to last item";
  38. }
  39. @Override
  40. protected Integer getTicketNumber() {
  41. return 10970;
  42. }
  43. }