From 692bbef040a61388d8ba028a9701a760b64baa43 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 14 Dec 2016 13:21:52 +0200 Subject: [PATCH] Rename SelectAllCheckBoxVisible enumeration. (#7981) Fixes vaadin/framework8-issues#540 --- .../grid/MultiSelectionModelImpl.java | 34 ++++++------- .../grid/GridMultiSelectionModelTest.java | 48 +++++++++---------- .../grid/GridMultiSelectionOnInit.java | 14 +++--- .../components/grid/basics/GridBasics.java | 14 +++--- 4 files changed, 55 insertions(+), 55 deletions(-) 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 fa25ff677c..02f7a4d0de 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 @@ -63,7 +63,7 @@ public class MultiSelectionModelImpl extends AbstractSelectionModel * only visible if an in-memory data provider is used * {@link DataSource#isInMemory()}. */ - public enum SelectAllCheckBoxVisible { + public enum SelectAllCheckBoxVisibility { /** * Shows the select all checkbox, regardless of data provider used. *

@@ -129,7 +129,7 @@ public class MultiSelectionModelImpl extends AbstractSelectionModel private Set selection = new LinkedHashSet<>(); - private SelectAllCheckBoxVisible selectAllCheckBoxVisible = SelectAllCheckBoxVisible.DEFAULT; + private SelectAllCheckBoxVisibility selectAllCheckBoxVisibility = SelectAllCheckBoxVisibility.DEFAULT; @Override protected void init() { @@ -149,18 +149,18 @@ public class MultiSelectionModelImpl extends AbstractSelectionModel /** * Sets the select all checkbox visibility mode. *

- * The default value is {@link SelectAllCheckBoxVisible#DEFAULT}, which + * 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 selectAllCheckBoxVisible + * @param selectAllCheckBoxVisibility * the visiblity mode to use - * @see SelectAllCheckBoxVisible + * @see SelectAllCheckBoxVisibility */ - public void setSelectAllCheckBoxVisible( - SelectAllCheckBoxVisible selectAllCheckBoxVisible) { - if (this.selectAllCheckBoxVisible != selectAllCheckBoxVisible) { - this.selectAllCheckBoxVisible = selectAllCheckBoxVisible; + public void setSelectAllCheckBoxVisibility( + SelectAllCheckBoxVisibility selectAllCheckBoxVisibility) { + if (this.selectAllCheckBoxVisibility != selectAllCheckBoxVisibility) { + this.selectAllCheckBoxVisibility = selectAllCheckBoxVisibility; markAsDirty(); } } @@ -169,22 +169,22 @@ public class MultiSelectionModelImpl extends AbstractSelectionModel * Gets the current mode for the select all checkbox visibility. * * @return the select all checkbox visibility mode - * @see SelectAllCheckBoxVisible + * @see SelectAllCheckBoxVisibility * @see #isSelectAllCheckBoxVisible() */ - public SelectAllCheckBoxVisible getSelectAllCheckBoxVisible() { - return selectAllCheckBoxVisible; + public SelectAllCheckBoxVisibility getSelectAllCheckBoxVisibility() { + return selectAllCheckBoxVisibility; } /** * Returns whether the select all checkbox will be visible with the current * setting of - * {@link #setSelectAllCheckBoxVisible(SelectAllCheckBoxVisible)}. + * {@link #setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility)}. * * @return {@code true} if the checkbox will be visible with the current * settings - * @see SelectAllCheckBoxVisible - * @see #setSelectAllCheckBoxVisible(SelectAllCheckBoxVisible) + * @see SelectAllCheckBoxVisibility + * @see #setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility) */ public boolean isSelectAllCheckBoxVisible() { updateCanSelectAll(); @@ -224,10 +224,10 @@ public class MultiSelectionModelImpl extends AbstractSelectionModel * This is updated as a part of {@link #beforeClientResponse(boolean)}, * since the data provider for grid can be changed on the fly. * - * @see SelectAllCheckBoxVisible + * @see SelectAllCheckBoxVisibility */ protected void updateCanSelectAll() { - switch (selectAllCheckBoxVisible) { + switch (selectAllCheckBoxVisibility) { case VISIBLE: getState(false).selectAllCheckBoxVisible = true; break; 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 c2896315f2..733f00816d 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 @@ -35,7 +35,7 @@ import com.vaadin.ui.Grid.GridSelectionModel; import com.vaadin.ui.Grid.SelectionMode; import com.vaadin.ui.UI; import com.vaadin.ui.components.grid.MultiSelectionModelImpl; -import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisible; +import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisibility; import elemental.json.JsonObject; @@ -622,28 +622,28 @@ public class GridMultiSelectionModelTest { ui.setContent(grid); // no items yet, default data provider is empty not in memory one Assert.assertFalse(model.isSelectAllCheckBoxVisible()); - Assert.assertEquals(SelectAllCheckBoxVisible.DEFAULT, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT, + model.getSelectAllCheckBoxVisibility()); grid.setItems("Foo", "Bar", "Baz"); // in-memory container keeps default Assert.assertTrue(model.isSelectAllCheckBoxVisible()); - Assert.assertEquals(SelectAllCheckBoxVisible.DEFAULT, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT, + model.getSelectAllCheckBoxVisibility()); // change to explicit NO - model.setSelectAllCheckBoxVisible(SelectAllCheckBoxVisible.HIDDEN); + model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.HIDDEN); - Assert.assertEquals(SelectAllCheckBoxVisible.HIDDEN, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.HIDDEN, + model.getSelectAllCheckBoxVisibility()); Assert.assertFalse(model.isSelectAllCheckBoxVisible()); // change to explicit YES - model.setSelectAllCheckBoxVisible(SelectAllCheckBoxVisible.VISIBLE); + model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.VISIBLE); - Assert.assertEquals(SelectAllCheckBoxVisible.VISIBLE, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.VISIBLE, + model.getSelectAllCheckBoxVisibility()); Assert.assertTrue(model.isSelectAllCheckBoxVisible()); } @@ -658,8 +658,8 @@ public class GridMultiSelectionModelTest { // no items yet, default data provider is empty not in memory one Assert.assertFalse(model.isSelectAllCheckBoxVisible()); - Assert.assertEquals(SelectAllCheckBoxVisible.DEFAULT, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT, + model.getSelectAllCheckBoxVisibility()); grid.setDataProvider( new BackEndDataProvider( @@ -672,29 +672,29 @@ public class GridMultiSelectionModelTest { // not in-memory -> checkbox is hidden Assert.assertFalse(model.isSelectAllCheckBoxVisible()); - Assert.assertEquals(SelectAllCheckBoxVisible.DEFAULT, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT, + model.getSelectAllCheckBoxVisibility()); // change to explicit YES - model.setSelectAllCheckBoxVisible(SelectAllCheckBoxVisible.VISIBLE); + model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.VISIBLE); - Assert.assertEquals(SelectAllCheckBoxVisible.VISIBLE, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.VISIBLE, + model.getSelectAllCheckBoxVisibility()); Assert.assertTrue(model.isSelectAllCheckBoxVisible()); // change to explicit NO - model.setSelectAllCheckBoxVisible(SelectAllCheckBoxVisible.HIDDEN); + model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.HIDDEN); - Assert.assertEquals(SelectAllCheckBoxVisible.HIDDEN, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.HIDDEN, + model.getSelectAllCheckBoxVisibility()); Assert.assertFalse(model.isSelectAllCheckBoxVisible()); // change back to depends on data provider - model.setSelectAllCheckBoxVisible(SelectAllCheckBoxVisible.DEFAULT); + model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.DEFAULT); Assert.assertFalse(model.isSelectAllCheckBoxVisible()); - Assert.assertEquals(SelectAllCheckBoxVisible.DEFAULT, - model.getSelectAllCheckBoxVisible()); + Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT, + model.getSelectAllCheckBoxVisibility()); } } 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 6ef8337c21..77d2bd5a84 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 @@ -24,7 +24,7 @@ import com.vaadin.ui.Grid; import com.vaadin.ui.Grid.SelectionMode; import com.vaadin.ui.RadioButtonGroup; import com.vaadin.ui.components.grid.MultiSelectionModelImpl; -import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisible; +import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisibility; public class GridMultiSelectionOnInit extends AbstractTestUI { @@ -44,14 +44,14 @@ public class GridMultiSelectionOnInit extends AbstractTestUI { grid.getSelectionModel().select("Foo 2"); } - RadioButtonGroup rbg = new RadioButtonGroup<>( + RadioButtonGroup rbg = new RadioButtonGroup<>( "Select All Visible", - Arrays.asList(SelectAllCheckBoxVisible.VISIBLE, - SelectAllCheckBoxVisible.HIDDEN, - SelectAllCheckBoxVisible.DEFAULT)); - rbg.setValue(selectionModel.getSelectAllCheckBoxVisible()); + Arrays.asList(SelectAllCheckBoxVisibility.VISIBLE, + SelectAllCheckBoxVisibility.HIDDEN, + SelectAllCheckBoxVisibility.DEFAULT)); + rbg.setValue(selectionModel.getSelectAllCheckBoxVisibility()); rbg.addValueChangeListener(event -> selectionModel - .setSelectAllCheckBoxVisible(event.getValue())); + .setSelectAllCheckBoxVisibility(event.getValue())); addComponent(rbg); } } 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 c9c5614205..a72a055e59 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 @@ -44,7 +44,7 @@ import com.vaadin.ui.StyleGenerator; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.components.grid.MultiSelectionModelImpl; -import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisible; +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; @@ -536,20 +536,20 @@ public class GridBasics extends AbstractTestUIWithLog { selectionModelItem.addItem("SelectAllCheckbox: Visible", menuItem -> { switchToMultiSelect(); ((MultiSelectionModelImpl) grid.getSelectionModel()) - .setSelectAllCheckBoxVisible( - SelectAllCheckBoxVisible.VISIBLE); + .setSelectAllCheckBoxVisibility( + SelectAllCheckBoxVisibility.VISIBLE); }); selectionModelItem.addItem("SelectAllCheckbox: Hidden", menuItem -> { switchToMultiSelect(); ((MultiSelectionModelImpl) grid.getSelectionModel()) - .setSelectAllCheckBoxVisible( - SelectAllCheckBoxVisible.HIDDEN); + .setSelectAllCheckBoxVisibility( + SelectAllCheckBoxVisibility.HIDDEN); }); selectionModelItem.addItem("SelectAllCheckbox: Default", menuItem -> { switchToMultiSelect(); ((MultiSelectionModelImpl) grid.getSelectionModel()) - .setSelectAllCheckBoxVisible( - SelectAllCheckBoxVisible.DEFAULT); + .setSelectAllCheckBoxVisibility( + SelectAllCheckBoxVisibility.DEFAULT); }); } -- 2.39.5