Arch4J 1.1

org.arch4j.ui.table
Class ObjectTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--javax.swing.table.DefaultTableModel
              |
              +--org.arch4j.ui.table.ObjectTableModel
All Implemented Interfaces:
Serializable, TableModel
Direct Known Subclasses:
ObjectSelectionTableModel

public class ObjectTableModel
extends DefaultTableModel

A table model where each row is a single object.

Author:
Allan Wick
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ObjectTableModel(Collection anObjectList, Collection anAccessorList, Collection aColumnHeadingList, Collection aRowHeadingList)
          Creates a new instance of ObjectTableModel
ObjectTableModel(Collection anObjectList, ObjectRowBuilder aRowBuilder, Collection aColumnHeadingList, Collection aRowHeadingList)
          Creates a new instance of ObjectTableModel
ObjectTableModel(Object[][] objects, String[] headers)
           
 
Method Summary
 void addObject(Object anObject)
          Add another object to the table.
 void addRowFor(Object anObject)
          Add another object row.
 int getIndex(Object anObject)
          Gets the index of the object.
 Collection getObjects()
          Gets a copy of all the objects in the table.
protected  Vector getRowData(Object anObject)
          Get the data for an object.
 Object getRowObject(int anIndex)
          Get the object for the given row index.
protected  int getSelectionMode()
          Returns the selectionMode.
protected  void refreshTableData()
          Refresh the data in the table rows.
 void refreshTableData(Object anObject)
          Refresh the row data for the given object.
protected  void removeAllRows()
          Remove all rows from the table.
 void removeObject(Object anObject)
          Remove an object from the table.
 void setObjects(Collection anObjectList)
          Set the objects that represent rows in the table.
protected  void setSelectionMode(int selectionMode)
          Sets the selectionMode.
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, isCellEditable, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectTableModel

public ObjectTableModel(Object[][] objects,
                        String[] headers)

ObjectTableModel

public ObjectTableModel(Collection anObjectList,
                        Collection anAccessorList,
                        Collection aColumnHeadingList,
                        Collection aRowHeadingList)
Creates a new instance of ObjectTableModel


ObjectTableModel

public ObjectTableModel(Collection anObjectList,
                        ObjectRowBuilder aRowBuilder,
                        Collection aColumnHeadingList,
                        Collection aRowHeadingList)
Creates a new instance of ObjectTableModel

Method Detail

getRowObject

public Object getRowObject(int anIndex)
Get the object for the given row index.

Parameters:
anIndex - The index of the row to get the object for.
Returns:
The object for the given index.

setObjects

public void setObjects(Collection anObjectList)
Set the objects that represent rows in the table.

Parameters:
anObjectList - The objects for each row.

addObject

public void addObject(Object anObject)
Add another object to the table.

Parameters:
anObject - The object to add.

removeObject

public void removeObject(Object anObject)
Remove an object from the table.

Parameters:
anObject - The object to remove.

getIndex

public int getIndex(Object anObject)
Gets the index of the object.

Parameters:
anObject - The object to get the index for.

addRowFor

public void addRowFor(Object anObject)
Add another object row.

Parameters:
anObject - The object to add a row for.

refreshTableData

protected void refreshTableData()
Refresh the data in the table rows.


refreshTableData

public void refreshTableData(Object anObject)
Refresh the row data for the given object.

Parameters:
anObject - The object to update the data for.

getRowData

protected Vector getRowData(Object anObject)
Get the data for an object.

Parameters:
anObject - The object to get the data for.

removeAllRows

protected void removeAllRows()
Remove all rows from the table.


getSelectionMode

protected int getSelectionMode()
Returns the selectionMode.

Returns:
int

setSelectionMode

protected void setSelectionMode(int selectionMode)
Sets the selectionMode.

Parameters:
selectionMode - The selectionMode to set

getObjects

public Collection getObjects()
Gets a copy of all the objects in the table.

Returns:
A copy of the collection of objects in the table.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.