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