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.

GridSelectAllStatus.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.vaadin.tests.components.grid;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractTestUI;
  4. import com.vaadin.ui.Grid;
  5. import com.vaadin.ui.Grid.SelectionMode;
  6. import com.vaadin.ui.Label;
  7. public class GridSelectAllStatus extends AbstractTestUI {
  8. public Grid<String> grid;
  9. @Override
  10. protected void setup(VaadinRequest request) {
  11. grid = new Grid<>();
  12. grid.setSelectionMode(SelectionMode.MULTI);
  13. grid.setItems("Item 1", "Item 2");
  14. grid.addColumn(item -> item);
  15. Label label = new Label("Select-all checkbox is checked?");
  16. Label selectAllStatus = new Label(
  17. String.valueOf(grid.asMultiSelect().isAllSelected()));
  18. selectAllStatus.setId("status");
  19. grid.asMultiSelect()
  20. .addMultiSelectionListener(e -> selectAllStatus.setValue(
  21. String.valueOf(grid.asMultiSelect().isAllSelected())));
  22. addComponents(grid, label, selectAllStatus);
  23. }
  24. @Override
  25. protected Integer getTicketNumber() {
  26. return 12081;
  27. }
  28. @Override
  29. protected String getTestDescription() {
  30. return "The status of the Grid's select-all checkbox should be "
  31. + "accessible through the Java API.";
  32. }
  33. }