org.itsnat.core.domutil
Interface ElementTable

All Superinterfaces:
ElementGroup, ElementListBase, ElementTableBase, ItsNatUserData, org.w3c.dom.NodeList

public interface ElementTable
extends ElementTableBase

Manages a pattern based DOM Element table.

The generic table structure is:

    <tableParent>
        <row>
            ...
            <optRowContent>
                <cell>
                    <opt1>...<optN>Pattern</optN>...</opt1>
                </cell>
                ...
            </optRowContent>
            ...
        </row>
        ...
    </tableParent>
 

The starting point usually is a DOM table with a single row containing one or several cells this row is save as the pattern (really a deep clone) and used when new rows are added, the first cell of the pattern is used to create new cells (for instance a new column). The initial DOM table (including the row pattern) may be initially cleared or kept as is when this object is created and attached to the underlying DOM table.

This type of table helps to render a table of values into the DOM element table, for instance, this interface support "out the box" the typical DOM element table where every cell element contains some value usually as the data of a text node. Methods to add new cells include optionally a value parameter. The structure and renderer objects are used to customize how and where this value is saved in the table beyond the default cases.

Columns can be added or removed, if a column is removed/added the same column is removed/added to the row pattern too (in fact the table may be empty, no rows, but getColumnCount() may be non-zero), the cell pattern is used to add new cells to the row pattern if necessary. All rows have the same number of columns.

By default a just created table has one row if the row pattern is not removed or zero rows if removed and as many columns as declared in the row pattern.

A pattern based DOM Element table ever works in "master" mode ElementListFree.isMaster()

Author:
Jose Maria Arranz Santamaria
See Also:
ElementGroupManager.createElementTable(Element,boolean)

Method Summary
 org.w3c.dom.Element[] addColumn()
          Adds a new column at the end of columns using the cell pattern.
 org.w3c.dom.Element[] addColumn(java.util.List columnData)
          Adds a new column at the end of columns using the cell pattern, and renders the specified values using the current structure and renderer.
 org.w3c.dom.Element[] addColumn(java.lang.Object[] columnData)
          Adds a new column at the end of columns using the cell pattern, and renders the specified values using the current structure and renderer.
 org.w3c.dom.Element addRow()
          Adds a new row element at the end of the table using the row pattern (the new row is a clone).
 org.w3c.dom.Element addRow(java.util.List rowData)
          Adds a new row element at the end of the table using the row pattern, and renders the specified values using the current structure and renderer.
 org.w3c.dom.Element addRow(java.lang.Object[] rowData)
          Adds a new row element at the end of the table using the row pattern, and renders the specified values using the current structure and renderer.
 org.w3c.dom.Element getCellContentElementAt(int row, int column)
          Returns the "content" element of the cell, this element is used to render below the associated value of the cell.
 org.w3c.dom.DocumentFragment getCellContentPatternFragment()
          Returns the pattern used to render values if isUsePatternMarkupToRender() is true.
 org.w3c.dom.Element getCellPatternElement()
          Returns the element used as a cell pattern.
 int getColumnCount()
          Returns the number of columns.
 ElementTableRenderer getElementTableRenderer()
          Returns the current renderer used by this table.
 ElementTableStructure getElementTableStructure()
          Returns the current structure used by this table.
 org.w3c.dom.Element getRowContentElementAt(int row)
          Returns the "content" element of the row, this element is the parent of the row cells This element is obtained using the current structure.
 org.w3c.dom.Element getRowPatternElement()
          Returns the element used as a row pattern.
 org.w3c.dom.Element[] insertColumnAt(int column)
          Inserts a new column at the specified position using the cell pattern.
 org.w3c.dom.Element[] insertColumnAt(int column, java.util.List columnData)
          Inserts a new column at the specified position using the cell pattern, and renders the specified values using the current structure and renderer.
 org.w3c.dom.Element[] insertColumnAt(int column, java.lang.Object[] columnData)
          Inserts a new column at the specified position using the cell pattern, and renders the specified values using the current structure and renderer.
 org.w3c.dom.Element insertRowAt(int row)
          Inserts a new row element at the specified position using the row pattern.
 org.w3c.dom.Element insertRowAt(int row, java.util.List rowData)
          Inserts a new row element at the specified position using the row pattern and renders the specified row values using the current structure and renderer.
 org.w3c.dom.Element insertRowAt(int row, java.lang.Object[] rowData)
          Inserts a new row element at the specified position using the row pattern, and renders the specified row values using the current structure and renderer.
 boolean isUsePatternMarkupToRender()
          Informs whether the original (saved as pattern) markup is used to render.
 void setCellValueAt(int row, int column, java.lang.Object value)
          Renders the specified value into the cell element with the given row and column position using the current structure and renderer.
 void setColumnCount(int columnCount)
          Increases or shrinks the number of columns to fit the new size.
 void setColumnValuesAt(int column, java.util.List columnData)
          Renders the specified values into the column with the given position using the current structure and renderer.
 void setColumnValuesAt(int column, java.lang.Object[] columnData)
          Renders the specified values into the column with the given position using the current structure and renderer.
 void setElementTableRenderer(ElementTableRenderer renderer)
          Sets the renderer used by this table.
 void setElementTableStructure(ElementTableStructure structure)
          Sets the structure used by this table.
 void setRowCount(int rowCount)
          Increases or shrinks the number of rows to fit the new size.
 void setRowValuesAt(int row, java.util.List rowData)
          Renders the specified values into the row with the given position using the current structure and renderer.
 void setRowValuesAt(int row, java.lang.Object[] rowData)
          Renders the specified values into the row with the given position using the current structure and renderer.
 void setTableValues(java.util.List values)
          Renders all table cells with new values using the current structure and renderer.
 void setTableValues(java.lang.Object[][] values)
          Renders all table cells with new values using the current structure and renderer.
 void setUsePatternMarkupToRender(boolean value)
          Sets whether the original (saved as pattern) markup is used to render.
 
