bibliothek.gui.dock
Class ScreenDockStation

java.lang.Object
  extended by bibliothek.gui.dock.station.AbstractDockStation
      extended by bibliothek.gui.dock.ScreenDockStation
All Implemented Interfaces:
DockComponentRoot, DockElement, DockStation
Direct Known Subclasses:
CScreenDockStation

public class ScreenDockStation
extends AbstractDockStation

A DockStation which is the whole screen. Every child of this station is a window. These windows can be moved and resized by the user.
This station tries to register a DockTitleVersion with the key TITLE_ID.

Author:
Benjamin Sigg

Field Summary
static PropertyKey<AttractorStrategy> ATTRACTOR_STRATEGY
          the AttractorStrategy that tells whether two Dockables attract each other
static Path ATTRACTOR_STRATEGY_EXTENSION
          Path of an ExtensionName for creating additional AttractorStrategy
static PropertyKey<BoundaryRestriction> BOUNDARY_RESTRICTION
          a key for a property telling which boundaries a ScreenDockWindow can have
static String DISPLAYER_ID
          This id is forwarded to Extensions which load additional DisplayerFactorys
static PropertyKey<ScreenDropSizeStrategy> DROP_SIZE_STRATEGY
          key for the ScreenDropSizeStrategy that is used when dropping a Dockable onto this station
static PropertyKey<Boolean> EXPAND_ON_DOUBLE_CLICK
          global setting to change the effect happening on a double click
static String EXTENSION_PARAM
          Name of a parameter of an ExtensionName pointing to this.
static PropertyKey<ScreenDockFullscreenStrategy> FULL_SCREEN_STRATEGY
          a key for a property telling how to handle fullscreen mode
static PropertyKey<MagnetStrategy> MAGNET_STRATEGY
          the MagnetStrategy decides how two ScreenDockWindows attract each other
static PropertyKey<Integer> PREVENT_FOCUS_STEALING_DELAY
          time in milliseconds a ScreenDockWindow is prevented from stealing the focus after the owner of this station changed.
static Path STATION_EXTENSION
          Path of an ExtensionName for creating ScreenDockStationExtensions
static String TITLE_ID
          The key for the DockTitleVersion of this station
static PropertyKey<ScreenDockWindowClosingStrategy> WINDOW_CLOSING_STRATEGY
          strategy for closing ScreenDockWindows, default is null
static PropertyKey<ScreenDockWindowConfiguration> WINDOW_CONFIGURATION
          A key for a property telling how to configure new windows.
static PropertyKey<ScreenDockWindowFactory> WINDOW_FACTORY
          a key for a property telling how to create new windows
 
Fields inherited from class bibliothek.gui.dock.station.AbstractDockStation
listeners
 
Constructor Summary
ScreenDockStation(Window owner)
          Constructs a new ScreenDockStation.
ScreenDockStation(WindowProvider owner)
          Constructs a new ScreenDockStation.
 
Method Summary
 void addDockable(Dockable dockable, Rectangle bounds)
          Adds a Dockable on a newly created ScreenDockWindow to the station.
 void addDockable(Dockable dockable, Rectangle bounds, boolean boundsIncludeWindow)
          Adds a Dockable on a newly created ScreenDockWindow to the station.
protected  void addDockable(Dockable dockable, Rectangle bounds, Path placeholder, boolean boundsIncludeWindow)
          Adds a Dockable on a newly created ScreenDockWindow to the station.
 void addFullscreenFilter(ScreenDockFullscreenFilter filter)
          Adds the new filter filter to this station.
 void addScreenDockStationListener(ScreenDockStationListener listener)
          Adds listener to this station.
 Dockable asDockable()
          Returns this if this is an instance of Dockable.
 DockStation asDockStation()
          Returns this if this is an instance of DockStation.
 void aside(AsideRequest request)
          Requests this DockStation to find a DockableProperty that is "aside" another property.
protected  void callDockUiUpdateTheme()
          Calls the method DockUI.DockUI.updateTheme(DockStation, DockFactory) with this as the first argument, and an appropriate factory as the second argument.
 boolean canDrag(Dockable dockable)
          Tells whether dockable can be removed from this station or not.
 boolean canReplace(Dockable old, Dockable next)
          Tells whether its possible to replace the child old with next where next is not a child of this station.
 void checkWindowBoundaries()
          Checks the boundaries of all windows of this station
 void clearExpandOnDoubleClick()
          Resets the expand-on-double-click property to its default value.
 void combine(Dockable lower, Dockable upper)
          Combines the lower and the upper Dockable to one Dockable, and replaces the lower with this new Dockable.
 void combine(Dockable lower, Dockable upper, DockableProperty property)
          Combines the lower and the upper Dockable to one Dockable, and replaces the lower with this new Dockable.
protected  ListeningDockAction createFullscreenAction()
          Creates an action which is added to all children of this station.
protected  DockComponentRootHandler createRootHandler()
          Creates a new DockComponentRootHandler which will be responsible for keeping track of all the Components of this station.
protected  ScreenDockWindow createWindow(WindowConfiguration configuration)
          Creates a new window which is associated with this station.
