Copyright © 2004 Christopher M Butler This work is licensed under a Creative Commons License.
Eleritec Docking Framework Tutorial
Border Management The BorderManager Interface
Looking Under the Hood
A series of things happen as a component is docked and undocked from a DockingPort. The DockingPort interface itself provides dock() and undock() methods. In most circumstances, there is little need to invoke these methods directly, unless constructing an initial UI layout. Instead, the DockingManager assumes responsibility for invoking these methods behind the scenes.

When the DockingManager docks a component into a DockingPort, it assumes the component must have come from somewhere. So before invoking dock() on the target DockingPort, it checks the component's existing parent. If the component currently resides within a DockingPort, undock() is invoked against that DockingPort to remove the component. Otherwise, a simple remove() is invoked against the component's parent container. After the component has been removed from its original parent, dock() is invoked against the target DockingPort to dock the component.

In the DefaultDockingPort implementation, both dock() and undock() complete with a call to the public method evaluateDockingBorderStatus(), which is specific to DefaultDockingPort and is not a part of the standard DockingPort interface. evaluateDockingBorderStatus() checks the status of the container hierarchy an, if an assigned BorderManager is present, invokes the appropriate method call against the assigned BorderManager instance. A very high-level overview of this sequence is illustrated in Figure 5.

DefaultDockingPort is intelligent enough to manage its own container hierarchy, adding necessary wrapper components during dock() and removing unnecessary wrapper components during undock(), so by the time evaluateDockingBorderStatus() is invoked, the state of the container hierarchy is predictable.

By implementing a BorderManager instance, one is able to have a certain level of control over borders during docking and undocking operations. One only needs to add the BorderManger to the DefaultDockingPort using its setBorderManager() method for the desired behavior to take effect.
Border Management The BorderManager Interface