use of org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit in project openolat by klemens.
the class ChoiceController method initForm.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
* org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
*/
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (singleSelection && layoutVertical) {
entrySelector = uifactory.addRadiosVertical(selectionName, null, formLayout, keysIn, translatedKeys);
} else if (singleSelection && !layoutVertical) {
entrySelector = uifactory.addRadiosHorizontal(selectionName, null, formLayout, keysIn, translatedKeys);
} else if (!singleSelection && layoutVertical) {
entrySelector = uifactory.addCheckboxesVertical(selectionName, null, formLayout, keysIn, translatedKeys, 1);
} else if (!singleSelection && !layoutVertical) {
entrySelector = uifactory.addCheckboxesHorizontal(selectionName, null, formLayout, keysIn, translatedKeys);
}
// add Submit
Submit subm = new FormSubmit("subm", submitI18nKey);
formLayout.add(subm);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit in project openolat by klemens.
the class AssessedIdentityCheckListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
List<DBCheck> checks = checkboxManager.loadCheck(assessedIdentity, courseOres, courseNode.getIdent());
Map<String, DBCheck> uuidToCheckMap = new HashMap<>();
for (DBCheck check : checks) {
uuidToCheckMap.put(check.getCheckbox().getCheckboxId(), check);
}
List<Checkbox> list = checkboxList.getList();
wrappers = new ArrayList<>(list.size());
for (Checkbox checkbox : list) {
DBCheck check = uuidToCheckMap.get(checkbox.getCheckboxId());
boolean readOnly = false;
CheckboxWrapper wrapper = forgeCheckboxWrapper(checkbox, check, readOnly, formLayout);
wrappers.add(wrapper);
}
layoutCont.contextPut("checkboxList", wrappers);
}
FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonCont);
FormSubmit saveButton = uifactory.addFormSubmitButton("save", "save", buttonCont);
saveButton.setEnabled(checkboxList.getNumOfCheckbox() > 0);
saveButton.setVisible(!coachCourseEnv.isCourseReadOnly());
saveAndCloseLink = uifactory.addFormLink("save.close", buttonCont, Link.BUTTON);
saveAndCloseLink.setEnabled(checkboxList.getNumOfCheckbox() > 0);
saveAndCloseLink.setVisible(saveAndClose && !coachCourseEnv.isCourseReadOnly());
if (cancel) {
uifactory.addFormCancelButton("cancel", buttonCont, ureq, getWindowControl());
}
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit in project openolat by klemens.
the class GuiDemoFlexiForm method initForm.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
* org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
*/
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
/*
* create a form with a title and 4 input fields to enter some persons data
*/
setFormTitle("guidemo_flexi_form_simpleform");
final int defaultDisplaySize = 32;
final boolean inputMode = !personData.isReadOnly();
firstName = uifactory.addTextElement("firstname", "guidemo.flexi.form.firstname", 256, personData.getFirstName(), formLayout);
firstName.setDisplaySize(defaultDisplaySize);
firstName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
firstName.setMandatory(true);
firstName.setEnabled(inputMode);
firstName.setPlaceholderText("Hans");
firstName.setHelpText("If you have a middle name, add it to the first name input field");
firstName.setHelpUrlForManualPage("Configuration#Profile");
lastName = uifactory.addTextElement("lastname", "guidemo.flexi.form.lastname", 256, personData.getLastName(), formLayout);
lastName.setDisplaySize(defaultDisplaySize);
lastName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
lastName.setEnabled(inputMode);
lastName.setPlaceholderText("Muster");
lastName.setHelpUrl("https://en.wikipedia.org/wiki/Family_name");
fileElement = uifactory.addFileElement(getWindowControl(), "file", formLayout);
fileElement.setLabel("guidemo.flexi.form.file", null);
fileElement.setMaxUploadSizeKB(500, "guidemo.flexi.form.filetobig", null);
Set<String> mimeTypes = new HashSet<String>();
mimeTypes.add("image/*");
fileElement.limitToMimeType(mimeTypes, "guidemo.flexi.form.wrongfiletype", null);
fileElement.setMandatory(true, "guidemo.flexi.form.mustbefilled");
fileElement.setEnabled(inputMode);
institution = uifactory.addTextElement("institution", "guidemo.flexi.form.institution", 256, personData.getInstitution(), formLayout);
institution.setDisplaySize(defaultDisplaySize);
institution.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
institution.setMandatory(true);
institution.setEnabled(inputMode);
institution.setHelpTextKey("guidemo.flexi.form.institution.help", null);
if (inputMode) {
// submit only if in input mode
submit = new FormSubmit("submit", "submit");
formLayout.add(submit);
}
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit in project openolat by klemens.
the class GuiDemoFlexiFormCustomlayout method initForm.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
*/
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
/*
* create a form with a title and 4 input fields to enter some persons data
*/
setFormTitle("guidemo_flexi_form_customlayout");
final boolean inputMode = !personData.isReadOnly();
firstName = uifactory.addTextElement("firstname", "guidemo.flexi.form.firstname", 256, personData.getFirstName(), formLayout);
firstName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
firstName.setMandatory(true);
firstName.setEnabled(inputMode);
lastName = uifactory.addTextElement("lastname", "guidemo.flexi.form.lastname", 256, personData.getLastName(), formLayout);
lastName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
lastName.setMandatory(true);
lastName.setEnabled(inputMode);
institution = uifactory.addTextElement("institution", "guidemo.flexi.form.institution", 256, personData.getInstitution(), formLayout);
institution.setEnabled(inputMode);
if (inputMode) {
// submit only if in input mode
submit = new FormSubmit("submit", "submit");
formLayout.add(submit);
}
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit in project openolat by klemens.
the class GuiDemoFlexiFormHideUnhide method initForm.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
*/
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("guidemo_flexi_form_hideunhide");
final boolean inputMode = !personData.isReadOnly();
/*
* hide unhide chooser
*/
checkbox = uifactory.addCheckboxesVertical("checkbox", "guidemo.flexi.form.show", formLayout, new String[] { "ison" }, new String[] { "" }, 1);
checkbox.select("ison", true);
// register for on click event to hide/disable other elements
checkbox.addActionListener(FormEvent.ONCLICK);
// rule to hide/unhide is defined at the end
firstName = uifactory.addTextElement("firstname", "guidemo.flexi.form.firstname", 256, personData.getFirstName(), formLayout);
firstName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
firstName.setMandatory(true);
firstName.setEnabled(inputMode);
lastName = uifactory.addTextElement("firstname", "guidemo.flexi.form.lastname", 256, personData.getLastName(), formLayout);
lastName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
lastName.setMandatory(true);
lastName.setEnabled(inputMode);
institution = uifactory.addTextElement("institution", "guidemo.flexi.form.institution", 256, personData.getInstitution(), formLayout);
institution.setEnabled(inputMode);
if (inputMode) {
// submit only if in input mode
submit = new FormSubmit("submit", "submit");
formLayout.add(submit);
}
/*
* now the rules to hide unhide
*/
Set<FormItem> targets = new HashSet<FormItem>();
targets.add(firstName);
targets.add(lastName);
targets.add(institution);
targets.add(submit);
RulesFactory.createHideRule(checkbox, null, targets, formLayout);
RulesFactory.createShowRule(checkbox, "ison", targets, formLayout);
}
Aggregations