Class LongFormatter
java.lang.Object
org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
org.eclipse.nebula.widgets.formattedtext.NumberFormatter
org.eclipse.nebula.widgets.formattedtext.LongFormatter
- All Implemented Interfaces:
java.util.EventListener
,ITextFormatter
,org.eclipse.swt.events.VerifyListener
,org.eclipse.swt.internal.SWTEventListener
public class LongFormatter extends NumberFormatter
This class provides formatting of
Long
values in a
FormattedText
.NumberFormatter returns different numeric types based on the current value in the Text field. LongFormatter is an override of NumberFormatter allowing to guaranty to always return Long values (Number.longValue()).
-
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 LongFormatter()
LongFormatter(java.lang.String editPattern)
LongFormatter(java.lang.String editPattern, java.lang.String displayPattern)
LongFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc)
LongFormatter(java.lang.String editPattern, java.util.Locale loc)
LongFormatter(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 validLong
.java.lang.Class<java.lang.Long>
getValueType()
Returns the type of value thisITextFormatter
handles, i.e. returns ingetValue()
.
A LongFormatter always returns a Long 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
-
LongFormatter
public LongFormatter() -
LongFormatter
public LongFormatter(java.util.Locale loc) -
LongFormatter
public LongFormatter(java.lang.String editPattern, java.util.Locale loc) -
LongFormatter
public LongFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc) -
LongFormatter
public LongFormatter(java.lang.String editPattern, java.lang.String displayPattern) -
LongFormatter
public LongFormatter(java.lang.String editPattern)
-
-
Method Details
-
getValue
public java.lang.Object getValue()Returns the current value of the text control if it is a validLong
. 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.Long> getValueType()Returns the type of value thisITextFormatter
handles, i.e. returns ingetValue()
.
A LongFormatter always returns a Long value.- Specified by:
getValueType
in interfaceITextFormatter
- Overrides:
getValueType
in classNumberFormatter
- Returns:
- The value type.
-