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();
}
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;
}
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;
}
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;
}
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;
}
Aggregations