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
BorderLayout
functionality based on thePercentLayout
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 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CENTER
Constant for the layout constraints Center.static String
EAST
Constant for the layout constraints East.static String
NORTH
Constant for the layout constraints North.static String
SOUTH
Constant for the layout constraints South.static String
WEST
Constant 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 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, 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:
initCells
in 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
-
-