瀏覽代碼

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 年之前
父節點
當前提交
74f36e731d
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 12 行新增0 行删除
  1. 12
    0
      server/src/main/java/com/vaadin/ui/Tree.java

+ 12
- 0
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

Loading…
取消
儲存