Browse Source

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
tags/8.11.0.alpha1
Tarek Oraby 4 years ago
parent
commit
74f36e731d
No account linked to committer's email address
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      server/src/main/java/com/vaadin/ui/Tree.java

+ 12
- 0
server/src/main/java/com/vaadin/ui/Tree.java View File

@@ -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

Loading…
Cancel
Save