protected  void deregister(Dockable dockable, ScreenDockWindow window)
          Invoked when a ScreenDockWindow is no longer needed.
 void drag(Dockable dockable)
          Removes a child from this station.
 void drop(Dockable dockable)
          Adds dockable to this station.
 boolean drop(Dockable dockable, Dockable location)
          Drops dockable at the same coordinates as location, a direct child of this station.
 boolean drop(Dockable dockable, DockableProperty property)
          Tries to add dockable to this station such that the location given by property is matched.
 boolean drop(Dockable dockable, ScreenDockProperty property)
          Tries to add the dockable to this station, and uses the property to determine its location.
 boolean drop(Dockable dockable, ScreenDockProperty property, boolean boundsIncludeWindow)
          Tries to add the dockable to this station, and uses the property to determine its location.
 BoundaryRestriction getBoundaryRestriction()
          Gets the currently used BoundaryRestriction.
 StationCombinerValue getCombiner()
          Gets the Combiner that is used to merge two Dockables on this station.
protected  WindowConfiguration getConfiguration(Dockable dockable)
          Gets the WindowConfiguration which should be used to create a new ScreenDockWindow for dockable.
 DockActionSource getDirectActionOffers(Dockable dockable)
          Gets a list of actions which should be available for the user and affect the child dockable.
 DefaultDisplayerFactoryValue getDisplayerFactory()
          Gets the DisplayerFactory that is used by this station to create an underground for its children.
 DisplayerCollection getDisplayers()
          Gets the current set of displayers used on this station.
 Dockable getDockable(int index)
          Gets the index'th child of this station.
 int getDockableCount()
          Gets the number of children.
 DockableProperty getDockableProperty(Dockable dockable, Dockable target)
          Gets precise information about the location of a child of this station.
 double getDropOverRatio()
          Tells the current overlapping two windows must have in order to be merged.
 String getFactoryID()
          Gets the unique name of the DockFactory which can read and write elements of this type.
 Dockable getFrontDockable()
          Gets the favorite child of this station.
 Dockable[] getFullscreenChildren()
          Gets a list of all children of this station that are currently in fullscreen mode.
 ScreenDockFullscreenStrategy getFullscreenStrategy()
          Gets the current fullscreen strategy.
 DockActionSource getIndirectActionOffers(Dockable dockable)
          Gets a list of actions which should be available for the user and affect dockable.
 DockStationDropLayer[] getLayers()
          Gets a description of all the areas of the screen where this DockStation can handle a drop event.
Everytime the mouse is moved or released during a drag & drop operation, this method is called for all DockStations.
 ScreenDockProperty getLocation(Dockable dockable, Dockable target)
          Gets the location of dockable and its current state.
 MagnetController getMagnetController()
          Gets the MagnetController of this station.
 Window getOwner()
          Gets the owner of this station.
 DefaultStationPaintValue getPaint()
          Gets the StationPaint for this station.
 PlaceholderMapping getPlaceholderMapping()
          Allows access to the placeholders that are stored on this station.
 PlaceholderMap getPlaceholders()
          Gets a snapshot of all placeholders that are currently stored in this DockStation.
 PlaceholderMap getPlaceholders(Map<Dockable,Integer> children)
          Gets the placeholders of this station using a PlaceholderListItemConverter to encode the children of this station.
 PlaceholderStrategy getPlaceholderStrategy()
          Gets the PlaceholderStrategy that is currently in use.
 WindowProvider getProvider()
          Gets the provider which delivers window owners for the windows of this station.
 Rectangle getStationBounds()
           
 DockTitleVersion getTitleVersion()
          Gets the DockTitleVersion used by this station to create new DockTitles.
 ScreenDockWindow getWindow(Dockable dockable)
          Searches the ScreenDockWindow which displays the dockable.
 ScreenDockWindow getWindow(int index)
          Gets the index'th window of this station.
 ScreenDockWindowConfiguration getWindowConfiguration()
          Gets the configuration which is currently used to create new windows.
protected  PropertyValue<ScreenDockWindowConfiguration> getWindowConfigurationProperty()
          Gets the property which represents the window configuration.
 ScreenDockWindowFactory getWindowFactory()
          Gets the factory that is currently used to create new windows for this station.
protected  PropertyValue<ScreenDockWindowFactory> getWindowFactoryProperty()
          Gets the property which represents the window factory.
 int indexOf(Dockable dockable)
          Gets the index of a Dockable that is shown on this station.
 boolean isChildShowing(Dockable dockable)
          Tells whether the child dockable is visible or not.
 boolean isExpandOnDoubleClick()
          Tells whether children change their fullscreen mode if the user double clicks on them.
 boolean isFullscreen(Dockable dockable)
          Tells whether dockable is currently shown in fullscreen mode.
 boolean isShowing()
          Tells whether this station shows its children or not.
 boolean isStationShowing()
          Tells whether this station shows its children.
 boolean isStationVisible()
          Deprecated. 
 boolean isVisible(Dockable dockable)
          Deprecated. 
 void move(Dockable dockable, DockableProperty property)
          Tries to move the child dockable in such a way, that DockStation.getDockableProperty(Dockable, Dockable) would return a DockableProperty that equals property.
There is no need to give a guarantee that the move successes, and clients should always be prepared for the possibility that this DockStation does nothing at all.
 StationDropOperation prepare(StationDropItem item, boolean drop)
           
 StationDragOperation prepareDrag(Dockable dockable)
          Informs this station that a drag and drop operation is in progress and that dockable might be removed from this station.
 StationDropOperation prepareDrop(StationDropItem item)
          Prepares this station to get the new child dockable or to move around the known child dockable.
