use of io.jmix.core.metamodel.datatype.impl.AdaptiveNumberDatatype in project jmix by jmix-framework.
the class CategoryAttrsEdit method setupNumberFormat.
protected void setupNumberFormat() {
String formatPattern = getEditedEntity().getConfiguration().getNumberFormatPattern();
Datatype datatype;
if (!Strings.isNullOrEmpty(formatPattern)) {
datatype = new AdaptiveNumberDatatype(BigDecimal.class, formatPattern, "", "", formatStringsRegistry);
} else {
datatype = datatypeRegistry.find(BigDecimal.class);
}
defaultDecimalField.setDatatype(datatype);
minDecimalField.setDatatype(datatype);
maxDecimalField.setDatatype(datatype);
defaultDecimalField.setValue(defaultDecimalField.getValue());
minDecimalField.setValue(minDecimalField.getValue());
maxDecimalField.setValue(maxDecimalField.getValue());
}
use of io.jmix.core.metamodel.datatype.impl.AdaptiveNumberDatatype in project jmix by jmix-framework.
the class DynAttrComponentGenerationStrategy method setCustomDatatype.
protected void setCustomDatatype(TextField field, AttributeDefinition attribute) {
String formatPattern = attribute.getConfiguration().getNumberFormatPattern();
if (!Strings.isNullOrEmpty(formatPattern)) {
Class<?> type = attribute.getDataType() == DECIMAL ? BigDecimal.class : Number.class;
// noinspection unchecked
field.setDatatype(new AdaptiveNumberDatatype(type, formatPattern, "", "", formatStringsRegistry));
}
}
Aggregations