Package snap.text
Class NumberFormat
java.lang.Object
snap.props.PropObject
snap.text.NumberFormat
- All Implemented Interfaces:
Cloneable
,PropChange.DoChange
,TextFormat
,XMLArchiver.Archivable
A class to format tick labels.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected DecimalFormat
protected String
static final NumberFormat
static final String
protected static String
static final String
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
ConstructorDescriptionConstructor.NumberFormat
(String aPattern) Constructor.NumberFormat
(String aPattern, NumberFormat.ExpStyle anExpStyle) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Standard clone implementation.copyForProps
(Object... theProps) Copy object for given array of property names and values.boolean
Standard equals implementation.format
(double aValue) Returns a formatted value.Returns a formatted value.fromXML
(XMLArchiver anArchiver, XMLElement anElement) Unarchival.protected int
getExponentForValue
(double aValue) Returns the exponent for given value.Returns the exponent style.protected DecimalFormat
Returns the DecimalFormat.static NumberFormat
getFormat
(TextFormat aFormat) Returns a NumberFormat or null.static NumberFormat
getFormatOrDefault
(TextFormat aFormat) Returns a NumberFormat or DEFAULT.Returns the format pattern.getPropValue
(String aPropName) Returns the prop value for given key.int
hashCode()
Standard hashCode implementation.protected void
Override to register props.boolean
Returns whether pattern is set.protected void
setExpStyle
(NumberFormat.ExpStyle anExpStyle) Sets the exponent style.void
setPattern
(String aPattern) Sets the format pattern.void
setPropValue
(String aPropName, Object aValue) Sets the prop value for given key.toString()
Standard toString implementation.toXML
(XMLArchiver anArchiver) Archival.Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, firePropChange, firePropChange, firePropChange, getPropDefault, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropsString, setPropValues, toStringProps
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface snap.text.TextFormat
formatStyle
-
Field Details
-
_pattern
-
_format
-
NULL_PATTERN
-
Pattern_Prop
- See Also:
-
ExpStyle_Prop
- See Also:
-
DEFAULT
-
-
Constructor Details
-
NumberFormat
public NumberFormat()Constructor. -
NumberFormat
Constructor. -
NumberFormat
Constructor.
-
-
Method Details
-
isPatternSet
public boolean isPatternSet()Returns whether pattern is set. -
getPattern
Returns the format pattern.- Specified by:
getPattern
in interfaceTextFormat
-
setPattern
Sets the format pattern.- Specified by:
setPattern
in interfaceTextFormat
-
getFormat
Returns the DecimalFormat. -
getExpStyle
Returns the exponent style. -
setExpStyle
Sets the exponent style. -
format
Returns a formatted value.- Specified by:
format
in interfaceTextFormat
-
format
Returns a formatted value. -
getExponentForValue
protected int getExponentForValue(double aValue) Returns the exponent for given value. -
copyForProps
Copy object for given array of property names and values. -
clone
Standard clone implementation.- Overrides:
clone
in classPropObject
-
equals
Standard equals implementation. -
hashCode
public int hashCode()Standard hashCode implementation. -
toString
Standard toString implementation.- Overrides:
toString
in classPropObject
-
initProps
Override to register props.- Overrides:
initProps
in classPropObject
-
getPropValue
Returns the prop value for given key.- Overrides:
getPropValue
in classPropObject
-
setPropValue
Sets the prop value for given key.- Overrides:
setPropValue
in classPropObject
-
toXML
Archival.- Specified by:
toXML
in interfaceXMLArchiver.Archivable
-
fromXML
Unarchival.- Specified by:
fromXML
in interfaceXMLArchiver.Archivable
-
getFormat
Returns a NumberFormat or null. -
getFormatOrDefault
Returns a NumberFormat or DEFAULT.
-