Package net.sf.jguiraffe.gui.layout
Class BorderLayout
- java.lang.Object
-
- net.sf.jguiraffe.gui.layout.PercentLayoutBase
-
- net.sf.jguiraffe.gui.layout.BorderLayout
-
- All Implemented Interfaces:
Serializable
public class BorderLayout extends PercentLayoutBase
A GUI library independent implementation of the AWT layout manager BorderLayout.
This layout manager implements the
BorderLayoutfunctionality based on thePercentLayoutlayout manager. Because of that it can be used for all platforms for which an adapter is available.This implementation differs from the original
BorderLayoutin 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 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCENTERConstant for the layout constraints Center.static StringEASTConstant for the layout constraints East.static StringNORTHConstant for the layout constraints North.static StringSOUTHConstant for the layout constraints South.static StringWESTConstant for the layout constraints West.
-
Constructor Summary
Constructors Constructor Description BorderLayout()Creates a new instance ofBorderLayout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumberWithUnitgetBottomMargin()Returns the bottom margin.NumberWithUnitgetEastGap()Returns the east gap.NumberWithUnitgetLeftMargin()Returns the left margin.NumberWithUnitgetNorthGap()Returns the north gap.NumberWithUnitgetRightMargin()Returns the right margin.NumberWithUnitgetSouthGap()Returns the south gap.NumberWithUnitgetTopMargin()Returns the top margin.NumberWithUnitgetWestGap()Returns the west gap.protected voidinitCells(PercentLayoutPlatformAdapter adapter)Initializes the percent layout.protected voidinitConstraints(boolean north, boolean south, boolean west, boolean east)Initializes the column and row constraints for the percent layout.voidsetBottomMargin(NumberWithUnit bottomMargin)Sets the bottom margin.voidsetEastGap(NumberWithUnit eastGap)Sets the east gap.voidsetLeftMargin(NumberWithUnit leftMargin)Sets the left margin.voidsetNorthGap(NumberWithUnit northGap)Sets the north gap.voidsetRightMargin(NumberWithUnit rightMargin)Sets the right margin.voidsetSouthGap(NumberWithUnit southGap)Sets the south gap.voidsetTopMargin(NumberWithUnit topMargin)Sets the top margin.voidsetWestGap(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, calcMinimumLayoutSize, calcPreferredLayoutSize, calcSizes, calcTotalWeight, checkConstraints, clearCells, clearCells, constraintsFor, fetchPlatformAdapter, flushCache, getAllColumnConstraints, getAllRowConstraints, getColumnConstraints, getColumnCount, getColumnGroups, getComponent, getConstraintsBuilder, getInternalAllColumnConstraints, getInternalAllRowConstraints, getMinimumComponentSize, getOrientationValue, getPercentData, getPlatformAdapter, getPreferredComponentSize, getRowConstraints, getRowCount, getRowGroups, getSizeHandler, getTotalWeightX, getTotalWeightY, handleMultiSpans, initCell, initDimensions, initFromCollections, isCanShrink, performLayout, performLayout, removeComponent, setCanShrink, setColumnConstraints, setComponentBounds, setPlatformAdapter, setRowConstraints
-
-
-
-
Field Detail
-
NORTH
public static final String NORTH
Constant for the layout constraints North.- See Also:
- Constant Field Values
-
EAST
public static final String EAST
Constant for the layout constraints East.- See Also:
- Constant Field Values
-
SOUTH
public static final String SOUTH
Constant for the layout constraints South.- See Also:
- Constant Field Values
-
WEST
public static final String WEST
Constant for the layout constraints West.- See Also:
- Constant Field Values
-
CENTER
public static final String CENTER
Constant for the layout constraints Center.- See Also:
- Constant Field Values
-
-
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:
initCellsin classPercentLayoutBase- 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 occupiedsouth- flag whether the south position is occupiedwest- flag whether the west position is occupiedeast- flag whether the east position is occupied
-
-