ilog.cpl.table
Class IlpAbstractTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by ilog.cpl.table.IlpAbstractTableModel
All Implemented Interfaces:
IlpTableModel, Serializable, TableModel
Direct Known Subclasses:
IlpTableListModel

public abstract class IlpAbstractTableModel
extends AbstractTableModel
implements IlpTableModel

Abstract class for table representation model. It defines an arbitrary order for attributes needed by the TableModel. This order is managed by listening to the IlpExtendedAttributeGroup. Each new attribute is appended to the list.

Since:
JTGO 3.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
IlpAbstractTableModel()
          Creates a table model without attributes.
IlpAbstractTableModel(IlpExtendedAttributeGroup attributeGroup)
          Creates a table model with attributes from an attribute model.
 
Method Summary
 IlpExtendedAttributeGroup getAttributeGroup()
          Returns the attribute group used by the table model.
 IlpAttribute getColumn(int columnIndex)
          Returns the attribute at index columnIndex.
 Class getColumnClass(int columnIndex)
          Returns the most specific superclass for all the cell values in the column.
 int getColumnCount()
          Returns the number of columns in the model.
 int getColumnIndex(IlpAttribute column)
          Returns the index of the specified column.
 String getColumnName(int columnIndex)
          Returns the name of the column at columnIndex.
 List getColumns()
          Returns the list of attributes managed by the table model.
 Object getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at rowIndex and columnIndex.
 void setAttributeGroup(IlpExtendedAttributeGroup attributeGroup)
          Sets the attribute model used to describe the attributes of the IlpTableRows inserted in the table model.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ilog.cpl.table.IlpTableModel
getRow, getRowIndex
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getRowCount, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

IlpAbstractTableModel

public IlpAbstractTableModel()
Creates a table model without attributes.


IlpAbstractTableModel

public IlpAbstractTableModel(IlpExtendedAttributeGroup attributeGroup)
Creates a table model with attributes from an attribute model. The current table model listens to this attribute model.

Parameters:
attributeGroup - The attribute model the table model uses; can be null.
Method Detail

getColumnCount

public int getColumnCount()
Returns the number of columns in the model. An IlpTableView uses this method to determine how many columns it should create and display by default.

Specified by:
getColumnCount in interface TableModel
Returns:
The number of columns in the model.

getColumn

public IlpAttribute getColumn(int columnIndex)
Returns the attribute at index columnIndex.

Specified by:
getColumn in interface IlpTableModel
Parameters:
columnIndex - The index of the attribute to return.
Returns:
The attribute at index columnIndex.
Throws:
IndexOutOfBoundsException - if columnIndex is negative or greater than or equal to the number of columns.

getColumnIndex

public int getColumnIndex(IlpAttribute column)
Returns the index of the specified column.

Specified by:
getColumnIndex in interface IlpTableModel
Parameters:
column - The column whose index is to be found.
Returns:
The index of the specified column; returns -1 if column is null or is not in the model.

getColumns

public List getColumns()
Returns the list of attributes managed by the table model.

Specified by:
getColumns in interface IlpTableModel
Returns:
The list of attributes managed by the table model; the returned list cannot be null and cannot be modified.

getColumnName

public String getColumnName(int columnIndex)
Returns the name of the column at columnIndex. This is used to initialize the table's column header name.
Note: This name does not need to be unique; two columns in a table can have the same name.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
columnIndex - The index of the column.
Returns:
The name of the column or null if column is invalid.

getColumnClass

public Class getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column. This is used by the JTable object to set up a default renderer and editor for the column.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
columnIndex - The index of the column.
Returns:
The common ancestor class of the object values in the model.

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Returns the value for the cell at rowIndex and columnIndex.

Specified by:
getValueAt in interface TableModel
Parameters:
rowIndex - The row whose value is to be queried.
columnIndex - The column whose value is to be queried.
Returns:
The value Object at the specified cell or null if row or column are invalid.

getAttributeGroup

public IlpExtendedAttributeGroup getAttributeGroup()
Returns the attribute group used by the table model. The attribute group comprises the columns which are initially visible in the table.

Specified by:
getAttributeGroup in interface IlpTableModel
Returns:
The attribute group used by the table model; can be null.

setAttributeGroup

public void setAttributeGroup(IlpExtendedAttributeGroup attributeGroup)
Sets the attribute model used to describe the attributes of the IlpTableRows inserted in the table model. The current table model listens to this attribute model.

Parameters:
attributeGroup - The attribute model used by the table model; can be null.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.