com.sas.visuals
Class AutoSizingGridLayout

com.sas.visuals.AutoSizingGridLayout
All Implemented Interfaces:
ColumnWidthInterface, RowHeightInterface, java.awt.LayoutManager, java.io.Serializable

public class AutoSizingGridLayout
implements java.awt.LayoutManager, java.io.Serializable, ColumnWidthInterface, RowHeightInterface

The AutoSizingGridLayout is a versatile LayoutManager that lays components out in a grid similar to a spreadsheet. Each row and column of the grid is sized based on the size of the largest item in that row or column.

See Also:
Serialized Form

Field Summary
protected  int cols
           
protected  SpacePartitionerInterface columnPartitioner
           
protected  int defaultCellGravity
           
protected  boolean fillCell
           
protected  int gridGravity
           
protected  int hgap
           
protected  boolean ignoreSizeOfNonVisibleComponents
          ignoreSizeOfNonVisibleComponents determines whether a non-visible component is considered as being 0x0 pixels when determining the size of the row and column the component is in.
protected  java.awt.Container[] interlockedColumnContainers
          interlockedColumnContainers is an array of Containers which have LayoutManagers which implement the ColumnWidthInterface and should be used in determining the widths of the columns as if the columns in the interlocked container were in the container being layed out.
protected  java.awt.Container[] interlockedRowContainers
          interlockedRowContainers is an array of Containers which have LayoutManagers which implement the RowHeightInterface and should be used in determining the heights of the rows as if the rows in the interlocked container were in the container being layed out.
static java.lang.String RB_KEY
           
protected  int remainderColumn
          remainderColumn is a one-based index.
protected  int remainderRow
          remainderRow is a one-based index.
protected  SpacePartitionerInterface rowPartitioner
           
protected  int rows
           
protected  boolean useColumnRemainder
           
protected  boolean useRowRemainder
           
protected  int vgap
           
 
Constructor Summary
AutoSizingGridLayout()
          Creates a grid layout with a default of one column per component, in a single row.
AutoSizingGridLayout(int rows, int cols)
          Creates a grid layout with the specified rows and columns.
AutoSizingGridLayout(int rows, int cols, int hgap, int vgap)
          Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.
AutoSizingGridLayout(int rows, int cols, int hgap, int vgap, boolean fillCell, boolean useRowRemainder, boolean useColumnRemainder)
          Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Adds the specified component with the specified name to the layout.
 int[] getActualColumnPositions(java.awt.Container parent)
          Returns an array of column positions (in pixels) that the Container passed in would have if its contents were layed out using the AutoSizingGridLayout.
 int getColumns()
          Returns the number of columns in this layout.
 SpacePartitionerInterface getColumnSpacePartitioner()
          Returns the SpacePartitionerInterface which is used to allocate horizontal space to the components.
 int getDefaultCellGravity()
          Returns the default gravity for the cells.
 boolean getFillCell()
          Returns whether the component is resized to fill the entire grid cell (true) or it's preferred size is used (false).
 int getGridGravity()
          Returns the gravity for the grid.
 int getHgap()
          Returns the horizontal gap between components.
 boolean getIgnoreSizeOfNonVisibleComponents()
          Returns whether the size of non-visible components contributes to the size of the row and column the component is in.
 java.awt.Container[] getInterlockedColumnContainers()
          Returns the array of containers used when determining the sizes of the columns.
protected  int[] getInterlockedColumnWidths(java.awt.Container parent, java.awt.Component[] comps, java.awt.Dimension[] prefSize, int ncols)
          A helper method used when the interlockedColumnContainers property is true.
protected  int[] getInterlockedColumnWidths(java.awt.Container parent, int ncols)
          A helper method used when the interlockedColumnContainers property is true.
 java.awt.Container[] getInterlockedRowContainers()
          Returns the array of containers used when determining the sizes of the rows.
