de.vc.jfo.flow

## Class Table

- java.lang.Object
- - de.vc.xml.AbstractNode
  - - de.vc.xml.AbstractNodeWithAttributes
    - - de.vc.jfo.FormattingObject
      - - de.vc.jfo.flow.FlowObject
        - - de.vc.jfo.flow.Table

- All Implemented Interfaces:
    BlockElement, Node, NodeElement, java.io.Serializable, java.lang.Cloneable

      public class Table
      extends FlowObject
      implements BlockElement

  The fo:table flow object is used for formatting the tabular material of a table.

  The fo:table flow object and its child flow objects model the visual layout of a table in a "row primary" manner. A complete table may be seen as consisting of a grid of rows and columns where each cell occupies one or more grid units in the row-progression-direction and column-progression-direction.

  The table content is divided into a header (optional), footer (optional), and one or more bodies. Properties specify if the headers and footers should be repeated at a break in the table. Each of these parts occupies one or more rows in the table grid.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `BORDER_COLLAPSE_COLLAPSE` Collapse borders of cells.
    `static java.lang.String` | `BORDER_COLLAPSE_SEPARATE` Separate borders of cells.
    `static java.lang.String` | `BORDER_COLLAPSE_SEPARATE_WITH_PRECEDENCE` Collapsing borders and use border precedence properties for conflict resolution.

    - ### Fields inherited from class de.vc.jfo.FormattingObject

      `EMPTY_ARRAY`

    - ### Fields inherited from class de.vc.xml.AbstractNodeWithAttributes

      `MAP_TYPE_FLYWEIGHT, MAP_TYPE_HASH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Table()` Creates a new empty table.
    `Table(Measure[] columnWidths)` Creates a new table and defines some columns.
    `Table(Measure[] columnWidths, java.lang.Object[][] cells)` Creates a new table, defines some columns and adds some cells to table-body.
    `Table(Measure[] columnWidths, java.lang.Object[][] bodyCells, java.lang.Object[][] headerCells)` Creates a new table, defines some columns and adds some cells to table-body and table-header..
    `Table(Measure[] columnWidths, TableRow[] rows)` Creates a new table, defines some columns and adds some rows to table-body.
    `Table(Measure[] columnWidths, TableRow[] bodyRows, TableRow[] headerRows)` Creates a new table, defines some columns and adds some rows to table-body and TableHeader.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Table` | `add(int idx, TableColumn c)` Adds a column to this table at an index.
    `Table` | `add(TableColumn c)` Adds a column to this table.
    `Table` | `addColumn(int idx, Measure width)` Adds a column to this table at an index.
    `Table` | `addColumn(Measure width)` Adds a column to this table.
    `Table` | `addRowToBody(java.lang.Object[] cells)` Adds a row at end of body.
    `Table` | `addRowToBody(TableRow row)` Adds a row at end of body.
    `boolean` | `addUnsafe(java.lang.Object child)` Adds a NodeElement to this FormattingObject.
    `java.lang.Object` | `clone()` Clones this element.
    `Accessibility` | `getAccessibility()` Gets the accessibilty of this fo.
    `Background` | `getBackground()` Gets the background of this fo.
    `TableBody` | `getBody()` Gets the body of this table.
    `Border` | `getBorder()` Gets the border of this fo.
    `TableColumn` | `getColumn(int column)`
    `int` | `getColumnCount()`
    `java.util.List` | `getColumns()` Gets a list of all columns (TableColumn).
    `java.util.List` | `getElements()` Gets childreen of this node.
    `TableFooter` | `getFooter()` Gets the footer of this table, if no header was set before an empty footer is created.
    `TableHeader` | `getHeader()` Gets the header of this table, if no header was set before an empty header is created.
    `Margin` | `getMargin()` Gets the margin of this fo.
    `Padding` | `getPadding()` Gets the padding of this fo.
    `RelativePosition` | `getRelativePosition()` Gets the relative position of this fo.
    `Values.WritingMode` | `getWritingMode()` Gets the writing mode of this formatting object.
    `boolean` | `hasBorder()` Returns true if at least one border attribute is set.
    `boolean` | `hasFooter()` Determinates if a footer was initialized by setFooter or getFooter.
    `boolean` | `hasHeader()` Determinates if a header was initialized by setHeader or getHeader.
    `void` | `setAccessibility(Accessibility access)` Sets the accessibility of this fo.
    `void` | `setBackground(Background bg)` Sets the background of this fo.
    `void` | `setBorder(Border border)` Sets the border of this fo.
    `void` | `setBorderCollapse(java.lang.String borderCollapse)` Sets the border collapse model.
    `void` | `setBreakAfter(Values.Break type)`
    `void` | `setBreakBefore(Values.Break type)`
    `void` | `setFooter(TableFooter footer)` Sets the footer of this table.
    `void` | `setHeader(TableHeader header)` Sets the header of this table.
    `void` | `setMargin(Margin margin)` Sets the margin of this fo.
    `void` | `setPadding(Padding padding)` Sets the padding of this fo.
    `void` | `setRelativePosition(RelativePosition pos)` Sets the relative position of this fo.
    `void` | `setWritingMode(Values.WritingMode mode)` Sets the writing mode for this formatting object.

    - ### Methods inherited from class de.vc.jfo.FormattingObject

      `addElement, addElement, addUnsafe, cloned, clonedList, createUniqueID, doGetAttribute, doSetAttribute, elementCount, get, getAbsolutePosition, getAttributeMap, getDefinedAttributes, getDocument, getFont, getID, getLanguage, getLogger, getMeasureValue, getObjectValue, getObjectValue, getObjectValue, getObjectValue, getOrphans, getParentFO, getWidows, hasID, hasPadding, isEmpty, isHyphenation, removeElement, removeElement, replaceElement, setAbsolutePosition, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setElement, setFont, setHyphenation, setID, setLanguage, setLanguage, setOrphans, setWidows`

    - ### Methods inherited from class de.vc.xml.AbstractNodeWithAttributes

      `getDefaultMapType, setDefaultMapType`

    - ### Methods inherited from class de.vc.xml.AbstractNode

      `addAttributeChangeListener, addElements, addElements, clearEqualAttributes, clearInheratedAttribute, clearInheratedAttributes, clearValue, contains, contains, copyAttributes, createID, findFirstNodeWithText, findNode, findNodesWithText, fire, fireSaxEvents, firstElement, getAttrAsBoolean, getAttrAsInteger, getAttrAsString, getAttrAsString, getAttribute, getAttribute, getAttributeMap, getContentText, getContentText, getDefinedAttributes, getElements, getElements, getElements, getFirstElement, getIndex, getLocalName, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getParent, getParent, getParent, getParentOrThis, getQName, getRoot, hasEqualAttrs, indexOf, lastElement, liftInheritedAttribute, removeAttributeChangeListener, setAttribute, setAttributes, setAttrIfNotNull, setEnableAttributeChangeEvent, setNamespace, setParent, setQName, setUndefinedAttributes, writeTo, writeTo, writeTo, writeTo`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface de.vc.xml.Node

      `addAttributeChangeListener, addElement, addElement, clearInheratedAttribute, clearInheratedAttributes, clearValue, contains, fireSaxEvents, firstElement, getAttrAsString, getAttrAsString, getAttribute, getAttribute, getAttributeMap, getContentText, getDefinedAttributes, getElements, getLocalName, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getQName, getRoot, indexOf, isEmpty, lastElement, removeAttributeChangeListener, removeElement, removeElement, replaceElement, setAttribute, setAttributes, setElement, setNamespace`

    - ### Methods inherited from interface de.vc.xml.NodeElement

      `getParent, setParent, writeTo`

- - ### Field Detail

    - #### BORDER_COLLAPSE_COLLAPSE

          public static java.lang.String BORDER_COLLAPSE_COLLAPSE

      Collapse borders of cells.

    - #### BORDER_COLLAPSE_SEPARATE

          public static java.lang.String BORDER_COLLAPSE_SEPARATE

      Separate borders of cells.

    - #### BORDER_COLLAPSE_SEPARATE_WITH_PRECEDENCE

          public static java.lang.String BORDER_COLLAPSE_SEPARATE_WITH_PRECEDENCE

      Collapsing borders and use border precedence properties for conflict resolution.

  - ### Constructor Detail

    - #### Table

          public Table()

      Creates a new empty table.

    - #### Table

          public Table(Measure[] columnWidths)

      Creates a new table and defines some columns.
      Parameters:
        `columnWidths` - Widths of columns.

    - #### Table

          public Table(Measure[] columnWidths,
               java.lang.Object[][] cells)

      Creates a new table, defines some columns and adds some cells to table-body.
      Parameters:
        `columnWidths` - Widths of columns. Number of columns should match number of cells in each row.
        `cells` - Some cells that are added to table-body.

    - #### Table

          public Table(Measure[] columnWidths,
               java.lang.Object[][] bodyCells,
               java.lang.Object[][] headerCells)

      Creates a new table, defines some columns and adds some cells to table-body and table-header..
      Parameters:
        `columnWidths` - Widths of columns. Number of columns should match number of cells in each row.
        `bodyCells` - Some cells that are added to table-body.
        `headerCells` - Some cells that are added to table-header.

    - #### Table

          public Table(Measure[] columnWidths,
               TableRow[] rows)

      Creates a new table, defines some columns and adds some rows to table-body.
      Parameters:
        `columnWidths` - Widths of columns. Number of columns should match number of cells in each row.
        `rows` - Some rows that are added to table-body.

    - #### Table

          public Table(Measure[] columnWidths,
               TableRow[] bodyRows,
               TableRow[] headerRows)

      Creates a new table, defines some columns and adds some rows to table-body and TableHeader.
      Parameters:
        `columnWidths` - Widths of columns. Number of columns should match number of cells in each row.
        `bodyRows` - Some rows that are added to table-body.
        `headerRows` - Some rows that are added to table-header.

  - ### Method Detail

    - #### addRowToBody

          public Table addRowToBody(java.lang.Object[] cells)

      Adds a row at end of body.
      Parameters:
        `cells` - Cells of row.
      Returns:
        This object for chained calls.

    - #### addRowToBody

          public Table addRowToBody(TableRow row)

      Adds a row at end of body.
      Parameters:
        `row` - Table row.
      Returns:
        This object for chained calls.

    - #### getElements

          public java.util.List getElements()

      Description copied from class: `AbstractNode`
      Gets childreen of this node. A child is typical an instance of `NodeElement` or `String`.
      Specified by:
        `getElements` in interface `Node`
      Specified by:
        `getElements` in class `AbstractNode`
      Returns:
        Childreen.

    - #### setHeader

          public void setHeader(TableHeader header)

      Sets the header of this table.
      Parameters:
        `header` - New header or NULL to clear.

    - #### setFooter

          public void setFooter(TableFooter footer)

      Sets the footer of this table.
      Parameters:
        `footer` - New footer or NULL to clear.

    - #### hasHeader

          public boolean hasHeader()

      Determinates if a header was initialized by setHeader or getHeader.
      Returns:
        true, if there is a header.

    - #### getHeader

          public TableHeader getHeader()

      Gets the header of this table, if no header was set before an empty header is created.
      Returns:
        Header of this table.

    - #### hasFooter

          public boolean hasFooter()

      Determinates if a footer was initialized by setFooter or getFooter.
      Returns:
        true, if there is a footer.

    - #### getFooter

          public TableFooter getFooter()

      Gets the footer of this table, if no header was set before an empty footer is created.
      Returns:
        Footer of this table.

    - #### getBody

          public TableBody getBody()

      Gets the body of this table.
      Returns:
        Body of table.

    - #### add

          public Table add(TableColumn c)

      Adds a column to this table.
      Parameters:
        `c` - New column.
      Returns:
        This object for chained calls.

    - #### addColumn

          public Table addColumn(Measure width)

      Adds a column to this table.
      Parameters:
        `width` - Width of column.
      Returns:
        This object for chained calls.

    - #### add

          public Table add(int idx,
                  TableColumn c)

      Adds a column to this table at an index.
      Parameters:
        `idx` - Index.
        `c` - New column.
      Returns:
        This object for chained calls.

    - #### addColumn

          public Table addColumn(int idx,
                        Measure width)

      Adds a column to this table at an index.
      Parameters:
        `idx` - Index.
        `width` - Width of column.
      Returns:
        This object for chained calls.

    - #### getColumns

          public java.util.List getColumns()

      Gets a list of all columns (TableColumn).
      Returns:
        List of columns.

    - #### getColumn

          public TableColumn getColumn(int column)

    - #### getColumnCount

          public int getColumnCount()

    - #### setBreakBefore

          public void setBreakBefore(Values.Break type)

    - #### setBreakAfter

          public void setBreakAfter(Values.Break type)

    - #### getMargin

          public Margin getMargin()

      Gets the margin of this fo. Is never null.
      Overrides:
        `getMargin` in class `FormattingObject`
      Returns:
        Margin.

    - #### setMargin

          public void setMargin(Margin margin)

      Sets the margin of this fo.
      Overrides:
        `setMargin` in class `FormattingObject`
      Parameters:
        `margin` - Margin.

    - #### getPadding

          public Padding getPadding()

      Gets the padding of this fo. Is never null.
      Overrides:
        `getPadding` in class `FormattingObject`
      Returns:
        Padding.

    - #### setPadding

          public void setPadding(Padding padding)

      Sets the padding of this fo.
      Overrides:
        `setPadding` in class `FormattingObject`
      Parameters:
        `padding` - Padding.

    - #### hasBorder

          public boolean hasBorder()

      Returns true if at least one border attribute is set.
      Overrides:
        `hasBorder` in class `FormattingObject`
      Returns:
        True if at least one border attribute is set.

    - #### getBorder

          public Border getBorder()

      Gets the border of this fo. Is never null.
      Overrides:
        `getBorder` in class `FormattingObject`
      Returns:
        Border.

    - #### setBorder

          public void setBorder(Border border)

      Sets the border of this fo. If border is NULL, an empty border is created.
      Overrides:
        `setBorder` in class `FormattingObject`
      Parameters:
        `border` - Border.

    - #### getBackground

          public Background getBackground()

      Gets the background of this fo. Is never null.
      Overrides:
        `getBackground` in class `FormattingObject`
      Returns:
        Background.

    - #### setBackground

          public void setBackground(Background bg)

      Sets the background of this fo.
      Overrides:
        `setBackground` in class `FormattingObject`
      Parameters:
        `bg` - Background.

    - #### getAccessibility

          public Accessibility getAccessibility()

      Gets the accessibilty of this fo. Is never null.
      Overrides:
        `getAccessibility` in class `FormattingObject`
      Returns:
        Accessibility.

    - #### setAccessibility

          public void setAccessibility(Accessibility access)

      Sets the accessibility of this fo.
      Overrides:
        `setAccessibility` in class `FormattingObject`
      Parameters:
        `access` - Accessibility.

    - #### getRelativePosition

          public RelativePosition getRelativePosition()

      Gets the relative position of this fo. Is never null.
      Overrides:
        `getRelativePosition` in class `FormattingObject`
      Returns:
        RelativePosition.

    - #### setRelativePosition

          public void setRelativePosition(RelativePosition pos)

      Sets the relative position of this fo.
      Overrides:
        `setRelativePosition` in class `FormattingObject`
      Parameters:
        `pos` - RelativePosition.

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

      Description copied from interface: `NodeElement`
      Clones this element. Should return a deep copy!
      Specified by:
        `clone` in interface `NodeElement`
      Overrides:
        `clone` in class `FormattingObject`
      Returns:
        Clone.
      Throws:
        `java.lang.CloneNotSupportedException`

    - #### setBorderCollapse

          public void setBorderCollapse(java.lang.String borderCollapse)

      Sets the border collapse model.
      Parameters:
        `borderCollapse` - Border collapse

    - #### getWritingMode

          public Values.WritingMode getWritingMode()

      Gets the writing mode of this formatting object. If no writing mode is specified the default writing mode LR-TB is returned.
      Returns:
        Writing mode.

    - #### setWritingMode

          public void setWritingMode(Values.WritingMode mode)

      Sets the writing mode for this formatting object.
      Parameters:
        `mode` - Writing mode.

    - #### addUnsafe

          public boolean addUnsafe(java.lang.Object child)

      Description copied from class: `FormattingObject`
      Adds a NodeElement to this FormattingObject. You must ensure, that this FormattingObject can contain given element.
      Overrides:
        `addUnsafe` in class `FormattingObject`
      Parameters:
        `child` - Element.
      Returns:
        `false` if this FO is unable to add object.

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.