diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-09-01 10:31:19 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-09-06 10:38:26 +0300 |
commit | fbb55ac4fdf09103cf7e999b321812bea033a981 (patch) | |
tree | 396e92361207f579c6d71b56db6ebc0eae9ae8fc /shared | |
parent | 2cafb5f128f718399b112a0c87e9a3d303018371 (diff) | |
download | vaadin-framework-fbb55ac4fdf09103cf7e999b321812bea033a981.tar.gz vaadin-framework-fbb55ac4fdf09103cf7e999b321812bea033a981.zip |
Clean up old Grid selection models
This patch removes old Grid selection model APIs
in favor of the new common SelectionModel API.
Change-Id: Iab8f2921930a575012c7da6226811d14a7145271
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/data/selection/SelectionModel.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/data/selection/SelectionModel.java b/shared/src/main/java/com/vaadin/shared/data/selection/SelectionModel.java index 8fff6ee434..270b964a79 100644 --- a/shared/src/main/java/com/vaadin/shared/data/selection/SelectionModel.java +++ b/shared/src/main/java/com/vaadin/shared/data/selection/SelectionModel.java @@ -1,12 +1,12 @@ /* * 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 @@ -23,9 +23,9 @@ import java.util.Set; /** * Models the selection logic of a {@code Listing} component. Determines how * items can be selected and deselected. - * + * * @author Vaadin Ltd. - * + * * @param <T> * the type of the items to select * @since @@ -51,7 +51,7 @@ public interface SelectionModel<T> extends Serializable { /** * Returns the currently selected item, or an empty optional if no item * is selected. - * + * * @return an optional of the selected item if any, an empty optional * otherwise */ @@ -60,7 +60,7 @@ public interface SelectionModel<T> extends Serializable { /** * Returns a singleton set of the currently selected item or an empty * set if no item is selected. - * + * * @return a singleton set of the selected item if any, an empty set * otherwise */ @@ -85,6 +85,7 @@ public interface SelectionModel<T> extends Serializable { */ @Override public void select(T item); + } /** @@ -93,7 +94,7 @@ public interface SelectionModel<T> extends Serializable { * <i>Implementation note:</i> the iteration order of the items in the * returned set should be well-defined and documented by the implementing * class. - * + * * @return the items in the current selection, not null */ public Set<T> getSelectedItems(); @@ -101,7 +102,7 @@ public interface SelectionModel<T> extends Serializable { /** * Selects the given item. Depending on the implementation, may cause other * items to be deselected. If the item is already selected, does nothing. - * + * * @param item * the item to select, not null */ @@ -110,15 +111,22 @@ public interface SelectionModel<T> extends Serializable { /** * Deselects the given item. If the item is not currently selected, does * nothing. - * + * * @param item * the item to deselect, not null */ public void deselect(T item); /** + * Deselects all currently selected items. + */ + public default void deselectAll() { + getSelectedItems().forEach(this::deselect); + } + + /** * 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 |