protected  int[] getInterlockedRowHeights(java.awt.Container parent, java.awt.Component[] comps, java.awt.Dimension[] prefSize, int nrows, int ncols)
          A helper method used when the interlockedRowContainers property is true.
protected  int[] getInterlockedRowHeights(java.awt.Container parent, int nrows, int ncols)
          A helper method used when the interlockedRowContainers property is true.
 int[] getPreferredColumnWidths(java.awt.Container parent, int ncols)
          Method getPreferredColumnWidths.
protected  int[] getPreferredRowHeights(java.awt.Component[] comps, java.awt.Dimension[] prefSizes, int nrows, int ncols)
          Method getPreferredRowHeights.
protected  int[] getPreferredRowHeights(java.awt.Container parent, int nrows, int ncols)
          Method getPreferredRowHeights.
 int[] getPreferredRowHeightsPublic(java.awt.Container parent, int nrows, int ncols)
          getPreferredRowHeights should have been public before V1.2 webAf, but it was originally protected.
 int getRemainderColumn()
          Returns the column which is widened by the remaining space of the container after the preferred size of the other columns has been parceled out.
 int getRemainderRow()
          Returns the row which is widened by the remaining space of the container after the preferred size of the other rows has been parceled out.
 int getRows()
          Returns the number of rows in this layout.
 SpacePartitionerInterface getRowSpacePartitioner()
          Returns the SpacePartitionerInterface which is used to allocate vertical space to the components.
 boolean getUseColumnRemainder()
          Returns true if components in the last column will fill the cell width plus any remaing horizontal space; false if component width is preferred width.
 boolean getUseRowRemainder()
           
 int getVgap()
          Returns the vertical gap between components.
protected  int getXGridGravityOffset(int totalRemainingWidth)
          Helper method to calculate the horizontal offset of the grid within the available space based on the gridGravity property.
protected  int getYGridGravityOffset(int totalRemainingHeight)
          Helper method to calculate the vertical offset of the grid within the available space based on the gridGravity property.
 void layoutContainer(java.awt.Container parent)
          Lays out the container in the specified panel.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Returns the minimum dimensions needed to layout the components contained in the specified panel.
 void paintLines(java.awt.Graphics g, java.awt.Container parent)
          This method paints lines between the rows and columns.
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Returns the preferred dimensions for this layout given the components int the specified panel.
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component from the layout.
 void setColumns(int cols)
          Sets the number of columns in this layout.
 void setColumnSpacePartitioner(SpacePartitionerInterface columnPartitioner)
          Sets the SpacePartitionerInterface which is used to allocate horizontal space to the components.
 void setDefaultCellGravity(int defaultCellGravity)
          Sets the default gravity for the cells.
 void setFillCell(boolean fillCell)
          Sets whether the component is resized to fill the entire grid cell (true) or it's preferred size is used (false).
 void setGridGravity(int gridGravity)
          Sets the gravity for the grid.
 void setHgap(int hgap)
          Sets the horizontal gap between components.
 void setIgnoreSizeOfNonVisibleComponents(boolean ignoreSizeOfNonVisibleComponents)
          Sets whether the size of non-visible components contributes to the size of the row and column the component is in.
 void setInterlockedColumnContainer(java.awt.Container interlockedColumnContainer)
          Convenience method.
 void setInterlockedColumnContainers(java.awt.Container[] interlockedColumnContainers)
          Sets the array of containers used when determining the sizes of the columns.
 void setInterlockedRowContainer(java.awt.Container interlockedRowContainer)
          Convenience method.
 void setInterlockedRowContainers(java.awt.Container[] interlockedRowContainers)
          Sets the array of containers used when determining the sizes of the rows.
 void setRemainderColumn(int remainderColumn)
          Sets the column which is widened by the remaining space of the container after the preferred size of the other columns has been parceled out.
 void setRemainderRow(int remainderRow)
          Sets the row which is widened by the remaining space of the container after the preferred size of the other roww has been parceled out.
 void setRows(int rows)
          Sets the number of rows in this layout.
 void setRowSpacePartitioner(SpacePartitionerInterface rowPartitioner)
          Sets the SpacePartitionerInterface which is used to allocate vertical space to the components.
 void setUseColumnRemainder(boolean useColumnRemainder)
          Sets whether the components in the last column will fill the cell width plus any remaing horizontal space or if they will be their preferred width
 void setUseRowRemainder(boolean useRowRemainder)
           
 void setVgap(int vgap)
          Sets the vertical gap between components.
 java.lang.String toString()
          Returns the String representation of this AutoSizingGridLayout's property values.
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

