jimm.datavision.field
Class FormattedValueCache
java.lang.Object
jimm.datavision.field.FormattedValueCache
- All Implemented Interfaces:
- java.util.Observer
class FormattedValueCache
- extends java.lang.Object
- implements java.util.Observer
Helps avoid multiple expensive formatting and font size calculations. Each
Field
holds on to one of these and asks it for the formatted
(wrapped) version of its value or the height needed to output the formatted
value.
- Author:
- Jim Menard, jimm@io.com
Method Summary |
(package private) void |
calcValues()
Cacluates formatted (wrapped) string and output height. |
protected void |
finalize()
|
protected java.text.SimpleDateFormat |
getDateFormatterFor(java.lang.String formatString)
|
(package private) java.lang.String |
getFormattedString(java.lang.Object val)
|
protected java.text.DecimalFormat |
getNumberFormatterFor(java.lang.String formatString)
|
(package private) double |
getOutputHeight(java.lang.Object val)
|
protected static javax.swing.JLabel |
getWrappingCalcsLabel()
|
protected boolean |
notSameAs(java.lang.Object otherValue)
|
void |
update(java.util.Observable o,
java.lang.Object arg)
When format changes, erase value so we recalculate it |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LINE_SIZE_FUDGE_FACTOR
protected static final double LINE_SIZE_FUDGE_FACTOR
- See Also:
- Constant Field Values
decimalFormatters
protected static final java.util.HashMap decimalFormatters
dateFormatters
protected static final java.util.HashMap dateFormatters
wrappingCalculationsLabel
protected static javax.swing.JLabel wrappingCalculationsLabel
field
protected Field field
value
protected java.lang.Object value
formatted
protected java.lang.String formatted
height
protected double height
FormattedValueCache
FormattedValueCache(Field f)
finalize
protected void finalize()
throws java.lang.Throwable
- Overrides:
finalize
in class java.lang.Object
- Throws:
java.lang.Throwable
update
public void update(java.util.Observable o,
java.lang.Object arg)
- When format changes, erase value so we recalculate it
- Specified by:
update
in interface java.util.Observer
getFormattedString
java.lang.String getFormattedString(java.lang.Object val)
getOutputHeight
double getOutputHeight(java.lang.Object val)
notSameAs
protected boolean notSameAs(java.lang.Object otherValue)
calcValues
void calcValues()
- Cacluates formatted (wrapped) string and output height.
getNumberFormatterFor
protected java.text.DecimalFormat getNumberFormatterFor(java.lang.String formatString)
getDateFormatterFor
protected java.text.SimpleDateFormat getDateFormatterFor(java.lang.String formatString)
getWrappingCalcsLabel
protected static javax.swing.JLabel getWrappingCalcsLabel()