public class CStationContainerHistoryRewriter extends java.lang.Object implements HistoryRewriter<Location,CLocationMode>
CStationContainerHistoryRewriter
tries to ensure that a CDockable
stays on the
same CStationContainer
when changing the ExtendedMode
.Constructor and Description |
---|
CStationContainerHistoryRewriter(CControl control)
Creates a new rewriter
|
Modifier and Type | Method and Description |
---|---|
protected CStationContainer |
getContainer(CStation<?> child)
Searches the
CStationContainer which is the parent of child . |
CControl |
getControl()
Gets the
CControl that is using this rewriter. |
protected CStation<?> |
getMatchingStation(Dockable dockable,
ExtendedMode mode)
|
protected CStation<?> |
getMatchingStation(Dockable dockable,
java.lang.String root)
Given the current location of
dockable and the root station it is going
to use, this method decides which CStation is actually going to be the new parent
root station. |
protected CStation<?> |
getParent(Dockable dockable)
Gets the first parent
CStation of dockable . |
protected CStation<?> |
getWorkingArea(Dockable dockable)
|
Location |
rewrite(Dockable dockable,
CLocationMode mode,
Location history)
Checks whether the history object
history is still valid. |
public CStationContainerHistoryRewriter(CControl control)
control
- provides the list of CStationContainer
s to checkpublic CControl getControl()
CControl
that is using this rewriter.protected CStation<?> getMatchingStation(Dockable dockable, java.lang.String root)
dockable
and the root station it is going
to use, this method decides which CStation
is actually going to be the new parent
root station.dockable
- the element that is going to be moved aroundroot
- the new root stationroot
, a value of null
means that
root
should be used.protected CStation<?> getMatchingStation(Dockable dockable, ExtendedMode mode)
dockable
- the element for which a new parent is searchedmode
- the mode element
should be innull
protected CStation<?> getWorkingArea(Dockable dockable)
dockable
- the element whose working area is searchednull
protected CStation<?> getParent(Dockable dockable)
CStation
of dockable
.dockable
- some dockable whose parent station is searchednull
if not foundprotected CStationContainer getContainer(CStation<?> child)
CStationContainer
which is the parent of child
.child
- some CStation
whose parent is searchedchild
or null
public Location rewrite(Dockable dockable, CLocationMode mode, Location history)
HistoryRewriter
history
is still valid.rewrite
in interface HistoryRewriter<Location,CLocationMode>
dockable
- the element which is about to change its modemode
- the mode that is going to be appliedhistory
- the history object that will be forwarded to mode
, may be null
null