use of org.olat.course.nodes.cl.model.Checkbox 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.course.nodes.cl.model.Checkbox in project openolat by klemens.
the class CheckboxListStepController method updateModel.
private void updateModel() {
List<Checkbox> boxList = data.getCheckboxList();
List<CheckboxConfigRow> rows = new ArrayList<>();
for (Checkbox box : boxList) {
rows.add(new CheckboxConfigRow(box, null));
}
model.setObjects(rows);
boxTable.reset();
}
use of org.olat.course.nodes.cl.model.Checkbox in project openolat by klemens.
the class CheckboxListStepController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (addLink == source) {
Checkbox checkbox = new Checkbox();
checkbox.setCheckboxId(UUID.randomUUID().toString());
String title = translate("add.checkbox");
doOpenEdit(ureq, checkbox, true, title);
} else if (boxTable == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("edit".equals(cmd)) {
CheckboxConfigRow row = model.getObject(se.getIndex());
doOpenEdit(ureq, row.getCheckbox(), false, translate("edit.checkbox"));
}
}
}
super.formInnerEvent(ureq, source, event);
}
Aggregations