Search in sources :

Example 56 with Checkbox

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());
    }
}
Also used : DBCheck(org.olat.course.nodes.cl.model.DBCheck) FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit) HashMap(java.util.HashMap) Checkbox(org.olat.course.nodes.cl.model.Checkbox) DBCheckbox(org.olat.course.nodes.cl.model.DBCheckbox) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 57 with Checkbox

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();
}
Also used : CheckboxConfigRow(org.olat.course.nodes.cl.ui.CheckboxConfigRow) Checkbox(org.olat.course.nodes.cl.model.Checkbox) ArrayList(java.util.ArrayList)

Example 58 with Checkbox

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);
}
Also used : CheckboxConfigRow(org.olat.course.nodes.cl.ui.CheckboxConfigRow) Checkbox(org.olat.course.nodes.cl.model.Checkbox) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)

Aggregations

Checkbox (org.olat.course.nodes.cl.model.Checkbox)58 CheckboxList (org.olat.course.nodes.cl.model.CheckboxList)24 ArrayList (java.util.ArrayList)16 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)14 ModuleConfiguration (org.olat.modules.ModuleConfiguration)14 File (java.io.File)12 HashMap (java.util.HashMap)12 DBCheckbox (org.olat.course.nodes.cl.model.DBCheckbox)12 Identity (org.olat.core.id.Identity)10 HashSet (java.util.HashSet)8 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)8 ICourse (org.olat.course.ICourse)8 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)8 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 VFSItem (org.olat.core.util.vfs.VFSItem)6 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)6 DBCheck (org.olat.course.nodes.cl.model.DBCheck)6 Date (java.util.Date)4 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)4