Search in sources :

Example 6 with FormEvent

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

the class FormToggleImpl method dispatchFormRequest.

@Override
public void dispatchFormRequest(UserRequest ureq) {
    toggle();
    getRootForm().fireFormEvent(ureq, new FormEvent(Event.DONE_EVENT, this, FormEvent.ONCLICK));
}
Also used : FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent)

Example 7 with FormEvent

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

the class ResumeController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source.equals(noButton)) {
        savePreferences(ureq, "none");
        fireEvent(ureq, new Event("no"));
    } else if (source.equals(landingButton)) {
        savePreferences(ureq, "none");
        fireEvent(ureq, new Event("landing"));
    }
}
Also used : FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) Event(org.olat.core.gui.control.Event)

Example 8 with FormEvent

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

the class CheckboxEditController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (deleteLink == source) {
        fireEvent(ureq, new Event("delete"));
        if (courseNode != null) {
            ThreadLocalUserActivityLogger.log(CourseLoggingAction.CHECKLIST_CHECKBOX_DELETED, getClass(), LoggingResourceable.wrap(courseNode), LoggingResourceable.wrapNonOlatResource(StringResourceableType.checkbox, checkbox.getCheckboxId(), checkbox.getTitle()));
        }
    } else if (downloadFileLink == source) {
        doDownloadFile(ureq);
    } else if (deleteFileLink == source) {
        deleteFile();
    } else if (awardPointEl == source) {
        pointsEl.setVisible(withScore && awardPointEl.isAtLeastSelected(1));
    } else if (fileEl == source) {
        String filename = fileEl.getUploadFileName();
        downloadFileLink.setI18nKey(filename);
        downloadFileLink.setEnabled(false);
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) Event(org.olat.core.gui.control.Event)

Example 9 with FormEvent

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

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)

Example 10 with FormEvent

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

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)

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