Class FormulaFormatter
java.lang.Object
com.vaadin.flow.component.spreadsheet.FormulaFormatter
- All Implemented Interfaces:
Serializable
Converts between a localized formula and a non-localized formula.
This is needed because internally POI only handles formulas with '.' as the decimal separator, and ',' as the argument separator.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected chargetCurrentDecimalSeparator(Locale locale) protected DecimalFormatgetDecimalFormat(Locale locale) booleanisFormulaFormat(String value) protected booleanisNumberChar(Character current, Locale locale) booleanisValidFormulaFormat(String value, Locale locale) Rudimentary checks if the given string could be a valid formulareFormatFormulaValue(String formulaValue, Locale locale) Convert from a non-localized format to a localized.protected List<com.vaadin.flow.component.spreadsheet.FormulaFormatter.FormulaToken>tokenizeFormula(String formulaValue, Locale from) protected StringtokensToString(List<com.vaadin.flow.component.spreadsheet.FormulaFormatter.FormulaToken> tokens) unFormatFormulaValue(String formulaValue, Locale locale) Convert from a localized format to a non-localized.protected List<com.vaadin.flow.component.spreadsheet.FormulaFormatter.FormulaToken>unLocalizeTokens(List<com.vaadin.flow.component.spreadsheet.FormulaFormatter.FormulaToken> tokens, Locale locale)
-
Constructor Details
-
FormulaFormatter
public FormulaFormatter()
-
-
Method Details
-
unFormatFormulaValue
Convert from a localized format to a non-localized.- Parameters:
formulaValue- the value that should be convertedlocale- the locale of the given value- Returns:
- the non-localized formula
-
reFormatFormulaValue
Convert from a non-localized format to a localized.- Parameters:
formulaValue- the value that should be convertedlocale- the target locale- Returns:
- the localized formula
-
isFormulaFormat
-
isValidFormulaFormat
Rudimentary checks if the given string could be a valid formula- Parameters:
value- whole formula as a string, must start with '=' or '+'locale- the current locale- Returns:
- true if the formula could be valid
-
tokensToString
-
unLocalizeTokens
-
tokenizeFormula
-
isNumberChar
-
getDecimalFormat
-
getCurrentDecimalSeparator
-