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;
}
Aggregations