Methods inherited from interface org.itsnat.core.domutil.ElementTableBase
getCellElementAt, getCellElementsOfColumn, getCellElementsOfRow, getElementRows, getFirstRowElement, getLastRowElement, getRowCount, getRowElementAt, getRowElementFromNode, getRowListElementInfoAt, getRowListElementInfoFromNode, getTableCellElementInfoAt, getTableCellElementInfoFromNode, indexOfRowElement, lastIndexOfRowElement, moveColumn, moveRow, removeAllColumns, removeAllRows, removeColumnAt, removeRowAt, removeRowRange
 
Methods inherited from interface org.itsnat.core.domutil.ElementListBase
getElementAt, getElementFromNode, getElements, getFirstElement, getLastElement, getListElementInfoAt, getListElementInfoFromNode, indexOfElement, isEmpty, lastIndexOfElement, moveElement, removeAllElements, removeElementAt, removeElementRange
 
Methods inherited from interface org.itsnat.core.domutil.ElementGroup
getItsNatDocument, getParentElement
 
Methods inherited from interface org.itsnat.core.ItsNatUserData
containsUserValueName, getUserValue, getUserValueNames, removeUserValue, setUserValue
 
Methods inherited from interface org.w3c.dom.NodeList
getLength, item
 

Method Detail

getElementTableStructure

ElementTableStructure getElementTableStructure()
Returns the current structure used by this table.

Returns:
the current structure.
See Also:
setElementTableStructure(ElementTableStructure)

setElementTableStructure

void setElementTableStructure(ElementTableStructure structure)
Sets the structure used by this table.

Parameters:
structure - the new structure.
See Also:
getElementTableStructure()

getElementTableRenderer

ElementTableRenderer getElementTableRenderer()
Returns the current renderer used by this table.

Returns:
the current renderer.
See Also:
setElementTableRenderer(ElementTableRenderer)

setElementTableRenderer

void setElementTableRenderer(ElementTableRenderer renderer)
Sets the renderer used by this table.

Parameters:
renderer - the new renderer.
See Also:
getElementTableRenderer()