protected  ScreenDockWindowHandle register(Dockable dockable, Path placeholder, ScreenDockWindow window, WindowConfiguration configuration)
          Invoked after a new ScreenDockWindow has been created.
 void removeDockable(Dockable dockable)
          Removes the dockable from this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure noone else adds or removes Dockables.
 void removeDockable(int index)
          Removes the index'th Dockable of this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure noone else adds or removes Dockables.
 void removeFullscreenFilter(ScreenDockFullscreenFilter filter)
          Removes filter from this station.
 void removeScreenDockStationListener(ScreenDockStationListener listener)
          Removes listener from this station.
 void replace(Dockable current, Dockable other)
          Replaces the child old by next which is not yet a child of this station.
 void replace(Dockable current, Dockable other, boolean station)
           
 void replace(DockStation old, Dockable next)
          Replaces the child old by next which is not yet a child of this station.
protected  ScreenDockStationListener[] screenDockStationListeners()
          Gets all the ScreenDockStationListeners that were added to this station.
protected  ScreenDockWindow searchCombineDockable(int x, int y, Dockable drop, boolean combineArea)
          Searches a window on the coordinates x/y which can be used to create a combination with drop.
 void setBoundaryRestriction(BoundaryRestriction restriction)
          Changes the boundary restriction used to check the boundaries of the windows of this station.
 void setController(DockController controller)
          Sets the controller of this station.
 void setDropOverRatio(double dropOverRatio)
          Sets how much two windows must overlap in order to be merged.
 void setExpandOnDoubleClick(boolean expand)
          Tells this station what to do on a double click on a child.
 void setFrontDockable(Dockable dockable)
          Sets the most important child.
 void setFullscreen(Dockable dockable, boolean fullscreen)
          Changes the fullscreen mode of dockable.
 void setFullscreenAction(ListeningDockAction fullScreenAction)
          Sets an action which allows to expand children.
 void setFullscreenStrategy(ScreenDockFullscreenStrategy strategy)
          Sets the strategy used to handle fullscreen mode.
 void setPlaceholders(PlaceholderMap placeholders)
          Sets an earlier snapshot of the placeholders of this station.
 void setPlaceholders(PlaceholderMap map, Map<Integer,Dockable> children)
          Sets a new layout on this station, this method assumes that map was created using getPlaceholders(Map).
 void setPlaceholderStrategy(PlaceholderStrategy strategy)
          Sets the PlaceholderStrategy to use, null will set the default strategy.
 void setShowing(boolean showing)
          Sets the visibility of all windows of this station.
 void setWindowConfiguration(ScreenDockWindowConfiguration configuration)
          Sets the configuration which should be used to create new windows.
 void setWindowFactory(ScreenDockWindowFactory factory)
          Sets the factory that will be used to create new windows for this station, Calling this method will result in closing all existing windows and creating new windows.
protected  void updateWindows()
          Called if getOwner() changed.
protected  void updateWindows(boolean force)
          Update all windows either by calling ScreenDockWindowFactory.updateWindow(ScreenDockWindow, WindowConfiguration, ScreenDockStation) or by calling ScreenDockWindowFactory.createWindow(ScreenDockStation, WindowConfiguration).
 
Methods inherited from class bibliothek.gui.dock.station.AbstractDockStation
accept, addDockStationListener, canCompare, changed, compare, delegate, getComponentConfiguration, getController, getRootHandler, getTheme, removeDockStationListener, requestChildDisplayer, requestChildDockTitle, setComponentConfiguration, updateTheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE_ID

public static final String TITLE_ID
The key for the DockTitleVersion of this station

See Also:
Constant Field Values

DISPLAYER_ID

public static final String DISPLAYER_ID
This id is forwarded to Extensions which load additional DisplayerFactorys

See Also:
Constant Field Values

ATTRACTOR_STRATEGY_EXTENSION

public static final Path ATTRACTOR_STRATEGY_EXTENSION
Path of an ExtensionName for creating additional AttractorStrategy


STATION_EXTENSION

public static final Path STATION_EXTENSION
Path of an ExtensionName for creating ScreenDockStationExtensions


EXTENSION_PARAM

public static final String EXTENSION_PARAM
Name of a parameter of an ExtensionName pointing to this.

See Also:
Constant Field Values

BOUNDARY_RESTRICTION

public static final PropertyKey<BoundaryRestriction> BOUNDARY_RESTRICTION
a key for a property telling which boundaries a ScreenDockWindow can have


WINDOW_FACTORY

public static final PropertyKey<ScreenDockWindowFactory> WINDOW_FACTORY
a key for a property telling how to create new windows


WINDOW_CLOSING_STRATEGY

public static final PropertyKey<ScreenDockWindowClosingStrategy> WINDOW_CLOSING_STRATEGY
strategy for closing ScreenDockWindows, default is null


WINDOW_CONFIGURATION

public static final PropertyKey<ScreenDockWindowConfiguration> WINDOW_CONFIGURATION
A key for a property telling how to configure new windows. Replacing the configuration always leads to closing and recreating all windows.


FULL_SCREEN_STRATEGY

public static final PropertyKey<ScreenDockFullscreenStrategy> FULL_SCREEN_STRATEGY
a key for a property telling how to handle fullscreen mode


EXPAND_ON_DOUBLE_CLICK

public static final PropertyKey<Boolean> EXPAND_ON_DOUBLE_CLICK
global setting to change the effect happening on a double click


PREVENT_FOCUS_STEALING_DELAY

public static final PropertyKey<Integer> PREVENT_FOCUS_STEALING_DELAY
time in milliseconds a ScreenDockWindow is prevented from stealing the focus after the owner of this station changed. A value of null disables the focus stealing prevention.


MAGNET_STRATEGY

public static final PropertyKey<MagnetStrategy> MAGNET_STRATEGY
the MagnetStrategy decides how two ScreenDockWindows attract each other


ATTRACTOR_STRATEGY

