Search in sources :

Example 1 with SimpleCondition

use of org.activityinfo.model.formula.simple.SimpleCondition in project activityinfo by bedatadriven.

the class RelevancePanel method init.

public void init(List<FormField> fields, SimpleConditionList model) {
    assert rows.isEmpty();
    this.selectableFields = new ArrayList<>();
    for (FormField field : fields) {
        if (!SimpleOperators.forType(field.getType()).isEmpty()) {
            selectableFields.add(field);
        }
    }
    if (model.getCriteria() == Criteria.ALL_TRUE) {
        criteriaListBox.setSelectedIndex(ALL_INDEX);
    } else {
        criteriaListBox.setSelectedIndex(ANY_INDEX);
    }
    for (SimpleCondition condition : model.getConditions()) {
        addRow(Optional.of(condition));
    }
    if (rows.isEmpty()) {
        addRow(Optional.<SimpleCondition>absent());
    }
    onRowCountUpdated();
}
Also used : SimpleCondition(org.activityinfo.model.formula.simple.SimpleCondition) FormField(org.activityinfo.model.form.FormField)

Aggregations

FormField (org.activityinfo.model.form.FormField)1 SimpleCondition (org.activityinfo.model.formula.simple.SimpleCondition)1