Search in sources :

Example 6 with Rule

use of org.olat.admin.landingpages.model.Rule in project openolat by klemens.

the class LandingPagesAdminController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    int rowCount = model.getRowCount();
    List<Rule> ruleList = new ArrayList<Rule>(rowCount);
    for (int i = 0; i < rowCount; i++) {
        ruleList.add(model.getObject(i).save());
    }
    Rules rules = new Rules();
    rules.setRules(ruleList);
    lpModule.setRules(rules);
}
Also used : ArrayList(java.util.ArrayList) Rule(org.olat.admin.landingpages.model.Rule) Rules(org.olat.admin.landingpages.model.Rules)

Example 7 with Rule

use of org.olat.admin.landingpages.model.Rule in project openolat by klemens.

the class RuleWrapper method save.

public Rule save() {
    Rule sRule = new Rule();
    if (roleEl.isOneSelected()) {
        sRule.setRole(roleEl.getSelectedKey());
    }
    if (attrNameEl.isOneSelected()) {
        sRule.setUserAttributeKey(attrNameEl.getSelectedKey());
        sRule.setUserAttributeValue(attrValueEl.getValue());
    }
    sRule.setLandingPath(landingPageEl.getValue());
    return sRule;
}
Also used : Rule(org.olat.admin.landingpages.model.Rule)

Example 8 with Rule

use of org.olat.admin.landingpages.model.Rule in project OpenOLAT by OpenOLAT.

the class LandingPagesAdminController method deleteRow.

private void deleteRow(RuleWrapper row) {
    List<RuleWrapper> rows = model.getObjects();
    rows.remove(row);
    if (rows.isEmpty()) {
        Rule rule = new Rule();
        rows.add(initRuleWrapper(1, rule, flc));
    }
    model.setObjects(reOrder(rows));
}
Also used : Rule(org.olat.admin.landingpages.model.Rule)

Example 9 with Rule

use of org.olat.admin.landingpages.model.Rule in project OpenOLAT by OpenOLAT.

the class LandingPagesAdminController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    int rowCount = model.getRowCount();
    List<Rule> ruleList = new ArrayList<Rule>(rowCount);
    for (int i = 0; i < rowCount; i++) {
        ruleList.add(model.getObject(i).save());
    }
    Rules rules = new Rules();
    rules.setRules(ruleList);
    lpModule.setRules(rules);
}
Also used : ArrayList(java.util.ArrayList) Rule(org.olat.admin.landingpages.model.Rule) Rules(org.olat.admin.landingpages.model.Rules)

Example 10 with Rule

use of org.olat.admin.landingpages.model.Rule in project OpenOLAT by OpenOLAT.

the class LandingPagesAdminController method addRow.

private void addRow(RuleWrapper row) {
    List<RuleWrapper> rows = model.getObjects();
    int currentIndex = rows.indexOf(row);
    RuleWrapper newRule = initRuleWrapper(1, new Rule(), flc);
    if (currentIndex >= 0 && currentIndex < rows.size() - 1) {
        rows.add(currentIndex + 1, newRule);
    } else {
        rows.add(newRule);
    }
    model.setObjects(reOrder(rows));
}
Also used : Rule(org.olat.admin.landingpages.model.Rule)

Aggregations

Rule (org.olat.admin.landingpages.model.Rule)12 Rules (org.olat.admin.landingpages.model.Rules)6 ArrayList (java.util.ArrayList)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)2