public static final PropertyKey<AttractorStrategy> ATTRACTOR_STRATEGY
the AttractorStrategy that tells whether two Dockables attract each other


DROP_SIZE_STRATEGY

public static final PropertyKey<ScreenDropSizeStrategy> DROP_SIZE_STRATEGY
key for the ScreenDropSizeStrategy that is used when dropping a Dockable onto this station

Constructor Detail

ScreenDockStation

public ScreenDockStation(Window owner)
Constructs a new ScreenDockStation.

Parameters:
owner - the window which will be used as parent for the windows of this station, must not be null

ScreenDockStation

public ScreenDockStation(WindowProvider owner)
Constructs a new ScreenDockStation.

Parameters:
owner - the window which will be used as parent for the windows of this station, must not be null
Method Detail

createRootHandler

protected DockComponentRootHandler createRootHandler()
Description copied from class: AbstractDockStation
Creates a new DockComponentRootHandler which will be responsible for keeping track of all the Components of this station.

Specified by:
createRootHandler in class AbstractDockStation
Returns:
the new handler

createFullscreenAction

protected ListeningDockAction createFullscreenAction()
Creates an action which is added to all children of this station. The action allows the user to expand a child to fullscreen. The action is also added to subchildren, but the effect does only affect direct children of this station.

Returns:
the action or null if this feature should be disabled, or the action is set later

addScreenDockStationListener

public void addScreenDockStationListener(ScreenDockStationListener listener)
Adds listener to this station.

Parameters:
listener - the new listener

removeScreenDockStationListener

public void removeScreenDockStationListener(ScreenDockStationListener listener)
Removes listener from this station.

Parameters:
listener - the listener to remove

screenDockStationListeners

protected ScreenDockStationListener[] screenDockStationListeners()
Gets all the ScreenDockStationListeners that were added to this station.

Returns:
all the listeners

setFullscreenAction

public void setFullscreenAction(ListeningDockAction fullScreenAction)
Sets an action which allows to expand children. This method can only be invoked if there is not already set an action. It is a condition that createFullscreenAction() returns null

Parameters:
fullScreenAction - the new action
Throws:
IllegalStateException - if there is already an action present

getDirectActionOffers

public DockActionSource getDirectActionOffers(Dockable dockable)
Description copied from interface: DockStation
Gets a list of actions which should be available for the user and affect the child dockable.

Parameters:
dockable - a child of this station
Returns:
actions for dockable, can be null

getIndirectActionOffers

public DockActionSource getIndirectActionOffers(Dockable dockable)
Description copied from interface: DockStation
Gets a list of actions which should be available for the user and affect dockable. The argument dockable can be a child of this station, or a child of any station which is below this station.

Parameters:
dockable - a child of this station or a child of another station which is below this station
Returns:
actions for dockable or null

getDisplayerFactory

public DefaultDisplayerFactoryValue getDisplayerFactory()
Gets the DisplayerFactory that is used by this station to create an underground for its children.

Returns:
the factory
See Also:
StationThemeItemValue.setDelegate(Object)

getDisplayers

public DisplayerCollection getDisplayers()
Gets the current set of displayers used on this station.

Returns:
the set of displayers

getCombiner

public StationCombinerValue getCombiner()
Gets the Combiner that is used to merge two Dockables on this station.

Returns:
the combiner
See Also:
StationThemeItemValue.setDelegate(Object)

getPaint

public DefaultStationPaintValue getPaint()
Gets the StationPaint for this station. The paint is needed to paint information on this station, when a Dockable is dragged or moved.

Returns:
the paint
See Also:
StationThemeItemValue.setDelegate(Object)

callDockUiUpdateTheme

protected void callDockUiUpdateTheme()
                              throws IOException
Description copied from class: AbstractDockStation
Calls the method DockUI.DockUI.updateTheme(DockStation, DockFactory) with this as the first argument, and an appropriate factory as the second argument.

Specified by:
callDockUiUpdateTheme in class AbstractDockStation
Throws:
IOException - if the DockUI throws an exception

setController

public void setController(DockController controller)
Description copied from interface: DockStation
Sets the controller of this station. If the station wants to show any DockTitle, then the titles have to be replaced by new instances (assuming the controller is really new). The title has to get new DockTitleVersions through the DockTitleManager of controller.
An argument of null means that this station is currently not shown.

Specified by:
setController in interface DockStation
Overrides:
setController in class AbstractDockStation
Parameters:
controller - the owner of this station, can be null

getDockableCount

public int getDockableCount()
Description copied from interface: DockStation
Gets the number of children.

Returns:
the number of children on this station

getDockable

public Dockable getDockable(int index)
Description copied from interface: DockStation
Gets the index'th child of this station.

Parameters:
index - a value between 0 (incl.) and DockStation.getDockableCount() (excl.).
Returns:
a child of this station

indexOf

public int indexOf(Dockable dockable)
Gets the index of a Dockable that is shown on this station. A call to getDockable(int) with the result of this method would return dockable, if dockable is on this station.

Parameters:
dockable - the item to search
Returns:
the index of the item or -1 if not found

getPlaceholderMapping

public PlaceholderMapping getPlaceholderMapping()
Description copied from interface: DockStation
Allows access to the placeholders that are stored on this station. Clients may use the PlaceholderMapping to add or remove placeholders from the station.
Not all stations support placeholders, and these station may return a mapping that performs no actions.

Returns:
access to the placeholders

getPlaceholders

