public class DockHierarchyObserver extends Object implements DockHierarchyListener
DockHierarchyEvent
s to
DockHierarchyListener
s. 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.Constructor and Description |
---|
DockHierarchyObserver(Dockable owner)
Creates a new observer.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public DockHierarchyObserver(Dockable owner)
owner
- the Dockable for which events are firedpublic void hierarchyChanged(DockHierarchyEvent event)
DockHierarchyListener
Dockable
has been changed.hierarchyChanged
in interface DockHierarchyListener
event
- the new pathpublic void controllerChanged(DockHierarchyEvent event)
DockHierarchyListener
dockable
has changedcontrollerChanged
in interface DockHierarchyListener
event
- the current path and controllerpublic void controllerChanged(DockController controller)
DockHierarchyEvent
controller
- the new controllerpublic void addDockHierarchyListener(DockHierarchyListener listener)
listener
- the new listenerpublic void removeDockHierarchyListener(DockHierarchyListener listener)
listener
- the listener to removeprotected void fireHierarchyChanged()
DockHierarchyEvent
to all registered listeners.protected void fireControllerChanged(DockController controller)
controller
- the new controllerpublic void update()