org.swixml.converters

Class FontConverter

Implemented Interfaces:
Converter

public class FontConverter
extends java.lang.Object
implements Converter

The FontConverter class defines / describes
Version:
$Revision: 1.1 $
Author:
Wolf Paulus
Since:
LiquidOffice 3.0

Field Summary

static Class
TEMPLATE
converter's return type

Method Summary

Object
convert(Class type, Attribute attr, Localizer localizer)
Convert the value of the given Attribute object into an output object of the specified type.
Class
convertsTo()
A Converters conversTo method informs about the Class type the converter is returning when its convert method is called

Field Details

TEMPLATE

public static final Class TEMPLATE
converter's return type

Method Details

convert

public Object convert(Class type,
                      Attribute attr,
                      Localizer localizer)
            throws Exception
Convert the value of the given Attribute object into an output object of the specified type. Returns the Font that the str argument describes. To ensure that this method returns the desired Font, format the str parameter in one of two ways:

"fontfamilyname-style-pointsize" or
"fontfamilyname style pointsize"

in which style is one of the three case-insensitive strings: "BOLD", "BOLDITALIC", or "ITALIC", and pointsize is a decimal representation of the point size. For example, if you want a font that is Arial, bold, and a point size of 18, you would call this method with: "Arial-BOLD-18".

The default size is 12 and the default style is PLAIN. If you don't specify a valid size, the returned Font has a size of 12. If you don't specify a valid style, the returned Font has a style of PLAIN. If you do not provide a valid font family name in the str argument, this method still returns a valid font with a family name of "dialog". To determine what font family names are available on your system, use the GraphicsEnvironment.getAvailableFontFamilyNames() method. If str is null, a new Font is returned with the family name "dialog", a size of 12 and a PLAIN style. If str is null, a new Font is returned with the name "dialog", a size of 12 and a PLAIN style.

Specified by:
convert in interface Converter
Parameters:
type - Class Data type to which the Attribute's value should be converted
attr - Attribute the attribute, providing the value to be converted.
Returns:
the Font object that str describes, or a new default Font if str is null.

convertsTo

public Class convertsTo()
A Converters conversTo method informs about the Class type the converter is returning when its convert method is called
Specified by:
convertsTo in interface Converter
Returns:
Class - the Class the converter is returning when its convert method is called

Copyright B) 2002 - 2005 - Wolf Paulus - CarlsbadCubes.com . All rights reserved.