getRowPatternElement

org.w3c.dom.Element getRowPatternElement()
Returns the element used as a row pattern. This element may be a clone of the original first row used as a pattern.

Returns:
the row pattern element.

getCellPatternElement

org.w3c.dom.Element getCellPatternElement()
Returns the element used as a cell pattern. This element may be a clone of the original first cell used as a pattern.

Returns:
the cell pattern element.

setRowCount

void setRowCount(int rowCount)
Increases or shrinks the number of rows to fit the new size.

If the new size is bigger new rows are added at the end, if the size is lower tail rows are removed.

Parameters:
rowCount - the new number of rows.
See Also:
ElementTableBase.getRowCount(), addRow(), ElementTableBase.removeRowAt(int)

addRow

org.w3c.dom.Element addRow()
Adds a new row element at the end of the table using the row pattern (the new row is a clone).

Returns:
the new row element.
See Also:
addRow(Object[])

addRow

org.w3c.dom.Element addRow(java.lang.Object[] rowData)
Adds a new row element at the end of the table using the row pattern, and renders the specified values using the current structure and renderer.

Parameters:
rowData - the row values to render.
Returns:
the new row element.
See Also:
addRow(), getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

addRow

org.w3c.dom.Element addRow(java.util.List rowData)
Adds a new row element at the end of the table using the row pattern, and renders the specified values using the current structure and renderer.

Parameters:
rowData - the row values to render.
Returns:
the new row element.
See Also:
addRow(Object[])

insertRowAt

org.w3c.dom.Element insertRowAt(int row)
Inserts a new row element at the specified position using the row pattern.

Parameters:
row - index of the new row.
Returns:
the new row element.
See Also:
insertRowAt(int,Object[])

insertRowAt

org.w3c.dom.Element insertRowAt(int row,
                                java.lang.Object[] rowData)
Inserts a new row element at the specified position using the row pattern, and renders the specified row values using the current structure and renderer.

Parameters:
row - index of the new row.
rowData - the row values to render.
Returns:
the new row element.
See Also:
insertRowAt(int), getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

insertRowAt

org.w3c.dom.Element insertRowAt(int row,
                                java.util.List rowData)
Inserts a new row element at the specified position using the row pattern and renders the specified row values using the current structure and renderer.

Parameters:
row - index of the new row.
rowData - the row values to render.
Returns:
the new row element.
See Also:
insertRowAt(int,Object[])

setRowValuesAt

void setRowValuesAt(int row,
                    java.lang.Object[] rowData)
Renders the specified values into the row with the given position using the current structure and renderer.

Parameters:
row - index of the row.
rowData - the row values to render.
See Also:
insertRowAt(int,Object[]), getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

setRowValuesAt

void setRowValuesAt(int row,
                    java.util.List rowData)
Renders the specified values into the row with the given position using the current structure and renderer.

Parameters:
row - index of the row.
rowData - the row values to render.
See Also:
setRowValuesAt(int,Object[])

getRowContentElementAt

org.w3c.dom.Element getRowContentElementAt(int row)
Returns the "content" element of the row, this element is the parent of the row cells This element is obtained using the current structure.

Parameters:
row - index of the row.
Returns:
the content element of the row.
See Also:
getElementTableStructure(), ElementTableStructure.getRowContentElement(ElementTable,int,Element)

getCellContentElementAt

org.w3c.dom.Element getCellContentElementAt(int row,
                                            int column)
Returns the "content" element of the cell, this element is used to render below the associated value of the cell. This element is obtained using the current structure.

Parameters:
row - index of the row.
Returns:
the content element of the row.
See Also:
getElementTableStructure(), ElementTableStructure.getCellContentElement(ElementTable,int,int,Element)

addColumn

org.w3c.dom.Element[] addColumn()
Adds a new column at the end of columns using the cell pattern.

Returns:
the new cell elements.
See Also:
addColumn(Object[])

addColumn

org.w3c.dom.Element[] addColumn(java.lang.Object[] columnData)
Adds a new column at the end of columns using the cell pattern, and renders the specified values using the current structure and renderer.

Parameters:
columnData - the column values to render.
Returns:
the new cell elements.
See Also:
addColumn(), getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

addColumn

org.w3c.dom.Element[] addColumn(java.util.List columnData)
Adds a new column at the end of columns using the cell pattern, and renders the specified values using the current structure and renderer.

Parameters:
columnData - the column values to render.
Returns:
the new cell elements.
See Also:
addColumn(Object[])

insertColumnAt

org.w3c.dom.Element[] insertColumnAt(int column)
Inserts a new column at the specified position using the cell pattern.

Parameters:
column - index of the new column.
Returns:
the new cell elements.
See Also:
insertColumnAt(int,Object[])

insertColumnAt

org.w3c.dom.Element[] insertColumnAt(int column,
                                     java.lang.Object[] columnData)
Inserts a new column at the specified position using the cell pattern, and renders the specified values using the current structure and renderer.

Parameters:
column - index of the new column.
columnData - the column values to render.
Returns:
the new cell elements.
See Also:
insertColumnAt(int), getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

insertColumnAt

org.w3c.dom.Element[] insertColumnAt(int column,
                                     java.util.List columnData)
Inserts a new column at the specified position using the cell pattern, and renders the specified values using the current structure and renderer.

Parameters:
column - index of the new column.
columnData - the column values to render.
Returns:
the new cell elements.
See Also:
insertColumnAt(int,Object[])

setColumnValuesAt

void setColumnValuesAt(int column,
                       java.lang.Object[] columnData)
Renders the specified values into the column with the given position using the current structure and renderer.

Parameters:
column - index of the column.
columnData - the column values to render.
See Also:
insertColumnAt(int,Object[]), getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

setColumnValuesAt

void setColumnValuesAt(int column,
                       java.util.List columnData)
Renders the specified values into the column with the given position using the current structure and renderer.

Parameters:
column - index of the column.
columnData - the column values to render.
See Also:
setColumnValuesAt(int,Object[])

getColumnCount

int getColumnCount()
Returns the number of columns.

Returns:
the number of columns.
See Also:
setColumnCount(int)

setColumnCount

void setColumnCount(int columnCount)
Increases or shrinks the number of columns to fit the new size.

If the new size is bigger new columns are added at the end, if the size is lower tail columns are removed.

Parameters:
columnCount - the new number of columns.
See Also:
getColumnCount(), addColumn(), ElementTableBase.removeColumnAt(int)

setCellValueAt

void setCellValueAt(int row,
                    int column,
                    java.lang.Object value)
Renders the specified value into the cell element with the given row and column position using the current structure and renderer.

Parameters:
row - row of the cell.
column - column of the cell.
value - the value to render.
See Also:
getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

setTableValues

void setTableValues(java.lang.Object[][] values)
Renders all table cells with new values using the current structure and renderer.

Parameters:
values - the values to render.
See Also:
getElementTableStructure(), getElementTableRenderer(), ElementTableStructure, ElementTableRenderer.renderTable(ElementTable,int,int,Object,Element,boolean)

setTableValues

void setTableValues(java.util.List values)
Renders all table cells with new values using the current structure and renderer.

Parameters:
values - the values to render.
See Also:
setTableValues(Object[][])

isUsePatternMarkupToRender

boolean isUsePatternMarkupToRender()
Informs whether the original (saved as pattern) markup is used to render.

The default value is defined by ItsNatDocument.isUsePatternMarkupToRender()

Returns:
true if the original markup is used.
See Also:
setUsePatternMarkupToRender(boolean)

setUsePatternMarkupToRender

void setUsePatternMarkupToRender(boolean value)
Sets whether the original (saved as pattern) markup is used to render.

Parameters:
value - true to enable the use of original markup to render.
See Also:
isUsePatternMarkupToRender()

getCellContentPatternFragment

org.w3c.dom.DocumentFragment getCellContentPatternFragment()
Returns the pattern used to render values if isUsePatternMarkupToRender() is true.

Returns:
the pattern used to render values.


Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.