public class StackGroupBehavior extends java.lang.Object implements CGroupBehavior
CGroupBehavior
assumes that all Dockable
s which share a common StackDockStation
as
parent belong to the same group. This behavior also assumes that all Combiner
s will create new
StackDockStation
s and that StackDockStation
s cannot be put into each other. All these assumptions
hold true with the default settings of a CControl
.StackDockStation
s, it moves around each Dockable
individually.
This has the benefit that StackDockStation
s cannot accidentally be put into each other.STACKED, TOPMOST
Constructor and Description |
---|
StackGroupBehavior() |
Modifier and Type | Method and Description |
---|---|
Dockable |
getGroupElement(LocationModeManager<? extends LocationMode> manager,
Dockable dockable,
ExtendedMode mode)
Gets the element whose location or mode must be changed in order to apply
mode to dockable . |
Dockable |
getReplaceElement(LocationModeManager<? extends LocationMode> manager,
Dockable old,
Dockable dockable,
ExtendedMode mode)
Gets the element which would replace
old if old is currently
in mode , and dockable is or will not be in mode . |
CGroupMovement |
prepare(LocationModeManager<? extends LocationMode> manager,
Dockable dockable,
ExtendedMode target)
Calculates how the mode of
dockable has to be changed such that it matches target . |
boolean |
shouldForwardActions(LocationModeManager<? extends LocationMode> manager,
DockStation station,
Dockable dockable,
ExtendedMode mode)
Tells whether the actions of
dockable for mode mode should be
shown on station too. |
public CGroupMovement prepare(LocationModeManager<? extends LocationMode> manager, Dockable dockable, ExtendedMode target)
CGroupBehavior
dockable
has to be changed such that it matches target
.
Please note that some modules use directly CGroupBehavior.getGroupElement(LocationModeManager, Dockable, ExtendedMode)
and do never call
this method.prepare
in interface CGroupBehavior
manager
- a manager which may be asked for additional informationdockable
- the element that was clicked by the usertarget
- the extended mode intended for dockable
null
public Dockable getGroupElement(LocationModeManager<? extends LocationMode> manager, Dockable dockable, ExtendedMode mode)
CGroupBehavior
mode
to dockable
. Normally dockable
itself
is returned, or a parent DockStation
of dockable
.getGroupElement
in interface CGroupBehavior
manager
- a manager which may be asked for additional informationdockable
- some element, not null
mode
- the target modedockable
itself, not null
public Dockable getReplaceElement(LocationModeManager<? extends LocationMode> manager, Dockable old, Dockable dockable, ExtendedMode mode)
CGroupBehavior
old
if old
is currently
in mode
, and dockable
is or will not be in mode
.getReplaceElement
in interface CGroupBehavior
manager
- a manager which may be asked for additional informationold
- some elementdockable
- some element, might be old
mode
- the mode in which old
isdockable
is
no longer in mode
, can be null
public boolean shouldForwardActions(LocationModeManager<? extends LocationMode> manager, DockStation station, Dockable dockable, ExtendedMode mode)
CGroupBehavior
dockable
for mode mode
should be
shown on station
too.shouldForwardActions
in interface CGroupBehavior
manager
- a manager which may be asked for additional informationstation
- the parent of dockable
dockable
- the element whose actions will be shownmode
- the mode for which the actions are requestedtrue
if the actions should be forwarded