Package org.jdesktop.swingx.renderer
Class FormatStringValue
java.lang.Object
org.jdesktop.swingx.renderer.FormatStringValue
- All Implemented Interfaces:
Serializable
,StringValue
Base type for
Format
-backed StringValue
. Has
static defaults for Date and Number which use the locale-dependent default
Format
s as returned from xxFormat.getInstance().
This class is intended to ease the handling of formatted cell content.
F.i. to show a list of Date
s in the default
Locale
's FULL version and right align the text:
StringValue stringValue = new FormatStringValue(
DateFormat.getInstance(DateFormat.FULL));
list.setCellRenderer(
new DefaultListRenderer(stringValue, JLabel.RIGHT);
PENDING: need to update on Locale change? How to detect? When?- Author:
- Jeanette Winzenburg
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a formatted converter with null format.FormatStringValue
(Format format) Instantiates a formatted converter with the given Format. -
Method Summary
-
Field Details
-
format
the format used in creating the String representation.
-
-
Constructor Details
-
FormatStringValue
public FormatStringValue()Instantiates a formatted converter with null format. -
FormatStringValue
Instantiates a formatted converter with the given Format.- Parameters:
format
- the format to use in creating the String representation.
-
-
Method Details
-
getFormat
- Returns:
- the format used in creating the String representation.
-
getString
Returns a string representation of the given value.PENDING JW: forgot - why not null return guaranteed?
- Specified by:
getString
in interfaceStringValue
- Parameters:
value
- the object to present as a string- Returns:
- a string representation of the given value, guaranteed to be not null
-