Class NumericFormElementConfiguration
java.lang.Object
java.util.AbstractMap<K,V>
 
java.util.HashMap<String,Object>
 
com.foreach.across.modules.bootstrapui.elements.NumericFormElementConfiguration
- All Implemented Interfaces:
- Serializable,- Cloneable,- Map<String,- Object> 
Configuration class for a 
NumericFormElement based on
 JQuery autoNumeric plugin.  The order in which properties
 are set is important, as setting a format or currency will update several properties at once.- Author:
- Arne Vandamme
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumPredefined formats defining decimal spaces, rounding methods, negative formatters and optionally a sign.Nested classes/interfaces inherited from class java.util.AbstractMapAbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> 
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String
- 
Constructor SummaryConstructorsConstructorDescriptionNumericFormElementConfiguration(NumericFormElementConfiguration configuration) NumericFormElementConfiguration(Currency currency) 
- 
Method SummaryModifier and TypeMethodDescriptionCreate aNumberFormatthat represents the same configuration.Create a localizable configuration for a given currency.intbooleanbooleanbooleanCreate a localized version of this configuration.percent(int decimalPositions, boolean forceWhitespaceAroundSign) Create a localizable configuration for percentages.voidsetCurrency(Currency currency) voidsetCurrency(Currency currency, Locale locale) Set currency to use and locale for which to retrieve the currency signal.voidsetDecimalPadding(boolean padding) voidsetDecimalPositions(int positions) voidsetDecimalSeparator(char separator) voidsetEmptyBehaviour(String behaviour) voidsetForceWhitespaceAroundSign(boolean forceWhitespaceAroundSign) Ensure that whitespace is added between the sign and the number itself, no matter the localized format.voidvoidsetGroupingSeparator(Character separator) voidsetGroupingSize(int size) voidsetLocalizeDecimalSymbols(boolean localizeDecimalSymbols) Set totrueif you want to have the decimal symbols modified when callinglocalize(Locale).voidsetLocalizeOutputFormat(boolean localizeOutputFormat) Set totrueif the output format for currency or percentage should be determined using the output locale, this could modify both position and symbol for both currency and percent.voidsetMaxValue(Number maxValue) voidsetMinValue(Number minValue) voidsetMultiplier(int multiplier) Set the multiplier to apply to the value before formatting and when posting back.voidsetNegativeFormatter(String formatter) Set the format to be used when rendering negative values if the texbox is not in focus.voidsetRoundingMode(String mode) voidsetRoundingMode(RoundingMode roundingMode) voidvoidsetSignPositionRight(boolean positionRight) Methods inherited from class java.util.HashMapclear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMapequals, hashCode, toString
- 
Field Details- 
ROUND_HALF_UP_SYMMETRIC- See Also:
 
- 
ROUND_HALF_UP_ASYMMETRIC- See Also:
 
- 
ROUND_HALF_DOWN_SYMMETRIC- See Also:
 
- 
ROUND_HALF_DOWN_ASYMMETRIC- See Also:
 
- 
ROUND_HALF_EVEN- See Also:
 
- 
ROUND_UP- See Also:
 
- 
ROUND_DOWN- See Also:
 
- 
ROUND_CEILING- See Also:
 
- 
ROUND_FLOOR- See Also:
 
- 
ROUND_SWISS- See Also:
 
- 
NEGATIVE_PARENTHESES- See Also:
 
- 
NEGATIVE_BRACKETS- See Also:
 
- 
NEGATIVE_BRACES- See Also:
 
- 
NEGATIVE_ANGLES- See Also:
 
- 
EMPTY_EMPTY- See Also:
 
- 
EMPTY_ZERO- See Also:
 
- 
EMPTY_SIGN- See Also:
 
 
- 
- 
Constructor Details- 
NumericFormElementConfigurationpublic NumericFormElementConfiguration()
- 
NumericFormElementConfiguration
- 
NumericFormElementConfiguration
- 
NumericFormElementConfiguration
- 
NumericFormElementConfiguration
 
- 
- 
Method Details- 
getFormat
- 
setFormat
- 
setCurrency
- 
setCurrencySet currency to use and locale for which to retrieve the currency signal.- Parameters:
- currency- instance
- locale- to use the currency symbol from
 
- 
getCurrency
- 
setDecimalPositionspublic void setDecimalPositions(int positions) 
- 
setGroupingSeparator
- 
setGroupingSizepublic void setGroupingSize(int size) 
- 
setDecimalSeparatorpublic void setDecimalSeparator(char separator) 
- 
setSign
- 
setSignPositionRightpublic void setSignPositionRight(boolean positionRight) 
- 
setMinValue
- 
setMaxValue
- 
setRoundingMode
- 
setMultiplierpublic void setMultiplier(int multiplier) Set the multiplier to apply to the value before formatting and when posting back. Useful if percentage values are below 1 as the javascript control expects them between 0 and 100.- Parameters:
- multiplier- defaults to 1
 
- 
getMultiplierpublic int getMultiplier()
- 
setRoundingMode
- 
setDecimalPaddingpublic void setDecimalPadding(boolean padding) 
- 
setNegativeFormatterSet the format to be used when rendering negative values if the texbox is not in focus. See for exampleNEGATIVE_BRACES.- Parameters:
- formatter- string
 
- 
setEmptyBehaviour
- 
isLocalizeOutputFormatpublic boolean isLocalizeOutputFormat()
- 
setLocalizeOutputFormatpublic void setLocalizeOutputFormat(boolean localizeOutputFormat) Set totrueif the output format for currency or percentage should be determined using the output locale, this could modify both position and symbol for both currency and percent. Default istrue.- Parameters:
- localizeOutputFormat- true if parameters can be modified according to output locale
 
- 
isLocalizeDecimalSymbolspublic boolean isLocalizeDecimalSymbols()
- 
setLocalizeDecimalSymbolspublic void setLocalizeDecimalSymbols(boolean localizeDecimalSymbols) Set totrueif you want to have the decimal symbols modified when callinglocalize(Locale).- Parameters:
- localizeDecimalSymbols- true if decimal symbols should be gotten from the locale
 
- 
isForceWhitespaceAroundSignpublic boolean isForceWhitespaceAroundSign()
- 
setForceWhitespaceAroundSignpublic void setForceWhitespaceAroundSign(boolean forceWhitespaceAroundSign) Ensure that whitespace is added between the sign and the number itself, no matter the localized format.- Parameters:
- forceWhitespaceAroundSign- true if space will be introduced
 
- 
localizeCreate a localized version of this configuration. Meaning that number formatting specifications (decimal symbol, thousands separator etc) will be used from the current locale. This is different from the NumericFormElementConfiguration(Locale)constructor as that one creates a configuration for the currency attached to the locale specified. Even though the currency could be USD, you usually still want to render in the output locale.Properties isLocalizeOutputFormat()andisLocalizeDecimalSymbols()will determine which settings this method will modify.- Parameters:
- locale- instance
- Returns:
- clone with altered settings if isLocalizeOutputFormat()istrue
 
- 
put
- 
createNumberFormatCreate aNumberFormatthat represents the same configuration.- Returns:
- numberformat instance
 
- 
percentpublic static NumericFormElementConfiguration percent(int decimalPositions, boolean forceWhitespaceAroundSign) Create a localizable configuration for percentages.- Parameters:
- decimalPositions- number of decimal positions to show
- forceWhitespaceAroundSign- true if whitespace should be added around the sign independent of the locale
- Returns:
- configuration
 
- 
currencypublic static NumericFormElementConfiguration currency(Currency currency, int decimalPositions, boolean forceWhitespaceAroundSign) Create a localizable configuration for a given currency.- Parameters:
- currency- currency to use
- decimalPositions- number of decimal positions to show
- forceWhitespaceAroundSign- true if whitespace should be added around the sign independent of the locale
- Returns:
- configuration
 
 
-