use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.
the class VCEditForm method addRow.
private void addRow(int index, final MeetingDate date) {
// title
TextElement vcTitle = uifactory.addTextElement("title" + counter, null, -1, date.getTitle(), editVC);
vcTitle.setDisplaySize(30);
vcTitle.setMandatory(true);
vcTitle.setNotEmptyCheck("vc.table.title.empty");
vcTitleInputList.add(index, vcTitle);
// description
TextElement vcDescription = uifactory.addTextElement("description" + counter, null, -1, date.getDescription(), editVC);
vcDescription.setDisplaySize(20);
vcDescription.setNotEmptyCheck("vc.table.description.empty");
vcDescription.setMandatory(true);
vcDescriptionInputList.add(index, vcDescription);
// begin
DateChooser vcScheduleDate = uifactory.addDateChooser("begin" + counter, "vc.table.begin", null, editVC);
vcScheduleDate.setNotEmptyCheck("vc.table.begin.empty");
vcScheduleDate.setValidDateCheck("vc.table.begin.error");
vcScheduleDate.setMandatory(true);
vcScheduleDate.setDisplaySize(20);
vcScheduleDate.setDateChooserTimeEnabled(true);
vcScheduleDate.setDate(date.getBegin());
vcCalenderbeginInputList.add(index, vcScheduleDate);
// add date duration
SimpleDateFormat sdDuration = new SimpleDateFormat("HH:mm");
TimeZone tz = TimeZone.getTimeZone("Etc/GMT+0");
sdDuration.setTimeZone(tz);
TextElement vcDuration = uifactory.addTextElement("duration" + counter, "vc.table.duration", 5, String.valueOf(0), editVC);
vcDuration.setDisplaySize(5);
vcDuration.setValue(sdDuration.format(new Date(date.getEnd().getTime() - date.getBegin().getTime())));
vcDuration.setRegexMatchCheck("\\d{1,2}:\\d\\d", "form.error.format");
vcDuration.setExampleKey("vc.table.duration.example", null);
vcDuration.setNotEmptyCheck("vc.table.duration.empty");
vcDuration.setErrorKey("vc.table.duration.error", null);
vcDuration.setMandatory(true);
vcDuration.showExample(true);
vcDuration.showError(false);
this.vcDurationInputList.add(index, vcDuration);
// add row button
FormLink addButton = new FormLinkImpl("add" + counter, "add" + counter, "vc.table.add", Link.BUTTON_SMALL);
editVC.add(addButton);
vcAddButtonList.add(index, addButton);
// remove row button
FormLink delButton = new FormLinkImpl("delete" + counter, "delete" + counter, "vc.table.delete", Link.BUTTON_SMALL);
editVC.add(delButton);
vcDelButtonList.add(index, delButton);
// increase the counter to enable unique component names
counter++;
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.
the class ChecklistEditCheckpointsController method initForm.
@Override
protected void initForm(FormItemContainer fic, Controller controller, UserRequest ureq) {
if (titleContainer != null)
fic.remove(titleContainer);
if (buttonContainer != null)
fic.remove(buttonContainer);
titleContainer = FormLayoutContainer.createCustomFormLayout("titleLayout", getTranslator(), velocity_root + "/edit.html");
fic.add(titleContainer);
// create gui elements for all checkpoints
loadCheckpointInVC();
addButton = new FormLinkImpl("add" + counter, "add" + counter, "cl.table.add", Link.BUTTON_SMALL);
addButton.setUserObject(checklist.getCheckpointsSorted(checkpointComparator).get(checklist.getCheckpoints().size() - 1));
titleContainer.add(addButton);
titleContainer.contextPut("checkpoints", checkpointsInVc);
titleContainer.contextPut("titleInputList", titleInputList);
titleContainer.contextPut("descriptionInputList", descriptionInputList);
titleContainer.contextPut("modeInputList", modeInputList);
titleContainer.contextPut("addButton", addButton);
titleContainer.contextPut("delButtonList", delButtonList);
buttonContainer = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
fic.add(buttonContainer);
uifactory.addFormCancelButton("cancel", buttonContainer, ureq, getWindowControl());
uifactory.addFormSubmitButton("subm", submitKey, buttonContainer);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.
the class ChecklistEditCheckpointsController method addNewFormCheckpoint.
private void addNewFormCheckpoint(int index, Checkpoint checkpoint) {
// add checkpoint title
String pointTitle = checkpoint.getTitle() == null ? "" : checkpoint.getTitle();
TextElement title = uifactory.addTextElement("title" + counter, null, -1, pointTitle, titleContainer);
// TODO:SK:2009-11-20:PB:should be default -> check layout in velocity.
title.showError(false);
title.setDisplaySize(20);
title.setMandatory(true);
// TODO:Stefan Köber: please verify that the default not empty check does the same as you ItemValidatorProvider
title.setNotEmptyCheck("cl.table.title.error");
title.setUserObject(checkpoint);
titleInputList.add(index, title);
// add checkpoint description
TextElement description = uifactory.addTextElement("description" + counter, null, -1, checkpoint.getDescription(), titleContainer);
description.setDisplaySize(35);
description.setMandatory(false);
description.setUserObject(checkpoint);
descriptionInputList.add(index, description);
// add link comment
String[] keys = CheckpointMode.getModes();
String[] values = new String[keys.length];
for (int i = 0; i < keys.length; i++) {
values[i] = translate(keys[i]);
}
SingleSelection mode = uifactory.addDropdownSingleselect("modus" + counter, "form.enableCancelEnroll", titleContainer, keys, values, null);
mode.select(checkpoint.getMode(), checkpoint.getMode() != null);
mode.setUserObject(checkpoint);
modeInputList.add(index, mode);
// add link deletion action button
FormLink delButton = new FormLinkImpl("delete" + counter, "delete" + counter, "cl.table.delete", Link.BUTTON_SMALL);
delButton.setUserObject(checkpoint);
titleContainer.add(delButton);
delButtonList.add(index, delButton);
// increase the counter to enable unique component names
counter++;
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.
the class FlexiTableElementImpl method setExportEnabled.
@Override
public void setExportEnabled(boolean enabled) {
this.exportEnabled = enabled;
if (exportEnabled) {
exportButton = null;
String dispatchId = component.getDispatchID();
exportButton = new FormLinkImpl(dispatchId + "_exportButton", "rExportButton", "", Link.BUTTON | Link.NONTRANSLATED);
exportButton.setTranslator(translator);
exportButton.setIconLeftCSS("o_icon o_icon_download");
components.put("rExport", exportButton);
rootFormAvailable(exportButton);
} else {
exportButton = null;
}
}
use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.
the class FlexiTableElementImpl method setSearchEnabled.
@Override
public void setSearchEnabled(ListProvider autoCompleteProvider, UserSession usess) {
searchEnabled = true;
String dispatchId = component.getDispatchID();
searchFieldEl = new AutoCompleterImpl(dispatchId + "_searchField", "search");
searchFieldEl.showLabel(false);
searchFieldEl.getComponent().addListener(this);
((AutoCompleterImpl) searchFieldEl).setListProvider(autoCompleteProvider, usess);
components.put("rSearch", searchFieldEl);
searchButton = new FormLinkImpl(dispatchId + "_searchButton", "rSearchButton", "search", Link.BUTTON);
searchButton.setTranslator(translator);
searchButton.setIconLeftCSS("o_icon o_icon_search");
components.put("rSearchB", searchButton);
rootFormAvailable(searchFieldEl);
rootFormAvailable(searchButton);
}
Aggregations