net.sf.jguiraffe.gui.layout
Class BorderLayout

java.lang.Object
  extended by net.sf.jguiraffe.gui.layout.PercentLayoutBase
      extended by net.sf.jguiraffe.gui.layout.BorderLayout
All Implemented Interfaces:
java.io.Serializable

public class BorderLayout
extends PercentLayoutBase

A GUI library independent implementation of the AWT layout manager BorderLayout.

This layout manager implements the BorderLayout functionality based on the PercentLayout layout manager. Because of that it can be used for all platforms for which an adapter is available.

This implementation differs from the original BorderLayout in only a few points: Margins can be defined around the hosting container and individual gaps are supported between all hosted components. These margins and gaps can be specified using all supported units.

Version:
$Id: BorderLayout.java 164 2009-08-01 15:14:51Z oheger $
Author:
Oliver Heger
See Also:
Serialized Form

Field Summary
static java.lang.String CENTER
          Constant for the layout constraints Center.
static java.lang.String EAST
          Constant for the layout constraints East.
static java.lang.String NORTH
          Constant for the layout constraints North.
static java.lang.String SOUTH
          Constant for the layout constraints South.
static java.lang.String WEST
          Constant for the layout constraints West.
 
Constructor Summary
BorderLayout()
          Creates a new instance of BorderLayout.
 
Method Summary
 NumberWithUnit getBottomMargin()
          Returns the bottom margin.
 NumberWithUnit getEastGap()
          Returns the east gap.
 NumberWithUnit getLeftMargin()
          Returns the left margin.
 NumberWithUnit getNorthGap()
          Returns the north gap.
 NumberWithUnit getRightMargin()
          Returns the right margin.
 NumberWithUnit getSouthGap()
          Returns the south gap.
 NumberWithUnit getTopMargin()
          Returns the top margin.
 NumberWithUnit getWestGap()
          Returns the west gap.
protected  void initCells(PercentLayoutPlatformAdapter adapter)
          Initializes the percent layout.
protected  void initConstraints(boolean north, boolean south, boolean west, boolean east)
          Initializes the column and row constraints for the percent layout.
 void setBottomMargin(NumberWithUnit bottomMargin)
          Sets the bottom margin.
 void setEastGap(NumberWithUnit eastGap)
          Sets the east gap.
 void setLeftMargin(NumberWithUnit leftMargin)
          Sets the left margin.
 void setNorthGap(NumberWithUnit northGap)
          Sets the north gap.
 void setRightMargin(NumberWithUnit rightMargin)
          Sets the right margin.
 void setSouthGap(NumberWithUnit southGap)
          Sets the south gap.
 void setTopMargin(NumberWithUnit topMargin)
          Sets the top margin.
 void setWestGap(NumberWithUnit westGap)
          Sets the west gap.
 
Methods inherited from class net.sf.jguiraffe.gui.layout.PercentLayoutBase
addColumnGroup, addRowGroup, alignComponent, applyCellGroups, applyWeightFactors, applyWeightFactors, calcCellPositions, calcCellSize, calcCellSizes, calcCellSizesWithGroups, calcComponentSize, calcComponentSizes, calcLayoutSize, calcMinimumLayoutSize, calcTotalWeight, checkConstraints, clearCells, clearCells, constraintsFor, fetchPlatformAdapter, flushCache, getAllColumnConstraints, getAllRowConstraints, getColumnConstraints, getColumnCount, getColumnGroups, getComponent, getConstraintsBuilder, getMinimumComponentSize, getOrientationValue, getPercentData, getPlatformAdapter, getPreferredComponentSize, getRowConstraints, getRowCount, getRowGroups, getSizeHandler, getTotalWeightX, getTotalWeightY, handleMultiSpans, initCell, initDimensions, initFromCollections, performLayout, removeComponent, setColumnConstraints, setComponentBounds, setPlatformAdapter, setRowConstraints
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORTH

public static final java.lang.String NORTH
Constant for the layout constraints North.

See Also:
Constant Field Values

EAST

public static final java.lang.String EAST
Constant for the layout constraints East.

See Also:
Constant Field Values

SOUTH

public static final java.lang.String SOUTH
Constant for the layout constraints South.

See Also:
Constant Field Values

WEST

public static final java.lang.String WEST
Constant for the layout constraints West.

See Also:
Constant Field Values

CENTER

public static final java.lang.String CENTER
Constant for the layout constraints Center.

See Also:
Constant Field Values
Constructor Detail

BorderLayout

public BorderLayout()
Creates a new instance of BorderLayout.

Method Detail

getBottomMargin

public NumberWithUnit getBottomMargin()
Returns the bottom margin.

Returns:
the bottom margin

setBottomMargin

public void setBottomMargin(NumberWithUnit bottomMargin)
Sets the bottom margin.

Parameters:
bottomMargin - the bottom margin

getEastGap

public NumberWithUnit getEastGap()
Returns the east gap.

Returns:
the east gap

setEastGap

public void setEastGap(NumberWithUnit eastGap)
Sets the east gap. This is a gap between the center and the east component.

Parameters:
eastGap - the east gap

getLeftMargin

public NumberWithUnit getLeftMargin()
Returns the left margin.

Returns:
the left margin

setLeftMargin

public void setLeftMargin(NumberWithUnit leftMargin)
Sets the left margin.

Parameters:
leftMargin - the left margin

getNorthGap

public NumberWithUnit getNorthGap()
Returns the north gap.

Returns:
the north gap

setNorthGap

public void setNorthGap(NumberWithUnit northGap)
Sets the north gap. This is a gap between the north and the center component.

Parameters:
northGap - the north gap

getRightMargin

public NumberWithUnit getRightMargin()
Returns the right margin.

Returns:
the right margin

setRightMargin

public void setRightMargin(NumberWithUnit rightMargin)
Sets the right margin.

Parameters:
rightMargin - the right margin

getSouthGap

public NumberWithUnit getSouthGap()
Returns the south gap.

Returns:
the south gap

setSouthGap

public void setSouthGap(NumberWithUnit southGap)
Sets the south gap. This is a gap between the south and the center component.

Parameters:
southGap - the south gap

getTopMargin

public NumberWithUnit getTopMargin()
Returns the top margin.

Returns:
the top margin

setTopMargin

public void setTopMargin(NumberWithUnit topMargin)
Sets the top margin.

Parameters:
topMargin - the top margin

getWestGap

public NumberWithUnit getWestGap()
Returns the west gap.

Returns:
the west gap

setWestGap

public void setWestGap(NumberWithUnit westGap)
Sets the west gap. This is a gap between the west and the center component.

Parameters:
westGap - the west gap

initCells

protected void initCells(PercentLayoutPlatformAdapter adapter)
Initializes the percent layout. This implementation creates a layout with 7 columns and 7 rows and places the contained components in the appropriate cells according to their constraints.

Specified by:
initCells in class PercentLayoutBase
Parameters:
adapter - the platform adapter

initConstraints

protected void initConstraints(boolean north,
                               boolean south,
                               boolean west,
                               boolean east)
Initializes the column and row constraints for the percent layout. They depend on the occupied positions in the border layout.

Parameters:
north - flag whether the north position is occupied
south - flag whether the south position is occupied
west - flag whether the west position is occupied
east - flag whether the east position is occupied


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.