Search in sources :

Example 71 with FormField

use of org.activityinfo.model.form.FormField 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)

Example 72 with FormField

use of org.activityinfo.model.form.FormField in project activityinfo by bedatadriven.

the class AttachmentFieldTemplate method create.

@Override
public FormField create() {
    AttachmentType type = (AttachmentType) AttachmentType.TYPE_CLASS.createType();
    type.setKind(kind);
    FormField formField = new FormField(CuidAdapter.indicatorField(new KeyGenerator().generateInt()));
    formField.setType(type);
    formField.setLabel(label);
    return formField;
}
Also used : AttachmentType(org.activityinfo.model.type.attachment.AttachmentType) FormField(org.activityinfo.model.form.FormField) KeyGenerator(org.activityinfo.model.legacy.KeyGenerator)

Example 73 with FormField

use of org.activityinfo.model.form.FormField in project activityinfo by bedatadriven.

the class SubFormTemplate method create.

@Override
public FormField create() {
    FormField field = new FormField(ResourceId.generateFieldId(SubFormReferenceType.TYPE_CLASS));
    field.setLabel(label);
    field.setType(new SubFormReferenceType());
    return field;
}
Also used : SubFormReferenceType(org.activityinfo.model.type.subform.SubFormReferenceType) FormField(org.activityinfo.model.form.FormField)

Example 74 with FormField

use of org.activityinfo.model.form.FormField in project activityinfo by bedatadriven.

the class TypeClassTemplate method create.

@Override
public FormField create() {
    FormField formField = new FormField(ResourceId.generateFieldId(typeClass));
    formField.setType(typeClass.createType());
    formField.setLabel(label);
    return formField;
}
Also used : FormField(org.activityinfo.model.form.FormField)

Example 75 with FormField

use of org.activityinfo.model.form.FormField in project activityinfo by bedatadriven.

the class CuidAdapter method partnerField.

public static FormField partnerField(FormClass formClass) {
    int databaseId = CuidAdapter.getLegacyIdFromCuid(formClass.getDatabaseId());
    ResourceId partnerId = field(formClass.getId(), PARTNER_FIELD);
    FormField formField = new FormField(partnerId);
    formField.setLabel("Partner");
    formField.setType(ReferenceType.single(partnerFormId(databaseId)));
    formField.setRequired(true);
    return formField;
}
Also used : ResourceId(org.activityinfo.model.resource.ResourceId) FormField(org.activityinfo.model.form.FormField)

Aggregations

FormField (org.activityinfo.model.form.FormField)119 FormClass (org.activityinfo.model.form.FormClass)48 ResourceId (org.activityinfo.model.resource.ResourceId)32 Test (org.junit.Test)30 QuantityType (org.activityinfo.model.type.number.QuantityType)18 SubFormReferenceType (org.activityinfo.model.type.subform.SubFormReferenceType)17 ReferenceType (org.activityinfo.model.type.ReferenceType)16 EnumType (org.activityinfo.model.type.enumerated.EnumType)14 FieldValue (org.activityinfo.model.type.FieldValue)12 EnumItem (org.activityinfo.model.type.enumerated.EnumItem)11 JsonValue (org.activityinfo.json.JsonValue)9 FormTree (org.activityinfo.model.formTree.FormTree)9 FormInstance (org.activityinfo.model.form.FormInstance)8 CalculatedFieldType (org.activityinfo.model.type.expr.CalculatedFieldType)8 ColumnSet (org.activityinfo.model.query.ColumnSet)6 QueryModel (org.activityinfo.model.query.QueryModel)6 KeyGenerator (org.activityinfo.model.legacy.KeyGenerator)5 Quantity (org.activityinfo.model.type.number.Quantity)5 TypedRecordUpdate (org.activityinfo.store.spi.TypedRecordUpdate)5 ArrayList (java.util.ArrayList)4