use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class MetadataBulkChangeController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (checkboxSwitch.contains(source)) {
MultipleSelectionElement checkbox = (MultipleSelectionElement) source;
FormItem item = (FormItem) checkbox.getUserObject();
item.setVisible(checkbox.isAtLeastSelected(1));
checkboxContainer.get(checkbox).setDirty(true);
} else if (licenseEl == source) {
updateLicenseVisibility();
licenseWrapperCont.setDirty(true);
} else {
super.formInnerEvent(ureq, source, event);
}
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class MetadataBulkChangeController method decorate.
private FormItem decorate(FormItem item, FormLayoutContainer formLayout) {
String itemName = item.getName();
MultipleSelectionElement checkbox = uifactory.addCheckboxesHorizontal("cbx_" + itemName, itemName, formLayout, new String[] { itemName }, EMPTY_VALUES);
checkbox.select(itemName, false);
checkbox.addActionListener(FormEvent.ONCLICK);
checkbox.setUserObject(item);
checkboxSwitch.add(checkbox);
item.setLabel(null, null);
item.setVisible(false);
item.setUserObject(checkbox);
checkboxContainer.put(checkbox, formLayout);
formLayout.moveBefore(checkbox, item);
return checkbox;
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class ViteroAdminBookingRawInfosController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
uifactory.addStaticTextElement("booking.id", Integer.toString(booking.getBookingId()), formLayout);
uifactory.addStaticTextElement("booking.begin", formatter.formatDateAndTime(booking.getStart()), formLayout);
uifactory.addStaticTextElement("booking.end", formatter.formatDateAndTime(booking.getEnd()), formLayout);
uifactory.addStaticTextElement("booking.beginBuffer", Integer.toString(booking.getStartBuffer()), formLayout);
uifactory.addStaticTextElement("booking.endBuffer", Integer.toString(booking.getEndBuffer()), formLayout);
uifactory.addStaticTextElement("booking.roomSize", Integer.toString(booking.getRoomSize()), formLayout);
uifactory.addStaticTextElement("group.numOfParticipants", Integer.toString(group.getNumOfParticipants()), formLayout);
uifactory.addStaticTextElement("group.id", Integer.toString(group.getGroupId()), formLayout);
String name = group.getName();
int sepIndex = name.indexOf("_OLAT_");
if (sepIndex > 0) {
name = name.substring(0, sepIndex);
}
uifactory.addStaticTextElement("group.name", name, formLayout);
MultipleSelectionElement autoSignIn = uifactory.addCheckboxesHorizontal("booking.autoSignIn", formLayout, autoSignInKeys, autoSignInValues);
if (booking.isAutoSignIn()) {
autoSignIn.select(autoSignInKeys[0], true);
}
autoSignIn.setEnabled(false);
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class HomePageSettingsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
boolean firstGroup = true;
List<UserPropertyHandler> homepagePropertyHanders = userManager.getUserPropertyHandlersFor(HomePageConfig.class.getCanonicalName(), isAdministrativeUser);
Map<String, FormLayoutContainer> groupContainerMap = new HashMap<>();
HomePageConfig conf = hpcm.loadConfigFor(identityToModify.getName());
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null) {
continue;
}
// add spacer if necessary (i.e. when group name changes)
String group = userPropertyHandler.getGroup();
FormLayoutContainer groupContainer;
if (groupContainerMap.containsKey(group)) {
groupContainer = groupContainerMap.get(group);
} else {
groupContainer = FormLayoutContainer.createDefaultFormLayout("group." + group, getTranslator());
groupContainer.setFormTitle(translate("form.group." + group));
formLayout.add(groupContainer);
groupContainerMap.put(group, groupContainer);
if (firstGroup) {
groupContainer.setFormContextHelp("Configuration");
firstGroup = false;
}
}
if (homepagePropertyHanders.contains(userPropertyHandler)) {
// add checkbox to container if configured for homepage usage identifier
String checkboxName = userPropertyHandler.getName();
MultipleSelectionElement publishCheckbox = uifactory.addCheckboxesHorizontal(checkboxName, userPropertyHandler.i18nFormElementLabelKey(), groupContainer, checkKeys, checkValues);
boolean isEnabled = conf.isEnabled(userPropertyHandler.getName());
publishCheckbox.select(checkKeys[0], isEnabled);
publishCheckbox.setUserObject(userPropertyHandler.getName());
// Mandatory homepage properties can not be changed by user
if (userManager.isMandatoryUserProperty(HomePageConfig.class.getCanonicalName(), userPropertyHandler)) {
publishCheckbox.select(checkKeys[0], true);
publishCheckbox.setEnabled(false);
} else {
publishCheckbox.addActionListener(FormEvent.ONCHANGE);
}
}
}
String previewPage = velocity_root + "/homepage_preview.html";
previewContainer = FormLayoutContainer.createCustomFormLayout("preview", getTranslator(), previewPage);
previewContainer.setFormTitle(translate("tab.preview"));
previewContainer.setRootForm(mainForm);
formLayout.add(previewContainer);
updatePreview(ureq);
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class GenericSelectionPropertyHandler method getStringValue.
@Override
public String getStringValue(FormItem formItem) {
if (isMultiselect) {
Collection<String> selectedKeys = ((MultipleSelectionElement) formItem).getSelectedKeys();
StringBuilder sb = new StringBuilder();
for (String sKey : selectedKeys) {
sb.append(sKey).append(KEY_DELIMITER);
}
return sb.toString();
}
if (formItem instanceof SingleSelection) {
SingleSelection sel = (SingleSelection) formItem;
if (sel.isOneSelected()) {
return sel.getSelectedKey();
} else {
return null;
}
}
return null;
}
Aggregations