Class FontTransmitter

java.lang.Object
bibliothek.gui.dock.common.intern.ui.UITransmitter<FontModifier,DockFont>
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 Details

    • FontTransmitter

      public FontTransmitter(FontManager manager, String... keys)
      Creates a new FontTransmitter.
      Parameters:
      manager - the source of original values
      keys - the keys which should be monitored by this transmitter
  • Method Details

    • getFirstNonNull

      protected FontModifier getFirstNonNull(FontMap map, 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, 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(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, 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