|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.monitorenter.gui.chart.labelformatters.ALabelFormatter
info.monitorenter.gui.chart.labelformatters.LabelFormatterUnit
public class LabelFormatterUnit
A label formatter that adds a constructor given
of the unit SI prefix to a decorated
AUnit.
IAxisLabelFormatter
The formatted Strings will be divided by a factor according to the chosen unit.
| Field Summary |
|---|
| Fields inherited from class info.monitorenter.gui.chart.labelformatters.ALabelFormatter |
|---|
m_propertyChangeSupport, UNIT_UNCHANGED |
| Fields inherited from interface info.monitorenter.gui.chart.IAxisLabelFormatter |
|---|
PROPERTY_FORMATCHANGE |
| Constructor Summary | |
|---|---|
LabelFormatterUnit(AUnit unit)
Default constructor that uses a
to add the unit feature to. |
|
LabelFormatterUnit(AUnit unit,
ALabelFormatter delegate)
Creates an instance that will add "unit-functionality" to the given formatter. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Registers a property change listener that will be informed about changes of the property identified by the given propertyName. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
format(double value)
Provide a String for the value. |
IAxis<?> |
getAxis()
Intended for AAxis only. |
int |
getMaxAmountChars()
Returns the maximum amount of characters that will be returned from IAxisLabelFormatter.format(double). |
double |
getMinimumValueShiftForChange()
Returns the minimum change in the value to format that will cause to return a different formatted String. |
double |
getNextEvenValue(double value,
boolean ceiling)
Returns the next "even" value to the given one. |
AUnit |
getUnit()
Returns ALabelFormatter.UNIT_UNCHANGED. |
int |
hashCode()
|
void |
initPaintIteration()
Void adapter method implementation - optional to override. |
java.lang.Number |
parse(java.lang.String formatted)
The reverse operation to . |
void |
removePropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
Deregisters a property change listener that has been registerd for listening on the given property. |
void |
setAxis(IAxis<?> axis)
Intended for AAxis only. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LabelFormatterUnit(AUnit unit)
LabelFormatterSimple
to add the unit feature to.
unit - the unit to use.
public LabelFormatterUnit(AUnit unit,
ALabelFormatter delegate)
unit - the unit to use.delegate - the formatter that will be decorated with units.| Method Detail |
|---|
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
IAxisLabelFormatterpropertyName.
addPropertyChangeListener in interface IAxisLabelFormatteraddPropertyChangeListener in class ALabelFormatterpropertyName - the name of the property the listener is interested inlistener - a listener that will only be informed if the property identified
by the argument propertyName changesIAxisLabelFormatter.addPropertyChangeListener(java.lang.String,
java.beans.PropertyChangeListener)public boolean equals(java.lang.Object obj)
equals in class ALabelFormatterObject.equals(java.lang.Object)public java.lang.String format(double value)
IAxisLabelFormatter
value - the value to format.
IAxisLabelFormatter.format(double)public IAxis<?> getAxis()
ALabelFormatterAAxis only.
getAxis in class ALabelFormatterALabelFormatter.getAxis()public int getMaxAmountChars()
ALabelFormatterIAxisLabelFormatter.format(double).
getMaxAmountChars in interface IAxisLabelFormattergetMaxAmountChars in class ALabelFormatterIAxisLabelFormatter.format(double).ALabelFormatter.getMaxAmountChars()public double getMinimumValueShiftForChange()
IAxisLabelFormatterTo achieve two different formatted Strings to be returned from the format method the corresponding values given to the format method have to differ at least by this value.
Some implementations (e.g. a formatter for date) have to use their own
format method an increas a value to determine when the first change will
occur. This is expensive and it's recommended that this action is performed
once only and the result is stored. Additionally this routine has to start
with an "even" (see IAxisLabelFormatter.getNextEvenValue(double, boolean)) value to
get a correct result (the distance from even number to even number).
IAxisLabelFormatter.getMinimumValueShiftForChange()
public double getNextEvenValue(double value,
boolean ceiling)
IAxisLabelFormatter
value - the value to get the next "even" value for.ceiling - if true, the next higher number will returned, else the next lower
one.
IAxisLabelFormatter.getNextEvenValue(double,
boolean)public AUnit getUnit()
ALabelFormatterALabelFormatter.UNIT_UNCHANGED.
getUnit in interface IAxisLabelFormattergetUnit in class ALabelFormatterALabelFormatter.UNIT_UNCHANGEDIAxisLabelFormatter.getUnit()public int hashCode()
hashCode in class ALabelFormatterObject.hashCode()public void initPaintIteration()
ALabelFormatter
initPaintIteration in interface IAxisLabelFormatterinitPaintIteration in class ALabelFormatterIAxisLabelFormatter.initPaintIteration()
public java.lang.Number parse(java.lang.String formatted)
throws java.lang.NumberFormatException
IAxisLabelFormatterIAxisLabelFormatter.format(double).
The given argument has to be in the format that will be generated by that
method or exceptions may be thrown.
test.parse(test.format(d))== d
has to be true if no rounding occurs by the formatter.
formatted - a String in the format that will be produced by
method IAxisLabelFormatter.format(double).
java.lang.NumberFormatException - if the format of the argument is invalid.IAxisLabelFormatter.parse(String)
public void removePropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
IAxisLabelFormatter
removePropertyChangeListener in interface IAxisLabelFormatterremovePropertyChangeListener in class ALabelFormatterproperty - the property the listener was registered to.listener - a listener that will only be informed if the property identified
by the argument propertyName changesALabelFormatter.removePropertyChangeListener(java.lang.String,
java.beans.PropertyChangeListener)public void setAxis(IAxis<?> axis)
ALabelFormatterAAxis only.
Do never invoke this! This is only public for package sorting reasons.
setAxis in interface IAxisLabelFormattersetAxis in class ALabelFormatteraxis - The m_axis to set.ALabelFormatter.setAxis(IAxis)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||