Search in sources :

Example 1 with FormEvent

use of org.olat.core.gui.components.form.flexible.impl.FormEvent in project OpenOLAT by OpenOLAT.

the class EPViewModeController method formInnerEvent.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formInnerEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.components.form.flexible.FormItem, org.olat.core.gui.components.form.flexible.impl.FormEvent)
 */
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableLink || source == detailsLink) {
        FormLink link = (FormLink) source;
        if (!link.getCmd().equals(userPrefsMode)) {
            String newUserPrefsMode = link.getCmd();
            ePFMgr.setUsersPreferedArtefactViewMode(getIdentity(), newUserPrefsMode, context);
            userPrefsMode = newUserPrefsMode;
            fireEvent(ureq, new Event(VIEWMODE_CHANGED_EVENT_CMD));
        }
    }
}
Also used : Event(org.olat.core.gui.control.Event) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 2 with FormEvent

use of org.olat.core.gui.components.form.flexible.impl.FormEvent in project OpenOLAT by OpenOLAT.

the class AttributeEasyRowAdderController method event.

@Override
protected void event(final UserRequest ureq, final Controller source, final Event event) {
    if (event instanceof FormEvent) {
        final FormEvent fe = (FormEvent) event;
        final FormItem sourceItem = fe.getFormItemSource();
        final String compName = sourceItem.getName();
        if (columnAddRow.contains(compName)) {
            // add link clicked
            final int clickPos = ((Integer) sourceItem.getUserObject()).intValue();
            addRowAt(clickPos + 1);
        } else if (columnRemoveRow.contains(compName)) {
            // remove link clicked
            final int clickPos = ((Integer) sourceItem.getUserObject()).intValue();
            removeRowAt(clickPos);
        }
    }
}
Also used : FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) FormItem(org.olat.core.gui.components.form.flexible.FormItem)

Example 3 with FormEvent

use of org.olat.core.gui.components.form.flexible.impl.FormEvent in project OpenOLAT by OpenOLAT.

the class CorrectionAssessmentItemListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            CorrectionAssessmentItemRow row = tableModel.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                // accept all
                doSelect(ureq, row, r -> true);
            } else if ("answered".equals(cmd)) {
                // accept all
                doSelect(ureq, row, new ResponsedPredicate(row, true));
            } else if ("notAnswered".equals(cmd)) {
                // accept all
                doSelect(ureq, row, new ResponsedPredicate(row, false));
            } else if ("autoCorrected".equals(cmd)) {
                doSelect(ureq, row, entry -> !row.isManualCorrection() && entry.getManualScore() == null);
            } else if ("corrected".equals(cmd)) {
                doSelect(ureq, row, entry -> entry.getManualScore() != null);
            } else if ("notCorrected".equals(cmd)) {
                doSelect(ureq, row, entry -> row.isManualCorrection() && entry.getManualScore() == null);
            } else if ("toReview".equals(cmd)) {
                doSelect(ureq, row, AssessmentItemListEntry::isToReview);
            }
        }
    } else if (saveTestsButton == source) {
        doConfirmSaveTests(ureq);
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        if ("tools".equals(link.getCmd())) {
            doOpenTools(ureq, (CorrectionAssessmentItemRow) link.getUserObject(), link);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Util(org.olat.core.util.Util) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) ItemSessionKey(org.olat.ims.qti21.ui.assessment.model.ItemSessionKey) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) AssessmentItemCorrection(org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection) OLATResourceable(org.olat.core.id.OLATResourceable) BigDecimal(java.math.BigDecimal) OresHelper(org.olat.core.util.resource.OresHelper) Map(java.util.Map) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) QuestionTypeFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.QuestionTypeFlexiCellRenderer) QTI21Module(org.olat.ims.qti21.QTI21Module) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ManifestMetadataBuilder(org.olat.ims.qti21.model.xml.ManifestMetadataBuilder) Translator(org.olat.core.gui.translator.Translator) Predicate(java.util.function.Predicate) WindowControl(org.olat.core.gui.control.WindowControl) PopEvent(org.olat.core.gui.components.stack.PopEvent) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) QTI21Service(org.olat.ims.qti21.QTI21Service) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) BasicController(org.olat.core.gui.control.controller.BasicController) CorrectionAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) CorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.CorrectedFlexiCellRenderer) Identity(org.olat.core.id.Identity) AssessmentTestComposerController(org.olat.ims.qti21.ui.editor.AssessmentTestComposerController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) SelectAssessmentItemEvent(org.olat.ims.qti21.ui.assessment.event.SelectAssessmentItemEvent) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) ToReviewFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.ToReviewFlexiCellRenderer) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) HashMap(java.util.HashMap) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) ArrayList(java.util.ArrayList) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) CorrectionWorkflow(org.olat.ims.qti21.QTI21Module.CorrectionWorkflow) AssessmentItemListEntry(org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) Link(org.olat.core.gui.components.link.Link) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) CompleteAssessmentTestSessionEvent(org.olat.modules.assessment.ui.event.CompleteAssessmentTestSessionEvent) ItemCols(org.olat.ims.qti21.ui.assessment.CorrectionAssessmentItemTableModel.ItemCols) AutoCorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.AutoCorrectedFlexiCellRenderer) Controller(org.olat.core.gui.control.Controller) UserManager(org.olat.user.UserManager) NotCorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.NotCorrectedFlexiCellRenderer) LockResult(org.olat.core.util.coordinate.LockResult) UserRequest(org.olat.core.gui.UserRequest) CoordinatorManager(org.olat.core.util.coordinate.CoordinatorManager) CorrectionAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow) AssessmentItemListEntry(org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 4 with FormEvent

use of org.olat.core.gui.components.form.flexible.impl.FormEvent in project OpenOLAT by OpenOLAT.

the class RichTextElementImpl method evalFormRequest.

/**
 * @see org.olat.core.gui.components.form.flexible.FormItemImpl#evalFormRequest(org.olat.core.gui.UserRequest)
 */
@Override
public void evalFormRequest(UserRequest ureq) {
    String paramId = component.getFormDispatchId();
    String cmd = getRootForm().getRequestParameter("cmd");
    String submitValue = getRootForm().getRequestParameter(paramId);
    if (StringHelper.containsNonWhitespace(submitValue)) {
        if (renderingMode == TextMode.oneLine) {
            submitValue = TextMode.fromOneLine(submitValue);
        } else if (renderingMode == TextMode.multiLine) {
            submitValue = TextMode.fromMultiLine(submitValue);
        }
    }
    String dispatchUri = getRootForm().getRequestParameter("dispatchuri");
    if ("saveinlinedtiny".equals(cmd)) {
        if (submitValue != null) {
            setValue(submitValue);
            getRootForm().fireFormEvent(ureq, new FormEvent(cmd, this, FormEvent.ONCLICK));
        }
    } else if (submitValue != null) {
        setValue(submitValue);
        // don't re-render component, value in GUI already correct
        component.setDirty(false);
    } else if (cmd != null && !cmd.equals("multiline") && !cmd.equals("formatted")) {
        getRootForm().fireFormEvent(ureq, new FormEvent(cmd, this, FormEvent.ONCLICK));
        component.setDirty(false);
    }
    if (paramId.equals(dispatchUri)) {
        if (TextMode.formatted.name().equals(cmd)) {
            component.setCurrentTextMode(TextMode.formatted);
        } else if (TextMode.multiLine.name().equals(cmd)) {
            component.setCurrentTextMode(TextMode.multiLine);
        } else if (TextMode.oneLine.name().equals(cmd)) {
            component.setCurrentTextMode(TextMode.oneLine);
        }
    }
}
Also used : FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent)

Example 5 with FormEvent

use of org.olat.core.gui.components.form.flexible.impl.FormEvent in project OpenOLAT by OpenOLAT.

the class RichTextElementComponent method doDispatchRequest.

@Override
protected void doDispatchRequest(UserRequest ureq) {
    // SPECIAL CASE - normally this method is never overriden. For the rich text
    // element we make an exception since we have the media and link chooser
    // events that must be dispatched by this code.
    String moduleUri = ureq.getModuleURI();
    if (CMD_FILEBROWSER.equals(moduleUri) || CMD_IMAGEBROWSER.equals(moduleUri) || CMD_FLASHPLAYERBROWSER.equals(moduleUri) || CMD_MEDIABROWSER.equals(moduleUri)) {
        // Get currently edited relative file path
        String fileName = getRichTextElementImpl().getEditorConfiguration().getLinkBrowserRelativeFilePath();
        createFileSelectorPopupWindow(ureq, moduleUri, fileName);
        setDirty(false);
    } else {
        String cmd = ureq.getParameter("cmd");
        if (StringHelper.containsNonWhitespace(cmd)) {
            element.getRootForm().fireFormEvent(ureq, new FormEvent(cmd, element, FormEvent.ONCLICK));
        }
        setDirty(false);
    }
}
Also used : FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent)

Aggregations

FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)16 Event (org.olat.core.gui.control.Event)8 FormItem (org.olat.core.gui.components.form.flexible.FormItem)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Predicate (java.util.function.Predicate)2 UserRequest (org.olat.core.gui.UserRequest)2 Component (org.olat.core.gui.components.Component)2 FormItemContainer (org.olat.core.gui.components.form.flexible.FormItemContainer)2 FlexiTableElement (org.olat.core.gui.components.form.flexible.elements.FlexiTableElement)2 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 FlexiTableDataModelFactory (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 Link (org.olat.core.gui.components.link.Link)2