public class SingleParentRemover extends Object
DockController
. The remover
ensures that there is no dockable DockStation
with only one
or none child.Constructor and Description |
---|
SingleParentRemover() |
Modifier and Type | Method and Description |
---|---|
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 . |
public void install(DockController controller)
controller
.controller
- a controller to observepublic void uninstall(DockController controller)
controller
.controller
- a controllerpublic void testAll(DockController controller)
controller
and removes
as many of them as possiblecontroller
- the controller to testprotected boolean shouldTest(DockStation station)
station
should be automatically
removed or just be ignored.station
- a station to testtrue
if the station may be removed
by this remover, false
otherwise.protected boolean test(DockStation station)
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.station
- the station to test