use of org.olat.core.gui.components.tree.TreeDropEvent in project OpenOLAT by OpenOLAT.
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.TreeDropEvent in project OpenOLAT by OpenOLAT.
the class CPTreeController method event.
/**
* Event-handling from components
*/
protected void event(UserRequest ureq, Component source, Event event) {
if (source == importLink) {
uploadCtr = new CPFileImportController(ureq, getWindowControl(), cp, currentPage);
listenTo(uploadCtr);
String title = translate("cpfileuploadcontroller.form.title");
cmc = new CloseableModalController(getWindowControl(), translate("close"), uploadCtr.getInitialComponent(), true, title);
listenTo(cmc);
cmc.activate();
} else if (source == newLink) {
fireEvent(ureq, new Event("New Page"));
} else if (source == copyLink) {
if (currentPage.isOrgaPage()) {
showInfo("cptreecontroller.orga.cannot.be.copied");
} else {
String newIdentifier = copyPage(currentPage);
contentCtr.displayPageWithMetadataEditor(ureq, newIdentifier);
}
} else if (source == deleteLink) {
if (currentPage.isOrgaPage()) {
showInfo("cptreecontroller.orga.cannot.be.deleted");
} else {
List<String> buttonLables = new ArrayList<String>();
buttonLables.add(translate("cptreecontrolller.delete.items.and.files"));
buttonLables.add(translate("cptreecontrolller.delete.items.only"));
buttonLables.add(translate("cancel"));
dialogCtr = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("cptreecontroller.q_delete_title"), translate("cptreecontroller.q_delete_text", getCurrentPageInfoStringHTML()), buttonLables);
listenTo(dialogCtr);
dialogCtr.activate();
}
} else if (source == treeCtr) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
String selectedNodeID = treeModel.getIdentifierForNodeID(te.getNodeId());
currentPage = new CPPage(selectedNodeID, cp);
fireEvent(ureq, new TreeEvent(TreeEvent.COMMAND_TREENODE_CLICKED, selectedNodeID));
} else if (event instanceof TreeDropEvent) {
TreeDropEvent te = (TreeDropEvent) event;
doDrop(ureq, te.getDroppedNodeId(), te.getTargetNodeId(), te.isAsChild());
}
}
}
use of org.olat.core.gui.components.tree.TreeDropEvent in project openolat by klemens.
the class CPTreeController method event.
/**
* Event-handling from components
*/
protected void event(UserRequest ureq, Component source, Event event) {
if (source == importLink) {
uploadCtr = new CPFileImportController(ureq, getWindowControl(), cp, currentPage);
listenTo(uploadCtr);
String title = translate("cpfileuploadcontroller.form.title");
cmc = new CloseableModalController(getWindowControl(), translate("close"), uploadCtr.getInitialComponent(), true, title);
listenTo(cmc);
cmc.activate();
} else if (source == newLink) {
fireEvent(ureq, new Event("New Page"));
} else if (source == copyLink) {
if (currentPage.isOrgaPage()) {
showInfo("cptreecontroller.orga.cannot.be.copied");
} else {
String newIdentifier = copyPage(currentPage);
contentCtr.displayPageWithMetadataEditor(ureq, newIdentifier);
}
} else if (source == deleteLink) {
if (currentPage.isOrgaPage()) {
showInfo("cptreecontroller.orga.cannot.be.deleted");
} else {
List<String> buttonLables = new ArrayList<String>();
buttonLables.add(translate("cptreecontrolller.delete.items.and.files"));
buttonLables.add(translate("cptreecontrolller.delete.items.only"));
buttonLables.add(translate("cancel"));
dialogCtr = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("cptreecontroller.q_delete_title"), translate("cptreecontroller.q_delete_text", getCurrentPageInfoStringHTML()), buttonLables);
listenTo(dialogCtr);
dialogCtr.activate();
}
} else if (source == treeCtr) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
String selectedNodeID = treeModel.getIdentifierForNodeID(te.getNodeId());
currentPage = new CPPage(selectedNodeID, cp);
fireEvent(ureq, new TreeEvent(TreeEvent.COMMAND_TREENODE_CLICKED, selectedNodeID));
} else if (event instanceof TreeDropEvent) {
TreeDropEvent te = (TreeDropEvent) event;
doDrop(ureq, te.getDroppedNodeId(), te.getTargetNodeId(), te.isAsChild());
}
}
}
use of org.olat.core.gui.components.tree.TreeDropEvent in project openolat by klemens.
the class QuestionPoolMainEditorController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (menuTree == source) {
if (event instanceof TreeDropEvent) {
TreeDropEvent e = (TreeDropEvent) event;
String targetId = e.getTargetNodeId();
String dropId = e.getDroppedNodeId();
// drop id w_o_fi1000002357-4
doDrop(ureq, targetId, dropId);
} else if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
TreeNode node = menuTree.getTreeModel().getNodeById(te.getNodeId());
doSelectControllerTreeNode(ureq, node, null, null);
}
}
}
}
use of org.olat.core.gui.components.tree.TreeDropEvent in project OpenOLAT by OpenOLAT.
the class EPTOCController 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) {
if (source instanceof Link) {
Link link = (Link) source;
if (link.getCommand().equals(DELETE_LINK_CMD)) {
if (artefactClicked != null) {
AbstractArtefact artefact = artefactClicked;
PortfolioStructure parentStruct = getArtefactParentStruct(artefactClicked);
ePFMgr.removeArtefactFromStructure(artefact, parentStruct);
// refresh the view
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (structureClicked != null) {
if ((structureClicked instanceof EPPage) && !(structureClicked instanceof EPAbstractMap)) {
PortfolioStructure ps = structureClicked;
while (ePFMgr.loadStructureParent(ps) != null) {
ps = ePFMgr.loadStructureParent(ps);
}
int childPages = ePFMgr.countStructureChildren(ps);
if (childPages > 1) {
eSTMgr.removeStructureRecursively(structureClicked);
// refresh the view
fireEvent(ureq, Event.CHANGED_EVENT);
} else {
showError("last.page.not.deletable");
}
} else if (structureClicked instanceof EPStructureElement && !(structureClicked instanceof EPAbstractMap)) {
// structures should always be deletable
eSTMgr.removeStructureRecursively(structureClicked);
// refresh the view
fireEvent(ureq, Event.CHANGED_EVENT);
} else {
showInfo("element.not.deletable");
}
}
}
} else if (source == treeCtr) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
doSelectTreeElement(ureq, te);
}
} else if (event instanceof TreeDropEvent) {
TreeDropEvent te = (TreeDropEvent) event;
doDrop(ureq, te.getDroppedNodeId(), te.getTargetNodeId(), te.isAsChild());
}
}
}
Aggregations