org.apache.jorphan.gui

## Class ObjectTableModel

- java.lang.Object
- - javax.swing.table.AbstractTableModel
  - - javax.swing.table.DefaultTableModel
    - - org.apache.jorphan.gui.ObjectTableModel

All Implemented Interfaces:
  Serializable, TableModel

    public class ObjectTableModel
    extends DefaultTableModel

The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.

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

Constructors
Constructor and Description
`ObjectTableModel(String[] headers, Class<?> _objClass, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses)` The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.
`ObjectTableModel(String[] headers, Class<?> _objClass, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses, boolean cellEditable)` The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.
`ObjectTableModel(String[] headers, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses)` The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addRow(Object value)`
`boolean` `checkFunctors(Object _value, Class<?> caller)` Check all registered functors.
`void` `clearData()`
`Class<?>` `getColumnClass(int arg0)`
`int` `getColumnCount()`
`String` `getColumnName(int col)`
`Object` `getObjectList()` Returns Object (List of Object).
`List<Object>` `getObjectListAsList()` Returns List of Object.
`int` `getRowCount()`
`Object` `getValueAt(int row, int col)`
`void` `insertRow(Object value, int index)`
`boolean` `isCellEditable(int arg0, int arg1)`
`Iterator<?>` `iterator()`
`void` `moveRow(int start, int end, int to)`
`void` `removeRow(int row)`
`void` `setRows(Iterable<?> rows)`
`void` `setValueAt(Object cellValue, int row, int col)`

### Methods inherited from class javax.swing.table.DefaultTableModel

`addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, newDataAvailable, newRowsAdded, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount`

### Methods inherited from class javax.swing.table.AbstractTableModel

`addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, 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(String[] headers,
                            Class<?> _objClass,
                            Functor[] readFunctors,
                            Functor[] writeFunctors,
                            Class<?>[] editorClasses)

The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.

Parameters:
  `headers` - - Column names
  `_objClass` - - Object class that will be used
  `readFunctors` - - used to get the values
  `writeFunctors` - - used to set the values
  `editorClasses` - - class for each column

#### ObjectTableModel

    public ObjectTableModel(String[] headers,
                            Class<?> _objClass,
                            Functor[] readFunctors,
                            Functor[] writeFunctors,
                            Class<?>[] editorClasses,
                            boolean cellEditable)

The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.

Parameters:
  `headers` - - Column names
  `_objClass` - - Object class that will be used
  `readFunctors` - - used to get the values
  `writeFunctors` - - used to set the values
  `editorClasses` - - class for each column
  `cellEditable` - - if cell must editable (false to allow double click on cell)

#### ObjectTableModel

    public ObjectTableModel(String[] headers,
                            Functor[] readFunctors,
                            Functor[] writeFunctors,
                            Class<?>[] editorClasses)

The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.

Parameters:
  `headers` - - Column names
  `readFunctors` - - used to get the values
  `writeFunctors` - - used to set the values
  `editorClasses` - - class for each column

### Method Detail

#### iterator

    public Iterator<?> iterator()

#### clearData

    public void clearData()

#### addRow

    public void addRow(Object value)

#### insertRow

    public void insertRow(Object value,
                          int index)

#### getColumnCount

    public int getColumnCount()

Specified by:
  `getColumnCount` in interface `TableModel`
Overrides:
  `getColumnCount` in class `DefaultTableModel`

#### getColumnName

    public String getColumnName(int col)

Specified by:
  `getColumnName` in interface `TableModel`
Overrides:
  `getColumnName` in class `DefaultTableModel`

#### getRowCount

    public int getRowCount()

Specified by:
  `getRowCount` in interface `TableModel`
Overrides:
  `getRowCount` in class `DefaultTableModel`

#### getValueAt

    public Object getValueAt(int row,
                             int col)

Specified by:
  `getValueAt` in interface `TableModel`
Overrides:
  `getValueAt` in class `DefaultTableModel`

#### isCellEditable

    public boolean isCellEditable(int arg0,
                                  int arg1)

Specified by:
  `isCellEditable` in interface `TableModel`
Overrides:
  `isCellEditable` in class `DefaultTableModel`

#### moveRow

    public void moveRow(int start,
                        int end,
                        int to)

Overrides:
  `moveRow` in class `DefaultTableModel`

#### removeRow

    public void removeRow(int row)

Overrides:
  `removeRow` in class `DefaultTableModel`

#### setValueAt

    public void setValueAt(Object cellValue,
                           int row,
                           int col)

Specified by:
  `setValueAt` in interface `TableModel`
Overrides:
  `setValueAt` in class `DefaultTableModel`

#### getColumnClass

    public Class<?> getColumnClass(int arg0)

Specified by:
  `getColumnClass` in interface `TableModel`
Overrides:
  `getColumnClass` in class `AbstractTableModel`

#### checkFunctors

    public boolean checkFunctors(Object _value,
                                 Class<?> caller)

Check all registered functors.

** only for use in unit test code **

Parameters:
  `_value` - - an instance of the table model row data item (if null, use the class passed to the constructor).
  `caller` - - class of caller.
Returns:
  false if at least one Functor cannot be found.

#### getObjectList

    public Object getObjectList()

Returns Object (List of Object).

Returns:
  Object (List of Object)

#### getObjectListAsList

    public List<Object> getObjectListAsList()

Returns List of Object.

Returns:
  List of Object

#### setRows

    public void setRows(Iterable<?> rows)