bibliothek.gui.dock.station.split
Interface Divideable

All Known Implementing Classes:
Node

public interface Divideable

A Divideable offers the information needed to represent a dividier between two SplitNodes. The Divideable may itself be a SplitNode. The location of a dividier is encoded by a double, where 0 means top/left, and 1.0 means bottom/right.

Author:
Benjamin Sigg

Method Summary
 double getDivider()
          Gets the location of the divider.
 double getDividerAt(int x, int y)
          Calculates the value which the divider must have on condition that the point x/y lies inside the divider bounds.
 Rectangle getDividerBounds(double divider, Rectangle bounds)
          Calculates the location and the size of the area which represents the divider.
 SplitDockStation.Orientation getOrientation()
          Gets the orientation of this divideable.
 void setDivider(double divider)
          Sets the location of the divider.
 double validateDivider(double divider)
          Validates the new location divider.
 

Method Detail

getDividerAt

double getDividerAt(int x,
                    int y)
Calculates the value which the divider must have on condition that the point x/y lies inside the divider bounds.

Parameters:
x - x-coordinate of the point in pixel
y - y-coordinate of the point in pixel
Returns:
The value that the divider should have. This value might not be valid if the coordinates of the point are too extreme.

getDividerBounds

Rectangle getDividerBounds(double divider,
                           Rectangle bounds)
Calculates the location and the size of the area which represents the divider. The user can grab this area with the mouse and drag it around.

Parameters:
divider - The location of the divider, should be between 0 and 1.
bounds - A rectangle in which the result will be stored. It can be null
Returns:
Either bounds or a new Rectangle if bounds was null

getOrientation

SplitDockStation.Orientation getOrientation()
Gets the orientation of this divideable. The orientation tells how to layout the children. If the orientation is SplitDockStation.Orientation.VERTICAL, one child will be at the top and the other at the bottom.

Returns:
the orientation

getDivider

double getDivider()
Gets the location of the divider.

Returns:
the divider
See Also:
setDivider(double)

setDivider

void setDivider(double divider)
Sets the location of the divider. The area of the left child is the area of the whole node multiplied with divider.

Parameters:
divider - the dividier

validateDivider

double validateDivider(double divider)
Validates the new location divider.

Parameters:
divider - the new divider
Returns:
a valid version of divider