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;
}
}
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));
}
}
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));
}
}
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);
}
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));
}
}
}
Aggregations