|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.visuals.AutoSizingGridLayout
public class AutoSizingGridLayout
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.
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 |
---|
public static final java.lang.String RB_KEY
protected int hgap
protected int vgap
protected int rows
protected int cols
protected boolean fillCell
protected boolean useColumnRemainder
protected boolean useRowRemainder
protected int defaultCellGravity
protected int gridGravity
protected SpacePartitionerInterface columnPartitioner
protected SpacePartitionerInterface rowPartitioner
protected boolean ignoreSizeOfNonVisibleComponents
protected int remainderColumn
protected int remainderRow
protected java.awt.Container[] interlockedColumnContainers
protected java.awt.Container[] interlockedRowContainers
Constructor Detail |
---|
public AutoSizingGridLayout()
public AutoSizingGridLayout(int rows, int cols)
rows
- the rowscols
- the columnspublic AutoSizingGridLayout(int rows, int cols, int hgap, int vgap)
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 variablevgap
- the vertical gap variable
java.lang.IllegalArgumentException
- If the rows and columns are invalid.public AutoSizingGridLayout(int rows, int cols, int hgap, int vgap, boolean fillCell, boolean useRowRemainder, boolean useColumnRemainder)
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 variablevgap
- the vertical gap variablefillCell
- true if a component should be sized to fill its cell;
if false, a component should be sized to its preferred sizeuseRowRemainder
- if true components in the remainder row will fill the cell height
plus any remaining vertical space; if false component height is preferred heightuseColumnRemainder
- if true components in the remainder column will fill the cell
width plus any remaing horizontal space; if false component width is preferred width
java.lang.IllegalArgumentException
- If the rows and columns are invalid.Method Detail |
---|
public int getDefaultCellGravity()
setDefaultCellGravity(int)
public void setDefaultCellGravity(int defaultCellGravity)
defaultCellGravity
- intOrientations
,
getDefaultCellGravity()
public int getGridGravity()
setDefaultCellGravity(int)
public void setGridGravity(int gridGravity)
gridGravity
- intOrientations
,
getGridGravity()
public SpacePartitionerInterface getColumnSpacePartitioner()
setColumnSpacePartitioner(com.sas.visuals.adapters.SpacePartitionerInterface)
public void setColumnSpacePartitioner(SpacePartitionerInterface columnPartitioner)
columnPartitioner
- the SpacePartitionerInterface which is used to allocate horizontal space to the components.getColumnSpacePartitioner()
public SpacePartitionerInterface getRowSpacePartitioner()
setRowSpacePartitioner(com.sas.visuals.adapters.SpacePartitionerInterface)
public void setRowSpacePartitioner(SpacePartitionerInterface rowPartitioner)
rowPartitioner
- SpacePartitionerInterfacegetRowSpacePartitioner()
public boolean getIgnoreSizeOfNonVisibleComponents()
setIgnoreSizeOfNonVisibleComponents(boolean)
public void setIgnoreSizeOfNonVisibleComponents(boolean ignoreSizeOfNonVisibleComponents)
ignoreSizeOfNonVisibleComponents
- whether the size of non-visible components contributes
to the size of the row and column the component is in.getIgnoreSizeOfNonVisibleComponents()
public int getRows()
public void setRows(int rows)
rows
- number of rows in this layoutpublic int getColumns()
public void setColumns(int cols)
cols
- number of columns in this layoutpublic int getHgap()
public void setHgap(int hgap)
hgap
- the horizontal gap between componentspublic int getVgap()
public void setVgap(int vgap)
vgap
- the vertical gap between componentspublic void setFillCell(boolean fillCell)
fillCell
- true to resize to components to fill cells, false to use preferred component size.public boolean getFillCell()
public int getRemainderColumn()
public void setRemainderColumn(int remainderColumn)
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.public boolean getUseColumnRemainder()
setFillCell(boolean)
public void setUseColumnRemainder(boolean useColumnRemainder)
useColumnRemainder
- if true components in the last column will fill the cell
width plus any remaing horizontal space; if false component width is preferred widthsetFillCell(boolean)
public int getRemainderRow()
public void setRemainderRow(int remainderRow)
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.public boolean getUseRowRemainder()
setFillCell(boolean)
public void setUseRowRemainder(boolean useRowRemainder)
useRowRemainder
- if true components in the last row will fill the cell height
plus any remaining vertical space; if false component height is preferred heightsetFillCell(boolean)
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)
addLayoutComponent
in interface java.awt.LayoutManager
name
- the name of the componentcomp
- the component to be addedLayoutManager.addLayoutComponent(String, Component)
public void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent
in interface java.awt.LayoutManager
comp
- the component to be removedLayoutManager.removeLayoutComponent(Component)
public final int[] getPreferredRowHeightsPublic(java.awt.Container parent, int nrows, int ncols)
getPreferredRowHeightsPublic
in interface RowHeightInterface
parent
- Containernrows
- intncols
- int
getPreferredRowHeights(java.awt.Container, int, int)
protected int[] getPreferredRowHeights(java.awt.Container parent, int nrows, int ncols)
parent
- Containernrows
- intncols
- int
protected int[] getPreferredRowHeights(java.awt.Component[] comps, java.awt.Dimension[] prefSizes, int nrows, int ncols)
comps
- Component[]prefSizes
- Dimension[]nrows
- intncols
- int
public int[] getPreferredColumnWidths(java.awt.Container parent, int ncols)
getPreferredColumnWidths
in interface ColumnWidthInterface
parent
- Containerncols
- int
ColumnWidthInterface.getPreferredColumnWidths(Container, int)
public java.awt.Container[] getInterlockedColumnContainers()
setInterlockedColumnContainers(java.awt.Container[])
public void setInterlockedColumnContainer(java.awt.Container interlockedColumnContainer)
interlockedColumnContainer
- ContainersetInterlockedColumnContainers(java.awt.Container[])
public void setInterlockedColumnContainers(java.awt.Container[] interlockedColumnContainers)
interlockedColumnContainers
- The array of containers to use to determine the widths of the
columns.getInterlockedColumnContainers()
public java.awt.Container[] getInterlockedRowContainers()
setInterlockedRowContainers(java.awt.Container[])
public void setInterlockedRowContainer(java.awt.Container interlockedRowContainer)
interlockedRowContainer
- ContainersetInterlockedRowContainers(java.awt.Container[])
public void setInterlockedRowContainers(java.awt.Container[] interlockedRowContainers)
interlockedRowContainers
- The array of containers to use to determine the height of the
rows.getInterlockedRowContainers()
protected int[] getInterlockedColumnWidths(java.awt.Container parent, int ncols)
parent
and the interlockedColumnContainers
.
parent
- The container to determine the column widths for.ncols
- The number of columns in that container.
parent
and the interlockedColumnContainers
.protected int[] getInterlockedColumnWidths(java.awt.Container parent, java.awt.Component[] comps, java.awt.Dimension[] prefSize, int ncols)
parent
and the interlockedColumnContainers
.
parent
- The container to determine the column widths for.comps
- Component[]prefSize
- Dimension[]ncols
- The number of columns in that container.
parent
and the interlockedColumnContainers
.protected int[] getInterlockedRowHeights(java.awt.Container parent, int nrows, int ncols)
parent
and the interlockedRowContainers
.
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.
parent
and the interlockedRowContainers
.protected int[] getInterlockedRowHeights(java.awt.Container parent, java.awt.Component[] comps, java.awt.Dimension[] prefSize, int nrows, int ncols)
parent
and the interlockedRowContainers
.
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.
parent
and the interlockedRowContainers
.public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize
in interface java.awt.LayoutManager
parent
- the component which needs to be laid out
minimumLayoutSize(java.awt.Container)
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
minimumLayoutSize
in interface java.awt.LayoutManager
parent
- the component which needs to be laid out
preferredLayoutSize(java.awt.Container)
protected int getXGridGravityOffset(int totalRemainingWidth)
totalRemainingWidth
- int
protected int getYGridGravityOffset(int totalRemainingHeight)
totalRemainingHeight
- int
public void layoutContainer(java.awt.Container parent)
layoutContainer
in interface java.awt.LayoutManager
parent
- the specified component being laid outContainer
public int[] getActualColumnPositions(java.awt.Container parent)
parent
- The container to determine the column positions for.
public void paintLines(java.awt.Graphics g, java.awt.Container parent)
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.
g
- The graphics context to use to draw the lines.parent
- The container to draw the lines in.public java.lang.String toString()
toString
in class java.lang.Object
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |