use of org.olat.course.run.navigation.NodeClickedRef in project OpenOLAT by OpenOLAT.
the class RunMainController method updateAfterChanges.
private CourseNode updateAfterChanges(CourseNode courseNode) {
if (currentCourseNode == null)
return null;
CourseNode newCurrentCourseNode;
NodeClickedRef nclr = navHandler.reloadTreeAfterChanges(courseNode);
if (nclr == null) {
doDisposeAfterEvent();
newCurrentCourseNode = null;
} else {
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
String selNodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(selNodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
newCurrentCourseNode = nclr.getCalledCourseNode();
}
return newCurrentCourseNode;
}
use of org.olat.course.run.navigation.NodeClickedRef in project OpenOLAT by OpenOLAT.
the class RunMainController method updateTreeAndContent.
private CourseNode updateTreeAndContent(UserRequest ureq, CourseNode calledCourseNode, String nodecmd, List<ContextEntry> entries, StateEntry state) {
// might be used in both controllers with the same ID (e.g. the course folder)
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
NodeClickedRef nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), calledCourseNode, this, nodecmd);
if (!nclr.isVisible()) {
// if not root -> fallback to root. e.g. when a direct node jump fails
if (calledCourseNode != null) {
nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), null, this, null);
}
if (!nclr.isVisible()) {
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.noaccess.title"), translate("course.noaccess.text"));
contentP.setContent(msgController.getInitialComponent());
luTree.setTreeModel(new GenericTreeModel());
return null;
}
}
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
String selNodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(selNodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
// get new run controller.
currentNodeController = nclr.getRunController();
addToHistory(ureq, currentNodeController);
if (currentNodeController instanceof TitledWrapperController) {
Controller contentcontroller = ((TitledWrapperController) currentNodeController).getContentController();
addToHistory(ureq, contentcontroller);
if (contentcontroller instanceof Activateable2) {
((Activateable2) contentcontroller).activate(ureq, entries, state);
}
} else if (currentNodeController instanceof Activateable2) {
((Activateable2) currentNodeController).activate(ureq, entries, state);
}
if (currentNodeController != null) {
contentP.setContent(currentNodeController.getInitialComponent());
} else {
MessageController msgCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, translate("msg.nodenotavailableanymore"));
listenTo(msgCtrl);
contentP.setContent(msgCtrl.getInitialComponent());
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
updateLastUsage(nclr.getCalledCourseNode());
return nclr.getCalledCourseNode();
}
use of org.olat.course.run.navigation.NodeClickedRef in project OpenOLAT by OpenOLAT.
the class RunMainController method doNodeClick.
private void doNodeClick(UserRequest ureq, TreeEvent tev) {
if (assessmentChangedEventReceived) {
uce.getScoreAccounting().evaluateAll();
assessmentChangedEventReceived = false;
}
// goto node:
// after a click in the tree, evaluate the model anew, and set the
// selection of the tree again
NodeClickedRef nclr = navHandler.evaluateJumpToTreeNode(ureq, getWindowControl(), treeModel, tev, this, null, currentNodeController);
if (!nclr.isVisible()) {
getWindowControl().setWarning(translate("msg.nodenotavailableanymore"));
// go to root since the current node is no more visible
updateTreeAndContent(ureq, null, null);
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
return;
}
// a click to a subtree's node
if (nclr.isHandledBySubTreeModelListener() || nclr.getSelectedNodeId() == null) {
if (nclr.getRunController() != null) {
// there is an update to the currentNodeController, apply it
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
currentNodeController = nclr.getRunController();
Component nodeComp = currentNodeController.getInitialComponent();
contentP.setContent(nodeComp);
updateLastUsage(nclr.getCalledCourseNode());
}
if (nclr.getSelectedNodeId() != null && nclr.getOpenNodeIds() != null) {
luTree.setSelectedNodeId(nclr.getSelectedNodeId());
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
return;
}
// set the new treemodel
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
// set the new tree selection
String nodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(nodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
currentCourseNode = nclr.getCalledCourseNode();
// get new run controller. Dispose only if not already disposed in navHandler.evaluateJumpToTreeNode()
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
currentNodeController = nclr.getRunController();
updateLastUsage(nclr.getCalledCourseNode());
Component nodeComp = currentNodeController.getInitialComponent();
contentP.setContent(nodeComp);
addToHistory(ureq, currentNodeController);
// stuff properly when in AJAX mode
if (glossaryMarkerCtr != null && glossaryMarkerCtr.isTextMarkingEnabled()) {
glossaryMarkerCtr.getInitialComponent().setDirty(true);
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
}
use of org.olat.course.run.navigation.NodeClickedRef in project openolat by klemens.
the class RunMainController method doNodeClick.
private void doNodeClick(UserRequest ureq, TreeEvent tev) {
if (assessmentChangedEventReceived) {
uce.getScoreAccounting().evaluateAll();
assessmentChangedEventReceived = false;
}
// goto node:
// after a click in the tree, evaluate the model anew, and set the
// selection of the tree again
NodeClickedRef nclr = navHandler.evaluateJumpToTreeNode(ureq, getWindowControl(), treeModel, tev, this, null, currentNodeController);
if (!nclr.isVisible()) {
getWindowControl().setWarning(translate("msg.nodenotavailableanymore"));
// go to root since the current node is no more visible
updateTreeAndContent(ureq, null, null);
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
return;
}
// a click to a subtree's node
if (nclr.isHandledBySubTreeModelListener() || nclr.getSelectedNodeId() == null) {
if (nclr.getRunController() != null) {
// there is an update to the currentNodeController, apply it
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
currentNodeController = nclr.getRunController();
Component nodeComp = currentNodeController.getInitialComponent();
contentP.setContent(nodeComp);
updateLastUsage(nclr.getCalledCourseNode());
}
if (nclr.getSelectedNodeId() != null && nclr.getOpenNodeIds() != null) {
luTree.setSelectedNodeId(nclr.getSelectedNodeId());
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
return;
}
// set the new treemodel
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
// set the new tree selection
String nodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(nodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
currentCourseNode = nclr.getCalledCourseNode();
// get new run controller. Dispose only if not already disposed in navHandler.evaluateJumpToTreeNode()
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
currentNodeController = nclr.getRunController();
updateLastUsage(nclr.getCalledCourseNode());
Component nodeComp = currentNodeController.getInitialComponent();
contentP.setContent(nodeComp);
addToHistory(ureq, currentNodeController);
// stuff properly when in AJAX mode
if (glossaryMarkerCtr != null && glossaryMarkerCtr.isTextMarkingEnabled()) {
glossaryMarkerCtr.getInitialComponent().setDirty(true);
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
}
use of org.olat.course.run.navigation.NodeClickedRef in project openolat by klemens.
the class PreviewRunController method updateTreeAndContent.
/**
* side-effecty to content and luTree
*
* @param ureq
* @param calledCourseNode the node to jump to, if null = jump to root node
* @return true if the node jumped to is visible
*/
private boolean updateTreeAndContent(UserRequest ureq, CourseNode calledCourseNode) {
// build menu (treemodel)
NodeClickedRef nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), calledCourseNode, this, null);
if (!nclr.isVisible()) {
// if not root -> fallback to root. e.g. when a direct node jump fails
if (calledCourseNode != null) {
nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), null, this, null);
}
if (!nclr.isVisible()) {
getWindowControl().setWarning(translate("msg.nodenotavailableanymore"));
content.setContent(null);
luTree.setTreeModel(new GenericTreeModel());
return false;
}
}
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
String selNodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(selNodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
// dispose old node controller
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
currentNodeController = nclr.getRunController();
content.setContent(currentNodeController.getInitialComponent());
return true;
}
Aggregations