ilog.cpl.table
Class IlpTableListModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by ilog.cpl.table.IlpAbstractTableModel
          extended by ilog.cpl.table.IlpTableListModel
All Implemented Interfaces:
IlpTableModel, Serializable, EventListener, ListDataListener, ListModel, TableModel

public class IlpTableListModel
extends IlpAbstractTableModel
implements ListModel, ListDataListener

This class adapts a list model that contains IlpAttributeValueHolders to a table model.

Note: This list model should fire a ListDataEvent when:

Since:
JTGO 3.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
IlpTableListModel()
          Default constructor.
IlpTableListModel(ListModel model, IlpExtendedAttributeGroup attributeGroup)
          Creates a model using the specified list model and attribute model.
 
Method Summary
 void addListDataListener(ListDataListener l)
          Add a listener to the list that is notified each time a change to the data model occurs.
 void contentsChanged(ListDataEvent e)
          Called when the underlying model has changed.
protected  void fireContentsChanged(Object source, int index0, int index1)
          IlpTableListModel is a List model.
protected  void fireIntervalAdded(Object source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements are added to the model.
protected  void fireIntervalRemoved(Object source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements are removed from the model.
 Object getElementAt(int index)
          Returns the value at the specified index.
 ListModel getModel()
          Retrieves the underlying list model.
 IlpTableRow getRow(int rowIndex)
          Returns the row at the given index.
 int getRowCount()
          Returns the number of rows in the model.
 int getRowIndex(IlpTableRow row)
          Returns the index of the specified row.
 int getSize()
          Returns the length of the list.
 void intervalAdded(ListDataEvent e)
          Called when the underlying model has changed.
 void intervalRemoved(ListDataEvent e)
          Called when the underlying model has changed.
 void removeListDataListener(ListDataListener l)
          Remove a listener from the list of those notified each time a change to the data model occurs.
 void setModel(ListModel model)
          Sets the underlying list model.
 
Methods inherited from class ilog.cpl.table.IlpAbstractTableModel
getAttributeGroup, getColumn, getColumnClass, getColumnCount, getColumnIndex, getColumnName, getColumns, getValueAt, setAttributeGroup
 
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 javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

IlpTableListModel

public IlpTableListModel()
Default constructor.


IlpTableListModel

public IlpTableListModel(ListModel model,
                         IlpExtendedAttributeGroup attributeGroup)
Creates a model using the specified list model and attribute model. The current model listens to this list model and this attribute model.

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

getSize

public int getSize()
Returns the length of the list.

Specified by:
getSize in interface ListModel
Internal method or field: do not use!

getElementAt

public Object getElementAt(int index)
Returns the value at the specified index.

Specified by:
getElementAt in interface ListModel
Internal method or field: do not use!

addListDataListener

public void addListDataListener(ListDataListener l)
Add a listener to the list that is notified each time a change to the data model occurs.

Specified by:
addListDataListener in interface ListModel
Parameters:
l - the ListDataListener
Internal method or field: do not use!

removeListDataListener

public void removeListDataListener(ListDataListener l)
Remove a listener from the list of those notified each time a change to the data model occurs.

Specified by:
removeListDataListener in interface ListModel
Parameters:
l - The ListDataListener to be removed.
Internal method or field: do not use!

intervalAdded

public void intervalAdded(ListDataEvent e)
Called when the underlying model has changed. Sent after the indices in the index0,index1 interval have been inserted in the data model. The new interval includes both index0 and index1.

Specified by:
intervalAdded in interface ListDataListener
Parameters:
e - A ListDataEvent encapsulating the event information.
Internal method or field: do not use!

intervalRemoved

public void intervalRemoved(ListDataEvent e)
Called when the underlying model has changed. Sent after the indices in the index0,index1 interval have been removed from the data model. The interval includes both index0 and index1.

Specified by:
intervalRemoved in interface ListDataListener
Parameters:
e - A ListDataEvent encapsulating the event information.
Internal method or field: do not use!

contentsChanged

public void contentsChanged(ListDataEvent e)
Called when the underlying model has changed. Sent when the contents of the list have changed in a way that is too complex to characterize with the previous methods. Index0 and index1 bracket the change.

Specified by:
contentsChanged in interface ListDataListener
Parameters:
e - A ListDataEvent encapsulating the event information.
Internal method or field: do not use!

getRowCount

public int getRowCount()
Returns the number of rows in the model. A JTable object uses this method to determine how many rows it should display. This method should be fast, as it is called frequently during rendering.

Specified by:
getRowCount in interface TableModel
Returns:
The number of rows in the model.

getModel

public ListModel getModel()
Retrieves the underlying list model.

Returns:
The underlying ListModel; can be null.

setModel

public void setModel(ListModel model)
Sets the underlying list model.

Parameters:
model - The underlying list model; can be null.

getRow

public IlpTableRow getRow(int rowIndex)
Returns the row at the given index.

Specified by:
getRow in interface IlpTableModel
Parameters:
rowIndex - The index of the row to retrieve.
Returns:
The row at the given index.
Throws:
IndexOutOfBoundsException - if index is negative or greater than or equal to the number of rows.

getRowIndex

public int getRowIndex(IlpTableRow row)
Returns the index of the specified row.

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

fireContentsChanged

protected void fireContentsChanged(Object source,
                                   int index0,
                                   int index1)
IlpTableListModel is a List model. This method notifies the ListModel listeners that the contents of the list has been modified. Called when the underlying model has changed. Sent when the contents of the list have changed in a way that is too complex to characterize with the previous methods. Index0 and index1 bracket the change.

Internal method or field: do not use!

fireIntervalAdded

protected void fireIntervalAdded(Object source,
                                 int index0,
                                 int index1)
AbstractListModel subclasses must call this method after one or more elements are added to the model. The new elements are specified by a closed interval index0, index1, that is, the range that includes both index0 and index1. Note that index0 need not be less than or equal to index1.

Parameters:
source - The ListModel that changed, typically "this".
index0 - One end of the new interval.
index1 - The other end of the new interval.
See Also:
EventListenerList, IlpDefaultListModel
Internal method or field: do not use!

fireIntervalRemoved

protected void fireIntervalRemoved(Object source,
                                   int index0,
                                   int index1)
AbstractListModel subclasses must call this method after one or more elements are removed from the model. The new elements are specified by a closed interval index0, index1, that is, the range that includes both index0 and index1. Note that index0 need not be less than or equal to index1.

Parameters:
source - The ListModel that changed, typically "this".
index0 - One end of the new interval.
index1 - The other end of the new interval.
See Also:
EventListenerList, IlpDefaultListModel
Internal method or field: do not use!


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