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