use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class BinderAssessmentController method forgeAssessmentSection.
private void forgeAssessmentSection(AssessmentSectionWrapper row) {
AssessmentSection assessmentSection = row.getAssessmentSection();
Section section = row.getSection();
if (!SectionStatus.isClosed(section)) {
// score
String pointVal = null;
if (assessmentSection != null && assessmentSection.getScore() != null) {
BigDecimal score = assessmentSection.getScore();
pointVal = AssessmentHelper.getRoundedScore(score);
}
TextElement pointEl = uifactory.addTextElement("point" + (++counter), null, 5, pointVal, flc);
pointEl.setDisplaySize(5);
row.setScoreEl(pointEl);
// passed
Boolean passed = assessmentSection == null ? null : assessmentSection.getPassed();
MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + (++counter), null, flc, onKeys, onValues);
if (passed != null && passed.booleanValue()) {
passedEl.select(onKeys[0], passed.booleanValue());
}
row.setPassedEl(passedEl);
}
if (SectionStatus.isClosed(section)) {
FormLink reopenButton = uifactory.addFormLink("reopen" + (++counter), "reopen", "reopen", null, flc, Link.BUTTON);
reopenButton.setElementCssClass("o_sel_pf_reopen_section");
reopenButton.setUserObject(row);
row.setButton(reopenButton);
} else {
FormLink closeButton = uifactory.addFormLink("close" + (++counter), "close", "close.section", null, flc, Link.BUTTON);
closeButton.setElementCssClass("o_sel_pf_close_section");
closeButton.setUserObject(row);
row.setButton(closeButton);
}
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class AccessRightsEditController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (removeLink == source) {
fireEvent(ureq, new AccessRightsEvent(AccessRightsEvent.REMOVE_ALL_RIGHTS));
} else if (selectAll == source) {
binderRow.setCoach();
binderRow.recalculate();
} else if (deselectAll == source) {
binderRow.unsetCoach();
binderRow.unsetReviewer();
for (SectionAccessRightsRow sectionRow : binderRow.getSections()) {
sectionRow.unsetCoach();
sectionRow.unsetReviewer();
for (PortfolioElementAccessRightsRow pageRow : sectionRow.getPages()) {
pageRow.unsetCoach();
pageRow.unsetReviewer();
}
}
} else if (source instanceof MultipleSelectionElement) {
binderRow.recalculate();
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class SingleParticipantCallController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
int numOfChecks = lectureBlock.getPlannedLecturesNumber();
List<Integer> absences = rollCall.getLecturesAbsentList();
for (int i = 0; i < numOfChecks; i++) {
String checkId = "check_" + i;
MultipleSelectionElement check = uifactory.addCheckboxesHorizontal(checkId, null, layoutCont, onKeys, onValues);
check.setDomReplacementWrapperRequired(false);
check.addActionListener(FormEvent.ONCHANGE);
if (absences.contains(i)) {
check.select(onKeys[0], true);
}
checks.add(check);
}
layoutCont.contextPut("checks", checks);
DisplayPortraitController portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), calledIdentity, true, false);
listenTo(portraitCtr);
layoutCont.getFormItemComponent().put("portrait", portraitCtr.getInitialComponent());
UserShortDescription userDescr = new UserShortDescription(ureq, getWindowControl(), calledIdentity);
listenTo(userDescr);
layoutCont.getFormItemComponent().put("userDescr", userDescr.getInitialComponent());
}
if (autorizedAbsenceEnabled) {
authorizedAbsencedEl = uifactory.addCheckboxesHorizontal("authorized.absence", "authorized.absence", formLayout, onKeys, onValues);
authorizedAbsencedEl.setDomReplacementWrapperRequired(false);
authorizedAbsencedEl.addActionListener(FormEvent.ONCHANGE);
if (rollCall.getAbsenceAuthorized() != null && rollCall.getAbsenceAuthorized().booleanValue()) {
authorizedAbsencedEl.select(onKeys[0], true);
}
String reason = rollCall.getAbsenceReason();
absenceReasonEl = uifactory.addTextAreaElement("absence.reason", "authorized.absence.reason", 2000, 4, 36, false, reason, formLayout);
absenceReasonEl.setDomReplacementWrapperRequired(false);
absenceReasonEl.setPlaceholderKey("authorized.absence.reason", null);
absenceReasonEl.setVisible(authorizedAbsencedEl.isAtLeastSelected(1));
absenceReasonEl.setMandatory(!absenceDefaultAuthorized);
}
String comment = rollCall.getComment();
commentEl = uifactory.addTextAreaElement("comment", "rollcall.comment", 2000, 4, 36, false, comment, formLayout);
commentEl.setPlaceholderKey("rollcall.comment", null);
selectAllLink = uifactory.addFormLink("all", formLayout);
uifactory.addFormSubmitButton("save", "save.next", formLayout);
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class CheckListRunController method forgeCheckboxWrapper.
private CheckboxWrapper forgeCheckboxWrapper(Checkbox checkbox, DBCheck check, boolean readOnly, FormItemContainer formLayout) {
String[] values = new String[] { translate(checkbox.getLabel().i18nKey()) };
boolean canCheck = CheckboxReleaseEnum.userAndCoach.equals(checkbox.getRelease());
String boxId = "box_" + checkbox.getCheckboxId();
MultipleSelectionElement el = uifactory.addCheckboxesHorizontal(boxId, null, formLayout, onKeys, values);
el.setEnabled(canCheck && !readOnly && !userCourseEnv.isCourseReadOnly());
el.addActionListener(FormEvent.ONCHANGE);
DownloadLink downloadLink = null;
if (StringHelper.containsNonWhitespace(checkbox.getFilename())) {
VFSContainer container = checkboxManager.getFileContainer(userCourseEnv.getCourseEnvironment(), courseNode);
VFSItem item = container.resolve(checkbox.getFilename());
if (item instanceof VFSLeaf) {
String name = "file_" + checkbox.getCheckboxId();
downloadLink = uifactory.addDownloadLink(name, checkbox.getFilename(), null, (VFSLeaf) item, formLayout);
}
}
CheckboxWrapper wrapper = new CheckboxWrapper(checkbox, downloadLink, el);
el.setUserObject(wrapper);
if (check != null && check.getChecked() != null && check.getChecked().booleanValue()) {
el.select(onKeys[0], true);
wrapper.setDbCheckbox(check.getCheckbox());
wrapper.setScore(check.getScore());
}
if (downloadLink != null) {
downloadLink.setUserObject(wrapper);
}
return wrapper;
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.
the class CheckListRunController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source instanceof MultipleSelectionElement) {
MultipleSelectionElement boxEl = (MultipleSelectionElement) source;
CheckboxWrapper wrapper = (CheckboxWrapper) boxEl.getUserObject();
if (wrapper != null) {
boolean checked = boxEl.isAtLeastSelected(1);
if (doCheck(ureq, wrapper, checked)) {
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
} else if ("ONCLICK".equals(event.getCommand())) {
String cmd = ureq.getParameter("fcid");
String panelId = ureq.getParameter("panel");
if (StringHelper.containsNonWhitespace(cmd) && StringHelper.containsNonWhitespace(panelId)) {
saveOpenPanel(ureq, panelId, "show".equals(cmd));
}
}
super.formInnerEvent(ureq, source, event);
}
Aggregations