Search in sources :

Example 16 with TreeEvaluation

use of org.olat.course.run.userview.TreeEvaluation in project openolat by klemens.

the class NavigationHandler method reloadTreeAfterChanges.

public NodeClickedRef reloadTreeAfterChanges(CourseNode courseNode) {
    TreeEvaluation treeEval = new TreeEvaluation();
    GenericTreeModel treeModel = new GenericTreeModel();
    CourseNode rootCn = userCourseEnv.getCourseEnvironment().getRunStructure().getRootNode();
    NodeEvaluation rootNodeEval = rootCn.eval(userCourseEnv.getConditionInterpreter(), treeEval, filter);
    TreeNode treeRoot = rootNodeEval.getTreeNode();
    treeModel.setRootNode(treeRoot);
    TreeNode treeNode = treeEval.getCorrespondingTreeNode(courseNode.getIdent());
    NodeClickedRef nclr;
    if (treeNode == null) {
        nclr = null;
    } else {
        Object uObject = treeNode.getUserObject();
        if (uObject instanceof NodeEvaluation) {
            NodeEvaluation nodeEval = (NodeEvaluation) uObject;
            ControllerEventListener subtreemodelListener = null;
            if (externalTreeModels.containsKey(courseNode.getIdent())) {
                SubTree subTree = externalTreeModels.get(courseNode.getIdent());
                subtreemodelListener = subTree.getTreeModelListener();
                reattachExternalTreeModels(treeEval);
            }
            openTreeNodeIds = convertToTreeNodeIds(treeEval, openCourseNodeIds);
            selectedCourseNodeId = nodeEval.getCourseNode().getIdent();
            if (subtreemodelListener == null) {
                nclr = new NodeClickedRef(treeModel, true, selectedCourseNodeId, openTreeNodeIds, nodeEval.getCourseNode(), null, false);
            } else {
                nclr = new NodeClickedRef(treeModel, true, selectedCourseNodeId, openTreeNodeIds, nodeEval.getCourseNode(), null, true);
            }
        } else {
            nclr = null;
        }
    }
    return nclr;
}
Also used : ControllerEventListener(org.olat.core.gui.control.ControllerEventListener) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) TreeEvaluation(org.olat.course.run.userview.TreeEvaluation) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) CourseNode(org.olat.course.nodes.CourseNode) AbstractAccessableCourseNode(org.olat.course.nodes.AbstractAccessableCourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) NodeEvaluation(org.olat.course.run.userview.NodeEvaluation)

Aggregations

NodeEvaluation (org.olat.course.run.userview.NodeEvaluation)16 TreeEvaluation (org.olat.course.run.userview.TreeEvaluation)16 VisibleTreeFilter (org.olat.course.run.userview.VisibleTreeFilter)12 CourseNode (org.olat.course.nodes.CourseNode)10 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)10 RepositoryEntry (org.olat.repository.RepositoryEntry)10 TreeNode (org.olat.core.gui.components.tree.TreeNode)8 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)6 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)6 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)4 Controller (org.olat.core.gui.control.Controller)4 ControllerEventListener (org.olat.core.gui.control.ControllerEventListener)4 WindowControl (org.olat.core.gui.control.WindowControl)4 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)4 ContextEntry (org.olat.core.id.context.ContextEntry)4 AssertException (org.olat.core.logging.AssertException)4 ICourse (org.olat.course.ICourse)4 RepositoryManager (org.olat.repository.RepositoryManager)4 RepositoryEntrySecurity (org.olat.repository.model.RepositoryEntrySecurity)4 AbstractAccessableCourseNode (org.olat.course.nodes.AbstractAccessableCourseNode)3