org.vizzini.ui.table
Class DescribedTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.vizzini.ui.table.DescribedTableModel
All Implemented Interfaces:
Serializable, TableModel
Direct Known Subclasses:
FilteredTableModel

public class DescribedTableModel
extends AbstractTableModel

Provides a table model for a DescribedTable. Uses TableDescriptor and ColumnDescriptor to provide behavior to the table.

Since:
v0.2
Version:
v0.2
Author:
Jeffrey M. Thompson
See Also:
DescribedTable, TableDescriptor, ColumnDescriptor, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DescribedTableModel(TableDescriptor tableDescriptor)
          Construct this object.
 
Method Summary
 void addData(Object data)
          Add the given data object.
 Class getColumnClass(int columnIndex)
          Return the class of the given column.
 int getColumnCount()
          Return the number of columns.
 String getColumnName(int columnIndex)
          Return the name of the given column.
 List getData()
          Return the collection of data.
 int getRowCount()
          Return the number of rows.
 TableDescriptor getTableDescriptor()
          Return the table descriptor.
 Object getValueAt(int rowIndex)
          Return the data object in the given row.
 Object getValueAt(int rowIndex, int columnIndex)
          Return the object in the given cell.
 int indexOf(Object data)
          Return the index of the given data object.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Return true if the given cell is editable.
 boolean isEditMode()
          Return true if this is in edit mode.
 void removeAll()
          Remove all the data.
 void removeRows(int[] rows)
          Remove the given rows.
 void setData(List data)
          Set the model data.
 void setData(Object[] data)
          Set the model data.
 void setEditMode(boolean isEditMode)
          Set the edit mode flag.
 void setValueAt(Object obj, int rowIndex, int columnIndex)
          Set the value of the given cell.
 
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

DescribedTableModel

public DescribedTableModel(TableDescriptor tableDescriptor)
Construct this object.

Parameters:
tableDescriptor - The table descriptor.
Since:
v0.2
Method Detail

addData

public void addData(Object data)
Add the given data object.

Parameters:
data - The new data to add.
Since:
v0.2

getColumnClass

public Class getColumnClass(int columnIndex)
Return the class of the given column.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
columnIndex - The index of the column of interest.
Since:
v0.2

getColumnCount

public int getColumnCount()
Return the number of columns.

Since:
v0.2

getColumnName

public String getColumnName(int columnIndex)
Return the name of the given column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
columnIndex - The index of the column of interest.
Since:
v0.2

getData

public List getData()
Return the collection of data.

Since:
v0.2

getRowCount

public int getRowCount()
Return the number of rows.

Since:
v0.2

getTableDescriptor

public TableDescriptor getTableDescriptor()
Return the table descriptor.

Since:
v0.2

getValueAt

public Object getValueAt(int rowIndex)
Return the data object in the given row.

Parameters:
rowIndex - The index of the row of interest.
Since:
v0.2

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Return the object in the given cell.

Parameters:
rowIndex - The index of the row of interest.
columnIndex - The index of the column of interest.
Since:
v0.2

indexOf

public int indexOf(Object data)
Return the index of the given data object.

Parameters:
data - The data object of interest.
Since:
v0.2

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Return true if the given cell is editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
rowIndex - The index of the row of interest.
columnIndex - The index of the column of interest.
Since:
v0.2

isEditMode

public boolean isEditMode()
Return true if this is in edit mode.

Since:
v0.2

removeAll

public void removeAll()
Remove all the data.

Since:
v0.2

removeRows

public void removeRows(int[] rows)
Remove the given rows.

Parameters:
rows - The indices of the rows to remove.
Since:
v0.2

setData

public void setData(List data)
Set the model data.

Parameters:
data - The new model data.
Since:
v0.2

setData

public void setData(Object[] data)
Set the model data.

Parameters:
data - The new model data.
Since:
v0.2

setEditMode

public void setEditMode(boolean isEditMode)
Set the edit mode flag.

Since:
v0.2

setValueAt

public void setValueAt(Object obj,
                       int rowIndex,
                       int columnIndex)
Set the value of the given cell.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
obj - The new value.
rowIndex - The index of the row of interest.
columnIndex - The index of the column of interest.
Since:
v0.2


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02