bibliothek.gui.dock.common
Class FontMap

java.lang.Object
  extended by bibliothek.gui.dock.common.FontMap

public class FontMap
extends java.lang.Object

A map containing FontModifiers. Each FontMap is associated with exactly one CDockable. This map is used to set the font of various elements like titles or tabs. Changes in the map will immediately be forwarded and applied.

Author:
Benjamin Sigg

Field Summary
static java.lang.String FONT_KEY_MINIMIZED_BUTTON
          key for font used on the button for a minimized dokable
static java.lang.String FONT_KEY_MINIMIZED_BUTTON_FOCUSED
          key for font used on the focused button for a minimized dokable
static java.lang.String FONT_KEY_TAB
          key for font used on a tab
static java.lang.String FONT_KEY_TAB_FOCUSED
          key for font used on a focused tab
static java.lang.String FONT_KEY_TAB_SELECTED
          key for font used on a selected tab
static java.lang.String FONT_KEY_TITLE
          key for font used in titles
static java.lang.String FONT_KEY_TITLE_FOCUSED
          key for font used in titles if the title is focused
 
Constructor Summary
FontMap(CDockable dockable)
          Creates a new map
 
Method Summary
 void addListener(FontMapListener listener)
          Adds a listener to this map.
 CDockable getDockable()
          Gets the owner of this map.
 FontModifier getFont(java.lang.String key)
          Gets the font which is associated with key.
 void removeFont(java.lang.String key)
          Ensures that the original font is used for key
 void removeListener(FontMapListener listener)
          Removes listener from this map.
 void setFont(java.lang.String key, java.awt.Font font)
          Sets the font which should be used for key.
 void setFont(java.lang.String key, FontModifier font)
          Sets the font for key.
 void setFont(java.lang.String key, java.lang.String... modifications)
          Tells to use a font that is derived from the original font of key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FONT_KEY_TITLE

public static final java.lang.String FONT_KEY_TITLE
key for font used in titles

See Also:
Constant Field Values

FONT_KEY_TITLE_FOCUSED

public static final java.lang.String FONT_KEY_TITLE_FOCUSED
key for font used in titles if the title is focused

See Also:
Constant Field Values

FONT_KEY_MINIMIZED_BUTTON

public static final java.lang.String FONT_KEY_MINIMIZED_BUTTON
key for font used on the button for a minimized dokable

See Also:
Constant Field Values

FONT_KEY_MINIMIZED_BUTTON_FOCUSED

public static final java.lang.String FONT_KEY_MINIMIZED_BUTTON_FOCUSED
key for font used on the focused button for a minimized dokable

See Also:
Constant Field Values

FONT_KEY_TAB

public static final java.lang.String FONT_KEY_TAB
key for font used on a tab

See Also:
Constant Field Values

FONT_KEY_TAB_SELECTED

public static final java.lang.String FONT_KEY_TAB_SELECTED
key for font used on a selected tab

See Also:
Constant Field Values

FONT_KEY_TAB_FOCUSED

public static final java.lang.String FONT_KEY_TAB_FOCUSED
key for font used on a focused tab

See Also:
Constant Field Values
Constructor Detail

FontMap

public FontMap(CDockable dockable)
Creates a new map

Parameters:
dockable - the owner of this map
Method Detail

getDockable

public CDockable getDockable()
Gets the owner of this map.

Returns:
the owner

addListener

public void addListener(FontMapListener listener)
Adds a listener to this map.

Parameters:
listener - the new listener

removeListener

public void removeListener(FontMapListener listener)
Removes listener from this map.

Parameters:
listener - the listener to remove

getFont

public FontModifier getFont(java.lang.String key)
Gets the font which is associated with key.

Parameters:
key - the key of the font
Returns:
the font or null

setFont

public void setFont(java.lang.String key,
                    java.awt.Font font)
Sets the font which should be used for key.

Parameters:
key - the key of the font
font - the new font, can be null

setFont

public void setFont(java.lang.String key,
                    java.lang.String... modifications)
Tells to use a font that is derived from the original font of key. There are different modifications possible, all have to be supplied in the same form: key=value.
Example: setFont( x, "i=!", "b=+", s=14" ); would create a modification that reverses the italic flag, sets any font to bold and creates only fonts of size 14

Parameters:
key - the key for the font
modifications - a set of modifications

removeFont

public void removeFont(java.lang.String key)
Ensures that the original font is used for key

Parameters:
key - the key which should no longer use a modified font

setFont

public void setFont(java.lang.String key,
                    FontModifier font)
Sets the font for key.

Parameters:
key - the key of the font
font - the new value or null to set the default value