com.kiwisoft.utils.format
Interface TextFormat

All Superinterfaces:
ObjectFormat
All Known Implementing Classes:
DefaultObjectFormat

public interface TextFormat
extends ObjectFormat

Interface class for displaying objects in UI text components like table cells, lists, labels and text fields.

Version:
$Revision: 1.1 $, $Date: 2006/03/18 15:57:42 $
Author:
Stefan Stiller

Field Summary
 
Fields inherited from interface com.kiwisoft.utils.format.ObjectFormat
DEFAULT
 
Method Summary
 String format(Object value)
          Returns the String representing the specified value.
 int getHorizontalAlignment(Object value)
          Returns the horizontal alignment of the formatted text.
 Icon getIcon(Object value)
          Returns the icon for the specified value;
 Object parse(String value, Class targetClass)
          Returns the Object created from the specified String.
 
Methods inherited from interface com.kiwisoft.utils.format.ObjectFormat
canFormat, canParse, getGroup, getName
 

Method Detail

getHorizontalAlignment

public int getHorizontalAlignment(Object value)
Returns the horizontal alignment of the formatted text.

Parameters:
value - The unformated value.
Returns:
One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING. TRAILING.

getIcon

public Icon getIcon(Object value)
Returns the icon for the specified value;

Parameters:
value - The unformated value.
Returns:
The icon for the specified value (can be null).

format

public String format(Object value)
Returns the String representing the specified value.

Parameters:
value - The object which should be formated.
Returns:
The string representing the specified object.
See Also:
ObjectFormat.canFormat(Class)

parse

public Object parse(String value,
                    Class targetClass)
Returns the Object created from the specified String. The method may throw an RuntimeException if the String is invalid.

Parameters:
value - The String which should be parsed.
targetClass - The Class the return value should have. Can be ignored if the format handles only one class.
Returns:
The Object created from the String.
See Also:
ObjectFormat.canParse(Class)