|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.renderer.FormatStringValue
public class FormatStringValue
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?
Field Summary | |
---|---|
static FormatStringValue |
DATE_TO_STRING
Default converter for Date types. |
protected java.text.Format |
format
the format used in creating the String representation. |
static FormatStringValue |
NUMBER_TO_STRING
Default converter for Number types. |
Fields inherited from interface org.jdesktop.swingx.renderer.StringValue |
---|
EMPTY, TO_STRING |
Constructor Summary | |
---|---|
FormatStringValue()
Instantiates a formatted converter with null format. |
|
FormatStringValue(java.text.Format format)
Instantiates a formatted converter with the given Format. |
Method Summary | |
---|---|
java.text.Format |
getFormat()
|
java.lang.String |
getString(java.lang.Object value)
Returns a string representation of the given value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final FormatStringValue DATE_TO_STRING
Date
types. Uses the default format
as returned from DateFormat
.
public static final FormatStringValue NUMBER_TO_STRING
Number
types. Uses the default format
as returned from NumberFormat
.
protected java.text.Format format
Constructor Detail |
---|
public FormatStringValue()
public FormatStringValue(java.text.Format format)
format
- the format to use in creating the String representation.Method Detail |
---|
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 StringValue
value
- the object to present as a string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |