bibliothek.gui.dock.station.split.layer
Class SideSnapDropLayer

java.lang.Object
  extended by bibliothek.gui.dock.station.split.layer.SideSnapDropLayer
All Implemented Interfaces:
DockStationDropLayer

public class SideSnapDropLayer
extends Object
implements DockStationDropLayer

Describes the area around a SplitDockStation where the user can drop a Dockable such that it appears at one side of the station

Author:
Benjamin Sigg

Constructor Summary
SideSnapDropLayer(SplitDockStation station)
          Creates a new layer
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SideSnapDropLayer

public SideSnapDropLayer(SplitDockStation station)
Creates a new layer

Parameters:
station - the owner of this level
Method Detail

getPriority

public LayerPriority getPriority()
Description copied from interface: DockStationDropLayer
Gets the basic priority of this level.

Specified by:
getPriority in interface DockStationDropLayer
Returns:
the basic priority, must not be null

setPriority

public void setPriority(LayerPriority priority)
Description copied from interface: DockStationDropLayer
Sets a new priority for this level.

Specified by:
setPriority in interface DockStationDropLayer
Parameters:
priority - the new priority, must not be null

canCompare

public boolean canCompare(DockStationDropLayer level)
Description copied from interface: DockStationDropLayer
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.

Specified by:
canCompare in interface DockStationDropLayer
Parameters:
level - some other level to check
Returns:
true if this DockStationDropLayer contains code to compare level with this

compare

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

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

getComponent

public Component getComponent()
Description copied from interface: DockStationDropLayer
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.

Specified by:
getComponent in interface DockStationDropLayer
Returns:
some component or null

getStation

public DockStation getStation()
Description copied from interface: DockStationDropLayer
Gets the DockStation which created this level.

Specified by:
getStation in interface DockStationDropLayer
Returns:
the creator and owner of this level

modify

public DockStationDropLayer modify(DockStationDropLayer child)
Description copied from interface: DockStationDropLayer
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 DockStationDropLayer.contains(int, int) returns true or false.

Specified by:
modify in interface DockStationDropLayer
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

public boolean contains(int x,
                        int y)
Description copied from interface: DockStationDropLayer
Tells whether this level contains the point x/y, which is the position of the mouse on the screen.

Specified by:
contains in interface DockStationDropLayer
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