Search in sources :

Example 1 with EPStructureEvent

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

the class EPStructureDetailsController method formOK.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formOK(org.olat.core.gui.UserRequest)
 */
@Override
protected void formOK(final UserRequest ureq) {
    editStructure = ePFMgr.reloadPortfolioStructure(editStructure);
    editStructure.setTitle(titleEl.getValue());
    editStructure.setDescription(descriptionEl.getValue());
    editStructure.setArtefactRepresentationMode(viewRadio.getSelectedKey());
    if (rootStructure instanceof EPStructuredMapTemplate && restrictionElements != null) {
        clearErrors();
        editStructure.getCollectRestrictions().clear();
        setCollectRestrictions();
        for (final SingleSelection restrictionElement : restrictionElements) {
            final CollectRestriction restriction = (CollectRestriction) restrictionElement.getUserObject();
            if (restriction.isValid()) {
                final CollectRestriction cr = new CollectRestriction(restriction);
                editStructure.getCollectRestrictions().add(cr);
            }
        }
    }
    ePFMgr.savePortfolioStructure(editStructure);
    fireEvent(ureq, new EPStructureEvent(EPStructureEvent.CHANGE, editStructure));
}
Also used : EPStructureEvent(org.olat.portfolio.ui.structel.EPStructureEvent) EPStructuredMapTemplate(org.olat.portfolio.model.structel.EPStructuredMapTemplate) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) CollectRestriction(org.olat.portfolio.model.restriction.CollectRestriction)

Example 2 with EPStructureEvent

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

the class EPTOCReadOnlyController 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 == artOnOffLink) {
        displayArtefactsInTOC = !displayArtefactsInTOC;
        artOnOffLink.setCustomDisplayText(translate("artOnOffLink." + !displayArtefactsInTOC));
        refreshTOC(ureq);
    } else if (source instanceof Link) {
        // could be a TOC-Link
        Link link = (Link) source;
        String cmd = link.getCommand();
        PortfolioStructure parentStruct = (PortfolioStructure) link.getUserObject();
        if (cmd.equals(LINK_CMD_OPEN_STRUCT)) {
            fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT, parentStruct));
        } else if (cmd.equals(LINK_CMD_OPEN_ARTEFACT)) {
            // open the parent structure
            fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT, parentStruct));
        } else if (cmd.equals(LINK_CMD_OPEN_COMMENTS)) {
            fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT_WITH_COMMENTS, parentStruct));
        }
    }
}
Also used : EPStructureEvent(org.olat.portfolio.ui.structel.EPStructureEvent) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) Link(org.olat.core.gui.components.link.Link)

Example 3 with EPStructureEvent

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

the class EPStructureDetailsController method formOK.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formOK(org.olat.core.gui.UserRequest)
 */
@Override
protected void formOK(final UserRequest ureq) {
    editStructure = ePFMgr.reloadPortfolioStructure(editStructure);
    editStructure.setTitle(titleEl.getValue());
    editStructure.setDescription(descriptionEl.getValue());
    editStructure.setArtefactRepresentationMode(viewRadio.getSelectedKey());
    if (rootStructure instanceof EPStructuredMapTemplate && restrictionElements != null) {
        clearErrors();
        editStructure.getCollectRestrictions().clear();
        setCollectRestrictions();
        for (final SingleSelection restrictionElement : restrictionElements) {
            final CollectRestriction restriction = (CollectRestriction) restrictionElement.getUserObject();
            if (restriction.isValid()) {
                final CollectRestriction cr = new CollectRestriction(restriction);
                editStructure.getCollectRestrictions().add(cr);
            }
        }
    }
    ePFMgr.savePortfolioStructure(editStructure);
    fireEvent(ureq, new EPStructureEvent(EPStructureEvent.CHANGE, editStructure));
}
Also used : EPStructureEvent(org.olat.portfolio.ui.structel.EPStructureEvent) EPStructuredMapTemplate(org.olat.portfolio.model.structel.EPStructuredMapTemplate) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) CollectRestriction(org.olat.portfolio.model.restriction.CollectRestriction)

Example 4 with EPStructureEvent

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

the class EPTOCReadOnlyController 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 == artOnOffLink) {
        displayArtefactsInTOC = !displayArtefactsInTOC;
        artOnOffLink.setCustomDisplayText(translate("artOnOffLink." + !displayArtefactsInTOC));
        refreshTOC(ureq);
    } else if (source instanceof Link) {
        // could be a TOC-Link
        Link link = (Link) source;
        String cmd = link.getCommand();
        PortfolioStructure parentStruct = (PortfolioStructure) link.getUserObject();
        if (cmd.equals(LINK_CMD_OPEN_STRUCT)) {
            fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT, parentStruct));
        } else if (cmd.equals(LINK_CMD_OPEN_ARTEFACT)) {
            // open the parent structure
            fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT, parentStruct));
        } else if (cmd.equals(LINK_CMD_OPEN_COMMENTS)) {
            fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT_WITH_COMMENTS, parentStruct));
        }
    }
}
Also used : EPStructureEvent(org.olat.portfolio.ui.structel.EPStructureEvent) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) Link(org.olat.core.gui.components.link.Link)

Aggregations

EPStructureEvent (org.olat.portfolio.ui.structel.EPStructureEvent)4 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 Link (org.olat.core.gui.components.link.Link)2 CollectRestriction (org.olat.portfolio.model.restriction.CollectRestriction)2 EPStructuredMapTemplate (org.olat.portfolio.model.structel.EPStructuredMapTemplate)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2