public class FormatStringValue extends java.lang.Object implements StringValue
Format-backed StringValue. Has
static defaults for Date and Number which use the locale-dependent default
Formats as returned from xxFormat.getInstance().
This class is intended to ease the handling of formatted cell content.
F.i. to show a list of Dates 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?| Modifier and Type | Field and Description |
|---|---|
static FormatStringValue |
DATE_TO_STRING
Deprecated.
Use
StringValues.DATE_TO_STRING instead |
protected java.text.Format |
format
the format used in creating the String representation.
|
static FormatStringValue |
NUMBER_TO_STRING
Deprecated.
Use
StringValues.NUMBER_TO_STRING instead |
EMPTY, TO_STRING| Constructor and Description |
|---|
FormatStringValue()
Instantiates a formatted converter with null format.
|
FormatStringValue(java.text.Format format)
Instantiates a formatted converter with the given Format.
|
@Deprecated public static final FormatStringValue DATE_TO_STRING
StringValues.DATE_TO_STRING insteadDate types. Uses the default format
as returned from DateFormat.@Deprecated public static final FormatStringValue NUMBER_TO_STRING
StringValues.NUMBER_TO_STRING insteadNumber types. Uses the default format
as returned from NumberFormat.protected java.text.Format format
public FormatStringValue()
public FormatStringValue(java.text.Format format)
format - the format to use in creating the String representation.public java.text.Format getFormat()
public java.lang.String getString(java.lang.Object value)
PENDING JW: forgot - why not null return guaranteed?
getString in interface StringValuevalue - the object to present as a string