Search in sources :

Example 16 with PopEvent

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());
            }
        }
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyTreeNode(org.olat.modules.taxonomy.model.TaxonomyTreeNode) PopEvent(org.olat.core.gui.components.stack.PopEvent)

Aggregations

PopEvent (org.olat.core.gui.components.stack.PopEvent)16 Controller (org.olat.core.gui.control.Controller)6 TreeNode (org.olat.core.gui.components.tree.TreeNode)4 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 Component (org.olat.core.gui.components.Component)2 Link (org.olat.core.gui.components.link.Link)2 SegmentViewComponent (org.olat.core.gui.components.segmentedview.SegmentViewComponent)2 SegmentViewEvent (org.olat.core.gui.components.segmentedview.SegmentViewEvent)2 VetoPopEvent (org.olat.core.gui.components.stack.VetoPopEvent)2 TableController (org.olat.core.gui.components.table.TableController)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)2 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)2 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 DialogBoxController (org.olat.core.gui.control.generic.modal.DialogBoxController)2 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)2 ICourse (org.olat.course.ICourse)2 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)2 CourseNode (org.olat.course.nodes.CourseNode)2