org.jdesktop.swingx.renderer
Class FormatStringValue

java.lang.Object
  extended by org.jdesktop.swingx.renderer.FormatStringValue
All Implemented Interfaces:
Serializable, StringValue

public class FormatStringValue
extends Object
implements StringValue

Base type for Format-backed StringValue. Has static defaults for Date and Number.

PENDING: need to update on Locale change? How to detect? When?

See Also:
Serialized Form

Field Summary
static FormatStringValue DATE_TO_STRING
          Default converter for Date types.
protected  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(Format format)
          Instantiates a formatted converter with the given Format.
 
Method Summary
 Format getFormat()
           
 String getString(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

DATE_TO_STRING

public static final FormatStringValue DATE_TO_STRING
Default converter for Date types. Uses the default format as returned from DateFormat.


NUMBER_TO_STRING

public static final FormatStringValue NUMBER_TO_STRING
Default converter for Number types. Uses the default format as returned from NumberFormat.


format

protected Format format
the format used in creating the String representation.

Constructor Detail

FormatStringValue

public FormatStringValue()
Instantiates a formatted converter with null format.


FormatStringValue

public FormatStringValue(Format format)
Instantiates a formatted converter with the given Format.

Parameters:
format - the format to use in creating the String representation.
Method Detail

getFormat

public Format getFormat()
Returns:
the format used in creating the String representation.

getString

public String getString(Object value)
Returns a string representation of the given value.

Specified by:
getString in interface StringValue
Parameters:
value - the object to present as a string
Returns:
a string representation of the given value, guaranteed to be not null