use of org.olat.core.gui.components.stack.PopEvent in project openolat by klemens.
the class DocumentPoolMainController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (taxonomyTree == source) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
TaxonomyTreeNode node = (TaxonomyTreeNode) taxonomyTree.getTreeModel().getNodeById(te.getNodeId());
doSelect(ureq, node);
}
}
} else if (content == source) {
if (event instanceof PopEvent) {
PopEvent popEvent = (PopEvent) event;
if (popEvent.getController() instanceof DocumentPoolLevelController) {
DocumentPoolLevelController taxonomyLevelCtrl = (DocumentPoolLevelController) popEvent.getController();
TaxonomyLevel level = taxonomyLevelCtrl.getTaxonomyLevel();
TaxonomyTreeNode node = (TaxonomyTreeNode) TreeHelper.findNodeByUserObject(level, taxonomyTree.getTreeModel().getRootNode());
TaxonomyTreeNode parentNode = (TaxonomyTreeNode) node.getParent();
if (parentNode == null) {
doSelectTaxonomy(ureq);
taxonomyTree.setSelectedNode(taxonomyTree.getTreeModel().getRootNode());
} else {
doSelect(ureq, parentNode);
taxonomyTree.setSelectedNode(parentNode);
}
} else if (popEvent.getUserObject() instanceof TaxonomyTreeNode) {
TaxonomyTreeNode node = (TaxonomyTreeNode) popEvent.getUserObject();
doSelect(ureq, node);
taxonomyTree.setSelectedNode(node);
} else if (popEvent.getController() instanceof DocumentDirectoryController) {
// pop the templates
taxonomyTree.setSelectedNode(taxonomyTree.getTreeModel().getRootNode());
}
}
}
}
Aggregations