com.javadocking.dock
Class Position

java.lang.Object
  extended by com.javadocking.dock.Position

public class Position
extends java.lang.Object

This class describes the positions of dockables in LeafDocks and the positions of child docks in CompositeDocks.

A position has a number of dimensions. For each dimension there is an integer that specifies the position in that dimension.

In many cases the positions are one-dimensional, but some docks like FloatDock have 3-dimensional positions for their child docks:

This class describes also the integer constants for special positions of dockables or docks in other docks. The possible positions are:

Author:
Heidi Rakels.

Field Summary
static int BOTTOM
          A dock or dockable at the bottom of a dock.
static int CENTER
          A dock or dockable at the center of a dock.
static int LEFT
          A dock or dockable at the left side of a dock.
static int RIGHT
          A dock or dockable at the right side of a dock.
static int TOP
          A dock or dockable at the top of a dock.
 
Constructor Summary
Position()
          Creates a position with 0 dimensions.
Position(int position)
          Creates a position with 1 dimension.
Position(int[] positions)
          Creates a position with the given integers.
Position(int positionX, int positionY)
          Creates a position with 2 dimensions.
Position(int positionX, int positionY, int positionZ)
          Creates a position with 3 dimensions.
 
Method Summary
 boolean equals(java.lang.Object object)
           
 int getDimensions()
          Gets the number of dimensions of this position.
 int getPosition(int dimension)
          Gets the position integer for the given dimension.
static Position getPositionProperty(java.util.Properties properties, java.lang.String name, Position defaultValue)
          Gets the position property with the given name.
 int hashCode()
           
static void setPositionProperty(java.util.Properties properties, java.lang.String name, Position value)
          Adds the position property with the given name and value to the given properties.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CENTER

public static final int CENTER
A dock or dockable at the center of a dock.

See Also:
Constant Field Values

LEFT

public static final int LEFT
A dock or dockable at the left side of a dock.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
A dock or dockable at the right side of a dock.

See Also:
Constant Field Values

TOP

public static final int TOP
A dock or dockable at the top of a dock.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
A dock or dockable at the bottom of a dock.

See Also:
Constant Field Values
Constructor Detail

Position

public Position()
Creates a position with 0 dimensions.


Position

public Position(int position)
Creates a position with 1 dimension.

Parameters:
position - The position in the only dimension.

Position

public Position(int positionX,
                int positionY)
Creates a position with 2 dimensions.

Parameters:
positionX - The position in the first dimension.
positionY - The position in the second dimension.

Position

public Position(int positionX,
                int positionY,
                int positionZ)
Creates a position with 3 dimensions.

Parameters:
positionX - The position in the first dimension.
positionY - The position in the second dimension.
positionZ - The position in the third dimension.

Position

public Position(int[] positions)
Creates a position with the given integers.

Parameters:
positions - The positions in the different dimensions.
Method Detail

getDimensions

public int getDimensions()
Gets the number of dimensions of this position.

Returns:
The number of dimensions of this position.

getPosition

public int getPosition(int dimension)
Gets the position integer for the given dimension.

Parameters:
dimension - The dimension for which the position is retrieved.
Returns:
The position integer for the given dimension.
Throws:
java.lang.IllegalArgumentException - If the given dimension is < 0 or >= getDimensions().

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPositionProperty

public static Position getPositionProperty(java.util.Properties properties,
                                           java.lang.String name,
                                           Position defaultValue)
Gets the position property with the given name. If the property is not found, the default value is returned.

Parameters:
properties - The given properties where the property is searched.
name - The name of the property.
defaultValue - The default value of the property.
Returns:
The position property with the given name. If the property is not found, the default value is returned.

setPositionProperty

public static void setPositionProperty(java.util.Properties properties,
                                       java.lang.String name,
                                       Position value)
Adds the position property with the given name and value to the given properties.

Parameters:
properties - The given properties to which the property is added.
name - The name of the property.
value - The default value of the property.