public PlaceholderMap getPlaceholders()
Description copied from interface: DockStation
Gets a snapshot of all placeholders that are currently stored in this DockStation. A DockStation is free in the format it chooses to fill the map. The map is to be created with the assumptions that DockStation.getDockableCount() is 0, meaning any existing Dockable gets replaced by its placeholder. The current PlaceholderStrategy should be used to convert Dockables to placeholders.
Clients interested in modifying the placeholders of this station should call DockStation.getPlaceholderMapping().

Returns:
the map of placeholders or null if this station does not support placeholders

getPlaceholders

public PlaceholderMap getPlaceholders(Map<Dockable,Integer> children)
Gets the placeholders of this station using a PlaceholderListItemConverter to encode the children of this station. To be exact, the converter puts the following parameters for each Dockable into the map:

Parameters:
children - a unique identifier for each child of this station
Returns:
the map

setPlaceholders

public void setPlaceholders(PlaceholderMap placeholders)
Description copied from interface: DockStation
Sets an earlier snapshot of the placeholders of this station. This station can assume that it currently does not have any children (that DockStation.getDockableCount() is 0).
This method does nothing if it cannot handle the format or the version of placeholders.

Parameters:
placeholders - some set of placeholders

setPlaceholders

public void setPlaceholders(PlaceholderMap map,
                            Map<Integer,Dockable> children)
Sets a new layout on this station, this method assumes that map was created using getPlaceholders(Map).

Parameters:
map - the map to read
children - the new children of this stations
Throws:
IllegalStateException - if there are children left on this station

getPlaceholderStrategy

public PlaceholderStrategy getPlaceholderStrategy()
Gets the PlaceholderStrategy that is currently in use.

Returns:
the current strategy, may be null

setPlaceholderStrategy

public void setPlaceholderStrategy(PlaceholderStrategy strategy)
Sets the PlaceholderStrategy to use, null will set the default strategy.

Parameters:
strategy - the new strategy, can be null

getFrontDockable

public Dockable getFrontDockable()
Description copied from interface: DockStation
Gets the favorite child of this station. The favorite child is the one child which is specially designated for the user. An example: if the station behaves like a stack, and only the top child is visible, then the favorite child could the the top.
A result of null indicates that there are no children at all, or that there is no favorite child (all children are equal important).
Stations should not change this property directly, they should call DockController.setFocusedDockable(Dockable, boolean) which will then call DockStation.setFrontDockable(Dockable). Note that the DockController itself listens to the DockTitles, and maybe the station doesn't need a logic to decide which child is important.

Returns:
the most important child or null

setFrontDockable

public void setFrontDockable(Dockable dockable)
Description copied from interface: DockStation
Sets the most important child. The station should ensure that this child is visible (assuming the station itself is visible). Read the comment on DockStation.getFrontDockable() how stations can change this property.

Parameters:
dockable - the new favorite child, can be null
See Also:
DockStation.getFrontDockable()

getLayers

public DockStationDropLayer[] getLayers()
Description copied from interface: DockStation
Gets a description of all the areas of the screen where this DockStation can handle a drop event.
Everytime the mouse is moved or released during a drag & drop operation, this method is called for all DockStations. The returned DockStationDropLayers are then filtered and ordered, the resulting order defines the order in which the method DockStation.prepareDrop(StationDropItem) is called.

Returns:
all the layers of this station, must not be null, must not contain null, must not contain the same entry twice. The array or the DockStationDropLayers may be modified, hence this method should always create new objects.

prepareDrop

public StationDropOperation prepareDrop(StationDropItem item)
Description copied from interface: DockStation
Prepares this station to get the new child dockable or to move around the known child dockable. The station can refuse dockable, in this case this method just returns null. There are some constraints:

Parameters:
item - information about the dockable that is going to be dropped
Returns:
an object describing where the Dockable can be dropped or null if no drop operation is possible

prepareDrag

public StationDragOperation prepareDrag(Dockable dockable)
Description copied from interface: DockStation
Informs this station that a drag and drop operation is in progress and that dockable might be removed from this station.

Parameters:
dockable - the child that might be removed in the near future
Returns:
a callback that will be informed when the dockable was removed or the operation canceleled, can be null

prepare

public StationDropOperation prepare(StationDropItem item,
                                    boolean drop)

searchCombineDockable

protected ScreenDockWindow searchCombineDockable(int x,
                                                 int y,
                                                 Dockable drop,
                                                 boolean combineArea)
Searches a window on the coordinates x/y which can be used to create a combination with drop.

Parameters:
x - the x-coordinate on the screen
y - die y-coordinate on the screen
drop - the Dockable which might be combined with a window
combineArea - whether the point x/y must be over the combine area or just over the window.
Returns:
the window which might become the parent of drop.

drop

public void drop(Dockable dockable)
Description copied from interface: DockStation
Adds dockable to this station. The station can decide by its own where to put dockable.

Parameters:
dockable - a new child

getDockableProperty

public DockableProperty getDockableProperty(Dockable dockable,
                                            Dockable target)
Description copied from interface: DockStation
Gets precise information about the location of a child of this station. The result of this method could later be used to invoke DockStation.drop(Dockable, DockableProperty).

Parameters:
dockable - a child of this station, this childs location is asked
target - an optional hint telling for which dockable the location information will be used, can be null. This hint can be used to find a placeholder that should be part of the result.
Returns:
the location
See Also:
DockUtilities.getPropertyChain(DockStation, Dockable)

getLocation

public ScreenDockProperty getLocation(Dockable dockable,
                                      Dockable target)
Gets the location of dockable and its current state.

Parameters:
dockable - some child of this station
target - the final element for which the location is needd
Returns:
the location, not null

