diff options
author | Denis Anisimov <denis@vaadin.com> | 2016-11-01 15:27:28 +0200 |
---|---|---|
committer | Denis Anisimov <denis@vaadin.com> | 2016-11-02 14:37:30 +0200 |
commit | 13747f7003625a012bfdc788a11482a346bcba4d (patch) | |
tree | bd5ee3c09c1a43ea3052fea032a80d8aaf9b5f0d | |
parent | dd20841c39b0b30eb2a5c5fddc2eb9cb1cd1e595 (diff) | |
download | vaadin-framework-13747f7003625a012bfdc788a11482a346bcba4d.tar.gz vaadin-framework-13747f7003625a012bfdc788a11482a346bcba4d.zip |
Make SelectionModel API only server side.
Client side doesn't use selection model anymore.
Fixes vaadin/framework8-issues#421
Change-Id: If3ecb1c2f3a0024df9bfdfd182eaf8cf8625ac75
29 files changed, 126 insertions, 122 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/AbstractFocusableListingConnector.java b/client/src/main/java/com/vaadin/client/connectors/AbstractFocusableListingConnector.java index 996086d36d..9ce7dc194c 100644 --- a/client/src/main/java/com/vaadin/client/connectors/AbstractFocusableListingConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/AbstractFocusableListingConnector.java @@ -18,7 +18,6 @@ package com.vaadin.client.connectors; import com.google.gwt.event.dom.client.HasAllFocusHandlers; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ui.ConnectorFocusAndBlurHandler; -import com.vaadin.shared.data.selection.SelectionModel; /** * Abstract class for listing widget connectors that contains focusable children @@ -28,11 +27,9 @@ import com.vaadin.shared.data.selection.SelectionModel; * * @param <WIDGET> * widget type which has to allow to register focus/blur handlers - * @param <SELECTIONMODEL> - * the client-side selection model type */ -public abstract class AbstractFocusableListingConnector<WIDGET extends Widget & HasAllFocusHandlers, SELECTIONMODEL extends SelectionModel<?>> - extends AbstractListingConnector<SELECTIONMODEL> { +public abstract class AbstractFocusableListingConnector<WIDGET extends Widget & HasAllFocusHandlers> + extends AbstractListingConnector { private ConnectorFocusAndBlurHandler handler; diff --git a/client/src/main/java/com/vaadin/client/connectors/AbstractListingConnector.java b/client/src/main/java/com/vaadin/client/connectors/AbstractListingConnector.java index b89106307e..88fccab32e 100644 --- a/client/src/main/java/com/vaadin/client/connectors/AbstractListingConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/AbstractListingConnector.java @@ -19,7 +19,6 @@ import com.vaadin.client.connectors.data.HasDataSource; import com.vaadin.client.data.DataSource; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.shared.data.DataCommunicatorConstants; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.ui.AbstractListing; import elemental.json.JsonObject; @@ -30,18 +29,13 @@ import elemental.json.JsonValue; * * @author Vaadin Ltd. * - * @param <SELECTIONMODEL> - * the client-side selection model type - * * @since 8.0 */ -public abstract class AbstractListingConnector<SELECTIONMODEL extends SelectionModel<?>> - extends AbstractFieldConnector implements HasDataSource { +public abstract class AbstractListingConnector extends AbstractFieldConnector + implements HasDataSource { private DataSource<JsonObject> dataSource = null; - private SELECTIONMODEL selectionModel = null; - @Override public void setDataSource(DataSource<JsonObject> dataSource) { this.dataSource = dataSource; @@ -53,25 +47,6 @@ public abstract class AbstractListingConnector<SELECTIONMODEL extends SelectionM } /** - * Sets the selection model to use. Passing {@code null} disables selection. - * - * @param selectionModel - * the selection model or null to disable - */ - public void setSelectionModel(SELECTIONMODEL selectionModel) { - this.selectionModel = selectionModel; - } - - /** - * Returns the selection model instance used. - * - * @return the selection model - */ - public SELECTIONMODEL getSelectionModel() { - return selectionModel; - } - - /** * Returns the key of the given data row. * * @param row diff --git a/client/src/main/java/com/vaadin/client/connectors/AbstractMultiSelectConnector.java b/client/src/main/java/com/vaadin/client/connectors/AbstractMultiSelectConnector.java index 60966c39a9..1550f86292 100644 --- a/client/src/main/java/com/vaadin/client/connectors/AbstractMultiSelectConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/AbstractMultiSelectConnector.java @@ -30,7 +30,6 @@ import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.Range; import com.vaadin.shared.Registration; import com.vaadin.shared.data.selection.MultiSelectServerRpc; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.shared.ui.ListingJsonConstants; import elemental.json.JsonObject; @@ -46,8 +45,7 @@ import elemental.json.JsonObject; * @since 8.0 */ public abstract class AbstractMultiSelectConnector - extends AbstractListingConnector<SelectionModel.Multi<?>> - implements HasRequiredIndicator { + extends AbstractListingConnector implements HasRequiredIndicator { /** * Abstraction layer to help populate different multiselect widgets based on diff --git a/client/src/main/java/com/vaadin/client/connectors/AbstractSingleSelectConnector.java b/client/src/main/java/com/vaadin/client/connectors/AbstractSingleSelectConnector.java index 5554b8421c..96ccf2f7c2 100644 --- a/client/src/main/java/com/vaadin/client/connectors/AbstractSingleSelectConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/AbstractSingleSelectConnector.java @@ -18,7 +18,6 @@ package com.vaadin.client.connectors; import com.google.gwt.event.dom.client.HasAllFocusHandlers; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ui.HasRequiredIndicator; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.shared.ui.AbstractSingleSelectState; /** @@ -28,8 +27,7 @@ import com.vaadin.shared.ui.AbstractSingleSelectState; * @since 8.0.0 */ public abstract class AbstractSingleSelectConnector<WIDGET extends Widget & HasAllFocusHandlers> - extends - AbstractFocusableListingConnector<WIDGET, SelectionModel.Single<?>> + extends AbstractFocusableListingConnector<WIDGET> implements HasRequiredIndicator { @Override diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java index ad5f8200ea..ef715acfad 100644 --- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java @@ -21,7 +21,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import com.google.gwt.dom.client.Element; @@ -40,6 +40,7 @@ import com.vaadin.client.annotations.OnStateChange; import com.vaadin.client.connectors.AbstractListingConnector; import com.vaadin.client.connectors.grid.ColumnConnector.CustomColumn; import com.vaadin.client.data.DataSource; +import com.vaadin.client.data.SelectionModel; import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.widget.grid.CellReference; import com.vaadin.client.widget.grid.EventCellReference; @@ -58,7 +59,6 @@ import com.vaadin.client.widgets.Grid.HeaderCell; import com.vaadin.client.widgets.Grid.HeaderRow; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.data.DataCommunicatorConstants; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.shared.data.selection.SelectionServerRpc; import com.vaadin.shared.data.sort.SortDirection; import com.vaadin.shared.ui.Connect; @@ -79,8 +79,7 @@ import elemental.json.JsonObject; * @since 8.0 */ @Connect(com.vaadin.ui.Grid.class) -public class GridConnector - extends AbstractListingConnector<SelectionModel<JsonObject>> +public class GridConnector extends AbstractListingConnector implements HasComponentsConnector, SimpleManagedLayout, DeferredWorker { private class ItemClickHandler @@ -205,7 +204,7 @@ public class GridConnector /* Item click events */ getWidget().addBodyClickHandler(itemClickHandler); getWidget().addBodyDoubleClickHandler(itemClickHandler); - getWidget().setSelectionModel(new SelectionModel.Single<JsonObject>() { + getWidget().setSelectionModel(new SelectionModel<JsonObject>() { @Override public void select(JsonObject item) { @@ -220,7 +219,7 @@ public class GridConnector } @Override - public Optional<JsonObject> getSelectedItem() { + public Set<JsonObject> getSelectedItems() { throw new UnsupportedOperationException( "Selected item not known on the client side"); } @@ -230,6 +229,7 @@ public class GridConnector return item.hasKey(DataCommunicatorConstants.SELECTED) && item.getBoolean(DataCommunicatorConstants.SELECTED); } + }); layout(); @@ -321,12 +321,6 @@ public class GridConnector getWidget().setDataSource(dataSource); } - @Override - public void setSelectionModel(SelectionModel<JsonObject> selectionModel) { - throw new UnsupportedOperationException( - "Cannot set a selection model for GridConnector"); - } - /** * Adds a column to the Grid widget. For each column a communication id * stored for client to server communication. diff --git a/client/src/main/java/com/vaadin/client/connectors/selection/AbstractSelectionConnector.java b/client/src/main/java/com/vaadin/client/connectors/selection/AbstractSelectionConnector.java index 9d4604993d..55ce2dee7b 100644 --- a/client/src/main/java/com/vaadin/client/connectors/selection/AbstractSelectionConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/selection/AbstractSelectionConnector.java @@ -19,7 +19,6 @@ import com.vaadin.client.ServerConnector; import com.vaadin.client.connectors.AbstractListingConnector; import com.vaadin.client.extensions.AbstractExtensionConnector; import com.vaadin.shared.data.DataCommunicatorConstants; -import com.vaadin.shared.data.selection.SelectionModel; import elemental.json.JsonObject; @@ -28,15 +27,11 @@ import elemental.json.JsonObject; * * @author Vaadin Ltd. * - * @param <SELECTIONMODEL> - * the supported client-side selection model * @since 8.0 */ -public abstract class AbstractSelectionConnector<SELECTIONMODEL extends SelectionModel<?>> +public abstract class AbstractSelectionConnector extends AbstractExtensionConnector { - private SELECTIONMODEL model = null; - @Override @SuppressWarnings("unchecked") protected void extend(ServerConnector target) { @@ -45,31 +40,12 @@ public abstract class AbstractSelectionConnector<SELECTIONMODEL extends Selectio "Cannot extend a connector that is not an " + AbstractListingConnector.class.getSimpleName()); } - model = createSelectionModel(); - ((AbstractListingConnector<SELECTIONMODEL>) target) - .setSelectionModel(model); } - /** - * Creates a selection model object to be used by the Connector. - * - * @return created selection model - */ - protected abstract SELECTIONMODEL createSelectionModel(); - @Override @SuppressWarnings("unchecked") - public AbstractListingConnector<SELECTIONMODEL> getParent() { - return (AbstractListingConnector<SELECTIONMODEL>) super.getParent(); - } - - /** - * Returns the client-side selection model associated with this connector. - * - * @return the selection model in use - */ - protected SELECTIONMODEL getSelectionModel() { - return model; + public AbstractListingConnector getParent() { + return (AbstractListingConnector) super.getParent(); } /** diff --git a/client/src/main/java/com/vaadin/client/data/SelectionModel.java b/client/src/main/java/com/vaadin/client/data/SelectionModel.java new file mode 100644 index 0000000000..80eb20fef1 --- /dev/null +++ b/client/src/main/java/com/vaadin/client/data/SelectionModel.java @@ -0,0 +1,73 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.client.data; + +import java.util.Set; + +/** + * Models the selection logic of a {@code Grid} component. Determines how items + * can be selected and deselected. + * + * @author Vaadin Ltd. + * + * @param <T> + * the type of the items to select + * @since 8.0 + */ +public interface SelectionModel<T> { + + /** + * Selects the given item. If another item was already selected, that item + * is deselected. + * + * @param item + * the item to select, not null + */ + void select(T item); + + /** + * Deselects the given item. If the item is not currently selected, does + * nothing. + * + * @param item + * the item to deselect, not null + */ + void deselect(T item); + + /** + * Returns a set of the currently selected items. It is safe to invoke other + * {@code SelectionModel} methods while iterating over the set. + * + * @return the items in the current selection, not null + */ + Set<T> getSelectedItems(); + + /** + * Returns whether the given item is currently selected. + * + * @param item + * the item to check, not null + * @return {@code true} if the item is selected, {@code false} otherwise + */ + boolean isSelected(T item); + + /** + * Deselects all currently selected items. + */ + default void deselectAll() { + getSelectedItems().forEach(this::deselect); + } +} diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java index 97f382453f..8b56483e8f 100644 --- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -30,7 +30,6 @@ import com.vaadin.shared.EventId; import com.vaadin.shared.Registration; import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc; import com.vaadin.shared.data.DataCommunicatorConstants; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.shared.data.selection.SelectionServerRpc; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.combobox.ComboBoxConstants; @@ -41,8 +40,7 @@ import com.vaadin.ui.ComboBox; import elemental.json.JsonObject; @Connect(ComboBox.class) -public class ComboBoxConnector - extends AbstractListingConnector<SelectionModel.Single<?>> +public class ComboBoxConnector extends AbstractListingConnector implements HasRequiredIndicator, HasDataSource, SimpleManagedLayout, HasErrorIndicator { diff --git a/client/src/main/java/com/vaadin/client/ui/optiongroup/CheckBoxGroupConnector.java b/client/src/main/java/com/vaadin/client/ui/optiongroup/CheckBoxGroupConnector.java index 940287d583..4262666943 100644 --- a/client/src/main/java/com/vaadin/client/ui/optiongroup/CheckBoxGroupConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/optiongroup/CheckBoxGroupConnector.java @@ -27,7 +27,6 @@ import com.vaadin.client.data.DataSource; import com.vaadin.client.ui.HasRequiredIndicator; import com.vaadin.client.ui.VCheckBoxGroup; import com.vaadin.shared.data.selection.MultiSelectServerRpc; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.optiongroup.CheckBoxGroupState; import com.vaadin.ui.CheckBoxGroup; @@ -38,8 +37,8 @@ import elemental.json.JsonObject; // We don't care about the framework-provided selection model at this point // TODO refactor to extend AbstractMultiSelectConnector, maybe when // SelectionModel is removed from client side framwork8-issues#421 -public class CheckBoxGroupConnector extends - AbstractFocusableListingConnector<VCheckBoxGroup, SelectionModel<?>> +public class CheckBoxGroupConnector + extends AbstractFocusableListingConnector<VCheckBoxGroup> implements HasRequiredIndicator { @Override diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java index cd86dbe993..2ac2f51e4b 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java @@ -16,7 +16,7 @@ package com.vaadin.client.widget.grid.events; import com.google.gwt.event.shared.GwtEvent; -import com.vaadin.shared.data.selection.SelectionModel; +import com.vaadin.client.data.SelectionModel; /** * A select all event, fired by the Grid when it needs all rows in data source @@ -32,9 +32,9 @@ public class SelectAllEvent<T> extends GwtEvent<SelectAllHandler<T>> { */ private final static Type<SelectAllHandler<?>> TYPE = new Type<>();; - private SelectionModel.Multi<T> selectionModel; + private SelectionModel selectionModel; - public SelectAllEvent(SelectionModel.Multi<T> selectionModel) { + public SelectAllEvent(SelectionModel selectionModel) { this.selectionModel = selectionModel; } @@ -53,7 +53,7 @@ public class SelectAllEvent<T> extends GwtEvent<SelectAllHandler<T>> { handler.onSelectAll(this); } - public SelectionModel.Multi<T> getSelectionModel() { + public SelectionModel getSelectionModel() { return selectionModel; } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelWithSelectionColumn.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelWithSelectionColumn.java index 5c57607e70..f6e55bf596 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelWithSelectionColumn.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelWithSelectionColumn.java @@ -16,7 +16,6 @@ package com.vaadin.client.widget.grid.selection; import com.vaadin.client.renderers.Renderer; -import com.vaadin.shared.data.selection.SelectionModel; /** * Interface for SelectionModels that wants Grid to display a selection column. @@ -24,13 +23,9 @@ import com.vaadin.shared.data.selection.SelectionModel; * @author Vaadin Ltd * @since 8.0 * - * @param <T> - * selected item type - * * @see Renderer */ -public interface SelectionModelWithSelectionColumn<T> - extends SelectionModel<T> { +public interface SelectionModelWithSelectionColumn { /** * Returns a new instance of the Renderer for selection column. diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 7d6c1369b8..276cde7666 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -83,6 +83,7 @@ import com.vaadin.client.WidgetUtil; import com.vaadin.client.data.DataChangeHandler; import com.vaadin.client.data.DataSource; import com.vaadin.client.data.DataSource.RowHandle; +import com.vaadin.client.data.SelectionModel; import com.vaadin.client.renderers.ComplexRenderer; import com.vaadin.client.renderers.Renderer; import com.vaadin.client.renderers.WidgetRenderer; @@ -171,8 +172,6 @@ import com.vaadin.client.widgets.Grid.StaticSection.StaticCell; import com.vaadin.client.widgets.Grid.StaticSection.StaticRow; import com.vaadin.shared.Range; import com.vaadin.shared.Registration; -import com.vaadin.shared.data.selection.SelectionModel; -import com.vaadin.shared.data.selection.SelectionModel.Multi; import com.vaadin.shared.data.sort.SortDirection; import com.vaadin.shared.ui.grid.GridConstants; import com.vaadin.shared.ui.grid.GridConstants.Section; @@ -2865,7 +2864,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * Later on this could be fixed so that it check such handlers * exist. */ - final SelectionModel.Multi<T> model = (Multi<T>) getSelectionModel(); + final SelectionModel<T> model = getSelectionModel(); if (selectAllCheckBox == null) { selectAllCheckBox = GWT.create(CheckBox.class); @@ -5886,6 +5885,11 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, public void deselect(T item) { } + @Override + public boolean isSelected(T item) { + return false; + } + }); escalator.getBody().setSpacerUpdater(gridSpacerUpdater); @@ -7580,7 +7584,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, this.selectionModel = selectionModel; if (selectionModel instanceof SelectionModelWithSelectionColumn) { setSelectColumnRenderer( - ((SelectionModelWithSelectionColumn<T>) selectionModel) + ((SelectionModelWithSelectionColumn) selectionModel) .getRenderer()); } else { setSelectColumnRenderer(null); @@ -8227,8 +8231,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, columnHider.updateTogglesOrder(); - fireEvent(new ColumnReorderEvent<T>(oldOrder, newOrder, - isUserOriginated)); + fireEvent( + new ColumnReorderEvent<>(oldOrder, newOrder, isUserOriginated)); } /** diff --git a/server/src/main/java/com/vaadin/data/Listing.java b/server/src/main/java/com/vaadin/data/Listing.java index 667d4f4aef..397272a677 100644 --- a/server/src/main/java/com/vaadin/data/Listing.java +++ b/server/src/main/java/com/vaadin/data/Listing.java @@ -20,7 +20,6 @@ import java.util.Collection; import java.util.Set; import com.vaadin.server.data.DataSource; -import com.vaadin.shared.data.selection.SelectionModel; /** * A generic interface for components that show a list of data. diff --git a/shared/src/main/java/com/vaadin/shared/data/selection/SelectionModel.java b/server/src/main/java/com/vaadin/data/SelectionModel.java index c56fe8c4d9..eca43e6c8d 100644 --- a/shared/src/main/java/com/vaadin/shared/data/selection/SelectionModel.java +++ b/server/src/main/java/com/vaadin/data/SelectionModel.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.shared.data.selection; +package com.vaadin.data; import java.io.Serializable; import java.util.Arrays; diff --git a/server/src/main/java/com/vaadin/data/selection/AbstractSelectionModel.java b/server/src/main/java/com/vaadin/data/selection/AbstractSelectionModel.java index aa2457f589..7e60847685 100644 --- a/server/src/main/java/com/vaadin/data/selection/AbstractSelectionModel.java +++ b/server/src/main/java/com/vaadin/data/selection/AbstractSelectionModel.java @@ -15,8 +15,8 @@ */ package com.vaadin.data.selection; +import com.vaadin.data.SelectionModel; import com.vaadin.shared.data.DataCommunicatorConstants; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.ui.AbstractListing.AbstractListingExtension; import elemental.json.JsonObject; diff --git a/server/src/main/java/com/vaadin/event/selection/MultiSelectionEvent.java b/server/src/main/java/com/vaadin/event/selection/MultiSelectionEvent.java index d63f26d680..5fb91bbcbe 100644 --- a/server/src/main/java/com/vaadin/event/selection/MultiSelectionEvent.java +++ b/server/src/main/java/com/vaadin/event/selection/MultiSelectionEvent.java @@ -24,7 +24,7 @@ import com.vaadin.ui.AbstractMultiSelect; /** * Event fired when the the selection changes in a - * {@link com.vaadin.shared.data.selection.SelectionModel.Multi}. + * {@link com.vaadin.data.SelectionModel.Multi}. * * @author Vaadin Ltd * diff --git a/server/src/main/java/com/vaadin/event/selection/MultiSelectionListener.java b/server/src/main/java/com/vaadin/event/selection/MultiSelectionListener.java index c8de132341..d8005a396c 100644 --- a/server/src/main/java/com/vaadin/event/selection/MultiSelectionListener.java +++ b/server/src/main/java/com/vaadin/event/selection/MultiSelectionListener.java @@ -20,7 +20,7 @@ import java.util.function.Consumer; /** * Listens to changes from a - * {@link com.vaadin.shared.data.selection.SelectionModel.Multi}. + * {@link com.vaadin.data.SelectionModel.Multi}. * * @author Vaadin Ltd * diff --git a/server/src/main/java/com/vaadin/ui/AbstractListing.java b/server/src/main/java/com/vaadin/ui/AbstractListing.java index 0840e3fc30..3892e55662 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractListing.java +++ b/server/src/main/java/com/vaadin/ui/AbstractListing.java @@ -18,11 +18,11 @@ package com.vaadin.ui; import java.util.Objects; import com.vaadin.data.Listing; +import com.vaadin.data.SelectionModel; import com.vaadin.server.AbstractExtension; import com.vaadin.server.data.DataCommunicator; import com.vaadin.server.data.DataGenerator; import com.vaadin.server.data.DataSource; -import com.vaadin.shared.data.selection.SelectionModel; /** * A base class for listing components. Provides common handling for fetching diff --git a/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java b/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java index bd1fc8937a..779cd959dd 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java @@ -26,6 +26,8 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import com.vaadin.data.HasValue; +import com.vaadin.data.SelectionModel; +import com.vaadin.data.SelectionModel.Multi; import com.vaadin.event.selection.MultiSelectionEvent; import com.vaadin.event.selection.MultiSelectionListener; import com.vaadin.server.Resource; @@ -35,8 +37,6 @@ import com.vaadin.server.data.DataGenerator; import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.Registration; import com.vaadin.shared.data.selection.MultiSelectServerRpc; -import com.vaadin.shared.data.selection.SelectionModel; -import com.vaadin.shared.data.selection.SelectionModel.Multi; import com.vaadin.shared.ui.ListingJsonConstants; import com.vaadin.util.ReflectTools; diff --git a/server/src/main/java/com/vaadin/ui/AbstractSingleSelect.java b/server/src/main/java/com/vaadin/ui/AbstractSingleSelect.java index c529ad3f26..cb72d52444 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSingleSelect.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSingleSelect.java @@ -20,12 +20,12 @@ import java.util.Objects; import java.util.Optional; import com.vaadin.data.HasValue; +import com.vaadin.data.SelectionModel; +import com.vaadin.data.SelectionModel.Single; import com.vaadin.event.selection.SingleSelectionChangeEvent; import com.vaadin.event.selection.SingleSelectionListener; import com.vaadin.server.data.DataCommunicator; import com.vaadin.shared.Registration; -import com.vaadin.shared.data.selection.SelectionModel; -import com.vaadin.shared.data.selection.SelectionModel.Single; import com.vaadin.shared.data.selection.SelectionServerRpc; import com.vaadin.shared.ui.AbstractSingleSelectState; import com.vaadin.util.ReflectTools; @@ -39,7 +39,7 @@ import com.vaadin.util.ReflectTools; * @param <T> * the item date type * - * @see com.vaadin.shared.data.selection.SelectionModel.Single + * @see com.vaadin.data.SelectionModel.Single * * @since 8.0 */ diff --git a/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java index e117d01b9e..6d748f076a 100644 --- a/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java +++ b/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java @@ -37,12 +37,12 @@ import org.junit.runners.Parameterized.Parameters; import org.mockito.Mockito; import com.vaadin.data.HasValue.ValueChangeEvent; +import com.vaadin.data.SelectionModel.Multi; import com.vaadin.event.selection.MultiSelectionEvent; import com.vaadin.event.selection.MultiSelectionListener; import com.vaadin.server.data.DataSource; import com.vaadin.shared.Registration; import com.vaadin.shared.data.selection.MultiSelectServerRpc; -import com.vaadin.shared.data.selection.SelectionModel.Multi; @RunWith(Parameterized.class) public class AbstractMultiSelectTest { diff --git a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java index 258bf8d0bd..6ae5c91b96 100644 --- a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java +++ b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java @@ -34,12 +34,12 @@ import org.junit.Test; import org.mockito.Mockito; import com.vaadin.data.HasValue.ValueChangeEvent; +import com.vaadin.data.SelectionModel.Multi; import com.vaadin.event.selection.SingleSelectionChangeEvent; import com.vaadin.event.selection.SingleSelectionListener; import com.vaadin.server.data.datasource.bov.Person; import com.vaadin.shared.Registration; import com.vaadin.shared.data.DataCommunicatorClientRpc; -import com.vaadin.shared.data.selection.SelectionModel.Multi; import com.vaadin.ui.AbstractSingleSelect.AbstractSingleSelection; /** diff --git a/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java b/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java index 6bbd9a9438..31bc2de271 100644 --- a/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java +++ b/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java @@ -23,9 +23,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import com.vaadin.data.SelectionModel; +import com.vaadin.data.SelectionModel.Multi; import com.vaadin.server.data.DataSource; -import com.vaadin.shared.data.selection.SelectionModel; -import com.vaadin.shared.data.selection.SelectionModel.Multi; import com.vaadin.shared.data.selection.SelectionServerRpc; public class RadioButtonGroupTest { diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractListingFocusBlurTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractListingFocusBlurTest.java index 0b94b8fecb..f953c3acac 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractListingFocusBlurTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractListingFocusBlurTest.java @@ -21,10 +21,10 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import com.googlecode.gentyref.GenericTypeReflector; +import com.vaadin.data.SelectionModel; import com.vaadin.event.FieldEvents.BlurNotifier; import com.vaadin.event.FieldEvents.FocusNotifier; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.ui.AbstractListing; /** diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java index 71fd0fd37d..ae69cbb6ff 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; -import com.vaadin.shared.data.selection.SelectionModel.Multi; +import com.vaadin.data.SelectionModel.Multi; import com.vaadin.ui.AbstractMultiSelect; import com.vaadin.ui.ItemCaptionGenerator; diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlur.java b/uitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlur.java index 92efed09e7..b92132d9f7 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlur.java +++ b/uitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlur.java @@ -15,7 +15,7 @@ */ package com.vaadin.tests.components.checkboxgroup; -import com.vaadin.shared.data.selection.SelectionModel.Multi; +import com.vaadin.data.SelectionModel.Multi; import com.vaadin.tests.components.AbstractListingFocusBlurTest; import com.vaadin.ui.CheckBoxGroup; diff --git a/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java index 036512a514..3d8802c5ed 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java @@ -15,8 +15,8 @@ */ package com.vaadin.tests.components.radiobutton; +import com.vaadin.data.SelectionModel; import com.vaadin.server.FontAwesome; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.tests.components.abstractlisting.AbstractListingTestUI; import com.vaadin.ui.ItemCaptionGenerator; import com.vaadin.ui.RadioButtonGroup; diff --git a/uitest/src/main/java/com/vaadin/tests/data/DummyData.java b/uitest/src/main/java/com/vaadin/tests/data/DummyData.java index 917eb39bbd..d0ba74a942 100644 --- a/uitest/src/main/java/com/vaadin/tests/data/DummyData.java +++ b/uitest/src/main/java/com/vaadin/tests/data/DummyData.java @@ -8,12 +8,12 @@ import java.util.Set; import java.util.stream.Stream; import com.vaadin.annotations.Widgetset; +import com.vaadin.data.SelectionModel; import com.vaadin.server.VaadinRequest; import com.vaadin.server.data.DataCommunicator; import com.vaadin.server.data.ListDataSource; import com.vaadin.server.data.Query; import com.vaadin.shared.data.DataCommunicatorConstants; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.tests.widgetset.TestingWidgetSet; import com.vaadin.ui.AbstractListing; diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/data/DummyComponentConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/data/DummyComponentConnector.java index 228f5120e7..80ae0d972a 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/data/DummyComponentConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/data/DummyComponentConnector.java @@ -4,15 +4,13 @@ import com.google.gwt.user.client.ui.FlowPanel; import com.vaadin.client.connectors.AbstractListingConnector; import com.vaadin.client.data.DataSource; import com.vaadin.client.ui.VLabel; -import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.shared.ui.Connect; import com.vaadin.tests.data.DummyData.DummyComponent; import elemental.json.JsonObject; @Connect(DummyComponent.class) -public class DummyComponentConnector extends - AbstractListingConnector<SelectionModel<?>> { +public class DummyComponentConnector extends AbstractListingConnector { @Override public FlowPanel getWidget() { |