pagelayout
Class Column

java.lang.Object
  extended by pagelayout.Cell
      extended by pagelayout.CellContainer
          extended by pagelayout.Column

public class Column
extends CellContainer

A Column is a collection of Cell objects in which the elements are arranged sequentially in the vertical direction from top to bottom. Both horizontal and vertical alignment of the elements can be specified. Components and Cell objects (including Gap objects which are also cells) that form the rows of a column can be specified in one of the constructors of this class, or may be added to an already constructed column by using the various add methods of the class CellContainer which is the superclass of Column. Note that by using the add or add method of the superclass CellContainer, the various rows of the column may be assigned horizontal alignments which differ from the alignment specified in the constructor.


Nested Class Summary
 
Nested classes/interfaces inherited from class pagelayout.Cell
Cell.Constraint
 
Field Summary
 
Fields inherited from class pagelayout.CellContainer
cells, halignment, parallelAlignment, valignment
 
Fields inherited from class pagelayout.Cell
BASELINE, BOTTOM, boundSpring, CENTER, constraint, filledSizeX, filledSizeY, fixMaxSize, FOUND_NOTREPLACED, FOUND_REPLACED, halign, JUSTIFIED, LEFT, links, MAX, NEWROW, NO_ALIGNMENT, NOT_FOUND, RIGHT, SKIP, TOP, valign
 
Constructor Summary
Column()
          Creates a column with no alignment.
Column(Cell... cellrows)
          Creates a column with no alignment.
Column(java.awt.Component... components)
          Creates a column with no alignment.
Column(java.awt.Component[]... rows)
          Creates a column with no alignment.
Column(int halignment, int valignment)
          Creates a column with the specified alignments.
Column(int halign, int valign, Cell... cellrows)
          Creates a column with the specified alignments.
Column(int halign, int valign, java.awt.Component... components)
          Creates a column with the specified alignments.
Column(int halign, int valign, java.awt.Component[]... rows)
          Creates a column with the specified alignments.
 
Method Summary
 BoundSpring computeBoundSpring()
          Computes the two-dimensional spring associated with the column that results from stacking vertically the two-dimensional springs associated with each row of the column.
 Cell duplicate(ComponentDuplicator c)
           
 int getBaseline()
          Returns the baseline of the topmost cell in this column.
protected static int[] getRowHeights(int x, int y, int width, int height, BoundSpring boundSpring, BoundSpring[] rowSprings, int n)
          Computes the heights of the individual rows contained in a column bounded by the specified rectangle.
protected  boolean isHorizontal()
          Specifies that this CellContainer is a column.
 Row newRow()
          Creates an empty row with the default alignments.
 Row newRow(Cell... cells)
          Creates a row of cells with default alignments.
 Row newRow(java.awt.Component... components)
          Creates a row of components with default alignments.
 Row newRow(int halign, int valign)
          Creates an empty row with the specified alignments.
 Row newRow(int halign, int valign, Cell... cells)
          Creates a row of cells with the specified alignments.
 Row newRow(int halign, int valign, java.awt.Component... components)
          Creates a row of components with the specified alignments.
protected  void setBounds(int x, int y, int width, int height)
          Arranges the rows of the column within the specified rectangle of the container.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class pagelayout.CellContainer
add, add, add, add, add, add, add, addComponentsToContainer, changeAlignment, clear, getAlignment, getChildAt, getParallelAlignment, layout, limitAlignment, numberOfChildren, replaceChild, xmlserialize
 
Methods inherited from class pagelayout.Cell
addArgs, alignBaseline, alignBaseline, checkArgs, createLayout, dupConstraint, getBoundSpring, getCellByName, getComponent, getComponentCell, getComponentCell, getConstraint, getContainer, getDim, getFilledSizeX, getFilledSizeY, getName, getParent, getRootCell, getSize, invalidate, isCell, isCellOrComponent, isComponentCell, isFixedHeight, isFixedSize, isFixedWidth, linkHeight, linkHeight, linkHeight, linkToContainerHeight, linkToContainerWidth, linkWidth, linkWidth, linkWidth, removeAllComponents, removeComponent, replaceCell, setAlignment, setBounds, setComponentGaps, setDim, setFixedHeight, setFixedHeight, setFixedHeight, setFixedHeight, setFixedHeight, setFixedSize, setFixedSize, setFixedSize, setFixedWidth, setFixedWidth, setFixedWidth, setFixedWidth, setFixedWidth, setName, setParent, setSize, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Column

public Column(int halignment,
              int valignment)
Creates a column with the specified alignments.

Parameters:
halignment - Horizontal alignment specification. May have one of the following four values: Cell.LEFT, Cell.CENTER, Cell.RIGHT, Cell.NO_ALIGNMENT.
valignment - Vertical alignment specification. May have one of the following four values: Cell.TOP, Cell.CENTER, Cell.BOTTOM, Cell.NO_ALIGNMENT.

Column

public Column()
Creates a column with no alignment.


Column

public Column(Cell... cellrows)
Creates a column with no alignment. The input cells are arranged sequentially from top to bottom.

Parameters:
cellrows - The variable argument list of cells, one for each row.

Column

public Column(int halign,
              int valign,
              Cell... cellrows)
