bibliothek.gui.dock.control
Class SingleParentRemover

java.lang.Object
  extended by bibliothek.gui.dock.control.SingleParentRemover
Direct Known Subclasses:
CSingleParentRemover

public class SingleParentRemover
extends Object

An observer of a DockController. The remover ensures that there is no dockable DockStation with only one or none child.

Author:
Benjamin Sigg

Constructor Summary
SingleParentRemover()
           
 
Method Summary
 void install(DockController controller)
          Commands this remover to observe controller.
protected  boolean shouldTest(DockStation station)
          Tells whether station should be automatically removed or just be ignored.
protected  boolean test(DockStation station)
          Tries to replace station with its only child or remove station if it has no children at all.
 void testAll(DockController controller)
          Tests all stations of controller and removes as many of them as possible
 void uninstall(DockController controller)
          Commands this remover that it should no longer observe controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleParentRemover

public SingleParentRemover()
Method Detail

install

public void install(DockController controller)
Commands this remover to observe controller.

Parameters:
controller - a controller to observe

uninstall

public void uninstall(DockController controller)
Commands this remover that it should no longer observe controller.

Parameters:
controller - a controller

testAll

public void testAll(DockController controller)
Tests all stations of controller and removes as many of them as possible

Parameters:
controller - the controller to test

shouldTest

protected boolean shouldTest(DockStation station)
Tells whether station should be automatically removed or just be ignored.

Parameters:
station - a station to test
Returns:
true if the station may be removed by this remover, false otherwise.

test

protected boolean test(DockStation station)
Tries to replace station with its only child or remove station if it has no children at all. If the parent of station refuses to accept the replacement or station refuses to let its child go, nothing will happen.

Parameters:
station - the station to test
Returns:
whether the station was replaced or removed