dsto.dfc.swing.controls
Class WindowLayout

java.lang.Object
  extended by dsto.dfc.swing.controls.WindowLayout

public final class WindowLayout
extends Object

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

Version:
$Revision$

Field Summary
static int BOTTOM_LEFT
           
static int BOTTOM_RIGHT
           
static int CENTER
           
static int DEFAULT_DISTANCE
           
static int EAST
           
static int MID_BOTTOM
           
static int MID_LEFT
           
static int MID_RIGHT
           
static int MID_TOP
           
static int NORTH
           
static int NORTH_EAST
           
static int NORTH_WEST
           
static int SOUTH
           
static int SOUTH_EAST
           
static int SOUTH_WEST
           
static int TOP_LEFT
           
static int TOP_RIGHT
           
static int WEST
           
 
Method Summary
static void bumpRectangle(Rectangle parentRect, Rectangle childRect)
           
protected static Point getOffsetForPoint(Dimension shape, int connector)
           
static void placeWindow(Window window, int position)
          Places a window at a specified alignmnent on the screen.
static void placeWindow(Window parent, int fromPoint, Window child, int toPoint)
           
static void placeWindow(Window parent, int fromPoint, Window child, int toPoint, int direction)
          Places a window at a default distance.
static void placeWindow(Window parent, int fromPoint, Window child, int toPoint, int direction, int distance)
          Places 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 void placeWindow(Window window, Point location)
          Place a window, adjusting so it does not go outside the screen.
static void placeWindow(Window parent, Window child, int position)
          Align a child window relative to its parent.
 
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

TOP_LEFT

public static final int TOP_LEFT
See Also:
Constant Field Values

MID_TOP

public static final int MID_TOP
See Also:
Constant Field Values

TOP_RIGHT

public static final int TOP_RIGHT
See Also:
Constant Field Values

MID_RIGHT

public static final int MID_RIGHT
See Also:
Constant Field Values

BOTTOM_RIGHT

public static final int BOTTOM_RIGHT
See Also:
Constant Field Values

MID_BOTTOM

public static final int MID_BOTTOM
See Also:
Constant Field Values

BOTTOM_LEFT

public static final int BOTTOM_LEFT
See Also:
Constant Field Values

MID_LEFT

public static final int MID_LEFT
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

placeWindow

public static void placeWindow(Window window,
                               int position)
Places a window at a specified alignmnent on the screen.

Parameters:
window - The window to place.
position - The position of the window (TOP_LEFT, CENTER, etc).

placeWindow

public static void placeWindow(Window parent,
                               int fromPoint,
                               Window child,
                               int toPoint)

placeWindow

public static void placeWindow(Window parent,
                               int fromPoint,
                               Window child,
                               int toPoint,
                               int direction)
Places a window at a default distance. See placeWindow below.


placeWindow

public static void placeWindow(Window parent,
                               int fromPoint,
                               Window child,
                               int toPoint,
                               int direction,
                               int distance)
Places 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:
parent - The parent window. May be null in which case the screen dimensions are used.
fromPoint - The point on the parent to connect the strut. One of TOP_RIGHT, BOTTOM_LEFT, etc.
child - The child window.
toPoint - The point on the child to connect the strut. See fromPoint for possible values.
direction - The direction of the strut.
distance - The length of the strut.

placeWindow

public static void placeWindow(Window parent,
                               Window child,
                               int position)
Align a child window relative to its parent.

Parameters:
parent - The parent window.
child - The child window.
position - The child's alignment relative to parent.

placeWindow

public static void placeWindow(Window window,
                               Point location)
Place a window, adjusting so it does not go outside the screen.


getOffsetForPoint

protected static Point getOffsetForPoint(Dimension shape,
                                         int connector)

bumpRectangle

public static void bumpRectangle(Rectangle parentRect,
                                 Rectangle childRect)


Copyright © 2008 Commonwealth of Australia