Search in sources :

Example 16 with TreeEvent

use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.

the class QuestionPoolMainEditorController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (menuTree == source) {
        if (event instanceof TreeDropEvent) {
            TreeDropEvent e = (TreeDropEvent) event;
            String targetId = e.getTargetNodeId();
            String dropId = e.getDroppedNodeId();
            // drop id w_o_fi1000002357-4
            doDrop(ureq, targetId, dropId);
        } else if (event instanceof TreeEvent) {
            TreeEvent te = (TreeEvent) event;
            if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
                TreeNode node = menuTree.getTreeModel().getNodeById(te.getNodeId());
                doSelectControllerTreeNode(ureq, node, null, null);
            }
        }
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) MyQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MyQuestionsTreeNode) ControllerTreeNode(org.olat.modules.qpool.ui.tree.ControllerTreeNode) CollectionTreeNode(org.olat.modules.qpool.ui.tree.CollectionTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) MarkedQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MarkedQuestionsTreeNode) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent)

Example 17 with TreeEvent

use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.

the class EPTOCController method doSelectTreeElement.

private void doSelectTreeElement(UserRequest ureq, TreeEvent te) {
    TreeNode selectedNode = treeCtr.getTreeModel().getNodeById(te.getNodeId());
    Object userObj = selectedNode.getUserObject();
    if (userObj instanceof PortfolioStructure) {
        // structure clicked
        structureClicked = (PortfolioStructure) userObj;
        refreshAddElements(ureq, structureClicked);
        delButton.setVisible(true);
        // send event to load this page
        fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.SELECTED, structureClicked));
    } else if (userObj instanceof AbstractArtefact) {
        // artefact clicked
        Object parentObj = ((TreeNode) selectedNode.getParent()).getUserObject();
        if (parentObj instanceof PortfolioStructure) {
            artefactClicked = (AbstractArtefact) userObj;
            PortfolioStructure structure = (PortfolioStructure) parentObj;
            refreshAddElements(ureq, null);
            delButton.setVisible(true);
            fireEvent(ureq, new EPArtefactClicked(ARTEFACT_NODE_CLICKED, structure));
        }
    } else {
        // root tree node clicked, no add/delete link
        delButton.setVisible(false);
        refreshAddElements(ureq, null);
        fireEvent(ureq, new Event(ARTEFACT_NODE_CLICKED));
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) Event(org.olat.core.gui.control.Event) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPArtefactClicked(org.olat.portfolio.ui.structel.EPArtefactClicked)

Example 18 with TreeEvent

use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.

the class QTI12StatisticsToolController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (courseTree == source) {
        if (event instanceof TreeEvent) {
            TreeEvent te = (TreeEvent) event;
            if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
                String ident = te.getNodeId();
                TreeNode selectedNode = courseTree.getTreeModel().getNodeById(ident);
                doSelectNode(ureq, selectedNode);
            }
        }
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 19 with TreeEvent

use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.

the class CPDisplayController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    Long id = entries.get(0).getOLATResourceable().getResourceableId();
    TreeNode newNode = null;
    if (id != null && id.longValue() > 0l) {
        newNode = ctm.getNodeById(id.toString());
    }
    if (newNode == null) {
        String path = BusinessControlFactory.getInstance().getPath(entries.get(0));
        newNode = ctm.lookupTreeNodeByHref(path);
    }
    if (newNode != null) {
        selectTreeNode(ureq, newNode);
        switchToPage(ureq, new TreeEvent(TreeEvent.COMMAND_TREENODES_SELECTED, newNode.getIdent()));
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 20 with TreeEvent

use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.

the class CPDisplayController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Component source, Event event) {
    if (source == cpTree) {
        // TreeEvent.dito...
        if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
            TreeEvent te = (TreeEvent) event;
            switchToPage(ureq, te);
        }
    } else if (source == cpComponent) {
        if (event instanceof NewInlineUriEvent) {
            NewInlineUriEvent nue = (NewInlineUriEvent) event;
            // adjust the tree selection to the current choice if found
            selectTreeNode(ureq, nue.getNewUri());
        }
    } else if (source == nextLink) {
        TreeNode nextUri = (TreeNode) nextLink.getUserObject();
        switchToPage(ureq, nextUri);
        if (cpTree != null) {
            cpTree.setSelectedNode(nextUri);
        }
        fireEvent(ureq, new TreeNodeEvent(nextUri));
    } else if (source == previousLink) {
        TreeNode previousUri = (TreeNode) previousLink.getUserObject();
        if (cpTree != null) {
            cpTree.setSelectedNode(previousUri);
        }
        switchToPage(ureq, previousUri);
        fireEvent(ureq, new TreeNodeEvent(previousUri));
    } else if (source == printLink) {
        selectPagesToPrint(ureq);
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode) NewInlineUriEvent(org.olat.core.gui.components.htmlsite.NewInlineUriEvent)

Aggregations

TreeEvent (org.olat.core.gui.components.tree.TreeEvent)50 TreeNode (org.olat.core.gui.components.tree.TreeNode)32 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)14 TreeDropEvent (org.olat.core.gui.components.tree.TreeDropEvent)12 CourseNode (org.olat.course.nodes.CourseNode)10 ArrayList (java.util.ArrayList)8 Event (org.olat.core.gui.control.Event)6 Component (org.olat.core.gui.components.Component)4 Link (org.olat.core.gui.components.link.Link)4 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 STCourseNode (org.olat.course.nodes.STCourseNode)4 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)4 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)4 List (java.util.List)2 FolderEvent (org.olat.core.commons.modules.bc.FolderEvent)2 NewInlineUriEvent (org.olat.core.gui.components.htmlsite.NewInlineUriEvent)2 OlatCmdEvent (org.olat.core.gui.components.htmlsite.OlatCmdEvent)2 PopEvent (org.olat.core.gui.components.stack.PopEvent)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2