hgap

protected int hgap

vgap

protected int vgap

rows

protected int rows

cols

protected int cols

fillCell

protected boolean fillCell

useColumnRemainder

protected boolean useColumnRemainder

useRowRemainder

protected boolean useRowRemainder

defaultCellGravity

protected int defaultCellGravity

gridGravity

protected int gridGravity

columnPartitioner

protected SpacePartitionerInterface columnPartitioner

rowPartitioner

protected SpacePartitionerInterface rowPartitioner

ignoreSizeOfNonVisibleComponents

protected boolean ignoreSizeOfNonVisibleComponents
ignoreSizeOfNonVisibleComponents determines whether a non-visible component is considered as being 0x0 pixels when determining the size of the row and column the component is in.


remainderColumn

protected int remainderColumn
remainderColumn is a one-based index. remainderColumn indicates which column should get the remaining space when useColumnRemainder is true. If remainderColumn is 0, it indicates that the last column should get the remainder.


remainderRow

protected int remainderRow
remainderRow is a one-based index. remainderRow indicates which row should get the remaining space when useRowRemainder is true. If remainderRow is 0, it indicates that the last row should get the remainder.


interlockedColumnContainers

protected java.awt.Container[] interlockedColumnContainers
interlockedColumnContainers is an array of Containers which have LayoutManagers which implement the ColumnWidthInterface and should be used in determining the widths of the columns as if the columns in the interlocked container were in the container being layed out.


interlockedRowContainers

protected java.awt.Container[] interlockedRowContainers
interlockedRowContainers is an array of Containers which have LayoutManagers which implement the RowHeightInterface and should be used in determining the heights of the rows as if the rows in the interlocked container were in the container being layed out.

Constructor Detail

AutoSizingGridLayout

public AutoSizingGridLayout()
Creates a grid layout with a default of one column per component, in a single row. Calls AutoSizingGridLayout( 0, 0 ).


AutoSizingGridLayout

public AutoSizingGridLayout(int rows,
                            int cols)
Creates a grid layout with the specified rows and columns. Calls AutoSizingGridLayout( rows, cols, 0, 0 ).

Parameters:
rows - the rows
cols - the columns

AutoSizingGridLayout

public AutoSizingGridLayout(int rows,
                            int cols,
                            int hgap,
                            int vgap)
Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap. Calls AutoSizingGridLayout( rows, cols, hgap, vgap, false, false, false ).

Parameters:
rows - the rows; zero means 'any number.'
cols - the columns; zero means 'any number.' Only one of 'rows' and 'cols' can be zero, not both.
hgap - the horizontal gap variable
vgap - the vertical gap variable
Throws:
java.lang.IllegalArgumentException - If the rows and columns are invalid.

AutoSizingGridLayout

public AutoSizingGridLayout(int rows,
                            int cols,
                            int hgap,
                            int vgap,
                            boolean fillCell,
                            boolean useRowRemainder,
                            boolean useColumnRemainder)
Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.

Parameters:
rows - the rows; zero means 'any number.'
cols - the columns; zero means 'any number.' Only one of 'rows' and 'cols' can be zero, not both.
hgap - the horizontal gap variable
vgap - the vertical gap variable
fillCell - true if a component should be sized to fill its cell; if false, a component should be sized to its preferred size
useRowRemainder - if true components in the remainder row will fill the cell height plus any remaining vertical space; if false component height is preferred height
useColumnRemainder - if true components in the remainder column will fill the cell width plus any remaing horizontal space; if false component width is preferred width
Throws:
java.lang.IllegalArgumentException - If the rows and columns are invalid.
Method Detail

