Search in sources :

Example 1 with EPReflexionWrapperController

use of org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController 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 2 with EPReflexionWrapperController

use of org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController in project OpenOLAT by OpenOLAT.

the class EPArtefactViewOptionsLinkController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == optionLink) {
        popUpArtefactOptionsBox(ureq);
    } else if (source == unlinkLink) {
        closeArtefactOptionsCallout();
        struct = ePFMgr.removeArtefactFromStructure(artefact, struct);
        // refresh ui
        fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.REMOVED, struct));
    } else if (source == moveLink) {
        closeArtefactOptionsCallout();
        showMoveTree(ureq);
    } else if (source == reflexionLink) {
        closeArtefactOptionsCallout();
        reflexionCtrl = new EPReflexionWrapperController(ureq, getWindowControl(), secCallback, artefact, struct);
        listenTo(reflexionCtrl);
    } else if (source == tagsLink) {
        closeArtefactOptionsCallout();
        tagsCtrl = new EPTagsController(ureq, getWindowControl(), secCallback, artefact, struct);
        listenTo(tagsCtrl);
    }
}
Also used : EPTagsController(org.olat.portfolio.ui.artefacts.edit.EPTagsController) EPReflexionWrapperController(org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent)

Example 3 with EPReflexionWrapperController

use of org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController in project openolat by klemens.

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 4 with EPReflexionWrapperController

use of org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController in project openolat by klemens.

the class EPArtefactViewOptionsLinkController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == optionLink) {
        popUpArtefactOptionsBox(ureq);
    } else if (source == unlinkLink) {
        closeArtefactOptionsCallout();
        struct = ePFMgr.removeArtefactFromStructure(artefact, struct);
        // refresh ui
        fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.REMOVED, struct));
    } else if (source == moveLink) {
        closeArtefactOptionsCallout();
        showMoveTree(ureq);
    } else if (source == reflexionLink) {
        closeArtefactOptionsCallout();
        reflexionCtrl = new EPReflexionWrapperController(ureq, getWindowControl(), secCallback, artefact, struct);
        listenTo(reflexionCtrl);
    } else if (source == tagsLink) {
        closeArtefactOptionsCallout();
        tagsCtrl = new EPTagsController(ureq, getWindowControl(), secCallback, artefact, struct);
        listenTo(tagsCtrl);
    }
}
Also used : EPTagsController(org.olat.portfolio.ui.artefacts.edit.EPTagsController) EPReflexionWrapperController(org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent)

Aggregations

EPReflexionWrapperController (org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController)4 EPStructureChangeEvent (org.olat.portfolio.ui.structel.EPStructureChangeEvent)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 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2 EPTagsController (org.olat.portfolio.ui.artefacts.edit.EPTagsController)2