bibliothek.gui.dock.common.group
Class StackGroupBehavior

java.lang.Object
  extended by bibliothek.gui.dock.common.group.StackGroupBehavior
All Implemented Interfaces:
CGroupBehavior

public class StackGroupBehavior
extends Object
implements CGroupBehavior

This CGroupBehavior assumes that all Dockables which share a common StackDockStation as parent belong to the same group. This behavior also assumes that all Combiners will create new StackDockStations and that StackDockStations cannot be put into each other. All these assumptions hold true with the default settings of a CControl.
This behavior does not move around entire StackDockStations, it moves around each Dockable indiviually. This has the benefit that StackDockStations cannot accidentally be put into each other.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from interface bibliothek.gui.dock.common.group.CGroupBehavior
STACKED, TOPMOST
 
Constructor Summary
StackGroupBehavior()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackGroupBehavior

public StackGroupBehavior()
Method Detail

prepare

public CGroupMovement prepare(LocationModeManager<? extends LocationMode> manager,
                              Dockable dockable,
                              ExtendedMode target)
Description copied from interface: CGroupBehavior
Calculates how the mode of 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.

Specified by:
prepare in interface CGroupBehavior
Parameters:
manager - a manager which may be asked for additional information
dockable - the element that was clicked by the user
target - the extended mode intended for dockable
Returns:
the operation to execute, may be null

getGroupElement

public Dockable getGroupElement(LocationModeManager<? extends LocationMode> manager,
                                Dockable dockable,
                                ExtendedMode mode)
Description copied from interface: CGroupBehavior
Gets the element whose location or mode must be changed in order to apply mode to dockable. Normally dockable itself is returned, or a parent DockStation of dockable.

Specified by:
getGroupElement in interface CGroupBehavior
Parameters:
manager - a manager which may be asked for additional information
dockable - some element, not null
mode - the target mode
Returns:
the element that must be repositioned, might be dockable itself, not null

getReplaceElement

public Dockable getReplaceElement(LocationModeManager<? extends LocationMode> manager,
                                  Dockable old,
                                  Dockable dockable,
                                  ExtendedMode mode)
Description copied from interface: CGroupBehavior
Gets the element which would replace old if old is currently in mode, and dockable is or will not be in mode.

Specified by:
getReplaceElement in interface CGroupBehavior
Parameters:
manager - a manager which may be asked for additional information
old - some element
dockable - some element, might be old
mode - the mode in which old is
Returns:
the element which would be maximized if dockable is no longer in mode, can be null

shouldForwardActions

public boolean shouldForwardActions(LocationModeManager<? extends LocationMode> manager,
                                    DockStation station,
                                    Dockable dockable,
                                    ExtendedMode mode)
Description copied from interface: CGroupBehavior
Tells whether the actions of dockable for mode mode should be shown on station too.

Specified by:
shouldForwardActions in interface CGroupBehavior
Parameters:
manager - a manager which may be asked for additional information
station - the parent of dockable
dockable - the element whose actions will be shown
mode - the mode for which the actions are requested
Returns:
true if the actions should be forwarded