Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make SelectionModel API only server side.
Client side doesn't use selection model anymore. Fixes vaadin/framework8-issues#421 Change-Id: If3ecb1c2f3a0024df9bfdfd182eaf8cf8625ac75
- Loading branch information
Denis Anisimov
committed
Nov 2, 2016
1 parent
dd20841
commit 13747f7
Showing
29 changed files
with
126 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
client/src/main/java/com/vaadin/client/data/SelectionModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.