Class NumberFormatOptions.Builder
java.lang.Object
de.xima.fc.form.common.number_format.NumberFormatOptions.Builder
- Enclosing class:
NumberFormatOptions
A simple builder for
NumberFormatOptions.- Since:
- 8.2.2
-
Method Summary
Modifier and TypeMethodDescriptionApply the defaults for all options that are not set when building the options.applyDefaultsIfMissing(boolean applyDefaultsIfMissing) When set to true, apply the defaults for all options that are not set when building the options.build()Builds a new options instance.changeValueOnWheel(boolean changeValueOnWheel) Sets whether to change the value when the mouse wheel is used.decimalPaddingMode(NumberFormatOptions.DecimalPaddingMode decimalPaddingMode) Whether to pad decimals with zeroes, up to the number of decimal places, seedecimalPlaces(int).decimalPlaces(int decimalPlaces) Maximum number of decimal places to display, see alsodecimalPaddingMode(DecimalPaddingMode).decimalSeparator(NumberFormatOptions.DecimalSeparator decimalSeparator) Separator to use to separate the integer part of the number from the fractional part.digitGroupMode(NumberFormatOptions.DigitGroupMode digitGroupMode) How to group digits in the integer part of the number.digitGroupSeparator(NumberFormatOptions.DigitGroupSeparator digitGroupSeparator) Separator to use between digit groups.emptyMode(NumberFormatOptions.EmptyMode emptyMode) Defines the behavior of the input field when it is empty.itemProperties(IXItemPropertiesData itemProperties) Reads the number format options from the given item properties and sets them on this builder.leadingZeroMode(NumberFormatOptions.LeadingZeroMode leadingZeroMode) Defines how to treat leading zeroes, e.g. `003512`.negativeSign(char negativeSign) The sign used to indicate that a number is negative.positiveSign(char positiveSign) The sign used to indicate that a number is positive.roundingMode(NumberFormatOptions.RoundingMode roundingMode) The mode to use when rounding numbers.Show the positive sign for positive numbers.showPositiveSign(boolean showPositiveSign) Whether to show the positive sign for positive numbers.signumSignPlacement(NumberFormatOptions.SignumSignPlacement signumSignPlacement) Where to place the signum sign that indicates whether a number is positive or negative.The unit sign to show before or after the number, seeunitSignPlacement(UnitSignPlacement).unitSignPlacement(NumberFormatOptions.UnitSignPlacement unitSignPlacement) Where to place theunit sign, if any.wheelStep(double wheelStep) Sets the wheel step value as a string.Sets the wheel step value as a string.
-
Method Details
-
applyDefaultsIfMissing
Apply the defaults for all options that are not set when building the options.- Returns:
- This builder for chaining method calls.
-
applyDefaultsIfMissing
@CanIgnoreReturnValue public NumberFormatOptions.Builder applyDefaultsIfMissing(boolean applyDefaultsIfMissing) When set to true, apply the defaults for all options that are not set when building the options.- Parameters:
applyDefaultsIfMissing- Whether to apply defaults for missing options.- Returns:
- This builder for chaining method calls.
-
build
Builds a new options instance. Subsequent modifications to this builder will not affect the returned instance.- Returns:
- A new options instance.
-
changeValueOnWheel
@CanIgnoreReturnValue public NumberFormatOptions.Builder changeValueOnWheel(boolean changeValueOnWheel) Sets whether to change the value when the mouse wheel is used. Defaults to false.- Parameters:
changeValueOnWheel- Whether to change the value on wheel.- Returns:
- This builder for chaining method calls.
-
decimalPaddingMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder decimalPaddingMode(NumberFormatOptions.DecimalPaddingMode decimalPaddingMode) Whether to pad decimals with zeroes, up to the number of decimal places, seedecimalPlaces(int).- Parameters:
decimalPaddingMode- The decimal padding mode.- Returns:
- This builder for chaining method calls.
-
decimalPlaces
Maximum number of decimal places to display, see alsodecimalPaddingMode(DecimalPaddingMode).- Parameters:
decimalPlaces- The number of decimal places.- Returns:
- This builder for chaining method calls.
-
decimalSeparator
@CanIgnoreReturnValue public NumberFormatOptions.Builder decimalSeparator(NumberFormatOptions.DecimalSeparator decimalSeparator) Separator to use to separate the integer part of the number from the fractional part.- Parameters:
decimalSeparator- The decimal separator to use.- Returns:
- This builder for chaining method calls.
-
digitGroupMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder digitGroupMode(NumberFormatOptions.DigitGroupMode digitGroupMode) How to group digits in the integer part of the number.- Parameters:
digitGroupMode- The digit group mode.- Returns:
- This builder for chaining method calls.
-
digitGroupSeparator
@CanIgnoreReturnValue public NumberFormatOptions.Builder digitGroupSeparator(NumberFormatOptions.DigitGroupSeparator digitGroupSeparator) Separator to use between digit groups.- Parameters:
digitGroupSeparator- The digit group separator.- Returns:
- This builder for chaining method calls.
-
emptyMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder emptyMode(NumberFormatOptions.EmptyMode emptyMode) Defines the behavior of the input field when it is empty.- Parameters:
emptyMode- The empty mode.- Returns:
- This builder for chaining method calls.
-
itemProperties
@CanIgnoreReturnValue public NumberFormatOptions.Builder itemProperties(IXItemPropertiesData itemProperties) Reads the number format options from the given item properties and sets them on this builder.- Parameters:
itemProperties- The item properties to read the options from.- Returns:
- This builder for chaining method calls.
-
leadingZeroMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder leadingZeroMode(NumberFormatOptions.LeadingZeroMode leadingZeroMode) Defines how to treat leading zeroes, e.g. `003512`.- Parameters:
leadingZeroMode- The leading zero mode.- Returns:
- This builder for chaining method calls.
-
negativeSign
The sign used to indicate that a number is negative. Must be a single character. Must not be any of the numerical characters (digits).- Parameters:
negativeSign- The negative sign.- Returns:
- This builder for chaining method calls.
-
positiveSign
The sign used to indicate that a number is positive. Must be a single character. Must not be any of the numerical characters (digits).- Parameters:
positiveSign- The positive sign.- Returns:
- This builder for chaining method calls.
-
roundingMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder roundingMode(NumberFormatOptions.RoundingMode roundingMode) The mode to use when rounding numbers.- Parameters:
roundingMode- The rounding mode.- Returns:
- This builder for chaining method calls.
-
showPositiveSign
Show the positive sign for positive numbers.- Returns:
- This builder for chaining method calls.
-
showPositiveSign
Whether to show the positive sign for positive numbers.- Parameters:
showPositiveSign- Whether to show the positive sign.- Returns:
- This builder for chaining method calls.
-
signumSignPlacement
@CanIgnoreReturnValue public NumberFormatOptions.Builder signumSignPlacement(NumberFormatOptions.SignumSignPlacement signumSignPlacement) Where to place the signum sign that indicates whether a number is positive or negative. See alsonegative signandpositive sign.- Parameters:
signumSignPlacement- The signum sign placement.- Returns:
- This builder for chaining method calls.
-
unitSign
The unit sign to show before or after the number, seeunitSignPlacement(UnitSignPlacement).- Parameters:
unitSign- The unit sign.- Returns:
- This builder for chaining method calls.
-
unitSignPlacement
@CanIgnoreReturnValue public NumberFormatOptions.Builder unitSignPlacement(NumberFormatOptions.UnitSignPlacement unitSignPlacement) Where to place theunit sign, if any.- Parameters:
unitSignPlacement- The unit sign placement.- Returns:
- This builder for chaining method calls.
-
wheelStep
Sets the wheel step value as a string. When null, uses an automatic step based on the current settings and the current value. Applicable only ifchangeValueOnWheelis set to true.- Parameters:
wheelStep- The wheel step.- Returns:
- This builder for chaining method calls.
-
wheelStep
Sets the wheel step value as a string. When null, uses an automatic step based on the current settings and the current value. Applicable only ifchangeValueOnWheelis set to true.- Parameters:
wheelStep- The wheel step.- Returns:
- This builder for chaining method calls.
-