Search in sources :

Example 6 with TreeDropEvent

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);
    }
}
Also used : HottextAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.HottextAssessmentItemBuilder) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) HotspotAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.HotspotAssessmentItemBuilder) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) UploadAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.UploadAssessmentItemBuilder) DrawingAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.DrawingAssessmentItemBuilder)

Example 7 with TreeDropEvent

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);
            }
        }
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) MyQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MyQuestionsTreeNode) ControllerTreeNode(org.olat.modules.qpool.ui.tree.ControllerTreeNode) CollectionTreeNode(org.olat.modules.qpool.ui.tree.CollectionTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) MarkedQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MarkedQuestionsTreeNode) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent)

Example 8 with TreeDropEvent

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());
        }
    }
}
Also used : EPStructureElement(org.olat.portfolio.model.structel.EPStructureElement) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) EPPage(org.olat.portfolio.model.structel.EPPage) EPAbstractMap(org.olat.portfolio.model.structel.EPAbstractMap) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) Link(org.olat.core.gui.components.link.Link)

Example 9 with TreeDropEvent

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;
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) ICourse(org.olat.course.ICourse) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) CourseNode(org.olat.course.nodes.CourseNode)

Example 10 with TreeDropEvent

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);
    }
}
Also used : HottextAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.HottextAssessmentItemBuilder) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) HotspotAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.HotspotAssessmentItemBuilder) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) UploadAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.UploadAssessmentItemBuilder) DrawingAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.DrawingAssessmentItemBuilder)

Aggregations

TreeDropEvent (org.olat.core.gui.components.tree.TreeDropEvent)10 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)10 TreeNode (org.olat.core.gui.components.tree.TreeNode)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Link (org.olat.core.gui.components.link.Link)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 Event (org.olat.core.gui.control.Event)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 ICourse (org.olat.course.ICourse)2 CourseNode (org.olat.course.nodes.CourseNode)2 DrawingAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.DrawingAssessmentItemBuilder)2 EssayAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder)2 FIBAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder)2 HotspotAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.HotspotAssessmentItemBuilder)2 HottextAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.HottextAssessmentItemBuilder)2 KPrimAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder)2 MatchAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder)2 MultipleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder)2 SingleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder)2