bibliothek.gui.dock.common.intern.font
Class FontTransmitter

java.lang.Object
  extended by bibliothek.gui.dock.common.intern.ui.UITransmitter<FontModifier,DockFont>
      extended by bibliothek.gui.dock.common.intern.font.FontTransmitter
All Implemented Interfaces:
FontBridge, UIBridge<FontModifier,DockFont>
Direct Known Subclasses:
ListFontTransmitter

public abstract class FontTransmitter
extends UITransmitter<FontModifier,DockFont>
implements FontBridge

A FontTransmitter observes some FontMap and transmits FontModifiers of these maps to a set of DockFonts.

Author:
Benjamin Sigg

Constructor Summary
FontTransmitter(FontManager manager, java.lang.String... keys)
          Creates a new FontTransmitter.
 
Method Summary
protected  void connect(CDockable dockable)
          Adds a listener to dockable and calls UITransmitter.update(CDockable, String, Object) whenever some value needs an update.
protected  void disconnect(CDockable dockable)
          Removes a listener from dockable.
protected abstract  FontModifier get(FontModifier value, java.lang.String id, CDockable dockable)
          Transforms value into the form that should be used together with dockable.
protected  FontModifier getFirstNonNull(FontMap map, java.lang.String... keys)
          Gets the first non- null color of map that matches a given key.
protected abstract  boolean isObservedMapKey(java.lang.String key)
          Tells whether key is one of the keys observed in the FontMap.
protected  void update(CDockable dockable, java.lang.String key, FontModifier value)
          Called when a value in an observed map has changed.
 
Methods inherited from class bibliothek.gui.dock.common.intern.ui.UITransmitter
add, get, getDockable, remove, set, set, setControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.util.UIBridge
add, remove, set
 

Constructor Detail

FontTransmitter

public FontTransmitter(FontManager manager,
                       java.lang.String... keys)
Creates a new FontTransmitter.

Parameters:
manager - the source of original values
keys - the keys which should be monitored by this transmitter
Method Detail

getFirstNonNull

protected FontModifier getFirstNonNull(FontMap map,
                                       java.lang.String... keys)
Gets the first non- null color of map that matches a given key.

Parameters:
map - a map of colors
keys - some keys that will be read from index 0 upward.
Returns:
the first Color that is not null or null

connect

protected void connect(CDockable dockable)
Description copied from class: UITransmitter
Adds a listener to dockable and calls UITransmitter.update(CDockable, String, Object) whenever some value needs an update.

Specified by:
connect in class UITransmitter<FontModifier,DockFont>
Parameters:
dockable - the element to observe

disconnect

protected void disconnect(CDockable dockable)
Description copied from class: UITransmitter
Removes a listener from dockable.

Specified by:
disconnect in class UITransmitter<FontModifier,DockFont>
Parameters:
dockable - the element from which a listener should be removed

update

protected void update(CDockable dockable,
                      java.lang.String key,
                      FontModifier value)
Description copied from class: UITransmitter
Called when a value in an observed map has changed.

Specified by:
update in class UITransmitter<FontModifier,DockFont>
Parameters:
dockable - the owner of the map
key - the name of the changed value
value - the new value in the map, can be null

isObservedMapKey

protected abstract boolean isObservedMapKey(java.lang.String key)
Tells whether key is one of the keys observed in the FontMap.

Parameters:
key - the key which might be observed
Returns:
true if a change of key can result in a change of fonts

get

protected abstract FontModifier get(FontModifier value,
                                    java.lang.String id,
                                    CDockable dockable)
Transforms value into the form that should be used together with dockable.

Parameters:
value - some default value for id
id - some of the keys specified for observation
dockable - the element for which the value would be used
Returns:
either value or a transformed version of value