Class BigIntegerFormatter
java.lang.Object
org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
org.eclipse.nebula.widgets.formattedtext.NumberFormatter
org.eclipse.nebula.widgets.formattedtext.BigIntegerFormatter
- All Implemented Interfaces:
java.util.EventListener
,ITextFormatter
,org.eclipse.swt.events.VerifyListener
,org.eclipse.swt.internal.SWTEventListener
public class BigIntegerFormatter extends NumberFormatter
This class provides formatting of
BigInteger
values in a FormattedText
.
BigIntegerFormatter returns different numeric types based on the current
value in the Text field. BigIntegerFormatter is an override of NumberFormatter
allowing to guaranty to always return BigInteger
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 BigIntegerFormatter()
Constructs a new instance with all defaults.BigIntegerFormatter(java.lang.String editPattern)
Constructs a new instance with the given edit mask.BigIntegerFormatter(java.lang.String editPattern, java.lang.String displayPattern)
Constructs a new instance with the given edit and display masks.BigIntegerFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc)
Constructs a new instance with the given masks and locale.BigIntegerFormatter(java.lang.String editPattern, java.util.Locale loc)
Constructs a new instance with the given edit mask and locale.BigIntegerFormatter(java.util.Locale loc)
Constructs a new instance with default edit and display masks for the given locale. -
Method Summary
Modifier and Type Method Description java.lang.Object
getValue()
Returns the current value of the text control if it is a validBigInteger
.java.lang.Class<java.math.BigInteger>
getValueType()
Returns the type of value thisITextFormatter
handles, i.e. returns ingetValue()
.
An BigIntegerFormatter always returns an BigInteger 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
-
BigIntegerFormatter
public BigIntegerFormatter()Constructs a new instance with all defaults.- See Also:
NumberFormatter()
-
BigIntegerFormatter
public BigIntegerFormatter(java.util.Locale loc)Constructs a new instance with default edit and display masks for the given locale.- Parameters:
loc
- thelocale
-
BigIntegerFormatter
public BigIntegerFormatter(java.lang.String editPattern, java.util.Locale loc)Constructs a new instance with the given edit mask and locale. Display mask is identical to the edit mask.- Parameters:
editPattern
- the edit maskloc
- thelocale
-
BigIntegerFormatter
public BigIntegerFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc)Constructs a new instance with the given masks and locale.- Parameters:
editPattern
- the edit maskdisplayPattern
- the display maskloc
- thelocale
-
BigIntegerFormatter
public BigIntegerFormatter(java.lang.String editPattern, java.lang.String displayPattern)Constructs a new instance with the given edit and display masks. Uses the default locale.- Parameters:
editPattern
- the edit maskdisplayPattern
- the display mask
-
BigIntegerFormatter
public BigIntegerFormatter(java.lang.String editPattern)Constructs a new instance with the given edit mask. Display mask is identical to the edit mask, and locale is the default one.- Parameters:
editPattern
- the edit mask
-
-
Method Details
-
getValue
public java.lang.Object getValue()Returns the current value of the text control if it is a validBigInteger
. 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
BigInteger
value if valid, elsenull
- See Also:
ITextFormatter.getValue()
-
getValueType
public java.lang.Class<java.math.BigInteger> getValueType()Returns the type of value thisITextFormatter
handles, i.e. returns ingetValue()
.
An BigIntegerFormatter always returns an BigInteger value.- Specified by:
getValueType
in interfaceITextFormatter
- Overrides:
getValueType
in classNumberFormatter
- Returns:
- The value type.
-