bibliothek.gui.dock.dockable
Class DockHierarchyObserver

java.lang.Object
  extended by bibliothek.gui.dock.dockable.DockHierarchyObserver
All Implemented Interfaces:
DockHierarchyListener

public class DockHierarchyObserver
extends java.lang.Object
implements DockHierarchyListener

A helper class that is able to send DockHierarchyEvents to DockHierarchyListeners. A Dockable might have one instance of an observer. Whenever the parent-station of the Dockable changes, it calls update() and the observer ensures that all events are send properly. The client should call controllerChanged(DockController) whenever the DockController changes. This observer will automatically monitor the super-parents of its owner and fire events when necessary.

Author:
Benjamin Sigg

Constructor Summary
DockHierarchyObserver(Dockable owner)
          Creates a new observer.
 
Method Summary
 void addDockHierarchyListener(DockHierarchyListener listener)
          Stores a listener which is informed when the path of the owner has changed.
 void controllerChanged(DockController controller)
          Invoked by the owner in order to fire a DockHierarchyEvent
 void controllerChanged(DockHierarchyEvent event)
          Invoked whenever the controller of dockable has changed
protected  void fireControllerChanged(DockController controller)
          Informs all listeners that the controller of the owner has been changed.
protected  void fireHierarchyChanged()
          Fires a DockHierarchyEvent to all registered listeners.
 void hierarchyChanged(DockHierarchyEvent event)
          Called when the path of the observed Dockable has been changed.
 void removeDockHierarchyListener(DockHierarchyListener listener)
          Removes an earlier stored listener.
 void update()
          Builds up a new path of parents and adds this listeners to each parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockHierarchyObserver

public DockHierarchyObserver(Dockable owner)
Creates a new observer.

Parameters:
owner - the Dockable for which events are fired
Method Detail

hierarchyChanged

public void hierarchyChanged(DockHierarchyEvent event)
Description copied from interface: DockHierarchyListener
Called when the path of the observed Dockable has been changed.

Specified by:
hierarchyChanged in interface DockHierarchyListener
Parameters:
event - the new path

controllerChanged

public void controllerChanged(DockHierarchyEvent event)
Description copied from interface: DockHierarchyListener
Invoked whenever the controller of dockable has changed

Specified by:
controllerChanged in interface DockHierarchyListener
Parameters:
event - the current path and controller

controllerChanged

public void controllerChanged(DockController controller)
Invoked by the owner in order to fire a DockHierarchyEvent

Parameters:
controller - the new controller

addDockHierarchyListener

public void addDockHierarchyListener(DockHierarchyListener listener)
Stores a listener which is informed when the path of the owner has changed.

Parameters:
listener - the new listener

removeDockHierarchyListener

public void removeDockHierarchyListener(DockHierarchyListener listener)
Removes an earlier stored listener.

Parameters:
listener - the listener to remove

fireHierarchyChanged

protected void fireHierarchyChanged()
Fires a DockHierarchyEvent to all registered listeners.


fireControllerChanged

protected void fireControllerChanged(DockController controller)
Informs all listeners that the controller of the owner has been changed.

Parameters:
controller - the new controller

update

public void update()
Builds up a new path of parents and adds this listeners to each parent.