com.tensegrity.gui.formatitems
Class FontItem

java.lang.Object
  extended bycom.tensegrity.gui.formatitems.FontItem
All Implemented Interfaces:
FormatItem

public class FontItem
extends java.lang.Object
implements FormatItem

A FontItem encapsulates the font format data and provides methods for accessing and changing them.

Changing a FontFormat without creating and pooling it is very often needed within font editors, where a typical user want to try out different fonts before he makes a decision.

Version:
$Id: FontItem.java,v 1.5 2005/03/21 10:33:48 ArndHouben Exp $
Author:
Arnd Houben

Constructor Summary
FontItem(FontFormat ff)
          Constructor which creates a FontItem from a given FontFormat.
FontItem(int size, int weight, java.lang.String family, int color, boolean italic, boolean underline, boolean strikethrough)
          Constructor which takes initial values for each FontItem data field.
 
Method Summary
 int getColor()
          Returns the current FontItem color
 java.lang.String getDescription()
          Returns the canonical description used to create a format.
 java.lang.String getFamily()
          Returns the current font family of the FontItem
 Format getFormat()
          Returns a new format.
 java.lang.Object[] getFormatData()
          Returns all format parameters
 int getSize()
          Returns the currently used font size.
 int getWeight()
          Returns the currently used font weight.
 boolean isItalic()
          Checks if FontItem is in italic state.
 boolean isStrikethrough()
          Checks if the current FontItem is strikethrough.
 boolean isUnderline()
          Checks if this FontItem is underlined.
 void setColor(int color)
          Sets the current FontItem color
 void setFamily(java.lang.String family)
          Changes the currently used font family.
 void setItalic(boolean italic)
          Sets the italic field of this FontItem.
 void setSize(int size)
          Sets the currently used font size.
 void setStrikethrough(boolean strikethrough)
          Sets the strikethrough field of this FontItem.
 void setUnderline(boolean underline)
          Sets the underlined field of this FontItem.
 void setWeight(int weight)
          Changes the font weight of this FontItem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontItem

public FontItem(FontFormat ff)
Constructor which creates a FontItem from a given FontFormat.

Parameters:
ff - a FontFormat instance

FontItem

public FontItem(int size,
                int weight,
                java.lang.String family,
                int color,
                boolean italic,
                boolean underline,
                boolean strikethrough)
Constructor which takes initial values for each FontItem data field.

Parameters:
size - initial font size
weight - initial font weight
family - initial font family
color - initial font color
italic - set to true if initial font is italic, false otherwise
underline - set to true if initial font is underlined, false otherwise
strikethrough - set to true if initial font is strikethrough, false otherwise
Method Detail

getFormat

public Format getFormat()
                 throws StaticException
Description copied from interface: FormatItem
Returns a new format. Usually it is pooled within a FormatPool.

Specified by:
getFormat in interface FormatItem
Returns:
the pooled new Format instance
Throws:
StaticException - if something goes wrong during format creation

getDescription

public java.lang.String getDescription()
Description copied from interface: FormatItem
Returns the canonical description used to create a format.

Specified by:
getDescription in interface FormatItem
Returns:
a canonical description of this Format

getFormatData

public java.lang.Object[] getFormatData()
Description copied from interface: FormatItem
Returns all format parameters

Specified by:
getFormatData in interface FormatItem
Returns:
any array of all format parameters

getColor

public final int getColor()
Returns the current FontItem color

Returns:
int representing the current color in Tensegrity color format

setColor

public final void setColor(int color)
Sets the current FontItem color

Parameters:
color - new color in Tensegrity format

getFamily

public final java.lang.String getFamily()
Returns the current font family of the FontItem

Returns:
the name of the currently used font family

setFamily

public final void setFamily(java.lang.String family)
Changes the currently used font family.

Parameters:
family - the font family name

isItalic

public final boolean isItalic()
Checks if FontItem is in italic state.

Returns:
true if current font item is italic, false otherwise

setItalic

public final void setItalic(boolean italic)
Sets the italic field of this FontItem.

Parameters:
italic - true to indicate that the FontItem is italic, false otherwise

getSize

public final int getSize()
Returns the currently used font size.

Returns:
the font size

setSize

public final void setSize(int size)
Sets the currently used font size.

Parameters:
size - the new font size

isStrikethrough

public final boolean isStrikethrough()
Checks if the current FontItem is strikethrough.

Returns:
true if FontItem is strikethrough, false otherwise

setStrikethrough

public final void setStrikethrough(boolean strikethrough)
Sets the strikethrough field of this FontItem.

Parameters:
strikethrough - true to indicate that this FontItem is strikethrough, false otherwise

isUnderline

public final boolean isUnderline()
Checks if this FontItem is underlined.

Returns:
true if this FontItem is underlined, false otherwise

setUnderline

public final void setUnderline(boolean underline)
Sets the underlined field of this FontItem.

Parameters:
underline - true to indicate that this FontItem is underlined, false otherwise

getWeight

public final int getWeight()
Returns the currently used font weight.

Returns:
the font weight

setWeight

public final void setWeight(int weight)
Changes the font weight of this FontItem.

Parameters:
weight - the new font weight


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.