public class FormatStringValue extends 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 |
|---|---|
protected Format |
format
the format used in creating the String representation.
|
| Constructor and Description |
|---|
FormatStringValue()
Instantiates a formatted converter with null format.
|
FormatStringValue(Format format)
Instantiates a formatted converter with the given Format.
|
| Modifier and Type | Method and Description |
|---|---|
Format |
getFormat() |
String |
getString(Object value)
Returns a string representation of the given value.
|
protected Format format
public FormatStringValue()
public FormatStringValue(Format format)
format - the format to use in creating the String representation.public Format getFormat()
public String getString(Object value)
PENDING JW: forgot - why not null return guaranteed?
getString in interface StringValuevalue - the object to present as a stringCopyright © 2017. All Rights Reserved.