aside

public void aside(AsideRequest request)
Description copied from interface: DockStation
Requests this DockStation to find a DockableProperty that is "aside" another property. What exactly the meaning of "aside" is, is left to the implementation. Usually "aside" means on the same "stack" but with the next higher index.
The request object contains information about the location whose neighbor is searched, about a placeholder that should be used for the new location, and offers methods to forward the call to the next DockStation or Combiner if there is a successor.
This method should call the answer methods of request with every kind of information it finds.
If this method cannot handle request, then it just has to return without calling any of the answer methods.

Parameters:
request - information about a location and methods to create the neighbor location
See Also:
Combiner.aside(AsideRequest)

getWindow

public ScreenDockWindow getWindow(Dockable dockable)
Searches the ScreenDockWindow which displays the dockable.

Parameters:
dockable - the Dockable to search
Returns:
the window or null

getWindow

public ScreenDockWindow getWindow(int index)
Gets the index'th window of this station. The number of windows is identical to the number of Dockables.

Parameters:
index - the index of the window
Returns:
the window which shows the index'th Dockable.

getFullscreenChildren

public Dockable[] getFullscreenChildren()
Gets a list of all children of this station that are currently in fullscreen mode.

Returns:
a list of children, not null

isFullscreen

public boolean isFullscreen(Dockable dockable)
Tells whether dockable is currently shown in fullscreen mode.

Parameters:
dockable - the element to check
Returns:
the mode
Throws:
IllegalArgumentException - if dockable is not known

setFullscreen

public void setFullscreen(Dockable dockable,
                          boolean fullscreen)
Changes the fullscreen mode of dockable.

Parameters:
dockable - the element whose mode is to be changed
fullscreen - the new mode
Throws:
IllegalArgumentException - if dockable is not known to this station

addFullscreenFilter

public void addFullscreenFilter(ScreenDockFullscreenFilter filter)
Adds the new filter filter to this station. The filter can deny Dockables the possibility of being in fullscreen mode.

Parameters:
filter - the new filter, not null

removeFullscreenFilter

public void removeFullscreenFilter(ScreenDockFullscreenFilter filter)
Removes filter from this station.

Parameters:
filter - the filter to remove
See Also:
addFullscreenFilter(ScreenDockFullscreenFilter)

setExpandOnDoubleClick

public void setExpandOnDoubleClick(boolean expand)
Tells this station what to do on a double click on a child. If set to true, then the childs fullscreen mode gets changed.

Parameters:
expand - whether to react on double clicks

clearExpandOnDoubleClick

public void clearExpandOnDoubleClick()
Resets the expand-on-double-click property to its default value.

See Also:
setExpandOnDoubleClick(boolean)

isExpandOnDoubleClick

public boolean isExpandOnDoubleClick()
Tells whether children change their fullscreen mode if the user double clicks on them.

Returns:
the state

move

public void move(Dockable dockable,
                 DockableProperty property)
Description copied from interface: DockStation
Tries to move the child dockable in such a way, that DockStation.getDockableProperty(Dockable, Dockable) would return a DockableProperty that equals property.
There is no need to give a guarantee that the move successes, and clients should always be prepared for the possibility that this DockStation does nothing at all.

Parameters:
dockable - a child of this station
property - the preferred position of dockable

canDrag

public boolean canDrag(Dockable dockable)
Description copied from interface: DockStation
Tells whether dockable can be removed from this station or not. This method assumes that dockable is a child of this station, if not, then the behavior of this method is unspecified.
Note that the result of this method may not be respected every time, it's more a hint for the controller how to act.

Parameters:
dockable - a child of this station
Returns:
true if dockable can be dragged

drag

public void drag(Dockable dockable)
Description copied from interface: DockStation
Removes a child from this station. This method may be called even if DockStation.canDrag(Dockable) returned false.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure noone else adds or removes Dockables.

Parameters:
dockable - the child to remove

addDockable

public void addDockable(Dockable dockable,
                        Rectangle bounds)
Adds a Dockable on a newly created ScreenDockWindow to the station. If the station is visible, the window will be made visible too.

Parameters:
dockable - the Dockable to show
bounds - the bounds that the window will have

addDockable

public void addDockable(Dockable dockable,
                        Rectangle bounds,
                        boolean boundsIncludeWindow)
Adds a Dockable on a newly created ScreenDockWindow to the station. If the station is visible, the window will be made visible too.

Parameters:
dockable - the Dockable to show
bounds - the bounds that the window will have
boundsIncludeWindow - if true, the bounds describe the size of the resulting window. Otherwise the size of the window will be a bit larger such that the title can be shown in the new space

addDockable

protected void addDockable(Dockable dockable,
                           Rectangle bounds,
                           Path placeholder,
                           boolean boundsIncludeWindow)
Adds a Dockable on a newly created ScreenDockWindow to the station. If the station is visible, the window will be made visible too.

Parameters:
dockable - the Dockable to show
bounds - the bounds that the window will have
placeholder - the name of dockable, used to associate a group of other dockables to dockable. Can be null.
boundsIncludeWindow - if true, the bounds describe the size of the resulting window. Otherwise the size of the window will be a bit larger such that the title can be shown in the new space
Throws:
IllegalStateException - if there is already a window associated with the group of placeholder

drop

public boolean drop(Dockable dockable,
                    DockableProperty property)
Description copied from interface: DockStation
Tries to add dockable to this station such that the location given by property is matched. If property has a successor and points to another station, just call the drop-method of this child-station. Note that property can be of any type and contain invalid information.