getDefaultCellGravity

public int getDefaultCellGravity()
Returns the default gravity for the cells. The default gravity is used if no gravity is specified for the cell.

Returns:
int
See Also:
setDefaultCellGravity(int)

setDefaultCellGravity

public void setDefaultCellGravity(int defaultCellGravity)
Sets the default gravity for the cells. The default gravity is used if no gravity is specified for the cell. Valid values from the Orientations class are : TOP_LEFT, TOP, TOP_RIGHT, LEFT, CENTER, RIGHT, BOTTOM_LEFT, BOTTOM, BOTTOM_RIGHT.

Parameters:
defaultCellGravity - int
See Also:
Orientations, getDefaultCellGravity()

getGridGravity

public int getGridGravity()
Returns the gravity for the grid.

Returns:
int
See Also:
setDefaultCellGravity(int)

setGridGravity

public void setGridGravity(int gridGravity)
Sets the gravity for the grid. Valid values from the Orientations class are : TOP_LEFT, TOP, TOP_RIGHT, LEFT, CENTER, RIGHT, BOTTOM_LEFT, BOTTOM, BOTTOM_RIGHT.

Parameters:
gridGravity - int
See Also:
Orientations, getGridGravity()

getColumnSpacePartitioner

public SpacePartitionerInterface getColumnSpacePartitioner()
Returns the SpacePartitionerInterface which is used to allocate horizontal space to the components.

Returns:
the SpacePartitionerInterface which is used to allocate horizontal space to the components.
See Also:
setColumnSpacePartitioner(com.sas.visuals.adapters.SpacePartitionerInterface)

setColumnSpacePartitioner

public void setColumnSpacePartitioner(SpacePartitionerInterface columnPartitioner)
Sets the SpacePartitionerInterface which is used to allocate horizontal space to the components.

Parameters:
columnPartitioner - the SpacePartitionerInterface which is used to allocate horizontal space to the components.
See Also:
getColumnSpacePartitioner()

getRowSpacePartitioner

public SpacePartitionerInterface getRowSpacePartitioner()
Returns the SpacePartitionerInterface which is used to allocate vertical space to the components.

Returns:
the SpacePartitionerInterface which is used to allocate vertical space to the components.
See Also:
setRowSpacePartitioner(com.sas.visuals.adapters.SpacePartitionerInterface)

setRowSpacePartitioner

public void setRowSpacePartitioner(SpacePartitionerInterface rowPartitioner)
Sets the SpacePartitionerInterface which is used to allocate vertical space to the components.

Parameters:
rowPartitioner - SpacePartitionerInterface
See Also:
getRowSpacePartitioner()

getIgnoreSizeOfNonVisibleComponents

public boolean getIgnoreSizeOfNonVisibleComponents()
Returns whether the size of non-visible components contributes to the size of the row and column the component is in.

Returns:
Whether the size of non-visible components contributes to the size of the row and column the component is in.
See Also:
setIgnoreSizeOfNonVisibleComponents(boolean)

setIgnoreSizeOfNonVisibleComponents

public void setIgnoreSizeOfNonVisibleComponents(boolean ignoreSizeOfNonVisibleComponents)
Sets whether the size of non-visible components contributes to the size of the row and column the component is in.

Parameters:
ignoreSizeOfNonVisibleComponents - whether the size of non-visible components contributes to the size of the row and column the component is in.
See Also:
getIgnoreSizeOfNonVisibleComponents()

getRows

public int getRows()
Returns the number of rows in this layout.

Returns:
the number of rows in this layout.

setRows

public void setRows(int rows)
Sets the number of rows in this layout.

Parameters:
rows - number of rows in this layout

getColumns

public int getColumns()
Returns the number of columns in this layout.

Returns:
the number of columns in this layout.

