use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class CustomfieldsFormController method formOK.
@Override
protected void formOK(UserRequest ureq) {
// loop over all Element to store values
for (int i = 0; i < customFields.size(); i++) {
TextElement nameTextElement = customFieldNameElementList.get(i);
if (!customFields.get(i).getName().equals(nameTextElement.getValue())) {
customFields.get(i).setName(nameTextElement.getValue());
}
TextElement valueTextElement = customFieldValueElementList.get(i);
if (!customFields.get(i).getValue().equals(valueTextElement.getValue())) {
customFields.get(i).setValue(valueTextElement.getValue());
}
MultipleSelectionElement tableViewElement = customFieldTableFlagElementList.get(i);
if (customFields.get(i).isTableViewEnabled() != tableViewElement.isSelected(0)) {
customFields.get(i).setTableViewEnabled(tableViewElement.isSelected(0));
}
}
config.setCustomFields(customFields);
fireEvent(ureq, Event.DONE_EVENT);
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class InvitationEditRightsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_pf_invitation_form");
FormLayoutContainer inviteeCont = FormLayoutContainer.createDefaultFormLayout("inviteeInfos", getTranslator());
inviteeCont.setRootForm(mainForm);
formLayout.add("inviteeInfos", inviteeCont);
firstNameEl = uifactory.addTextElement("firstName", "firstName", 64, invitation.getFirstName(), inviteeCont);
firstNameEl.setElementCssClass("o_sel_pf_invitation_firstname");
firstNameEl.setMandatory(true);
lastNameEl = uifactory.addTextElement("lastName", "lastName", 64, invitation.getLastName(), inviteeCont);
lastNameEl.setElementCssClass("o_sel_pf_invitation_lastname");
lastNameEl.setMandatory(true);
String invitationEmail = email != null ? email : invitation.getMail();
mailEl = uifactory.addTextElement("mail", "mail", 128, invitationEmail, inviteeCont);
mailEl.setElementCssClass("o_sel_pf_invitation_mail");
mailEl.setMandatory(true);
mailEl.setNotEmptyCheck("map.share.empty.warn");
mailEl.setEnabled(invitation.getKey() == null);
if (StringHelper.containsNonWhitespace(invitation.getMail()) && MailHelper.isValidEmailAddress(invitation.getMail())) {
SecurityGroup allUsers = securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
List<Identity> shareWithIdentities = userManager.findIdentitiesByEmail(Collections.singletonList(invitation.getMail()));
if (isAtLeastOneInSecurityGroup(shareWithIdentities, allUsers)) {
mailEl.setErrorKey("map.share.with.mail.error.olatUser", new String[] { invitation.getMail() });
}
}
String link = getInvitationLink();
StaticTextElement linkEl = uifactory.addStaticTextElement("invitation.link", link, inviteeCont);
linkEl.setElementCssClass("o_sel_pf_invitation_url");
linkEl.setLabel("invitation.link", null);
if (mailTemplate != null) {
subjectEl = uifactory.addTextElement("subjectElem", "mail.subject", 128, mailTemplate.getSubjectTemplate(), inviteeCont);
subjectEl.setDisplaySize(60);
subjectEl.setMandatory(true);
bodyEl = uifactory.addTextAreaElement("bodyElem", "mail.body", -1, 15, 60, true, mailTemplate.getBodyTemplate(), inviteeCont);
bodyEl.setHelpUrlForManualPage("E-Mail");
bodyEl.setMandatory(true);
}
// binder
MultipleSelectionElement accessEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
accessEl.addActionListener(FormEvent.ONCHANGE);
binderRow = new BinderAccessRightsRow(accessEl, binder);
// sections
List<Section> sections = portfolioService.getSections(binder);
Map<Long, SectionAccessRightsRow> sectionMap = new HashMap<>();
for (Section section : sections) {
MultipleSelectionElement sectionAccessEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
sectionAccessEl.addActionListener(FormEvent.ONCHANGE);
SectionAccessRightsRow sectionRow = new SectionAccessRightsRow(sectionAccessEl, section, binderRow);
binderRow.getSections().add(sectionRow);
sectionMap.put(section.getKey(), sectionRow);
}
// pages
List<Page> pages = portfolioService.getPages(binder, null);
for (Page page : pages) {
Section section = page.getSection();
SectionAccessRightsRow sectionRow = sectionMap.get(section.getKey());
MultipleSelectionElement pageAccessEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
pageAccessEl.addActionListener(FormEvent.ONCHANGE);
PortfolioElementAccessRightsRow pageRow = new PortfolioElementAccessRightsRow(pageAccessEl, page, sectionRow);
sectionRow.getPages().add(pageRow);
}
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("binderRow", binderRow);
}
selectAll = uifactory.addFormLink("form.checkall", "form.checkall", null, formLayout, Link.LINK);
selectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_on");
deselectAll = uifactory.addFormLink("form.uncheckall", "form.uncheckall", null, formLayout, Link.LINK);
deselectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_off");
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
buttonsCont.setRootForm(mainForm);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
if (invitation.getKey() != null) {
removeLink = uifactory.addFormLink("remove", buttonsCont, Link.BUTTON);
}
uifactory.addFormSubmitButton("save", buttonsCont);
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class MultiSPController method initTreeRec.
private MultipleSelectionElement initTreeRec(int level, VFSItem item, FormLayoutContainer layoutcont) {
SelectNodeObject node = new SelectNodeObject(item, UUID.randomUUID().toString(), level);
String[] singleKey = new String[] { node.getId() };
String[] singleValue = new String[] { node.getName() };
String[] iconCSS = new String[] { "o_icon o_icon-fw " + node.getIconCssClass() };
MultipleSelectionElement nodeSelection = uifactory.addCheckboxesVertical("print.node.list." + nodeSelections.size(), layoutcont, singleKey, singleValue, iconCSS, 1);
nodeSelection.setLabel("multi.sps.file", null);
nodeSelection.setUserObject(node);
nodeSelection.addActionListener(FormEvent.ONCLICK);
nodeSelections.add(nodeSelection);
identToSelectionMap.put(node.getId(), nodeSelection);
layoutcont.add(nodeSelection.getComponent().getComponentName(), nodeSelection);
if (item instanceof VFSContainer) {
VFSContainer container = (VFSContainer) item;
for (VFSItem subItem : container.getItems(new MultiSPVFSItemFilter())) {
MultipleSelectionElement sel = initTreeRec(level + 1, subItem, layoutcont);
node.getChildren().add(sel);
}
}
return nodeSelection;
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class MultiSPController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (nodeSelections.contains(source)) {
MultipleSelectionElement nodeSelection = (MultipleSelectionElement) source;
if (nodeSelection.isMultiselect()) {
selectRec(nodeSelection, nodeSelection.isSelected(0));
}
} else if (source == selectAll) {
for (MultipleSelectionElement nodeSelection : nodeSelections) {
if (nodeSelection.isMultiselect() && !nodeSelection.isSelected(0)) {
SelectNodeObject treeNode = (SelectNodeObject) nodeSelection.getUserObject();
String id = treeNode.getId();
nodeSelection.select(id, true);
}
}
} else if (source == deselectAll) {
for (MultipleSelectionElement nodeSelection : nodeSelections) {
if (nodeSelection.isMultiselect() && nodeSelection.isSelected(0)) {
SelectNodeObject treeNode = (SelectNodeObject) nodeSelection.getUserObject();
String id = treeNode.getId();
nodeSelection.select(id, false);
}
}
} else if (source == asChild) {
position = -1;
ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
create(rootSelection, course, selectedNode.getCourseNode());
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (source == sameLevel) {
ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
CourseEditorTreeNode parentNode = (CourseEditorTreeNode) selectedNode.getParent();
position = 0;
for (position = parentNode.getChildCount(); position-- > 0; ) {
if (selectedNode.getIdent().equals(parentNode.getChildAt(position).getIdent())) {
position++;
break;
}
}
create(rootSelection, course, parentNode.getCourseNode());
fireEvent(ureq, Event.CHANGED_EVENT);
} else {
super.formInnerEvent(ureq, source, event);
}
}
Aggregations