Parameters:
dockable - the new child
property - the location of the child, may be invalid data
Returns:
true if property could be read and dockable was dropped, false otherwise.

drop

public boolean drop(Dockable dockable,
                    ScreenDockProperty property)
Tries to add the dockable to this station, and uses the property to determine its location. If the preferred location overlaps an existing window, then the Dockable may be added to a child-station of this station.

Parameters:
dockable - the new Dockable
property - the preferred location of the dockable
Returns:
true if the dockable could be added, false otherwise.

drop

public boolean drop(Dockable dockable,
                    ScreenDockProperty property,
                    boolean boundsIncludeWindow)
Tries to add the dockable to this station, and uses the property to determine its location. If the preferred location overlaps an existing window, then the Dockable may be added to a child-station of this station.

Parameters:
dockable - the new Dockable
property - the preferred location of the dockable
boundsIncludeWindow - if true, the bounds describe the size of the resulting window. Otherwise the size of the window will be a bit larger such that the title can be shown in the new space
Returns:
true if the dockable could be added, false otherwise.

drop

public boolean drop(Dockable dockable,
                    Dockable location)
Drops dockable at the same coordinates as location, a direct child of this station.

Parameters:
dockable - a new dockable
location - a known dockable
Returns:
whether the operation completed

combine

public void combine(Dockable lower,
                    Dockable upper)
Combines the lower and the upper Dockable to one Dockable, and replaces the lower with this new Dockable. There are no checks whether this station accepts the new child or the children can be combined. The creation of the new Dockable is done by the combiner.

Parameters:
lower - a Dockable which must be child of this station
upper - a Dockable which may be child of this station

combine

public void combine(Dockable lower,
                    Dockable upper,
                    DockableProperty property)
Combines the lower and the upper Dockable to one Dockable, and replaces the lower with this new Dockable. There are no checks whether this station accepts the new child or the children can be combined. The creation of the new Dockable is done by the combiner.

Parameters:
lower - a Dockable which must be child of this station
upper - a Dockable which may be child of this station
property - location information associated with upper, may be null

canReplace

public boolean canReplace(Dockable old,
                          Dockable next)
Description copied from interface: DockStation
Tells whether its possible to replace the child old with next where next is not a child of this station.

Parameters:
old - a child of this station
next - the replacement of next.
Returns:
true if the replacement is possible

replace

public void replace(DockStation old,
                    Dockable next)
Description copied from interface: DockStation
Replaces the child old by next which is not yet a child of this station. This method should not be called if canReplace returned false. This method can assume that next was a child of old but no longer is.

Parameters:
old - a dockable station that is a child of this station
next - the replacement of old

replace

public void replace(Dockable current,
                    Dockable other)
Description copied from interface: DockStation
Replaces the child old by next which is not yet a child of this station. This method should not be called if canReplace returned false.

Parameters:
current - a child
other - the replacement of old

replace

public void replace(Dockable current,
                    Dockable other,
                    boolean station)

removeDockable

public void removeDockable(Dockable dockable)
Removes the dockable from this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure noone else adds or removes Dockables.

Parameters:
dockable - the Dockable to remove

removeDockable

public void removeDockable(int index)
Removes the index'th Dockable of this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure noone else adds or removes Dockables.

Parameters:
index - the index of the Dockable to remove

register

protected ScreenDockWindowHandle register(Dockable dockable,
                                          Path placeholder,
                                          ScreenDockWindow window,
                                          WindowConfiguration configuration)
Invoked after a new ScreenDockWindow has been created. This method adds some listeners to the window. If the method is overridden, it should be called from the subclass to ensure the correct function of this station.

Parameters:
dockable - the element for which window will be used
placeholder - the name of dockable, used to place the new ScreenDockWindowHandle at its correct position. Can be null.
window - the window which was newly created
configuration - the configuration that was used to create window
Returns:
the newly created handle for window

deregister

protected void deregister(Dockable dockable,
                          ScreenDockWindow window)
Invoked when a ScreenDockWindow is no longer needed. This method removes some listeners from the window. If overridden by a subclass, the subclass should ensure that this implementation is invoked too.

Parameters:
dockable - the element for which window was used
window - the old window

getConfiguration

protected WindowConfiguration getConfiguration(Dockable dockable)
Gets the WindowConfiguration which should be used to create a new ScreenDockWindow for dockable.

Parameters:
dockable - the element that is going to be shown
Returns:
its confugration, not null

createWindow

protected ScreenDockWindow createWindow(WindowConfiguration configuration)
Creates a new window which is associated with this station.

Parameters:
configuration - the configuration that should be used to set up the new window
Returns:
the new window

updateWindows

protected void updateWindows()
Called if getOwner() changed. This method replaces existing ScreenDockWindow by new windows created by ScreenDockWindowFactory.updateWindow(ScreenDockWindow, WindowConfiguration, ScreenDockStation).


updateWindows

protected void updateWindows(boolean force)
Update all windows either by calling ScreenDockWindowFactory.updateWindow(ScreenDockWindow, WindowConfiguration, ScreenDockStation) or by calling ScreenDockWindowFactory.createWindow(ScreenDockStation, WindowConfiguration).

Parameters:
force - if true, then createWindow is used and all windows are replaced, if false the factory is allowed to do optimizations.

getOwner

public Window getOwner()
Gets the owner of this station. The owner is forwarded to some windows as their owner. So the windows will always remain in the foreground.

Returns:
the current owner
See Also:
getProvider()

getProvider

public WindowProvider getProvider()
Gets the provider which delivers window owners for the windows of this station.

