提交 b9c0bd99 编写于 作者: S serge-rider

#3006 Numeric format: configure decimal part render (from column scale)

上级 99136e27
......@@ -334,6 +334,8 @@ DateFormatter.number.general.maxFractDigits.label=Maximum fraction digits
DateFormatter.number.general.maxFractDigits.description=Maximum fraction digits
DateFormatter.number.general.minFractDigits.label=Minimum fraction digits
DateFormatter.number.general.minFractDigits.description=Minimum fraction digits
DateFormatter.number.general.useTypeScale.label=Use data type scale for fraction digits
DateFormatter.number.general.useTypeScale.description=Use column/attribute data type scale as minimum fraction digits number
DateFormatter.number.general.roundingMode.label=Rounding mode
DateFormatter.number.general.roundingMode.description=Rounding mode
......
......@@ -3356,6 +3356,7 @@
<property id="minIntegerDigits" label="%DateFormatter.number.general.minIntDigits.label" type="integer" description="%DateFormatter.number.general.minIntDigits.description"/>
<property id="maxFractionDigits" label="%DateFormatter.number.general.maxFractDigits.label" type="integer" description="%DateFormatter.number.general.maxFractDigits.description"/>
<property id="minFractionDigits" label="%DateFormatter.number.general.minFractDigits.label" type="integer" description="%DateFormatter.number.general.minFractDigits.description"/>
<property id="useTypeScale" label="%DateFormatter.number.general.useTypeScale.label" type="boolean" description="%DateFormatter.number.general.useTypeScale.description"/>
<property id="roundingMode" label="%DateFormatter.number.general.roundingMode.label" type="string" description="%DateFormatter.number.general.roundingMode.description" validValues="UP,DOWN,CEILING,FLOOR,HALF_UP,HALF_DOWN,HALF_EVEN,UNNECESSARY"/>
</propertyGroup>
</formatter>
......
......@@ -71,7 +71,8 @@ public class NumberDataFormatter implements DBDDataFormatter {
// just skip it
}
}
if (type != null) {
Object useTypeScale = CommonUtils.toString(properties.get(NumberFormatSample.PROP_USE_TYPE_SCALE));
if (type != null && CommonUtils.toBoolean(useTypeScale)) {
if (type.getScale() != null && type.getScale() > 0) {
int fractionDigits = type.getScale();
if (fractionDigits > MAX_DEFAULT_FRACTIONS_DIGITS) fractionDigits = MAX_DEFAULT_FRACTIONS_DIGITS;
......
......@@ -30,6 +30,7 @@ public class NumberFormatSample implements DBDDataFormatterSample {
public static final String PROP_MIN_INT_DIGITS ="minIntegerDigits";
public static final String PROP_MAX_FRACT_DIGITS ="maxFractionDigits";
public static final String PROP_MIN_FRACT_DIGITS ="minFractionDigits";
public static final String PROP_USE_TYPE_SCALE ="useTypeScale";
public static final String PROP_ROUNDING_MODE ="roundingMode";
@Override
......@@ -42,6 +43,7 @@ public class NumberFormatSample implements DBDDataFormatterSample {
props.put(PROP_MIN_INT_DIGITS, tmp.getMinimumIntegerDigits());
props.put(PROP_MAX_FRACT_DIGITS, Math.max(tmp.getMaximumFractionDigits(), 10));
props.put(PROP_MIN_FRACT_DIGITS, tmp.getMinimumFractionDigits());
props.put(PROP_USE_TYPE_SCALE, true);
props.put(PROP_ROUNDING_MODE, tmp.getRoundingMode().name());
return props;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册