Search in sources :

Example 1 with RuleEditorFragment

use of org.olat.modules.reminder.RuleEditorFragment in project OpenOLAT by OpenOLAT.

the class CourseReminderEditController method initRuleForm.

protected RuleElement initRuleForm(UserRequest ureq, RuleSPI ruleSpi, ReminderRule rule) {
    String id = Integer.toString(counter++);
    String type = ruleSpi.getClass().getSimpleName();
    SingleSelection typeEl = uifactory.addDropdownSingleselect("rule.type.".concat(id), null, rulesCont, typeKeys, typeValues, null);
    typeEl.addActionListener(FormEvent.ONCHANGE);
    for (String typeKey : typeKeys) {
        if (type.equals(typeKey)) {
            typeEl.select(typeKey, true);
        }
    }
    FormLink addRuleButton = uifactory.addFormLink("add.rule.".concat(id), "add", "add.rule", null, rulesCont, Link.BUTTON);
    addRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_add");
    addRuleButton.setElementCssClass("o_sel_course_add_rule");
    FormLink deleteRuleButton = uifactory.addFormLink("delete.rule.".concat(id), "delete", "delete.rule", null, rulesCont, Link.BUTTON);
    deleteRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item");
    deleteRuleButton.setElementCssClass("o_sel_course_delete_rule");
    RuleEditorFragment editor = ruleSpi.getEditorFragment(rule, entry);
    FormItem customItem = editor.initForm(rulesCont, this, ureq);
    RuleElement ruleEl = new RuleElement(typeEl, addRuleButton, deleteRuleButton, editor, customItem);
    typeEl.setUserObject(ruleEl);
    addRuleButton.setUserObject(ruleEl);
    deleteRuleButton.setUserObject(ruleEl);
    return ruleEl;
}
Also used : RuleEditorFragment(org.olat.modules.reminder.RuleEditorFragment) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormItem(org.olat.core.gui.components.form.flexible.FormItem) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 2 with RuleEditorFragment

use of org.olat.modules.reminder.RuleEditorFragment in project OpenOLAT by OpenOLAT.

the class CourseReminderEditController method doUpdateRuleForm.

private void doUpdateRuleForm(UserRequest ureq, RuleElement panelToUpdate, RuleSPI ruleSpi) {
    // remove old editor
    rulesCont.remove(panelToUpdate.getCustomItem());
    // add new one
    RuleEditorFragment editor = ruleSpi.getEditorFragment(null, entry);
    FormItem customItem = editor.initForm(rulesCont, this, ureq);
    panelToUpdate.setCustomItem(customItem, editor);
    rulesCont.setDirty(true);
}
Also used : RuleEditorFragment(org.olat.modules.reminder.RuleEditorFragment) FormItem(org.olat.core.gui.components.form.flexible.FormItem)

Example 3 with RuleEditorFragment

use of org.olat.modules.reminder.RuleEditorFragment in project openolat by klemens.

the class CourseReminderEditController method initRuleForm.

protected RuleElement initRuleForm(UserRequest ureq, RuleSPI ruleSpi, ReminderRule rule) {
    String id = Integer.toString(counter++);
    String type = ruleSpi.getClass().getSimpleName();
    SingleSelection typeEl = uifactory.addDropdownSingleselect("rule.type.".concat(id), null, rulesCont, typeKeys, typeValues, null);
    typeEl.addActionListener(FormEvent.ONCHANGE);
    for (String typeKey : typeKeys) {
        if (type.equals(typeKey)) {
            typeEl.select(typeKey, true);
        }
    }
    FormLink addRuleButton = uifactory.addFormLink("add.rule.".concat(id), "add", "add.rule", null, rulesCont, Link.BUTTON);
    addRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_add");
    addRuleButton.setElementCssClass("o_sel_course_add_rule");
    FormLink deleteRuleButton = uifactory.addFormLink("delete.rule.".concat(id), "delete", "delete.rule", null, rulesCont, Link.BUTTON);
    deleteRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item");
    deleteRuleButton.setElementCssClass("o_sel_course_delete_rule");
    RuleEditorFragment editor = ruleSpi.getEditorFragment(rule, entry);
    FormItem customItem = editor.initForm(rulesCont, this, ureq);
    RuleElement ruleEl = new RuleElement(typeEl, addRuleButton, deleteRuleButton, editor, customItem);
    typeEl.setUserObject(ruleEl);
    addRuleButton.setUserObject(ruleEl);
    deleteRuleButton.setUserObject(ruleEl);
    return ruleEl;
}
Also used : RuleEditorFragment(org.olat.modules.reminder.RuleEditorFragment) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormItem(org.olat.core.gui.components.form.flexible.FormItem) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 4 with RuleEditorFragment

use of org.olat.modules.reminder.RuleEditorFragment in project openolat by klemens.

the class CourseReminderEditController method doUpdateRuleForm.

private void doUpdateRuleForm(UserRequest ureq, RuleElement panelToUpdate, RuleSPI ruleSpi) {
    // remove old editor
    rulesCont.remove(panelToUpdate.getCustomItem());
    // add new one
    RuleEditorFragment editor = ruleSpi.getEditorFragment(null, entry);
    FormItem customItem = editor.initForm(rulesCont, this, ureq);
    panelToUpdate.setCustomItem(customItem, editor);
    rulesCont.setDirty(true);
}
Also used : RuleEditorFragment(org.olat.modules.reminder.RuleEditorFragment) FormItem(org.olat.core.gui.components.form.flexible.FormItem)

Aggregations

FormItem (org.olat.core.gui.components.form.flexible.FormItem)4 RuleEditorFragment (org.olat.modules.reminder.RuleEditorFragment)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2