bibliothek.gui.dock.station.layer
Interface DockStationDropLayer

All Known Implementing Classes:
DefaultDropLayer, FlapOverrideDropLayer, FlapSideDropLayer, ScreenLayer, ScreenWindowLayer, SideSnapDropLayer, SplitOverrideDropLayer, TabDropLayer, WindowDropLayer

public interface DockStationDropLayer

A DockStationDropLayer describes an area of the screen where a drag and drop operation can end with the "drop event". Several levels can be active at the same time, and there is a strong order in which level is more important than the other level, the first level hit by the mouse wins.
The order of two DockStationDropLayers is calculated by applying the following steps, the first conclusive result is the final result.

Levels whose contains(int, int) method returns false for the current position of the mouse are ignored for the order, but not when calling modify.

Author:
Benjamin Sigg

Method Summary
 boolean canCompare(DockStationDropLayer level)
          Tells whether this level contains code to tell whether it has a higher or lower priority as level.
 int compare(DockStationDropLayer level)
          Compares this level with level.
 boolean contains(int x, int y)
          Tells whether this level contains the point x/y, which is the position of the mouse on the screen.
 Component getComponent()
          Gets a Component which is associated with this level.
 LayerPriority getPriority()
          Gets the basic priority of this level.
 DockStation getStation()
          Gets the DockStation which created this level.
 DockStationDropLayer modify(DockStationDropLayer child)
          This method is called for any DockStationDropLayer whose station is a child to the station of this level.
 void setPriority(LayerPriority priority)
          Sets a new priority for this level.
 

Method Detail

getStation

DockStation getStation()
Gets the DockStation which created this level.

Returns:
the creator and owner of this level

getComponent

Component getComponent()
Gets a Component which is associated with this level. The Component can be used to order levels because Components can overlap each other. This is an optional method, a result of null is perfectly valid.

Returns:
some component or null

modify

DockStationDropLayer modify(DockStationDropLayer child)
This method is called for any DockStationDropLayer whose station is a child to the station of this level. This method may modify the level, e.g. increase or decrease its priority. This method is called before this level itself gets modified by its parents. This method is called independent of whether contains(int, int) returns true or false.

Parameters:
child - the child to modify, this method may either directly modify child, create a wrapper or a copy of child
Returns:
either child or a new DockStationDropLayer replacing child, not null

contains

boolean contains(int x,
                 int y)
Tells whether this level contains the point x/y, which is the position of the mouse on the screen.

Parameters:
x - the x-coordinate of the mouse on the screen
y - the y-coordinate of the mouse on the screen
Returns:
true if this level contains x/y, false otherwise

getPriority

LayerPriority getPriority()
Gets the basic priority of this level.

Returns:
the basic priority, must not be null

setPriority

void setPriority(LayerPriority priority)
Sets a new priority for this level.

Parameters:
priority - the new priority, must not be null

canCompare

boolean canCompare(DockStationDropLayer level)
Tells whether this level contains code to tell whether it has a higher or lower priority as level. For most implementations the result of this method should be false.
If this method returns true, then the ordering defined by the custom algorithm supercedes any other conditions.

Parameters:
level - some other level to check
Returns:
true if this DockStationDropLayer contains code to compare level with this

compare

int compare(DockStationDropLayer level)
Compares this level with level. This method is only called if canCompare(DockStationDropLayer) returned true for level. This method works like Comparable.compareTo(Object).

Parameters:
level - another level to compare
Returns:
a number less/equal/higher than zero, if this level has higher/equal/lesser priority than level.