SWIXML
1.6 (#161)

org.swixml.converters
Class FontConverter

java.lang.Object
  extended by org.swixml.converters.FontConverter
All Implemented Interfaces:
Converter

public class FontConverter
extends Object
implements Converter

The FontConverter class defines / describes

Since:
swixml 1.0
Version:
$Revision: 1.1 $
Author:
Wolf Paulus

Field Summary
static Class TEMPLATE
          converter's return type
 
Constructor Summary
FontConverter()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

public static final Class TEMPLATE
converter's return type

Constructor Detail

FontConverter

public FontConverter()
Method Detail

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.
Throws:
Exception

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

SWIXML
1.6 (#161)

Copyright 2002 - 2011 - Wolf Paulus - wolfpaulus.com. All rights reserved.