Returns:
the provider for windows

getWindowFactory

public ScreenDockWindowFactory getWindowFactory()
Gets the factory that is currently used to create new windows for this station.

Returns:
the factory, not null

getWindowFactoryProperty

protected PropertyValue<ScreenDockWindowFactory> getWindowFactoryProperty()
Gets the property which represents the window factory.

Returns:
the property

setWindowFactory

public void setWindowFactory(ScreenDockWindowFactory factory)
Sets the factory that will be used to create new windows for this station, Calling this method will result in closing all existing windows and creating new windows.

Parameters:
factory - the new factory, null to set the default value

getWindowConfiguration

public ScreenDockWindowConfiguration getWindowConfiguration()
Gets the configuration which is currently used to create new windows.

Returns:
the configuration, not null

getWindowConfigurationProperty

protected PropertyValue<ScreenDockWindowConfiguration> getWindowConfigurationProperty()
Gets the property which represents the window configuration.

Returns:
the property, not null

setWindowConfiguration

public void setWindowConfiguration(ScreenDockWindowConfiguration configuration)
Sets the configuration which should be used to create new windows. Calling this method results in closing all existing windows and creating new windows.

Parameters:
configuration - the new configuration or null to use the default configuration

getFullscreenStrategy

public ScreenDockFullscreenStrategy getFullscreenStrategy()
Gets the current fullscreen strategy.

Returns:
the strategy, not null

setFullscreenStrategy

public void setFullscreenStrategy(ScreenDockFullscreenStrategy strategy)
Sets the strategy used to handle fullscreen mode.

Parameters:
strategy - the new strategy, null will reapply the default strategy

isShowing

public boolean isShowing()
Tells whether this station shows its children or not.

Returns:
true if the windows are visible, false otherwise
See Also:
setShowing(boolean)

setShowing

public void setShowing(boolean showing)
Sets the visibility of all windows of this station.

Parameters:
showing - true if all windows should be visible, false otherwise.

isStationShowing

public boolean isStationShowing()
Tells whether this station shows its children. This method just calls isShowing().

Returns:
true if the windows are visible, false if not.
See Also:
isShowing()

isStationVisible

@Deprecated
@Todo(compatibility=BREAK_MAJOR,
      priority=ENHANCEMENT,
      target=VERSION_1_1_3,
      description="remove this method")
public boolean isStationVisible()
Deprecated. 

Description copied from interface: DockStation
Tells whether this station is visible or not. For example a station on a JFrame is not visible if the frame is minimized.

Returns:
whether this station is visible

isChildShowing

public boolean isChildShowing(Dockable dockable)
Description copied from interface: DockStation
Tells whether the child dockable is visible or not. Visible means that the component of dockable can be seen by the user. The result must be false if this station is not visible.

Parameters:
dockable - the child whose visibility-state is questioned
Returns:
whether dockable is visible or not
See Also:
DockStation.isStationVisible()

isVisible

@Deprecated
@Todo(compatibility=BREAK_MAJOR,
      priority=ENHANCEMENT,
      target=VERSION_1_1_3,
      description="remove this method")
public boolean isVisible(Dockable dockable)
Deprecated. 

Description copied from interface: DockStation
Tells whether the child dockable is visible or not. Visible means that the component of dockable can be seen by the user. The result must be false if this station is not visible.

Specified by:
isVisible in interface DockStation
Overrides:
isVisible in class AbstractDockStation
Parameters:
dockable - the child whose visibility-state is questioned
Returns:
whether dockable is visible or not
See Also:
DockStation.isStationVisible()

getStationBounds

public Rectangle getStationBounds()

asDockable

public Dockable asDockable()
Description copied from interface: DockElement
Returns this if this is an instance of Dockable. Otherwise null is returned.

Returns:
this or null. Must not return null if DockElement.asDockable() already returns null.

asDockStation

public DockStation asDockStation()
Description copied from interface: DockElement
Returns this if this is an instance of DockStation. Otherwise null is returned.

Returns:
this or null. Must not return null if DockElement.asDockable() already returns null

getFactoryID

public String getFactoryID()
Description copied from interface: DockElement
Gets the unique name of the DockFactory which can read and write elements of this type.

Returns:
the id of the factory

getTitleVersion

public DockTitleVersion getTitleVersion()
Gets the DockTitleVersion used by this station to create new DockTitles.

Returns:
the version, can be null

getBoundaryRestriction

public BoundaryRestriction getBoundaryRestriction()
Gets the currently used BoundaryRestriction.

Returns:
the restriction

setBoundaryRestriction

public void setBoundaryRestriction(BoundaryRestriction restriction)
Changes the boundary restriction used to check the boundaries of the windows of this station.

Parameters:
restriction - the new restriction or null to reset the default value

checkWindowBoundaries

public void checkWindowBoundaries()
Checks the boundaries of all windows of this station


getMagnetController

public MagnetController getMagnetController()
Gets the MagnetController of this station. The MagnetController controlls the attraction between ScreenDockWindows.

Returns:
the controller, never null

getDropOverRatio

public double getDropOverRatio()
Tells the current overlapping two windows must have in order to be merged.

Returns:
the overlapping, a number between 0 and 1
See Also:
setDropOverRatio(double)

setDropOverRatio

public void setDropOverRatio(double dropOverRatio)
Sets how much two windows must overlap in order to be merged. This property is only used when dropping a Dockable. A value of 0 means that the windows don't have to overlap, a value of 1 indicates a perfect match. The default value is 0.75.

Parameters:
dropOverRatio - the new ratio, a value between 0 and 1 inclusive