summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java69
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java64
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java2
5 files changed, 78 insertions, 66 deletions
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java
index 4c5da97a5d..c535789ea7 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java
@@ -16,6 +16,7 @@
package com.vaadin.ui.components.grid;
import com.vaadin.data.Binder;
+import com.vaadin.data.provider.DataProvider;
import com.vaadin.event.selection.MultiSelectionListener;
import com.vaadin.event.selection.SelectionListener;
import com.vaadin.shared.Registration;
@@ -34,6 +35,39 @@ public interface MultiSelectionModel<T>
extends GridSelectionModel<T>, com.vaadin.data.SelectionModel.Multi<T> {
/**
+ * State for showing the select all checkbox in the grid's default header
+ * row for the selection column.
+ * <p>
+ * Default value is {@link #DEFAULT}, which means that the select all is
+ * only visible if an in-memory data provider is used
+ * {@link DataProvider#isInMemory()}.
+ */
+ public enum SelectAllCheckBoxVisibility {
+ /**
+ * Shows the select all checkbox, regardless of data provider used.
+ * <p>
+ * <b>For a lazy data provider, selecting all will result in to all rows
+ * being fetched from backend to application memory!</b>
+ */
+ VISIBLE,
+ /**
+ * Never shows the select all checkbox, regardless of data provider
+ * used.
+ */
+ HIDDEN,
+ /**
+ * By default select all checkbox depends on the grid's dataprovider.
+ * <ul>
+ * <li>Visible, if the data provider is in-memory</li>
+ * <li>Hidden, if the data provider is NOT in-memory (lazy)</li>
+ * </ul>
+ *
+ * @see DataProvider#isInMemory()}.
+ */
+ DEFAULT;
+ }
+
+ /**
* Gets a wrapper to use this multiselection model as a multiselect in
* {@link Binder}.
*
@@ -65,4 +99,39 @@ public interface MultiSelectionModel<T>
*/
public Registration addMultiSelectionListener(
MultiSelectionListener<T> listener);
+
+ /**
+ * Sets the select all checkbox visibility mode.
+ * <p>
+ * The default value is {@link SelectAllCheckBoxVisibility#DEFAULT}, which
+ * means that the checkbox is only visible if the grid's data provider is
+ * in- memory.
+ *
+ * @param selectAllCheckBoxVisibility
+ * the visiblity mode to use
+ * @see SelectAllCheckBoxVisibility
+ */
+ public void setSelectAllCheckBoxVisibility(
+ SelectAllCheckBoxVisibility selectAllCheckBoxVisibility);
+
+ /**
+ * Gets the current mode for the select all checkbox visibility.
+ *
+ * @return the select all checkbox visibility mode
+ * @see SelectAllCheckBoxVisibility
+ * @see #isSelectAllCheckBoxVisible()
+ */
+ public SelectAllCheckBoxVisibility getSelectAllCheckBoxVisibility();
+
+ /**
+ * Returns whether the select all checkbox will be visible with the current
+ * setting of
+ * {@link #setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility)}.
+ *
+ * @return {@code true} if the checkbox will be visible with the current
+ * settings
+ * @see SelectAllCheckBoxVisibility
+ * @see #setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility)
+ */
+ public boolean isSelectAllCheckBoxVisible();
}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java
index 122abadc5a..01635302f0 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java
@@ -55,39 +55,6 @@ import com.vaadin.ui.MultiSelect;
public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T>
implements MultiSelectionModel<T> {
- /**
- * State for showing the select all checkbox in the grid's default header
- * row for the selection column.
- * <p>
- * Default value is {@link #DEFAULT}, which means that the select all is
- * only visible if an in-memory data provider is used
- * {@link DataProvider#isInMemory()}.
- */
- public enum SelectAllCheckBoxVisibility {
- /**
- * Shows the select all checkbox, regardless of data provider used.
- * <p>
- * <b>For a lazy data provider, selecting all will result in to all rows
- * being fetched from backend to application memory!</b>
- */
- VISIBLE,
- /**
- * Never shows the select all checkbox, regardless of data provider
- * used.
- */
- HIDDEN,
- /**
- * By default select all checkbox depends on the grid's dataprovider.
- * <ul>
- * <li>Visible, if the data provider is in-memory</li>
- * <li>Hidden, if the data provider is NOT in-memory (lazy)</li>
- * </ul>
- *
- * @see DataProvider#isInMemory()}.
- */
- DEFAULT;
- }
-
private class GridMultiSelectServerRpcImpl
implements GridMultiSelectServerRpc {
@@ -141,17 +108,7 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T>
return (MultiSelectionModelState) super.getState(markAsDirty);
}
- /**
- * Sets the select all checkbox visibility mode.
- * <p>
- * The default value is {@link SelectAllCheckBoxVisibility#DEFAULT}, which
- * means that the checkbox is only visible if the grid's data provider is
- * in- memory.
- *
- * @param selectAllCheckBoxVisibility
- * the visiblity mode to use
- * @see SelectAllCheckBoxVisibility
- */
+ @Override
public void setSelectAllCheckBoxVisibility(
SelectAllCheckBoxVisibility selectAllCheckBoxVisibility) {
if (this.selectAllCheckBoxVisibility != selectAllCheckBoxVisibility) {
@@ -160,27 +117,12 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T>
}
}
- /**
- * Gets the current mode for the select all checkbox visibility.
- *
- * @return the select all checkbox visibility mode
- * @see SelectAllCheckBoxVisibility
- * @see #isSelectAllCheckBoxVisible()
- */
+ @Override
public SelectAllCheckBoxVisibility getSelectAllCheckBoxVisibility() {
return selectAllCheckBoxVisibility;
}
- /**
- * Returns whether the select all checkbox will be visible with the current
- * setting of
- * {@link #setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility)}.
- *
- * @return {@code true} if the checkbox will be visible with the current
- * settings
- * @see SelectAllCheckBoxVisibility
- * @see #setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility)
- */
+ @Override
public boolean isSelectAllCheckBoxVisible() {
updateCanSelectAll();
return getState(false).selectAllCheckBoxVisible;
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
index c45bad66f0..3b107d6c9b 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
@@ -34,8 +34,9 @@ import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.UI;
import com.vaadin.ui.components.grid.GridSelectionModel;
+import com.vaadin.ui.components.grid.MultiSelectionModel;
+import com.vaadin.ui.components.grid.MultiSelectionModel.SelectAllCheckBoxVisibility;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl;
-import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisibility;
import elemental.json.JsonObject;
@@ -616,7 +617,7 @@ public class GridMultiSelectionModelTest {
UI ui = new MockUI();
Grid<String> grid = new Grid<>();
- MultiSelectionModelImpl<String> model = (MultiSelectionModelImpl<String>) grid
+ MultiSelectionModel<String> model = (MultiSelectionModel<String>) grid
.setSelectionMode(SelectionMode.MULTI);
ui.setContent(grid);
@@ -655,7 +656,7 @@ public class GridMultiSelectionModelTest {
UI ui = new MockUI();
ui.setContent(grid);
- MultiSelectionModelImpl<String> model = (MultiSelectionModelImpl<String>) grid
+ MultiSelectionModel<String> model = (MultiSelectionModel<String>) grid
.setSelectionMode(SelectionMode.MULTI);
// no items yet, default data provider is empty not in memory one
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java
index 77d2bd5a84..f9e9e63151 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java
@@ -23,8 +23,8 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.RadioButtonGroup;
+import com.vaadin.ui.components.grid.MultiSelectionModel.SelectAllCheckBoxVisibility;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl;
-import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisibility;
public class GridMultiSelectionOnInit extends AbstractTestUI {
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
index eabf281bbd..4c7283dfcc 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
@@ -48,8 +48,8 @@ import com.vaadin.ui.components.grid.FooterRow;
import com.vaadin.ui.components.grid.HeaderCell;
import com.vaadin.ui.components.grid.HeaderRow;
import com.vaadin.ui.components.grid.MultiSelectionModel;
+import com.vaadin.ui.components.grid.MultiSelectionModel.SelectAllCheckBoxVisibility;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl;
-import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisibility;
import com.vaadin.ui.components.grid.SingleSelectionModelImpl;
import com.vaadin.ui.renderers.DateRenderer;
import com.vaadin.ui.renderers.HtmlRenderer;