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.

CheckboxAlignmentWithNoHeaderGrid.java 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package com.vaadin.tests.components.grid;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import com.vaadin.server.VaadinRequest;
  5. import com.vaadin.tests.components.AbstractTestUI;
  6. import com.vaadin.ui.Button;
  7. import com.vaadin.ui.Grid;
  8. import com.vaadin.ui.VerticalLayout;
  9. public class CheckboxAlignmentWithNoHeaderGrid extends AbstractTestUI {
  10. List<String> items = new ArrayList<>();
  11. int count = 1;
  12. @Override
  13. protected void setup(VaadinRequest request) {
  14. VerticalLayout lay = new VerticalLayout();
  15. Grid<String> grid = new Grid<>();
  16. grid.setSelectionMode(Grid.SelectionMode.MULTI);
  17. grid.setHeaderVisible(false);
  18. grid.addColumn(Object::toString);
  19. grid.setItems(items);
  20. lay.addComponent(grid);
  21. lay.addComponent(new Button("add", e -> {
  22. items.add("ABCDEFG" + count);
  23. grid.getDataProvider().refreshAll();
  24. count++;
  25. }));
  26. addComponent(lay);
  27. }
  28. @Override
  29. protected String getTestDescription() {
  30. return "Rows added to empty grid with multiselect and no header should not break ";
  31. }
  32. @Override
  33. protected Integer getTicketNumber() {
  34. return 11607;
  35. }
  36. }