use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class GTARevisionAndCorrectionEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// configuration
FormLayoutContainer configCont = FormLayoutContainer.createDefaultFormLayout("config", getTranslator());
configCont.setRootForm(mainForm);
configCont.setFormTitle(translate("editor.revisions.title"));
configCont.setFormContextHelp("Assessment#_task_abgabe");
formLayout.add(configCont);
maxNumberOfDocsEl = uifactory.addTextElement("max.documents", "max.documents", 5, "", configCont);
updateDefaultMaximumNumberOfDocuments();
// save
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsCont.setRootForm(mainForm);
configCont.add(buttonsCont);
uifactory.addFormSubmitButton("save", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class NewDocumentController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_course_gta_new_doc_form");
filenameEl = uifactory.addTextElement("fileName", "file.name", -1, "", formLayout);
filenameEl.setElementCssClass("o_sel_course_gta_doc_filename");
filenameEl.setExampleKey("file.name.example", null);
filenameEl.setDisplaySize(20);
filenameEl.setMandatory(true);
FormLayoutContainer formButtons = FormLayoutContainer.createButtonLayout("formButton", getTranslator());
formLayout.add(formButtons);
uifactory.addFormSubmitButton("submit", "create", formButtons);
uifactory.addFormCancelButton("cancel", formButtons, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class PFFileUploadController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
uploadFileEl = uifactory.addFileElement(getWindowControl(), "upload", "textfield.upload", formLayout);
uploadFileEl.addActionListener(FormEvent.ONCHANGE);
typeEl = uifactory.addStaticTextElement("video.mime.type", "video.mime.type", "", formLayout);
typeEl.setVisible(false);
FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonGroupLayout);
uifactory.addFormSubmitButton("submit", "upload.link", buttonGroupLayout);
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class FIBNumericalEntrySettingsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_gap_numeric_form");
Double solution = interaction.getSolution();
String solString = solution == null ? "" : solution.toString();
solutionEl = uifactory.addTextElement("fib.solution", "fib.solution", 256, solString, formLayout);
solutionEl.setElementCssClass("o_sel_gap_numeric_solution");
solutionEl.setEnabled(!restrictedEdit && !readOnly);
if (!restrictedEdit && !readOnly && !StringHelper.containsNonWhitespace(solString)) {
solutionEl.setFocus(true);
}
String placeholder = interaction.getPlaceholder();
placeholderEl = uifactory.addTextElement("fib.placeholder", "fib.placeholder", 256, placeholder, formLayout);
placeholderEl.setElementCssClass("o_sel_gap_numeric_placeholder");
placeholderEl.setEnabled(!restrictedEdit && !readOnly);
Integer expectedLength = interaction.getExpectedLength();
String expectedLengthStr = expectedLength == null ? null : expectedLength.toString();
expectedLengthEl = uifactory.addTextElement("fib.expectedLength", "fib.expectedLength", 256, expectedLengthStr, formLayout);
expectedLengthEl.setEnabled(!restrictedEdit && !readOnly);
String[] toleranceModeValues = new String[] { translate("fib.tolerance.mode.exact"), translate("fib.tolerance.mode.absolute"), translate("fib.tolerance.mode.relative") };
toleranceModeEl = uifactory.addDropdownSingleselect("fib.tolerance.mode", "fib.tolerance.mode", formLayout, toleranceModeKeys, toleranceModeValues, null);
toleranceModeEl.setEnabled(!restrictedEdit && !readOnly);
toleranceModeEl.setHelpText(getToleranceHelp());
toleranceModeEl.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#details_testeditor_fragetypen_ni");
if (interaction.getToleranceMode() != null) {
for (String toleranceModeKey : toleranceModeKeys) {
if (toleranceModeKey.equals(interaction.getToleranceMode().name())) {
toleranceModeEl.select(toleranceModeKey, true);
}
}
}
if (!toleranceModeEl.isOneSelected()) {
toleranceModeEl.select(toleranceModeKeys[0], true);
}
toleranceModeEl.addActionListener(FormEvent.ONCHANGE);
Double lowerTolerance = interaction.getLowerTolerance();
String lowerToleranceString;
if (interaction.getToleranceMode() == ToleranceMode.ABSOLUTE) {
if (lowerTolerance == null) {
lowerToleranceString = "";
} else if (solution != null) {
BigDecimal solBig = BigDecimal.valueOf(solution);
BigDecimal lowerToleranceBig = BigDecimal.valueOf(lowerTolerance);
lowerToleranceString = solBig.subtract(lowerToleranceBig).toString();
} else {
lowerToleranceString = lowerTolerance.toString();
}
} else {
lowerToleranceString = lowerTolerance == null ? "" : lowerTolerance.toString();
}
lowerToleranceEl = uifactory.addTextElement("fib.tolerance.low", "fib.tolerance.low", 8, lowerToleranceString, formLayout);
lowerToleranceEl.setExampleKey("fib.tolerance.mode.absolute.example", null);
lowerToleranceEl.setElementCssClass("o_sel_gap_numeric_lower_bound");
lowerToleranceEl.setEnabled(!restrictedEdit && !readOnly);
Double upperTolerance = interaction.getUpperTolerance();
String upperToleranceString;
if (interaction.getToleranceMode() == ToleranceMode.ABSOLUTE) {
if (upperTolerance == null) {
upperToleranceString = "";
} else if (solution != null) {
BigDecimal solBig = BigDecimal.valueOf(solution);
BigDecimal upperToleranceBig = BigDecimal.valueOf(upperTolerance);
upperToleranceString = solBig.add(upperToleranceBig).toString();
} else {
upperToleranceString = upperTolerance.toString();
}
} else {
upperToleranceString = upperTolerance == null ? "" : upperTolerance.toString();
}
upperToleranceEl = uifactory.addTextElement("fib.tolerance.up", "fib.tolerance.up", 8, upperToleranceString, formLayout);
upperToleranceEl.setExampleKey("fib.tolerance.mode.absolute.example", null);
upperToleranceEl.setElementCssClass("o_sel_gap_numeric_upper_bound");
upperToleranceEl.setEnabled(!restrictedEdit && !readOnly);
updateToleranceUpAndLow();
// Submit Button
FormLayoutContainer buttonsContainer = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsContainer.setRootForm(mainForm);
formLayout.add(buttonsContainer);
uifactory.addFormCancelButton("cancel", buttonsContainer, ureq, getWindowControl());
if (!restrictedEdit && !readOnly) {
uifactory.addFormSubmitButton("submit", buttonsContainer);
}
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class FIBTextEntrySettingsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_gap_entry_form");
String solution = interaction.getSolution();
solutionEl = uifactory.addTextElement("fib.solution", "fib.solution", 256, solution, formLayout);
solutionEl.setElementCssClass("o_sel_gap_entry_solution");
solutionEl.setEnabled(!restrictedEdit && !readOnly);
if (!StringHelper.containsNonWhitespace(solution)) {
solutionEl.setFocus(true);
}
String placeholder = interaction.getPlaceholder();
placeholderEl = uifactory.addTextElement("fib.placeholder", "fib.placeholder", 256, placeholder, formLayout);
placeholderEl.setElementCssClass("o_sel_gap_entry_placeholder");
placeholderEl.setEnabled(!restrictedEdit && !readOnly);
String alternativesPage = velocity_root + "/fib_alternatives.html";
alternativesCont = FormLayoutContainer.createCustomFormLayout("alternatives.list", getTranslator(), alternativesPage);
alternativesCont.setRootForm(mainForm);
formLayout.add(alternativesCont);
alternativesCont.setLabel("fib.alternative", null);
alternativesCont.setHelpText(translate("fib.alternative.help"));
alternativesCont.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#details_testeditor_fragetypen_fib");
alternativesCont.contextPut("alternatives", alternativeRows);
addFirstAlternative = uifactory.addFormLink("add.first.alternative", "add", "", null, alternativesCont, Link.LINK | Link.NONTRANSLATED);
addFirstAlternative.setIconLeftCSS("o_icon o_icon-lg o_icon_add");
addFirstAlternative.setVisible(!restrictedEdit && !readOnly);
List<TextEntryAlternative> alternatives = interaction.getAlternatives();
if (alternatives != null && alternatives.size() > 0) {
for (TextEntryAlternative alternative : alternatives) {
appendAlternative(alternative, null, false);
}
}
Integer expectedLength = interaction.getExpectedLength();
String expectedLengthStr = expectedLength == null ? null : expectedLength.toString();
expectedLengthEl = uifactory.addTextElement("fib.expectedLength", "fib.expectedLength", 256, expectedLengthStr, formLayout);
expectedLengthEl.setEnabled(!restrictedEdit && !readOnly);
caseSensitiveEl = uifactory.addCheckboxesHorizontal("fib.caseSensitive", "fib.caseSensitive", formLayout, onKeys, new String[] { "" });
caseSensitiveEl.setEnabled(!restrictedEdit && !readOnly);
if (interaction.isCaseSensitive()) {
caseSensitiveEl.select(onKeys[0], true);
}
// Submit Button
FormLayoutContainer buttonsContainer = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsContainer.setRootForm(mainForm);
formLayout.add(buttonsContainer);
uifactory.addFormCancelButton("cancel", buttonsContainer, ureq, getWindowControl());
if (!restrictedEdit && !readOnly) {
uifactory.addFormSubmitButton("submit", buttonsContainer);
}
}
Aggregations