Search in sources :

Example 1 with CoordinateAttributeFieldsOrder

use of org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder in project collect by openforis.

the class CoordinateAttributeDefinitionFormObject method loadFieldsOrderValue.

protected void loadFieldsOrderValue(T source) {
    CollectSurvey survey = (CollectSurvey) source.getSurvey();
    UIOptions uiOptions = survey.getUIOptions();
    CoordinateAttributeFieldsOrder fieldsOrder = uiOptions.getFieldsOrder(source);
    fieldsOrderValue = fieldsOrder.name();
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) CollectSurvey(org.openforis.collect.model.CollectSurvey) CoordinateAttributeFieldsOrder(org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder)

Example 2 with CoordinateAttributeFieldsOrder

use of org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder in project collect by openforis.

the class CoordinateAttributeDefinitionFormObject method saveFieldOrderValue.

protected void saveFieldOrderValue(T dest) {
    CollectSurvey survey = (CollectSurvey) dest.getSurvey();
    UIOptions uiOptions = survey.getUIOptions();
    CoordinateAttributeFieldsOrder fieldsOrder;
    if (StringUtils.isBlank(fieldsOrderValue)) {
        fieldsOrder = null;
    } else {
        fieldsOrder = CoordinateAttributeFieldsOrder.valueOf(fieldsOrderValue);
    }
    uiOptions.setFieldsOrder(dest, fieldsOrder);
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) CollectSurvey(org.openforis.collect.model.CollectSurvey) CoordinateAttributeFieldsOrder(org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder)

Example 3 with CoordinateAttributeFieldsOrder

use of org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder in project collect by openforis.

the class CoordinateAttributeVM method getFieldsOrderValues.

public String[] getFieldsOrderValues() {
    CoordinateAttributeFieldsOrder[] values = CoordinateAttributeFieldsOrder.values();
    String[] result = new String[values.length];
    for (int i = 0; i < values.length; i++) {
        CoordinateAttributeFieldsOrder fieldsOrder = values[i];
        result[i] = fieldsOrder.name();
    }
    return result;
}
Also used : CoordinateAttributeFieldsOrder(org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder)

Example 4 with CoordinateAttributeFieldsOrder

use of org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder in project collect by openforis.

the class CoordinateAttributeVM method getFieldsOrderLabel.

public String getFieldsOrderLabel(String value) {
    CoordinateAttributeFieldsOrder enumValue = CoordinateAttributeFieldsOrder.valueOf(value);
    String messageKey = "survey.schema.attribute.coordinate.fields_order." + enumValue.name().toLowerCase(Locale.ENGLISH);
    return Labels.getLabel(messageKey);
}
Also used : CoordinateAttributeFieldsOrder(org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder)

Example 5 with CoordinateAttributeFieldsOrder

use of org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder in project collect by openforis.

the class UIOptionsMigrator method createField.

protected UIField createField(UIFormContentContainer parent, NodeDefinition nodeDefn) {
    CollectSurvey survey = (CollectSurvey) nodeDefn.getSurvey();
    UIOptions uiOptions = survey.getUIOptions();
    CollectAnnotations annotations = survey.getAnnotations();
    UIField field;
    if (nodeDefn instanceof CodeAttributeDefinition) {
        UICodeField codeField = parent.createCodeField();
        CodeAttributeDefinition codeAttrDefn = (CodeAttributeDefinition) nodeDefn;
        codeField.setLayout(uiOptions.getLayoutType(codeAttrDefn));
        codeField.setShowCode(uiOptions.getShowCode(codeAttrDefn));
        codeField.setItemsOrientation(uiOptions.getLayoutDirection(codeAttrDefn));
        field = codeField;
    } else {
        field = parent.createField();
    }
    field.setAttributeDefinitionId(nodeDefn.getId());
    if (nodeDefn instanceof TextAttributeDefinition) {
        String autoCompleteGroup = annotations.getAutoCompleteGroup((TextAttributeDefinition) nodeDefn);
        field.setAutoCompleteGroup(autoCompleteGroup);
    } else if (nodeDefn instanceof CoordinateAttributeDefinition) {
        CoordinateAttributeFieldsOrder fieldsOrder = uiOptions.getFieldsOrder((CoordinateAttributeDefinition) nodeDefn);
        field.setFieldsOrder(fieldsOrder);
    }
    field.setHidden(uiOptions.isHidden(nodeDefn));
    return field;
}
Also used : CoordinateAttributeDefinition(org.openforis.idm.metamodel.CoordinateAttributeDefinition) CodeAttributeDefinition(org.openforis.idm.metamodel.CodeAttributeDefinition) TextAttributeDefinition(org.openforis.idm.metamodel.TextAttributeDefinition) CollectAnnotations(org.openforis.collect.metamodel.CollectAnnotations) CollectSurvey(org.openforis.collect.model.CollectSurvey) CoordinateAttributeFieldsOrder(org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder)

Aggregations

CoordinateAttributeFieldsOrder (org.openforis.collect.metamodel.ui.UIOptions.CoordinateAttributeFieldsOrder)5 CollectSurvey (org.openforis.collect.model.CollectSurvey)3 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)2 CollectAnnotations (org.openforis.collect.metamodel.CollectAnnotations)1 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)1 CoordinateAttributeDefinition (org.openforis.idm.metamodel.CoordinateAttributeDefinition)1 TextAttributeDefinition (org.openforis.idm.metamodel.TextAttributeDefinition)1