Class FloatFormatter
java.lang.Object
org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
org.eclipse.nebula.widgets.formattedtext.NumberFormatter
org.eclipse.nebula.widgets.formattedtext.FloatFormatter
- All Implemented Interfaces:
java.util.EventListener,ITextFormatter,org.eclipse.swt.events.VerifyListener,org.eclipse.swt.internal.SWTEventListener
public class FloatFormatter extends NumberFormatter
This class provides formatting of
Float values in a
FormattedText.NumberFormatter returns different numeric types based on the current value in the Text field. FloatFormatter is an override of NumberFormatter allowing to guaranty to always return Float values (Number.floatValue()).
-
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, zeroIntLenFields inherited from class org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
EMPTY, ignore, SPACE, text -
Constructor Summary
Constructors Constructor Description FloatFormatter()FloatFormatter(java.lang.String editPattern)FloatFormatter(java.lang.String editPattern, java.lang.String displayPattern)FloatFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc)FloatFormatter(java.lang.String editPattern, java.util.Locale loc)FloatFormatter(java.util.Locale loc) -
Method Summary
Modifier and Type Method Description java.lang.ObjectgetValue()Returns the current value of the text control if it is a validFloat.java.lang.Class<java.lang.Float>getValueType()Returns the type of value thisITextFormatterhandles, i.e. returns ingetValue().
A FloatFormatter always returns a Float value.Methods inherited from class org.eclipse.nebula.widgets.formattedtext.NumberFormatter
clearText, format, getDefaultPattern, getDisplayString, getEditString, isEmpty, isValid, setDecimalSeparatorAlwaysShown, setFixedLengths, setPatterns, setPrefix, setSuffix, setValue, verifyTextMethods inherited from class org.eclipse.nebula.widgets.formattedtext.AbstractFormatter
beep, detach, setIgnore, setText, updateText, updateText
-
Constructor Details
-
FloatFormatter
public FloatFormatter() -
FloatFormatter
public FloatFormatter(java.util.Locale loc) -
FloatFormatter
public FloatFormatter(java.lang.String editPattern, java.util.Locale loc) -
FloatFormatter
public FloatFormatter(java.lang.String editPattern, java.lang.String displayPattern, java.util.Locale loc) -
FloatFormatter
public FloatFormatter(java.lang.String editPattern, java.lang.String displayPattern) -
FloatFormatter
public FloatFormatter(java.lang.String editPattern)
-
-
Method Details
-
getValue
public java.lang.Object getValue()Returns the current value of the text control if it is a validFloat. If the buffer is flagged as modified, the value is recalculated by parsing with thenfEditinitialized with the edit pattern. If the number is not valid, returnsnull.- Specified by:
getValuein interfaceITextFormatter- Overrides:
getValuein classNumberFormatter- Returns:
- current number value if valid,
nullelse - See Also:
ITextFormatter.getValue()
-
getValueType
public java.lang.Class<java.lang.Float> getValueType()Returns the type of value thisITextFormatterhandles, i.e. returns ingetValue().
A FloatFormatter always returns a Float value.- Specified by:
getValueTypein interfaceITextFormatter- Overrides:
getValueTypein classNumberFormatter- Returns:
- The value type.
-