| Graphic Components > Table Component > Architecture of the Table Component > The Model |
The Model |
INDEX
PREVIOUS
NEXT
|
The table model provides the representation objects to be displayed in the associated table. It can be connected to a back-end application by means of an adapter. It refers to an attribute group IlpExtendedAttributeGroup to determine which attributes of the representation objects are to be displayed. Each time an attribute is added to or removed from this attribute group, a column is added to or removed from the table. (For more information on attributes, see Attribute API in the Business Objects and Data Sources documentation.)
| Note |
Each added column is arbitrarily placed at the end of the table, unless its position is defined as property index in the style sheets set to the table.
|
By default, the IlpTableView creates an instance of IlpTableListModel. This table model could be filled through an IlpDefaultListModel connected to a back end or could be used directly.
When the table is to be connected to a back-end application, a data source and a list adapter must be instantiated. Both the data source and the default list model must be connected to the adapter.
Attributes contain the values of the representation objects, or of the business objects related to the representation objects, to be shown in the table. Attributes are displayed in the columns of the table.
| Note |
| An attribute can also contain a computed value, that is, the result of a calculation, or refer to another attribute. See the Business Objects and Data Sources documentation. |
The IlpAbstractTableModel class provides the following methods to manage these attributes:
setAttributeGroup(IlpExtendedAttributeGroup attributeGroup) sets the attribute group used by the table model to determine which attributes are to be shown. A call to this method does not empty the table model (which keeps its representation objects.)tableColumnOrder is defined for the accepted business class or when the property index is defined for the attribute represented in the column.
getAttributeGroup() returns the attribute group used by the table model.
getColumns(int) returns the attribute at the given index.
getColumnCount() returns the number of columns (attributes) contained in the table model.
getColumnName(int columnIndex) returns the name of the column, the index of which is given as parameter. The column name is the same as the attribute name.
The IlpTableListModel class, which extends IlpAbstractTableModel, provides the following methods to manage the representation objects in a table. The representation objects correspond to the rows in the table. These rows must be instances of an implementation of IlpTableRow.
setModel(ListModel model) sets the IlpDefaultListModel used by the table model to store the representation objects.
getModel() returns the IlpDefaultListModel used by the table model.
getRow(int index) returns the representation object (IlpTableRow) at the given index.
getRowCount() returns the number of representation objects in the table model.
To add or remove representation objects when you do not use an adapter and a data source, you must use the following IlpDefaultListModel methods:
add(Object o) adds a representation object to the table model (o must be an IlpTableRow).
addAll(Collection c) adds a set of representation objects to the table model (c must contain only IlpTableRow instances).
remove(int index) removes the representation object, the index of which is given as parameter.
remove(Object o) removes the given representation object from the table model.
clear() removes all the representation objects from the table model.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |