Class DoubleFormatter
java.lang.Object
org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
org.eclipse.nebula.widgets.formattedtext.NumberFormatter
org.eclipse.nebula.widgets.formattedtext.DoubleFormatter
- All Implemented Interfaces:
java.util.EventListener
,ITextFormatter
,org.eclipse.swt.events.VerifyListener
,org.eclipse.swt.internal.SWTEventListener
public class DoubleFormatter extends NumberFormatter
This class provides formatting of
Double
values in a
FormattedText
.NumberFormatter returns different numeric types based on the current value in the Text field. DoubleFormatter is an override of NumberFormatter allowing to guaranty to always return Double values (Number.doubleValue()).
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.formattedtext.NumberFormatter
alwaysShowDec, cachedPatterns, decimalLen, editPattern, editValue, fixedDec, fixedInt, groupLen, intCount, intLen, locale, minus, modified, nbspSeparator, negative, nfDisplay, nfEdit, prefixLen, suffixLen, symbols, value, zeroDecimalLen, zeroIntLen
Fields inherited from class org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
EMPTY, ignore, SPACE, text
-
Constructor Summary
Constructors Constructor Description DoubleFormatter()
DoubleFormatter(java.lang.String editPattern)
DoubleFormatter(java.lang.String editPattern, java.lang.String displayPattern)
DoubleFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc)
DoubleFormatter(java.lang.String editPattern, java.util.Locale loc)
DoubleFormatter(java.util.Locale loc)
-
Method Summary
Modifier and Type Method Description java.lang.Object
getValue()
Returns the current value of the text control if it is a validDouble
.java.lang.Class<java.lang.Double>
getValueType()
Returns the type of value thisITextFormatter
handles, i.e. returns ingetValue()
.
A DoubleFormatter always returns a Double value.Methods inherited from class org.eclipse.nebula.widgets.formattedtext.NumberFormatter
clearText, format, getDefaultPattern, getDisplayString, getEditString, isEmpty, isValid, setDecimalSeparatorAlwaysShown, setFixedLengths, setPatterns, setPrefix, setSuffix, setValue, verifyText
Methods inherited from class org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
beep, detach, setIgnore, setText, updateText, updateText
-
Constructor Details
-
DoubleFormatter
public DoubleFormatter() -
DoubleFormatter
public DoubleFormatter(java.util.Locale loc) -
DoubleFormatter
public DoubleFormatter(java.lang.String editPattern, java.util.Locale loc) -
DoubleFormatter
public DoubleFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc) -
DoubleFormatter
public DoubleFormatter(java.lang.String editPattern, java.lang.String displayPattern) -
DoubleFormatter
public DoubleFormatter(java.lang.String editPattern)
-
-
Method Details
-
getValue
public java.lang.Object getValue()Returns the current value of the text control if it is a validDouble
. If the buffer is flagged as modified, the value is recalculated by parsing with thenfEdit
initialized with the edit pattern. If the number is not valid, returnsnull
.- Specified by:
getValue
in interfaceITextFormatter
- Overrides:
getValue
in classNumberFormatter
- Returns:
- current number value if valid,
null
else - See Also:
ITextFormatter.getValue()
-
getValueType
public java.lang.Class<java.lang.Double> getValueType()Returns the type of value thisITextFormatter
handles, i.e. returns ingetValue()
.
A DoubleFormatter always returns a Double value.- Specified by:
getValueType
in interfaceITextFormatter
- Overrides:
getValueType
in classNumberFormatter
- Returns:
- The value type.
-