Search in sources :

Example 16 with TreeNode

use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.

the class NavigationHandler method reattachExternalTreeModels.

private void reattachExternalTreeModels(TreeEvaluation treeEval) {
    if (externalTreeModels == null || externalTreeModels.isEmpty())
        return;
    for (Map.Entry<String, SubTree> entry : externalTreeModels.entrySet()) {
        String courseNodeId = entry.getKey();
        SubTree subTree = entry.getValue();
        TreeModel treeModel = subTree.getTreeModel();
        CourseNode courseNode = userCourseEnv.getCourseEnvironment().getRunStructure().getNode(courseNodeId);
        TreeNode treeNode = treeEval.getCorrespondingTreeNode(courseNode);
        if (treeNode != null) {
            addSubTreeModel(treeNode, treeModel);
        }
    }
}
Also used : TreeModel(org.olat.core.gui.components.tree.TreeModel) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseNode(org.olat.course.nodes.CourseNode) AbstractAccessableCourseNode(org.olat.course.nodes.AbstractAccessableCourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) Map(java.util.Map) HashMap(java.util.HashMap)

Example 17 with TreeNode

use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.

the class RunMainController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (needsRebuildAfter) {
        currentCourseNode = updateAfterChanges(currentCourseNode);
        needsRebuildAfter = false;
    }
    if (source == currentNodeController) {
        if (event instanceof OlatCmdEvent) {
            OlatCmdEvent oe = (OlatCmdEvent) event;
            String cmd = oe.getCommand();
            if (OlatCmdEvent.GOTONODE_CMD.equals(cmd)) {
                // "69680861018558/node-specific-data";
                String subcmd = oe.getSubcommand();
                CourseNode identNode;
                String nodecmd = null;
                int slPos = subcmd.indexOf('/');
                if (slPos != -1) {
                    nodecmd = subcmd.substring(slPos + 1);
                    identNode = course.getRunStructure().getNode(subcmd.substring(0, slPos));
                } else {
                    identNode = course.getRunStructure().getNode(subcmd);
                }
                if (identNode == null) {
                    showWarning("msg.nodenotavailableanymore");
                } else {
                    addLoggingResourceable(LoggingResourceable.wrap(identNode));
                    currentCourseNode = identNode;
                    updateTreeAndContent(ureq, identNode, nodecmd);
                    oe.accept();
                }
            }
        } else if (event == Event.DONE_EVENT) {
            // preconditions may have changed
            if (needsRebuildAfterRunDone) {
                needsRebuildAfterRunDone = false;
                updateTreeAndContent(ureq, currentCourseNode, null);
            }
        } else if (REBUILD.equals(event.getCommand())) {
            needsRebuildAfterRunDone = false;
            updateTreeAndContent(ureq, currentCourseNode, null);
        } else if (event instanceof TreeNodeEvent) {
            TreeNodeEvent tne = (TreeNodeEvent) event;
            TreeNode newCpTreeNode = tne.getChosenTreeNode();
            luTree.setSelectedNodeId(newCpTreeNode.getIdent());
        } else if (event == Event.CHANGED_EVENT) {
            updateTreeAndContent(ureq, currentCourseNode, null);
        } else if (event instanceof BusinessGroupModifiedEvent) {
            fireEvent(ureq, event);
            updateTreeAndContent(ureq, currentCourseNode, null);
        }
    }
}
Also used : OlatCmdEvent(org.olat.core.gui.components.htmlsite.OlatCmdEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseNode(org.olat.course.nodes.CourseNode) TreeNodeEvent(org.olat.modules.cp.TreeNodeEvent) BusinessGroupModifiedEvent(org.olat.group.ui.edit.BusinessGroupModifiedEvent)

Example 18 with TreeNode

use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.

the class RunMainController method doPrevious.

private void doPrevious(UserRequest ureq) {
    List<TreeNode> flatList = new ArrayList<>();
    TreeNode currentNode = luTree.getSelectedNode();
    TreeHelper.makeTreeFlat(luTree.getTreeModel().getRootNode(), flatList);
    int index = flatList.indexOf(currentNode);
    if (index - 1 >= 0 && index - 1 < flatList.size()) {
        TreeNode previousNode = flatList.get(index - 1);
        TreeEvent tev = new TreeEvent(MenuTree.COMMAND_TREENODE_CLICKED, previousNode.getIdent());
        doNodeClick(ureq, tev);
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode) ArrayList(java.util.ArrayList)

Example 19 with TreeNode

use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.

the class NodeEvaluation method addNodeEvaluationChild.

public void addNodeEvaluationChild(NodeEvaluation chdNodeEval) {
    addChild(chdNodeEval);
    TreeNode chTn = chdNodeEval.getTreeNode();
    gtn.addChild(chTn);
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 20 with TreeNode

use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.

the class EditorMainController method doOpenNodeTypeChooser.

private void doOpenNodeTypeChooser(UserRequest ureq) {
    removeAsListenerAndDispose(cmc);
    removeAsListenerAndDispose(chooseNodeTypeCtr);
    menuTree.getSelectedNode();
    TreeNode tn = menuTree.getSelectedNode();
    CourseEditorTreeNode cetn = tn == null ? null : cetm.getCourseEditorNodeById(tn.getIdent());
    chooseNodeTypeCtr = new ChooseNodeController(ureq, getWindowControl(), ores, cetn);
    listenTo(chooseNodeTypeCtr);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), chooseNodeTypeCtr.getInitialComponent(), true, translate("header.insertnodes"));
    listenTo(cmc);
    cmc.activate();
}
Also used : TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode)

Aggregations

TreeNode (org.olat.core.gui.components.tree.TreeNode)296 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)146 ArrayList (java.util.ArrayList)44 CourseNode (org.olat.course.nodes.CourseNode)38 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)32 ContextEntry (org.olat.core.id.context.ContextEntry)30 Controller (org.olat.core.gui.control.Controller)28 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)24 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)22 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)20 INode (org.olat.core.util.nodes.INode)20 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)20 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)20 ICourse (org.olat.course.ICourse)18 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)16 OLATResourceable (org.olat.core.id.OLATResourceable)16 List (java.util.List)14 TreeModel (org.olat.core.gui.components.tree.TreeModel)14 WindowControl (org.olat.core.gui.control.WindowControl)14 AssertException (org.olat.core.logging.AssertException)14