org.kaiwitte.workbench.ui.model
Class MetaSchemeTableModelImpl

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.kaiwitte.workbench.ui.model.MetaSchemeTableModelImpl
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, MetaSchemeTableModel

public final class MetaSchemeTableModelImpl
extends javax.swing.table.AbstractTableModel
implements MetaSchemeTableModel

A TableModel to hold MetaRecords.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
MetaSchemeTableModelImpl(MetaScheme scheme)
          Creates a new instance.
 
Method Summary
 void addRecord(MetaRecord... r)
          Adds a record as a table row.
 void clear()
          Removes all entries.
 void delete(int row)
          Deletes the MetaRecord in the specified row.
 void delete(MetaRecord record)
          Deletes the specified MetaRecord.
 java.lang.Class<?> getColumnClass(int column)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int column)
           
 MetaRecord getRecord(int row)
          Returns the MetaRecord in the specified row.
 int getRowCount()
           
 MetaScheme getScheme()
          Returns the scheme that defines this table model's structure.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 void update(MetaRecord record, int index)
          Updates the MetaRecord at the specified index.
 
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

MetaSchemeTableModelImpl

public MetaSchemeTableModelImpl(MetaScheme scheme)
Creates a new instance.

Parameters:
scheme - the MetaScheme that defines the structure of this TableModel
Throws:
java.lang.NullPointerException - iff scheme == null
Method Detail

addRecord

public void addRecord(MetaRecord... r)
Adds a record as a table row.

Specified by:
addRecord in interface MetaSchemeTableModel
Parameters:
r - the new record

getColumnName

public java.lang.String getColumnName(int column)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getColumnClass

public java.lang.Class<?> getColumnClass(int column)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

clear

public void clear()
Removes all entries.

Specified by:
clear in interface MetaSchemeTableModel

getScheme

public MetaScheme getScheme()
Returns the scheme that defines this table model's structure.

Specified by:
getScheme in interface MetaSchemeTableModel
Returns:
the scheme

getRecord

public MetaRecord getRecord(int row)
Returns the MetaRecord in the specified row.

Specified by:
getRecord in interface MetaSchemeTableModel
Parameters:
row - the row number, 0-based
Returns:
the MetaRecord in the specified row
Throws:
java.lang.IndexOutOfBoundsException - iff row < 0 or row > the maximum index

delete

public void delete(int row)
Deletes the MetaRecord in the specified row.

Specified by:
delete in interface MetaSchemeTableModel
Parameters:
row -
row - the row number, 0-based
Throws:
java.lang.IndexOutOfBoundsException - iff row < 0 or row > the maximum index

delete

public void delete(MetaRecord record)
Deletes the specified MetaRecord.

Specified by:
delete in interface MetaSchemeTableModel
Parameters:
record - a MetaRecord to be deleted

update

public void update(MetaRecord record,
                   int index)
Updates the MetaRecord at the specified index.

Specified by:
update in interface MetaSchemeTableModel
Parameters:
record - a MetaRecord to be updated
index - the index of the record
Throws:
java.lang.IndexOutOfBoundsException - iff index < 0 or index > the maximum index

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Specified by:
getValueAt in interface javax.swing.table.TableModel