setColumns

public void setColumns(int cols)
Sets the number of columns in this layout.

Parameters:
cols - number of columns in this layout

getHgap

public int getHgap()
Returns the horizontal gap between components.

Returns:
the horizontal gap between components.

setHgap

public void setHgap(int hgap)
Sets the horizontal gap between components.

Parameters:
hgap - the horizontal gap between components

getVgap

public int getVgap()
Returns the vertical gap between components.

Returns:
the vertical gap between components.

setVgap

public void setVgap(int vgap)
Sets the vertical gap between components.

Parameters:
vgap - the vertical gap between components

setFillCell

public void setFillCell(boolean fillCell)
Sets whether the component is resized to fill the entire grid cell (true) or it's preferred size is used (false).

Parameters:
fillCell - true to resize to components to fill cells, false to use preferred component size.

getFillCell

public boolean getFillCell()
Returns whether the component is resized to fill the entire grid cell (true) or it's preferred size is used (false).

Returns:
whether the component is resized to fill the entire grid cell (true) or it's preferred size is used (false).

getRemainderColumn

public int getRemainderColumn()
Returns the column which is widened by the remaining space of the container after the preferred size of the other columns has been parceled out. The index is 1 based.

Returns:
the column which is widened by the remaining space of the container after the preferred size of the other columns has been parceled out. The index is 1 based.

setRemainderColumn

public void setRemainderColumn(int remainderColumn)
Sets the column which is widened by the remaining space of the container after the preferred size of the other columns has been parceled out. The index is 1 based and a value of -1 will result in thr last column getting the remainder space.

Parameters:
remainderColumn - the column which is widened by the remaining space of the container after the preferred size of the other columns has been parceled out. The index is 1 based.

getUseColumnRemainder

public boolean getUseColumnRemainder()
Returns true if components in the last column will fill the cell width plus any remaing horizontal space; false if component width is preferred width.

Returns:
true if components in the last column will fill the cell width plus any remaing horizontal space; false if component width is preferred width
See Also:
setFillCell(boolean)

setUseColumnRemainder

public void setUseColumnRemainder(boolean useColumnRemainder)
Sets whether the components in the last column will fill the cell width plus any remaing horizontal space or if they will be their preferred width

Parameters:
useColumnRemainder - if true components in the last column will fill the cell width plus any remaing horizontal space; if false component width is preferred width
See Also:
setFillCell(boolean)

getRemainderRow

public int getRemainderRow()
Returns the row which is widened by the remaining space of the container after the preferred size of the other rows has been parceled out. The index is 1 based.

Returns:
the row which is widened by the remaining space of the container after the preferred size of the other rows has been parceled out. The index is 1 based.

setRemainderRow

public void setRemainderRow(int remainderRow)
Sets the row which is widened by the remaining space of the container after the preferred size of the other roww has been parceled out. The index is 1 based and a value of -1 will result in thr last row getting the remainder space.

Parameters:
remainderRow - the row which is widened by the remaining space of the container after the preferred size of the other roww has been parceled out. The index is 1 based.

getUseRowRemainder

public boolean getUseRowRemainder()
Returns:
boolean
See Also:
setFillCell(boolean)

setUseRowRemainder

public void setUseRowRemainder(boolean useRowRemainder)
Parameters:
useRowRemainder - if true components in the last row will fill the cell height plus any remaining vertical space; if false component height is preferred height
See Also:
setFillCell(boolean)

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Adds the specified component with the specified name to the layout. Does not apply.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - the name of the component
comp - the component to be added
See Also:
LayoutManager.addLayoutComponent(String, Component)

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout. Does not apply.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
comp - the component to be removed
See Also:
LayoutManager.removeLayoutComponent(Component)

getPreferredRowHeightsPublic

public final int[] getPreferredRowHeightsPublic(java.awt.Container parent,
                                                int nrows,
                                                int ncols)
