Search in sources :

Example 1 with EPStructureChangeEvent

use of org.olat.portfolio.ui.structel.EPStructureChangeEvent in project OpenOLAT by OpenOLAT.

the class EPReflexionWrapperController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == reflexionCtrl && event instanceof EPReflexionChangeEvent) {
        EPReflexionChangeEvent refEv = (EPReflexionChangeEvent) event;
        if (struct != null) {
            ePFMgr.setReflexionForArtefactToStructureLink(refEv.getRefArtefact(), struct, refEv.getReflexion());
            reflexionBox.deactivate();
            fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, struct));
        } else {
            AbstractArtefact refArtefact = refEv.getRefArtefact();
            refArtefact.setReflexion(refEv.getReflexion());
            ePFMgr.updateArtefact(refArtefact);
            reflexionBox.deactivate();
            fireEvent(ureq, Event.DONE_EVENT);
        }
        removeAsListenerAndDispose(reflexionBox);
    } else if (source == reflexionBox && event == CloseableCalloutWindowController.CLOSE_WINDOW_EVENT) {
        removeAsListenerAndDispose(reflexionBox);
        reflexionBox = null;
    }
}
Also used : AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) EPReflexionChangeEvent(org.olat.portfolio.ui.artefacts.collect.EPReflexionChangeEvent) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent)

Example 2 with EPStructureChangeEvent

use of org.olat.portfolio.ui.structel.EPStructureChangeEvent in project openolat by klemens.

the class EPTOCController method doSelectTreeElement.

private void doSelectTreeElement(UserRequest ureq, TreeEvent te) {
    TreeNode selectedNode = treeCtr.getTreeModel().getNodeById(te.getNodeId());
    Object userObj = selectedNode.getUserObject();
    if (userObj instanceof PortfolioStructure) {
        // structure clicked
        structureClicked = (PortfolioStructure) userObj;
        refreshAddElements(ureq, structureClicked);
        delButton.setVisible(true);
        // send event to load this page
        fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.SELECTED, structureClicked));
    } else if (userObj instanceof AbstractArtefact) {
        // artefact clicked
        Object parentObj = ((TreeNode) selectedNode.getParent()).getUserObject();
        if (parentObj instanceof PortfolioStructure) {
            artefactClicked = (AbstractArtefact) userObj;
            PortfolioStructure structure = (PortfolioStructure) parentObj;
            refreshAddElements(ureq, null);
            delButton.setVisible(true);
            fireEvent(ureq, new EPArtefactClicked(ARTEFACT_NODE_CLICKED, structure));
        }
    } else {
        // root tree node clicked, no add/delete link
        delButton.setVisible(false);
        refreshAddElements(ureq, null);
        fireEvent(ureq, new Event(ARTEFACT_NODE_CLICKED));
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) Event(org.olat.core.gui.control.Event) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPArtefactClicked(org.olat.portfolio.ui.structel.EPArtefactClicked)

Example 3 with EPStructureChangeEvent

use of org.olat.portfolio.ui.structel.EPStructureChangeEvent in project OpenOLAT by OpenOLAT.

the class EPTOCController method doSelectTreeElement.

private void doSelectTreeElement(UserRequest ureq, TreeEvent te) {
    TreeNode selectedNode = treeCtr.getTreeModel().getNodeById(te.getNodeId());
    Object userObj = selectedNode.getUserObject();
    if (userObj instanceof PortfolioStructure) {
        // structure clicked
        structureClicked = (PortfolioStructure) userObj;
        refreshAddElements(ureq, structureClicked);
        delButton.setVisible(true);
        // send event to load this page
        fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.SELECTED, structureClicked));
    } else if (userObj instanceof AbstractArtefact) {
        // artefact clicked
        Object parentObj = ((TreeNode) selectedNode.getParent()).getUserObject();
        if (parentObj instanceof PortfolioStructure) {
            artefactClicked = (AbstractArtefact) userObj;
            PortfolioStructure structure = (PortfolioStructure) parentObj;
            refreshAddElements(ureq, null);
            delButton.setVisible(true);
            fireEvent(ureq, new EPArtefactClicked(ARTEFACT_NODE_CLICKED, structure));
        }
    } else {
        // root tree node clicked, no add/delete link
        delButton.setVisible(false);
        refreshAddElements(ureq, null);
        fireEvent(ureq, new Event(ARTEFACT_NODE_CLICKED));
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) Event(org.olat.core.gui.control.Event) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPArtefactClicked(org.olat.portfolio.ui.structel.EPArtefactClicked)

Example 4 with EPStructureChangeEvent

use of org.olat.portfolio.ui.structel.EPStructureChangeEvent in project OpenOLAT by OpenOLAT.

