use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class FileChooserController 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
protected void event(UserRequest ureq, Component source, Event event) {
// events from ajax tree view
if (source == cancelLink) {
fireEvent(ureq, Event.CANCELLED_EVENT);
} else if (source == selectLink) {
if (selectedItem != null) {
// fxdiff FXOLAT-125: virtual file system for CP
if (onlyLeafsSelectable && !(selectedItem instanceof VFSLeaf)) {
showWarning("filechooser.tree.error.only.leafs", selectedItem.getName());
} else {
fireEvent(ureq, new FileChoosenEvent(selectedItem));
}
} else {
fireEvent(ureq, Event.FAILED_EVENT);
}
} else if (source == selectionTree) {
TreeEvent te = (TreeEvent) event;
if (te.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
String selectedPath = treeModel.getSelectedPath(selectionTree.getSelectedNode());
selectedItem = rootContainer.resolve(selectedPath);
selectLink.setCustomEnabledLinkCSS("btn btn-default o_button_dirty");
}
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class GenericMainController method activateTreeNodeByActionExtension.
/**
* activates the correct treenode for a given ActionExtension
* @param ureq
* @param ae
*/
private void activateTreeNodeByActionExtension(UserRequest ureq, ActionExtension ae) {
TreeNode node = ((GenericTreeModel) olatMenuTree.getTreeModel()).findNodeByUserObject(ae);
if (node != null) {
olatMenuTree.setSelectedNodeId(node.getIdent());
TreeEvent te = new TreeEvent(MenuTree.COMMAND_TREENODE_CLICKED, node.getIdent());
event(ureq, olatMenuTree, te);
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class CourseNodeSelectionController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == menuTree) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (TreeEvent.COMMAND_TREENODE_OPEN.equals(te.getSubCommand()) || TreeEvent.COMMAND_TREENODE_CLOSE.equals(te.getSubCommand())) {
Object uo = menuTree.getSelectedNode().getUserObject();
if (menuTree.getSelectedNode() == menuTree.getTreeModel().getRootNode()) {
// do nothing
} else if (uo instanceof AssessableCourseNode && !(uo instanceof STCourseNode)) {
AssessableCourseNode selectedNode = (AssessableCourseNode) uo;
fireEvent(ureq, new CourseNodeEvent(CourseNodeEvent.SELECT_COURSE_NODE, selectedNode.getIdent()));
}
} else if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
Object uo = menuTree.getSelectedNode().getUserObject();
if (menuTree.getSelectedNode() == menuTree.getTreeModel().getRootNode()) {
CourseNode rootNode = (CourseNode) uo;
fireEvent(ureq, new CourseNodeEvent(CourseNodeEvent.SELECT_COURSE_NODE, rootNode.getIdent()));
} else if (uo instanceof AssessableCourseNode && !(uo instanceof STCourseNode)) {
AssessableCourseNode selectedNode = (AssessableCourseNode) uo;
fireEvent(ureq, new CourseNodeEvent(CourseNodeEvent.SELECT_COURSE_NODE, selectedNode.getIdent()));
}
}
}
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class EditorMainController 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) {
try {
ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
if (source == menuTree) {
if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
// goto node in edit mode
TreeEvent te = (TreeEvent) event;
String nodeId = te.getNodeId();
updateViewForSelectedNodeId(ureq, nodeId);
} else if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_DROP)) {
TreeDropEvent te = (TreeDropEvent) event;
dropNodeAsChild(ureq, course, te.getDroppedNodeId(), te.getTargetNodeId(), te.isAsChild(), te.isAtTheEnd());
}
} else if (source == main) {
if (event.getCommand().startsWith(NLS_START_HELP_WIZARD)) {
doStartHelpWizard(ureq, event);
}
} else if (source == undelButton) {
doUndelete(ureq, course);
} else if (source == alternativeLink) {
CourseNode chosenNode = (CourseNode) alternativeLink.getUserObject();
askForAlternative(ureq, chosenNode);
} else if (previewLink == source) {
launchPreview(ureq, course);
} else if (publishLink == source) {
launchPublishingWizard(ureq, course, false);
} else if (closeLink == source) {
doReleaseEditLock();
fireEvent(ureq, Event.DONE_EVENT);
} else if (createNodeLink == source) {
doOpenNodeTypeChooser(ureq);
} else if (deleteNodeLink == source) {
doDeleteNode(ureq);
} else if (moveNodeLink == source) {
doMove(ureq, course, false);
} else if (copyNodeLink == source) {
doMove(ureq, course, true);
} else if (statusLink == source) {
doOpenStatusOverview(ureq);
}
} catch (RuntimeException e) {
log.warn(RELEASE_LOCK_AT_CATCH_EXCEPTION + " [in event(UserRequest,Component,Event)]", e);
dispose();
throw e;
}
}
use of org.olat.core.gui.components.tree.TreeEvent in project openolat by klemens.
the class RunMainController 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 (needsRebuildAfter) {
currentCourseNode = updateAfterChanges(currentCourseNode);
needsRebuildAfter = false;
}
// Links in editTools dropdown
if (nextLink == source) {
doNext(ureq);
} else if (previousLink == source) {
doPrevious(ureq);
} else if (source == luTree) {
if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED) || event.getCommand().equals(MenuTree.COMMAND_TREENODE_EXPANDED)) {
TreeEvent tev = (TreeEvent) event;
doNodeClick(ureq, tev);
}
} else if (source == coursemain) {
if ("activateCourseNode".equals(event.getCommand())) {
// Events from the JS function o_activateCourseNode() - activate the given node id
String nodeid = ureq.getParameter("nodeid");
if (nodeid != null) {
CourseNode identNode = course.getRunStructure().getNode(nodeid);
CourseNode node = updateTreeAndContent(ureq, identNode, null);
if (node != null) {
currentCourseNode = node;
} else {
getWindowControl().setWarning(translate("msg.nodenotavailableanymore"));
}
}
}
}
}
Aggregations