dsto.dfc.swt.util
Class WindowLayout

java.lang.Object
  extended by dsto.dfc.swt.util.WindowLayout

public final class WindowLayout
extends Object

Provides utilities for placing windows relative to each other and to the screen.


Field Summary
static int CENTER
           
static int DEFAULT_DISTANCE
           
static int EAST
           
static int HORIZ_CENTER
           
static int HORIZ_LEFT
           
static int HORIZ_RIGHT
           
static int NORTH
           
static int NORTH_EAST
           
static int NORTH_WEST
           
static int SOUTH
           
static int SOUTH_EAST
           
static int SOUTH_WEST
           
static int VERT_BOTTOM
           
static int VERT_CENTER
           
static int VERT_TOP
           
static int WEST
           
 
Method Summary
static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Point windowSize, int position)
          Get location needed to place window at a specified alignmnent on the screen.
static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect, int fromPoint, org.eclipse.swt.graphics.Point childSize, int toPoint)
           
static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect, int fromPoint, org.eclipse.swt.graphics.Point childSize, int toPoint, int direction)
          Places a window at a default distance.
static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect, int fromPoint, org.eclipse.swt.graphics.Point childSize, int toPoint, int direction, int distance)
          Get location needed to place a child window relative to a parent (or the screen) using an imaginary strut connecting 8 points on the parent and child window's borders.
static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect, org.eclipse.swt.graphics.Point childSize, int position)
          Align a child window relative to its parent.
static void setLocation(org.eclipse.swt.widgets.Shell window, int position)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DISTANCE

public static final int DEFAULT_DISTANCE
See Also:
Constant Field Values

HORIZ_LEFT

public static final int HORIZ_LEFT
See Also:
Constant Field Values

HORIZ_CENTER

public static final int HORIZ_CENTER
See Also:
Constant Field Values

HORIZ_RIGHT

public static final int HORIZ_RIGHT
See Also:
Constant Field Values

VERT_TOP

public static final int VERT_TOP
See Also:
Constant Field Values

VERT_CENTER

public static final int VERT_CENTER
See Also:
Constant Field Values

VERT_BOTTOM

public static final int VERT_BOTTOM
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

NORTH

public static final int NORTH
See Also:
Constant Field Values

SOUTH

public static final int SOUTH
See Also:
Constant Field Values

EAST

public static final int EAST
See Also:
Constant Field Values

WEST

public static final int WEST
See Also:
Constant Field Values

NORTH_EAST

public static final int NORTH_EAST
See Also:
Constant Field Values

SOUTH_EAST

public static final int SOUTH_EAST
See Also:
Constant Field Values

SOUTH_WEST

public static final int SOUTH_WEST
See Also:
Constant Field Values

NORTH_WEST

public static final int NORTH_WEST
See Also:
Constant Field Values
Method Detail

setLocation

public static void setLocation(org.eclipse.swt.widgets.Shell window,
                               int position)

getLocation

public static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Point windowSize,
                                                         int position)
Get location needed to place window at a specified alignmnent on the screen.

Parameters:
windowSize - The size of the window to place.
position - The position of the window. A bitmask of one of the HORIZ_* constants with one of the VERT_* constants, eg "HORIZ_TOP | VERT_CENTER".
Returns:
The new location.

getLocation

public static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect,
                                                         org.eclipse.swt.graphics.Point childSize,
                                                         int position)
Align a child window relative to its parent.

Parameters:
parentRect - The parent window.
childSize - The size of the child window.
position - The child's alignment relative to parent.
Returns:
The new location.

getLocation

public static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect,
                                                         int fromPoint,
                                                         org.eclipse.swt.graphics.Point childSize,
                                                         int toPoint)

getLocation

public static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect,
                                                         int fromPoint,
                                                         org.eclipse.swt.graphics.Point childSize,
                                                         int toPoint,
                                                         int direction)
Places a window at a default distance. See placeWindow below.


getLocation

public static org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Rectangle parentRect,
                                                         int fromPoint,
                                                         org.eclipse.swt.graphics.Point childSize,
                                                         int toPoint,
                                                         int direction,
                                                         int distance)
Get location needed to place a child window relative to a parent (or the screen) using an imaginary strut connecting 8 points on the parent and child window's borders.

Parameters:
parentRect - The parent window. May be null in which case the screen dimensions are used.
fromPoint - The point on the parent to connect the strut. A bitmask of one of the HORIZ_* constants with one of the VERT_* constants, eg "HORIZ_TOP | VERT_CENTER".
childSize - The child window size.
toPoint - The point on the child to connect the strut. Same format as fromPoint.
direction - The direction of the strut.
distance - The length of the strut.
Returns:
The new location.


Copyright © 2008 Commonwealth of Australia