Search in sources :

Example 6 with FieldTypeClass

use of org.activityinfo.model.type.FieldTypeClass in project activityinfo by bedatadriven.

the class BaseEntityHandler method updateType.

private void updateType(Indicator indicator, PropertyMap changes) {
    FieldTypeClass type = parseType(changes.get(TYPE_PROPERTY));
    indicator.setType(type.getId());
    if ((type != FieldTypeClass.QUANTITY) && !changes.containsKey(UNITS_PROPERTY)) {
        indicator.setUnits("");
    }
}
Also used : FieldTypeClass(org.activityinfo.model.type.FieldTypeClass)

Example 7 with FieldTypeClass

use of org.activityinfo.model.type.FieldTypeClass in project activityinfo by bedatadriven.

the class ColumnTypeGuesserTest method assertType.

private void assertType(FieldTypeClass exptectedType, String... columnValueList) {
    List<String> columnValues = Arrays.asList(columnValueList);
    ColumnTypeGuesser guesser = new ColumnTypeGuesser(columnValues, JvmConverterFactory.get());
    final FieldTypeClass formFieldType = guesser.guessType();
    Assert.assertEquals(exptectedType, formFieldType);
}
Also used : FieldTypeClass(org.activityinfo.model.type.FieldTypeClass)

Example 8 with FieldTypeClass

use of org.activityinfo.model.type.FieldTypeClass in project activityinfo by bedatadriven.

the class IndicatorForm method setState.

private void setState() {
    if (typeCombo.getValue() != null) {
        FieldTypeClass selectedType = TypeRegistry.get().getTypeClass(typeCombo.getValue().getWrappedValue());
        unitsField.setVisible(selectedType == FieldTypeClass.QUANTITY);
        unitsField.setAllowBlank(selectedType != FieldTypeClass.QUANTITY);
        if (selectedType != FieldTypeClass.QUANTITY) {
            unitsField.setValue("");
        }
        calculatedExpressionLabelDesc.setEnabled(selectedType == FieldTypeClass.QUANTITY);
        calculateAutomatically.setEnabled(selectedType == FieldTypeClass.QUANTITY);
        expressionField.setEnabled(selectedType == FieldTypeClass.QUANTITY && calculateAutomatically.getValue());
        aggregationCombo.setVisible(selectedType == FieldTypeClass.QUANTITY);
    }
}
Also used : FieldTypeClass(org.activityinfo.model.type.FieldTypeClass)

Aggregations

FieldTypeClass (org.activityinfo.model.type.FieldTypeClass)8 Map (java.util.Map)2 SqlResultCallback (com.bedatadriven.rebar.sql.client.SqlResultCallback)1 SqlResultSet (com.bedatadriven.rebar.sql.client.SqlResultSet)1 SqlResultSetRow (com.bedatadriven.rebar.sql.client.SqlResultSetRow)1 SqlTransaction (com.bedatadriven.rebar.sql.client.SqlTransaction)1 SqlQuery (com.bedatadriven.rebar.sql.client.query.SqlQuery)1 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)1 TextField (com.extjs.gxt.ui.client.widget.form.TextField)1 Promise (org.activityinfo.promise.Promise)1 ColumnAction (org.activityinfo.ui.client.component.importDialog.model.ColumnAction)1 MapExistingAction (org.activityinfo.ui.client.component.importDialog.model.MapExistingAction)1 ImportTarget (org.activityinfo.ui.client.component.importDialog.model.strategy.ImportTarget)1 FieldValueParser (org.activityinfo.ui.client.component.importDialog.model.type.converter.FieldValueParser)1 RadioButton (org.activityinfo.ui.client.widget.RadioButton)1