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.

CompatibilityGridToggleMultiSelectSort.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  1. package com.vaadin.tests.components.grid;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractTestUI;
  4. import com.vaadin.tests.minitutorials.v7_4.GridExampleHelper;
  5. import com.vaadin.ui.Button;
  6. import com.vaadin.v7.ui.Grid;
  7. import com.vaadin.v7.ui.Grid.MultiSelectionModel;
  8. import com.vaadin.v7.ui.Grid.SelectionMode;
  9. public class CompatibilityGridToggleMultiSelectSort extends AbstractTestUI {
  10. @Override
  11. protected void setup(VaadinRequest request) {
  12. // container with at least 100 rows
  13. final Grid grid = new Grid(GridExampleHelper.createContainer());
  14. grid.setSelectionMode(SelectionMode.MULTI);
  15. addComponent(grid);
  16. Button button = new Button("Toggle multi-select", e -> {
  17. if (grid.getSelectionModel() instanceof MultiSelectionModel) {
  18. grid.setSelectionMode(SelectionMode.SINGLE);
  19. } else {
  20. grid.setSelectionMode(SelectionMode.MULTI);
  21. }
  22. });
  23. addComponent(button);
  24. }
  25. @Override
  26. protected String getTestDescription() {
  27. return "Toggling multi-select off should not break sorting "
  28. + "first column to both directions.";
  29. }
  30. }