getPreferredRowHeights should have been public before V1.2 webAf, but it was originally protected. So, getPreferredRowHeightsPublic simply calls getPreferredRowHeights.

Specified by:
getPreferredRowHeightsPublic in interface RowHeightInterface
Parameters:
parent - Container
nrows - int
ncols - int
Returns:
int[]
See Also:
getPreferredRowHeights(java.awt.Container, int, int)

getPreferredRowHeights

protected int[] getPreferredRowHeights(java.awt.Container parent,
                                       int nrows,
                                       int ncols)
Method getPreferredRowHeights.

Parameters:
parent - Container
nrows - int
ncols - int
Returns:
int[]

getPreferredRowHeights

protected int[] getPreferredRowHeights(java.awt.Component[] comps,
                                       java.awt.Dimension[] prefSizes,
                                       int nrows,
                                       int ncols)
Method getPreferredRowHeights.

Parameters:
comps - Component[]
prefSizes - Dimension[]
nrows - int
ncols - int
Returns:
int[]

getPreferredColumnWidths

public int[] getPreferredColumnWidths(java.awt.Container parent,
                                      int ncols)
Method getPreferredColumnWidths.

Specified by:
getPreferredColumnWidths in interface ColumnWidthInterface
Parameters:
parent - Container
ncols - int
Returns:
int[]
See Also:
ColumnWidthInterface.getPreferredColumnWidths(Container, int)

getInterlockedColumnContainers

public java.awt.Container[] getInterlockedColumnContainers()
Returns the array of containers used when determining the sizes of the columns. The LayoutManager for each of the containers in the array is queried via the ColumnWidthInterface to determine the widths of the columns in that container.

Returns:
The array of containers to use to determine the widths of the columns.
See Also:
setInterlockedColumnContainers(java.awt.Container[])

setInterlockedColumnContainer

public void setInterlockedColumnContainer(java.awt.Container interlockedColumnContainer)
Convenience method. Calls setInterlockedColumnContainers( new Container[] { interlockedColumnContainer } );

Parameters:
interlockedColumnContainer - Container
See Also:
setInterlockedColumnContainers(java.awt.Container[])

setInterlockedColumnContainers

public void setInterlockedColumnContainers(java.awt.Container[] interlockedColumnContainers)
Sets the array of containers used when determining the sizes of the columns. The LayoutManager for each of the containers in the array is queried via the ColumnWidthInterface to determine the widths of the columns in that container.

Parameters:
interlockedColumnContainers - The array of containers to use to determine the widths of the columns.
See Also:
getInterlockedColumnContainers()

getInterlockedRowContainers

public java.awt.Container[] getInterlockedRowContainers()
Returns the array of containers used when determining the sizes of the rows. The LayoutManager for each of the containers in the array is queried via the RowHeightInterface to determine the heights of the rows in that container.

Returns:
The array of containers to use to determine the heights of the rows.
See Also:
setInterlockedRowContainers(java.awt.Container[])

setInterlockedRowContainer

public void setInterlockedRowContainer(java.awt.Container interlockedRowContainer)
Convenience method. Calls setInterlockedRowContainers( new Container[] { interlockedRowContainer } );

Parameters:
interlockedRowContainer - Container
See Also:
setInterlockedRowContainers(java.awt.Container[])

setInterlockedRowContainers

public void setInterlockedRowContainers(java.awt.Container[] interlockedRowContainers)
Sets the array of containers used when determining the sizes of the rows. The LayoutManager for each of the containers in the array is queried via the RowHeightInterface to determine the heights of the rows in that container.

Parameters:
interlockedRowContainers - The array of containers to use to determine the height of the rows.
See Also:
getInterlockedRowContainers()

getInterlockedColumnWidths

protected int[] getInterlockedColumnWidths(java.awt.Container parent,
                                           int ncols)
A helper method used when the interlockedColumnContainers property is true. getInterlockedColumnWidths returns an array of integers which indicate the column widths based on the parent and the interlockedColumnContainers.

