Package pulse.properties
Class NumericPropertyFormatter
- java.lang.Object
-
- javax.swing.JFormattedTextField.AbstractFormatter
-
- pulse.properties.NumericPropertyFormatter
-
- All Implemented Interfaces:
Serializable
public class NumericPropertyFormatter extends JFormattedTextField.AbstractFormatter
- Author:
- Artem Lunev
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static doubleLOWER_LIMITStart using scientific notations for number whose absolute values are lower than 0.01.static doubleUPPER_LIMITStart using scientific notations for number whose absolute values are larger than 10000.0.
-
Constructor Summary
Constructors Constructor Description NumericPropertyFormatter(NumericProperty p, boolean convertDimension, boolean addHtmlTags)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareHtmlTagsAdded()SegmentgetBounds()booleanisDimensionConverted()NumberFormatnumberFormat(NumericProperty p)ObjectstringToValue(String arg0)StringvalueToString(Object o)Used to print out a nicevaluefor GUI applications and for exporting.-
Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter
clone, getActions, getDocumentFilter, getFormattedTextField, getNavigationFilter, install, invalidEdit, setEditValid, uninstall
-
-
-
-
Field Detail
-
UPPER_LIMIT
public static final double UPPER_LIMIT
Start using scientific notations for number whose absolute values are larger than 10000.0.- See Also:
- Constant Field Values
-
LOWER_LIMIT
public static final double LOWER_LIMIT
Start using scientific notations for number whose absolute values are lower than 0.01.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NumericPropertyFormatter
public NumericPropertyFormatter(NumericProperty p, boolean convertDimension, boolean addHtmlTags)
- Parameters:
convertDimension- iftrue, the output will be thevalue * dimensionFactor
-
-
Method Detail
-
numberFormat
public NumberFormat numberFormat(NumericProperty p)
-
stringToValue
public Object stringToValue(String arg0) throws ParseException
- Specified by:
stringToValuein classJFormattedTextField.AbstractFormatter- Throws:
ParseException
-
valueToString
public String valueToString(Object o) throws ParseException
Used to print out a nicevaluefor GUI applications and for exporting.Will use a
DecimalFormatto reduce the number of digits, if necessary. Automatically detects whether it is dealing withintordoublevalues, and adjust formatting accordingly. Iferror != null, will use the latter as the error value, which is separated from the main value by a plus-minus sign.- Specified by:
valueToStringin classJFormattedTextField.AbstractFormatter- Returns:
- a nice
Stringrepresenting thevalueof thisNumericPropertyand itserror - Throws:
ParseException
-
isDimensionConverted
public boolean isDimensionConverted()
-
areHtmlTagsAdded
public boolean areHtmlTagsAdded()
-
getBounds
public Segment getBounds()
-
-