Creates a column with the specified alignments. The input cells are arranged sequentially from top to bottom.

Parameters:
halign - Horizontal alignment specification.
valign - Vertical alignment specification.
cellrows - The variable argument list of cells, one for each row.

Column

public Column(java.awt.Component... components)
Creates a column with no alignment. The input components are arranged sequentially from top to bottom.

Parameters:
components - The variable argument list of components, one for each row.

Column

public Column(int halign,
              int valign,
              java.awt.Component... components)
Creates a column with the specified alignments. The input components are arranged sequentially from top to bottom.

Parameters:
halign - Horizontal alignment specification.
valign - Vertical alignment specification.
components - The variable argument list of components, one for each row.

Column

public Column(int halign,
              int valign,
              java.awt.Component[]... rows)
Creates a column with the specified alignments. Each of the input component arrays is used to construct a row. The rows are arranged sequentially from top to bottom.

Parameters:
halign - Horizontal alignment specification.
valign - Vertical alignment specification.
rows - The variable argument list of component arrays, one for each row.

Column

public Column(java.awt.Component[]... rows)
Creates a column with no alignment. Each of the input component arrays is used to construct a row. The rows are arranged sequentially from top to bottom.

Parameters:
rows - The variable argument list of component arrays, one for each row.
Method Detail

isHorizontal

protected boolean isHorizontal()
Specifies that this CellContainer is a column.

Specified by:
isHorizontal in class CellContainer
Returns:
false.

toString

public java.lang.String toString()
Description copied from class: CellContainer
Returns a string representation of this object.

Overrides:
toString in class CellContainer
Returns:
The string represntation of the column.

setBounds

protected void setBounds(int x,
                         int y,
                         int width,
                         int height)
Arranges the rows of the column within the specified rectangle of the container.

Overrides:
setBounds in class Cell
Parameters:
x - the x-coordinate of the top left of the rectangle.
y - the y-coordinate of the top left of the rectangle.
width - the width of the rectangle.
height - the height of the rectangle.

getRowHeights

protected static int[] getRowHeights(int x,
                                     int y,
                                     int width,
                                     int height,
                                     BoundSpring boundSpring,
                                     BoundSpring[] rowSprings,
                                     int n)
Computes the heights of the individual rows contained in a column bounded by the specified rectangle. This method is used by this class and CellGrid to layout the rows of a column when the method setBounds of the two classes is called.

Parameters:
x - the x-coordinate of the top left of the rectangle.
y - the y-coordinate of the top left of the rectangle.
width - the width of the rectangle.
height - the height of the rectangle.
boundSpring - the two-dimensional spring associated with the column.
rowSprings - the array of two-dimensional springs associated with the rows of the column.
n - the number of rows in the column.
Returns:
The array of heights of the individual rows to fit in the specified rectangle.

computeBoundSpring

public BoundSpring computeBoundSpring()
Computes the two-dimensional spring associated with the column that results from stacking vertically the two-dimensional springs associated with each row of the column.

Specified by:
computeBoundSpring in class CellContainer
Returns:
The computed two-dimensional spring.

getBaseline

public int getBaseline()
Returns the baseline of the topmost cell in this column.

Overrides:
getBaseline in class Cell
Returns:
The baseline for the topmost cell in this column, if defined, and -1 if not.
See Also:
ComponentCell.getBaseline(), Row.getBaseline(), Cell.getBaseline()

newRow

public Row newRow(int halign,
                  int valign,
                  java.awt.Component... components)
Creates a row of components with the specified alignments. The input components are arranged sequentially from left to right. The newly created row is added to the column and returned as the output of this method.

Parameters:
halign - Horizontal alignment specification.
valign - Vertical alignment specification.
components - The variable argument list of cells.
Returns:
The newly created row.

newRow

public Row newRow(int halign,
                  int valign,
                  Cell... cells)
Creates a row of cells with the specified alignments. The input cells are arranged sequentially from left to right. The newly created row is added to the column and returned as the output of this method.

Parameters:
halign - Horizontal alignment specification.
valign - Vertical alignment specification.
cells - The variable argument list of cells.
Returns:
The newly created row.

newRow

public Row newRow(java.awt.Component... components)
Creates a row of components with default alignments. The input components are arranged sequentially from left to right. The newly created row is added to the column and returned as the output of this method.

Parameters:
components - The variable argument list of cells.
Returns:
The newly created row.

newRow

public Row newRow(Cell... cells)
Creates a row of cells with default alignments. The input cells are arranged sequentially from left to right. The newly created row is added to the column and returned as the output of this method.

Parameters:
cells - The variable argument list of cells.
Returns:
The newly created row.

newRow

public Row newRow(int halign,
                  int valign)
Creates an empty row with the specified alignments. The newly created row is added to the column and returned as the output of this method.

Parameters:
halign - Horizontal alignment specification.
valign - Vertical alignment specification.
Returns:
The newly created row.

newRow

public Row newRow()
Creates an empty row with the default alignments. The newly created row is added to the column and returned as the output of this method.

Returns:
The newly created row.

duplicate

public Cell duplicate(ComponentDuplicator c)
Specified by:
duplicate in class Cell