borland Packages Class Hierarchy internetbeans Package
java.lang.Object +----com.borland.internetbeans.IxComponent +----com.borland.internetbeans.IxTable
Variables Constructors Properties Methods
Implements DataSetAware, Renderable, Serializable, Cloneable
IxTable
generates HTML tables from data sets or table models.
public static final String BODY_TAG = "tbody"Tag name for table body section.
public static final int DEFAULT_ROW_COUNT = 20Default number of data rows to display every time the table is rendered.
public static final String FOOTER_TAG = "tfoot"Tag name for table footer section.
public static final String HEADER_TAG = "thead"Tag name for table header section.
public static final String TAG_NAME = "table"Tag name for this type of element.
public IxTable()Constructs an
IxTable
with the default data model.
public IxTable(int numColumns, int numRows)Constructs an
IxTable
with numRows
and numColumns
of empty cells using the DefaultTableModel
. The columns will have names of the form "A", "B", "C", and so on.
numRows
numColumns
public IxTable(Object[][] rowData, Object[] columnNames)Constructs an
IxTable
to display the values in the two dimensional array, rowData
, with column names, columnNames
. rowData
is an Array of rows, so the value of the cell at row 1, column 5 can be obtained with the following code:
rowData[1][5];
All rows must be of the same length as columnNames
.
rowData
columnNames
public IxTable(Vector rowData, Vector columnNames)Constructs an
IxTable
to display the values in the Vector of Vectors, rowData
, with column names, columnNames
. The Vectors contained in rowData
should contain the values for that row. In other words, the value of the cell at row 1, column 5 can be obtained with the following code:
((Vector)rowData.elementAt(1)).elementAt(5);
All rows must be of the same length as columnNames
.
rowData
columnNames
public IxTable(TableModel dm)Constructs an
IxTable
which is initialized with dm
as the data model.
dm
DefaultTableModel
.
public boolean getAdaptFormat() public void setAdaptFormat(boolean adapt)Whether to attempt to match the table structure and attrributes in the template.
public boolean getAutoHeadingMatch() public void setAutoHeadingMatch(boolean match)Whether to match heading text in the template with columns in the data model and display the matching columns only.
public String[] getBodyRowStyles() public void setBodyRowStyles(String cssClasses) public void setBodyRowStyles(String[] cssClasses)The Cascading Style Sheet classes for all defined rows. You may set this property to override the formatting found in the template (if any).
public int getBorder() public void setBorder(int newBorder)Convenience property that maps to the BORDER attribute.
public Length getCellPadding() public void setCellPadding(Length newCellPadding)Convenience property that maps to the CELLPADDING attribute.
public Length getCellSpacing() public void setCellSpacing(Length newCellSpacing)Convenience property that maps to the CELLSPACING attribute.
public DataSet getDataSet() public void setDataSet(DataSet ds)Wires the
IxTable
directly to a DataSet
by creating a DBTableModel
and setting it as the model
.
public String getHeaderCellStyle() public void setHeaderCellStyle(String cssClass)The Cascading Style Sheet class for the table header cells.
public String getHeaderRowStyle() public void setHeaderRowStyle(String cssClass)The Cascading Style Sheet class for the table header row.
public TableModel getModel() public void setModel(TableModel newModel)The data model for the table.
newModel
Throws IllegalArgumentException
if newModel
is null.
public void setRequestParameterValue(String value)Reacts to a matching parameter in the request by setting the start row to the numeric value in the string. Parameters names are matched via
getIdentifier
.
public int getRowCount() public void setRowCount(int newRowCount)The number of data rows to display when rendering the table. For example, if there are 87 rows in the data model and the
rowCount
is 20, it would take five pages of tables to display all the rows.
public int getStartRow() public void setStartRow(int newStartRow)The first row in the data model to display. Row zero is the first row.
When using the auto-replication, be sure to call IxPageProducer.getSessionComponent
to retrieve the actual instance being used by the session to set the starting row.
public String getTupleTableName() public void setTupleTableName(String newTupleTableName)Name used to identify nested set in
TupleModel
. Set automatically when using a DataSet
from a DataModule
as the data model, and ignored when using a single DataSet
(because there's only one table).
public Length getWidth() public void setWidth(Length newWidth)Convenience property that maps to the WIDTH attribute.
public void addColumn(IxTableColumn aColumn)Appends
aColumn
to the end of the array of columns
aColumn
IxTableColumn
to be added
protected void assembleElementBody(OutputWrapper outWrap)Renders table header and body. (TFOOT is not supported.)
Starting at row startRow
in the data model, renders rowCount
rows.
outWrap
protected void assembleTagAttributes(OutputWrapper outWrap)Concretes
IxComponent
but does nothing; any attributes are handled by assembleMergedAttributes
.
outWrap
protected IxComponent cloneForTupleModel(TupleModel tupleModel)Clones table and ties it to the specified
TupleModel
, if the current table data model is from the original of that TupleModel
or a DataSet
.
tupleModel
property set to new model.
public int convertColumnIndexToModel(int viewColumnIndex)Return the index of the column in the data model whose data is being displayed in the column
viewColumnIndex
. Returns viewColumnIndex
unchanged when viewColumnIndex
is less than zero or greater than the number of columns in the view.
viewColumnIndex
Returns column number from the data model.
public void createDefaultColumnsFromModel()Creates IxTableColumn objects that match each column in the table model. Any existing columns will be cleared (unless the table model is null, in which case nothing happens).
protected TableModel createDefaultDataModel()Returns the default table model object which is a
DefaultTableModel
. Subclass can override this method to return a different table model object.
protected IxTableRow[] createRowRenderers(String[] cssClasses)Creates simple row renders with a given Cascading Style Sheet class
cssClasses
Returns array of row renderers that use those style classes.
protected IxTableRow[] createRowRenderers(Map[] attributes)Creates more complicated row renderes with a given set of attributes
attributes
Returns array of row renderers that use those attributes.
protected String[] getClosureTags()TABLE elements require a matching end tag.
public IxTableColumn getColumn(int columnIndex)Returns the column object for the given column in the table.
columnIndex
Returns column object for that column.
public IxTableCellRenderer getDefaultRenderer(Class columnClass)Gets cell renderer from the default list. The default default renderer is the one assigned to the
null
class.
Sets default cell renderers by class. If a cell renderer is not assigned specifically to the corresponding IxTableColumn
a renderer will be chosen from the default list, based on the class of the content in the column. The default default renderer is the one assigned to the null
class.
protected String getElementType()Returns the tag name "table".
public Object getValueAt(int row, int column)Returns the cell value at
row
and column
.
TableModel
. This is an important distinction because the table may be hiding some columns, or displaying them in a different order.
row
column
Returns the Object at the specified cell.
protected boolean isElementEmpty()Tables are never empty.
public void mergeBody(ParseUnit[] units, int beginIndex, int endIndex)Called by
PageProducer
; do not call directly. Reads the table in the template source markup (if any) to determine the columns to display and replicate the formatting.
units
beginIndex
endIndex
protected static String normalizeText(String arg)Remove non-alpha characters and convert to uppercase.
protected void setBodyRowAttributes(Map[] attributes)Creates the row renders to render body rows with the given attributes. Simple tables have one table row per data row, but there can be more.
attributes
public void setDefaultRenderer(Class columnClass, IxTableCellRenderer renderer)Sets default cell renderers by class. If a cell renderer is not assigned specifically to the corresponding
IxTableColumn
a renderer will be chosen from the default list, based on the class of the content in the column. The default default renderer is the one assigned to the null
class.
columnClass
renderer
protected void setHeaderRowAttributes(Map[] attributes)Creates the row renders to render header rows with the given attributes. Simple tables have only one header row, so there is only one set of attributes; but more complicated tables -- with more than one table row per data row -- can have more than one header row.
attributes