the class EPMultipleArtefactsAsTableController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == artefactListTblCtrl) {
        if (event instanceof TableEvent) {
            TableEvent te = (TableEvent) event;
            AbstractArtefact artefact = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(te.getRowId());
            String action = te.getActionId();
            if (CMD_TITLE.equals(action)) {
                popupArtefact(artefact, ureq);
            } else if (CMD_REFLEXION.equals(action)) {
                EPReflexionWrapperController reflexionCtrl = new EPReflexionWrapperController(ureq, getWindowControl(), secCallback, artefact, struct);
                listenTo(reflexionCtrl);
            } else if (CMD_CHOOSE.equals(action)) {
                fireEvent(ureq, new EPArtefactChoosenEvent(artefact));
            } else if (CMD_UNLINK.equals(action)) {
                struct = ePFMgr.reloadPortfolioStructure(struct);
                ePFMgr.removeArtefactFromStructure(artefact, struct);
                artefactListTblCtrl.modelChanged();
                fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, struct));
            } else if (CMD_MOVE.equals(action)) {
                showMoveTree(ureq, artefact);
            } else if (CMD_DELETEARTEFACT.equals(action)) {
                String text = translate("delete.artefact.text", StringHelper.escapeHtml(artefact.getTitle()));
                deleteDialogController = activateYesNoDialog(ureq, translate("delete.artefact"), text, deleteDialogController);
                deleteDialogController.setUserObject(artefact);
            }
        } else if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            BitSet objectMarkers = tmse.getSelection();
            List<AbstractArtefact> selectedArtefacts = new ArrayList<>(objectMarkers.size());
            for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
                AbstractArtefact entry = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(i);
                selectedArtefacts.add(entry);
            }
            fireEvent(ureq, new EPArtefactListChoosenEvent(selectedArtefacts));
        }
    } else if (source == moveTreeCtrl && event.getCommand().equals(EPStructureChangeEvent.CHANGED)) {
        EPStructureChangeEvent epsEv = (EPStructureChangeEvent) event;
        PortfolioStructure newStruct = epsEv.getPortfolioStructure();
        showInfo("artefact.moved", newStruct.getTitle());
        fireEvent(ureq, event);
        moveTreeBox.deactivate();
    } else if (source == deleteDialogController) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            AbstractArtefact artefact2delete = (AbstractArtefact) deleteDialogController.getUserObject();
            ePFMgr.deleteArtefact(artefact2delete);
            ArtefactTableDataModel model = (ArtefactTableDataModel) artefactListTblCtrl.getTableDataModel();
            model.getObjects().remove(artefact2delete);
            artefactListTblCtrl.modelChanged();
            fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.REMOVED, struct));
        }
        removeAsListenerAndDispose(deleteDialogController);
        deleteDialogController = null;
    }
    super.event(ureq, source, event);
}
Also used : TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) BitSet(java.util.BitSet) EPReflexionWrapperController(org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController) TableEvent(org.olat.core.gui.components.table.TableEvent) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) ArrayList(java.util.ArrayList) List(java.util.List) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent)

Example 5 with EPStructureChangeEvent

use of org.olat.portfolio.ui.structel.EPStructureChangeEvent in project OpenOLAT by OpenOLAT.

the class EPCollectStepForm04 method formOK.

/**
 * @see org.olat.core.gui.control.generic.wizard.StepFormBasicController#formOK(org.olat.core.gui.UserRequest)
 */
@Override
protected void formOK(UserRequest ureq) {
    PortfolioStructure selectedPortfolioStructure = preSelectedStructure;
    TreeNode node = mapsTreeController == null ? null : mapsTreeController.getSelectedNode();
    if (node != null) {
        Object obj = node.getUserObject();
        if (obj == null) {
            selectedPortfolioStructure = null;
        } else if (obj instanceof PortfolioStructure && !(obj instanceof EPAbstractMap)) {
            selectedPortfolioStructure = (PortfolioStructure) obj;
        }
    }
    if (selectedPortfolioStructure != null) {
        ePFMgr.setUsersLastUsedPortfolioStructure(getIdentity(), selectedPortfolioStructure);
    }
    if (isUsedInStepWizzard()) {
        addToRunContext("selectedStructure", selectedPortfolioStructure);
        fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
    } else {
        if (selectedPortfolioStructure != null && !selectedPortfolioStructure.getKey().equals(oldStructure.getKey())) {
            ePFMgr.moveArtefactFromStructToStruct(artefact, oldStructure, selectedPortfolioStructure);
            // refresh ui
            fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.CHANGED, selectedPortfolioStructure));
        }
    }
}
Also used : EPAbstractMap(org.olat.portfolio.model.structel.EPAbstractMap) TreeNode(org.olat.core.gui.components.tree.TreeNode) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent)

Aggregations

EPStructureChangeEvent (org.olat.portfolio.ui.structel.EPStructureChangeEvent)12 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)8 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)6 TreeNode (org.olat.core.gui.components.tree.TreeNode)4 EPReflexionWrapperController (org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController)4 ArrayList (java.util.ArrayList)2 BitSet (java.util.BitSet)2 List (java.util.List)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeDropEvent (org.olat.core.gui.components.tree.TreeDropEvent)2 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)2 Event (org.olat.core.gui.control.Event)2 EPAbstractMap (org.olat.portfolio.model.structel.EPAbstractMap)2 EPReflexionChangeEvent (org.olat.portfolio.ui.artefacts.collect.EPReflexionChangeEvent)2 EPTagsController (org.olat.portfolio.ui.artefacts.edit.EPTagsController)2 EPArtefactClicked (org.olat.portfolio.ui.structel.EPArtefactClicked)2