use of org.olat.core.gui.components.tree.TreeDropEvent in project OpenOLAT by OpenOLAT.
the class AssessmentTestComposerController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (menuTree == source) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
String cmd = te.getCommand();
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(cmd)) {
TreeNode selectedNode = menuTree.getTreeModel().getNodeById(te.getNodeId());
partEditorFactory(ureq, selectedNode);
}
} else if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_DROP)) {
TreeDropEvent tde = (TreeDropEvent) event;
doDrop(ureq, tde.getDroppedNodeId(), tde.getTargetNodeId(), tde.isAsChild());
}
} else if (newSectionLink == source) {
doNewSection(ureq, menuTree.getSelectedNode());
} else if (newTestPartLink == source) {
doNewTestPart(ureq);
} else if (newSingleChoiceLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new SingleChoiceAssessmentItemBuilder(translate("new.sc"), translate("new.answer"), qtiService.qtiSerializer()));
} else if (newMultipleChoiceLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MultipleChoiceAssessmentItemBuilder(translate("new.mc"), translate("new.answer"), qtiService.qtiSerializer()));
} else if (newKPrimLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new KPrimAssessmentItemBuilder(translate("new.kprim"), translate("new.answer"), qtiService.qtiSerializer()));
} else if (newMatchLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.match"), QTI21Constants.CSS_MATCH_MATRIX, qtiService.qtiSerializer()));
} else if (newMatchDragAndDropLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.matchdraganddrop"), QTI21Constants.CSS_MATCH_DRAG_AND_DROP, qtiService.qtiSerializer()));
} else if (newMatchTrueFalseLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.matchtruefalse"), QTI21Constants.CSS_MATCH_TRUE_FALSE, translate("match.unanswered"), translate("match.true"), translate("match.false"), qtiService.qtiSerializer()));
} else if (newFIBLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new FIBAssessmentItemBuilder(translate("new.fib"), EntryType.text, qtiService.qtiSerializer()));
} else if (newNumericalLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new FIBAssessmentItemBuilder(translate("new.fib.numerical"), EntryType.numerical, qtiService.qtiSerializer()));
} else if (newHotspotLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new HotspotAssessmentItemBuilder(translate("new.hotspot"), qtiService.qtiSerializer()));
} else if (newHottextLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new HottextAssessmentItemBuilder(translate("new.hottext"), translate("new.hottext.start"), translate("new.hottext.text"), qtiService.qtiSerializer()));
} else if (newEssayLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new EssayAssessmentItemBuilder(translate("new.essay"), qtiService.qtiSerializer()));
} else if (newUploadLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new UploadAssessmentItemBuilder(translate("new.upload"), qtiService.qtiSerializer()));
} else if (newDrawingLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new DrawingAssessmentItemBuilder(translate("new.drawing"), qtiService.qtiSerializer()));
} else if (importFromPoolLink == source) {
doSelectQItem(ureq);
} else if (importFromTableLink == source) {
doImportTable(ureq);
} else if (exportToPoolLink == source) {
doExportPool();
} else if (exportToDocxLink == source) {
doExportDocx(ureq);
} else if (deleteLink == source) {
doConfirmDelete(ureq);
} else if (copyLink == source) {
doCopy(ureq);
} else if (reloadInCacheLink == source) {
doForceReloadFiles(ureq);
}
}
use of org.olat.core.gui.components.tree.TreeDropEvent in project OpenOLAT by OpenOLAT.
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 klemens.
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());
}
}
}
use of org.olat.core.gui.components.tree.TreeDropEvent 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.TreeDropEvent in project openolat by klemens.
the class AssessmentTestComposerController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (menuTree == source) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
String cmd = te.getCommand();
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(cmd)) {
TreeNode selectedNode = menuTree.getTreeModel().getNodeById(te.getNodeId());
partEditorFactory(ureq, selectedNode);
}
} else if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_DROP)) {
TreeDropEvent tde = (TreeDropEvent) event;
doDrop(ureq, tde.getDroppedNodeId(), tde.getTargetNodeId(), tde.isAsChild());
}
} else if (newSectionLink == source) {
doNewSection(ureq, menuTree.getSelectedNode());
} else if (newTestPartLink == source) {
doNewTestPart(ureq);
} else if (newSingleChoiceLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new SingleChoiceAssessmentItemBuilder(translate("new.sc"), translate("new.answer"), qtiService.qtiSerializer()));
} else if (newMultipleChoiceLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MultipleChoiceAssessmentItemBuilder(translate("new.mc"), translate("new.answer"), qtiService.qtiSerializer()));
} else if (newKPrimLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new KPrimAssessmentItemBuilder(translate("new.kprim"), translate("new.answer"), qtiService.qtiSerializer()));
} else if (newMatchLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.match"), QTI21Constants.CSS_MATCH_MATRIX, qtiService.qtiSerializer()));
} else if (newMatchDragAndDropLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.matchdraganddrop"), QTI21Constants.CSS_MATCH_DRAG_AND_DROP, qtiService.qtiSerializer()));
} else if (newMatchTrueFalseLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.matchtruefalse"), QTI21Constants.CSS_MATCH_TRUE_FALSE, translate("match.unanswered"), translate("match.true"), translate("match.false"), qtiService.qtiSerializer()));
} else if (newFIBLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new FIBAssessmentItemBuilder(translate("new.fib"), EntryType.text, qtiService.qtiSerializer()));
} else if (newNumericalLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new FIBAssessmentItemBuilder(translate("new.fib.numerical"), EntryType.numerical, qtiService.qtiSerializer()));
} else if (newHotspotLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new HotspotAssessmentItemBuilder(translate("new.hotspot"), qtiService.qtiSerializer()));
} else if (newHottextLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new HottextAssessmentItemBuilder(translate("new.hottext"), translate("new.hottext.start"), translate("new.hottext.text"), qtiService.qtiSerializer()));
} else if (newEssayLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new EssayAssessmentItemBuilder(translate("new.essay"), qtiService.qtiSerializer()));
} else if (newUploadLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new UploadAssessmentItemBuilder(translate("new.upload"), qtiService.qtiSerializer()));
} else if (newDrawingLink == source) {
doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new DrawingAssessmentItemBuilder(translate("new.drawing"), qtiService.qtiSerializer()));
} else if (importFromPoolLink == source) {
doSelectQItem(ureq);
} else if (importFromTableLink == source) {
doImportTable(ureq);
} else if (exportToPoolLink == source) {
doExportPool();
} else if (exportToDocxLink == source) {
doExportDocx(ureq);
} else if (deleteLink == source) {
doConfirmDelete(ureq);
} else if (copyLink == source) {
doCopy(ureq);
} else if (reloadInCacheLink == source) {
doForceReloadFiles(ureq);
}
}
Aggregations