Parameters:
parent - The container to determine the column widths for.
ncols - The number of columns in that container.
Returns:
an array of integers which indicate the column widths based on the parent and the interlockedColumnContainers.

getInterlockedColumnWidths

protected int[] getInterlockedColumnWidths(java.awt.Container parent,
                                           java.awt.Component[] comps,
                                           java.awt.Dimension[] prefSize,
                                           int ncols)
A helper method used when the interlockedColumnContainers property is true. getInterlockedColumnWidths returns an array of integers which indicate the column widths based on the parent and the interlockedColumnContainers.

Parameters:
parent - The container to determine the column widths for.
comps - Component[]
prefSize - Dimension[]
ncols - The number of columns in that container.
Returns:
an array of integers which indicate the column widths based on the parent and the interlockedColumnContainers.

getInterlockedRowHeights

protected int[] getInterlockedRowHeights(java.awt.Container parent,
                                         int nrows,
                                         int ncols)
A helper method used when the interlockedRowContainers property is true. getInterlockedRowHeights returns an array of integers which indicate the row heights based on the parent and the interlockedRowContainers.

Parameters:
parent - The container to determine the row heights for.
nrows - The number of rows in that container.
ncols - The number of columns in that container.
Returns:
an array of integers which indicate the row heights based on the parent and the interlockedRowContainers.

getInterlockedRowHeights

protected int[] getInterlockedRowHeights(java.awt.Container parent,
                                         java.awt.Component[] comps,
                                         java.awt.Dimension[] prefSize,
                                         int nrows,
                                         int ncols)
A helper method used when the interlockedRowContainers property is true. getInterlockedRowHeights returns an array of integers which indicate the row heights based on the parent and the interlockedRowContainers.

Parameters:
parent - The container to determine the row heights for.
comps - Component[]
prefSize - Dimension[]
nrows - The number of rows in that container.
ncols - The number of columns in that container.
Returns:
an array of integers which indicate the row heights based on the parent and the interlockedRowContainers.

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Returns the preferred dimensions for this layout given the components int the specified panel.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - the component which needs to be laid out
Returns:
Dimension
See Also:
minimumLayoutSize(java.awt.Container)

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Returns the minimum dimensions needed to layout the components contained in the specified panel.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - the component which needs to be laid out
Returns:
Dimension
See Also:
preferredLayoutSize(java.awt.Container)

getXGridGravityOffset

protected int getXGridGravityOffset(int totalRemainingWidth)
Helper method to calculate the horizontal offset of the grid within the available space based on the gridGravity property.

Parameters:
totalRemainingWidth - int
Returns:
int

getYGridGravityOffset

protected int getYGridGravityOffset(int totalRemainingHeight)
Helper method to calculate the vertical offset of the grid within the available space based on the gridGravity property.

Parameters:
totalRemainingHeight - int
Returns:
int

layoutContainer

public void layoutContainer(java.awt.Container parent)
Lays out the container in the specified panel.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
parent - the specified component being laid out
See Also:
Container

getActualColumnPositions

public int[] getActualColumnPositions(java.awt.Container parent)
Returns an array of column positions (in pixels) that the Container passed in would have if its contents were layed out using the AutoSizingGridLayout.

Parameters:
parent - The container to determine the column positions for.
Returns:
An integer array of column positions.

paintLines

public void paintLines(java.awt.Graphics g,
                       java.awt.Container parent)
This method paints lines between the rows and columns. It centers the lines in the gap between the columns if possible. If there is not a gap, the lines may not show up since they can be drawn over by the child components.

Components which call this method should synchronize on the container when adding/removing children so that a comflict does not happen between the child manipulation and a painting thread.

Parameters:
g - The graphics context to use to draw the lines.
parent - The container to draw the lines in.

toString

public java.lang.String toString()
Returns the String representation of this AutoSizingGridLayout's property values.

Overrides:
toString in class java.lang.Object
Returns:
the String representation of this AutoSizingGridLayout's property values.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.