Class UITransmitter<V,U extends UIValue<V>>

java.lang.Object
bibliothek.gui.dock.common.intern.ui.UITransmitter<V,U>
Type Parameters:
V - the kind of value that is described by the UIValue
U - the kind of UIValue used in this transmitter
All Implemented Interfaces:
UIBridge<V,U>
Direct Known Subclasses:
ColorTransmitter, FontTransmitter

public abstract class UITransmitter<V,U extends UIValue<V>> extends Object implements UIBridge<V,U>
An UITransmitter listens to some kind of map and updates some UIValues when the contents of that map change.
Author:
Benjamin Sigg
  • Constructor Details

    • UITransmitter

      public UITransmitter(String... keys)
      Creates a new ColorTransmitter.
      Parameters:
      keys - the keys which should be monitored by this transmitter
  • Method Details

    • add

      public void add(String id, U value)
      Specified by:
      add in interface UIBridge<V,U extends UIValue<V>>
    • remove

      public void remove(String id, U value)
      Specified by:
      remove in interface UIBridge<V,U extends UIValue<V>>
    • setControl

      public void setControl(CControl control)
      Sets the CControl which should be observed for new CDockables by this transmitter.
      Parameters:
      control - the observed control, can be null
    • set

      public void set(String id, V value, U observer)
      Specified by:
      set in interface UIBridge<V,U extends UIValue<V>>
    • get

      protected abstract V get(V value, String id, U observer)
      Called when a value needs to be set whose key has been registered at this UITransmitter.
      Parameters:
      value - the original value
      id - the key of the value
      observer - the destination for the value
      Returns:
      the value that should be set to observer
    • update

      protected abstract void update(CDockable dockable, String key, V value)
      Called when a value in an observed map has changed.
      Parameters:
      dockable - the owner of the map
      key - the name of the changed value
      value - the new value in the map, can be null
    • getDockable

      protected abstract CDockable getDockable(U observer)
      Gets the CDockable which is associated with observer.
      Parameters:
      observer - some observer
      Returns:
      the associated dockable or null
    • set

      protected void set(String id, V value, CDockable dockable)
      Transmits value to all UIValues which listen to the given id and which are associated with dockable.
      Parameters:
      id - the id of the changed value
      value - the new value, might be null
      dockable - the associated dockable, might be null
    • connect

      protected abstract void connect(CDockable dockable)
      Adds a listener to dockable and calls update(CDockable, String, Object) whenever some value needs an update.
      Parameters:
      dockable - the element to observe
    • disconnect

      protected abstract void disconnect(CDockable dockable)
      Removes a listener from dockable.
      Parameters:
      dockable - the element from which a listener should be removed