diff options
author | Tarek Oraby <42799254+tarekoraby@users.noreply.github.com> | 2020-04-21 14:37:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-21 14:37:54 +0300 |
commit | 74f36e731db60f3ecaf9f57e2e4cc42095f0dd10 (patch) | |
tree | 43b20d62b59a45d799c03b2daf16979baa840913 /server/src/main | |
parent | 14de087d19735517da59caf515a7386df4dfd9ce (diff) | |
download | vaadin-framework-74f36e731db60f3ecaf9f57e2e4cc42095f0dd10.tar.gz vaadin-framework-74f36e731db60f3ecaf9f57e2e4cc42095f0dd10.zip |
Add asMultiSelect() to Tree class (#11949)
Tree class doesn't currently provide an obvious way that would enable a Tree object to be treated as a multi select. This commit extends the Tree API, enabling it to be used as a multi select, which would importantly facilitate the selection/deselection of multiple items in trees whose SelectionMode is MULTI.
closes #11948
Diffstat (limited to 'server/src/main')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Tree.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Tree.java b/server/src/main/java/com/vaadin/ui/Tree.java index cf8bb49f2b..9e8030daae 100644 --- a/server/src/main/java/com/vaadin/ui/Tree.java +++ b/server/src/main/java/com/vaadin/ui/Tree.java @@ -573,6 +573,18 @@ public class Tree<T> extends Composite public Registration addSelectionListener(SelectionListener<T> listener) { return treeGrid.addSelectionListener(listener); } + + /** + * Use this tree as a multi select in {@link Binder}. Throws + * {@link IllegalStateException} if the tree is not using + * {@link SelectionMode#MULTI}. + * + * @return the multi select wrapper that can be used in binder + * @since 8.11 + */ + public MultiSelect<T> asMultiSelect() { + return treeGrid.asMultiSelect(); + } /** * Use this tree as a single select in {@link Binder}. Throws |