pagelayout
Class Row

java.lang.Object
  extended by pagelayout.Cell
      extended by pagelayout.CellContainer
          extended by pagelayout.Row
Direct Known Subclasses:
NamedSeparator.SepRow

public class Row
extends CellContainer

A Row is a collection of Cell objects in which the elements are arranged sequentially in the horizontal direction from left to right. 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 columns of a row can be specified in one of the constructors of this class, or may be added to an already constructed row by using the various add methods of the class CellContainer, which is the superclass of Row. Note that by using the add or add method of the superclass CellContainer, the various columns of the row may be assigned vertical 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
Row()
          Creates a row with no alignment.
Row(Cell... columnCells)
          Creates a row with no alignment.
Row(java.awt.Component... components)
          Creates a row with the no alignments.
Row(java.awt.Component[]... components)
          Creates a row with the no alignments.
Row(int halignment, int valignment)
          Creates a row with the specified alignments.
Row(int halign, int valign, Cell... columnCells)
          Creates a row with the specified alignments.
Row(int halign, int valign, java.awt.Component... components)
          Creates a row with the specified alignments.
Row(int halign, int valign, java.awt.Component[]... components)
          Creates a row with the specified alignments.
 
Method Summary
 BoundSpring computeBoundSpring()
          Computes the two-dimensional spring associated with the row that results from stacking horizontally the two-dimensional springs associated with each column of the row.
 Cell duplicate(ComponentDuplicator c)
           
 int getBaseline()
          Returns the maximum of the baseline of all those cells in this row whose baseline is defined.
protected static int[] getColumnWidths(int x, int y, int width, int height, BoundSpring boundSpring, BoundSpring[] columnSprings, int n)
          Computes the widths of the individual columns contained in a row bounded by the specified rectangle.
protected  boolean isHorizontal()
          Specifies that this CellContainer is a row.
 Column newColumn()
          Creates an empty column with default alignments.
 Column newColumn(Cell... cells)
          Creates a column of cells with default alignments.
 Column newColumn(java.awt.Component... components)
          Creates a column of components with default alignments.
 Column newColumn(int halign, int valign)
          Creates an empty column with specified alignments.
 Column newColumn(int halign, int valign, Cell... cells)
          Creates a column of cells with the specified alignments.
 Column newColumn(int halign, int valign, java.awt.Component... components)
          Creates a column of components with the specified alignments.
protected  void setBounds(int x, int y, int width, int height)
          Arranges the columns of the row within the specified rectangle of the container.
 
Methods inherited from class pagelayout.CellContainer
add, add, add, add, add, add, add, addComponentsToContainer, changeAlignment, clear, getAlignment, getChildAt, getParallelAlignment, layout, limitAlignment, numberOfChildren, replaceChild, toString, 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

Row

public Row(int halignment,
           int valignment)
Creates a row 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.

Row

public Row()
Creates a row with no alignment.


Row

public Row(Cell... columnCells)
Creates a row with no alignment. The input cells are arranged sequentially from left to right.

Parameters:
columnCells - The variable argument list of cells, one for each columns.

Row

public Row(int halign,
           int valign,
           Cell... columnCells)
Creates a row with the specified alignments. The input cells are arranged sequentially from left to right.

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

Row

public Row(int halign,
           int valign,
           java.awt.Component... components)
Creates a row with the specified alignments. The input components are arranged sequentially from left to right.

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

Row

public Row(java.awt.Component... components)
Creates a row with the no alignments. The input components are arranged sequentially from left to right.

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

Row

public Row(java.awt.Component[]... components)
Creates a row with the no alignments. The input component arrays are are used to form columns which are arranged sequentially from left to right.

Parameters:
components - The variable argument list of component arrays, one for each column.

Row

public Row(int halign,
           int valign,
           java.awt.Component[]... components)
Creates a row with the specified alignments. The input component arrays are are used to form columns which are arranged sequentially from left to right.

Parameters:
halign - Horizontal alignment specification.
valign - Vertical alignment specification.
components - The variable argument list of component arrays, one for each column.
Method Detail

isHorizontal

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

Specified by:
isHorizontal in class CellContainer
Returns:
true.

setBounds

protected void setBounds(int x,
                         int y,
                         int width,
                         int height)
Arranges the columns of the row 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.

getColumnWidths

protected static int[] getColumnWidths(int x,
                                       int y,
                                       int width,
                                       int height,
                                       BoundSpring boundSpring,
                                       BoundSpring[] columnSprings,
                                       int n)
Computes the widths of the individual columns contained in a row bounded by the specified rectangle. This method is used by this class and CellGrid to layout the colums within a row 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 row.
columnSprings - the array of two-dimensional springs associated with the columns of the row.
n - the number of columns in the row.
Returns:
The array of widths of the individual columns to fit in the specified rectangle.

computeBoundSpring

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

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

getBaseline

public int getBaseline()
Returns the maximum of the baseline of all those cells in this row whose baseline is defined. If baseline of none of the cells in this row is defined, it returns -1.

Overrides:
getBaseline in class Cell
Returns:
The baseline for this row as defined above.
See Also:
ComponentCell.getBaseline(), Column.getBaseline(), Cell.getBaseline()

newColumn

public Column newColumn(int halign,
                        int valign,
                        java.awt.Component... components)
Creates a column of components with the specified alignments. The input components are arranged sequentially from top to bottom. The newly created column is added to the row 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 column.

newColumn

public Column newColumn(int halign,
                        int valign,
                        Cell... cells)
Creates a column of cells with the specified alignments. The input cells are arranged sequentially from top to bottom. The newly created column is added to the row 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 column.

newColumn

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

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

newColumn

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

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

newColumn

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

Returns:
The newly created column.

newColumn

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

Returns:
The newly created column.

duplicate

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