List of usage examples for com.vaadin.ui Tree addExpandListener
public Registration addExpandListener(ExpandListener<T> listener)
From source file:com.haulmont.cuba.web.app.folders.CubaFoldersPane.java
License:Apache License
protected void collapseItemInTree(Tree tree, final String foldersCollapse) { String s = userSettingService.loadSetting(foldersCollapse); List<UUID> idFolders = strToIds(s); //noinspection unchecked, RedundantCast for (AbstractSearchFolder folder : (Collection<AbstractSearchFolder>) tree.getItemIds()) { if (idFolders.contains(folder.getId())) { tree.collapseItem(folder);//from ww w.j a va 2 s . co m } } tree.addExpandListener(new Tree.ExpandListener() { @Override public void nodeExpand(Tree.ExpandEvent event) { if (event.getItemId() instanceof AbstractSearchFolder) { UUID uuid = ((AbstractSearchFolder) event.getItemId()).getId(); String str = userSettingService.loadSetting(foldersCollapse); userSettingService.saveSetting(foldersCollapse, removeIdInStr(str, uuid)); } } }); tree.addCollapseListener(new Tree.CollapseListener() { @Override public void nodeCollapse(Tree.CollapseEvent event) { if (event.getItemId() instanceof AbstractSearchFolder) { UUID uuid = ((AbstractSearchFolder) event.getItemId()).getId(); String str = userSettingService.loadSetting(foldersCollapse); userSettingService.saveSetting(foldersCollapse, addIdInStr(str, uuid)); } } }); }