org.ozoneDB.adminGui.widget
Class TableMap

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byorg.ozoneDB.adminGui.widget.TableMap
All Implemented Interfaces:
java.util.EventListener, java.io.Serializable, javax.swing.table.TableModel, javax.swing.event.TableModelListener
Direct Known Subclasses:
TableSorter, UserTableModel

public class TableMap
extends javax.swing.table.AbstractTableModel
implements javax.swing.event.TableModelListener

In a chain of data manipulators some behaviour is common. TableMap provides most of this behavour and can be subclassed by filters that only need to override a handful of specific methods. TableMap implements TableModel by routing all requests to its model, and TableModelListener by routing all events to its listeners. Inserting a TableMap which has not been subclassed into a chain of table filters should have no effect.

Version:
1.0
Author:

Per Nyfelt
Copyright © 1997-2004 by SMB GmbH. All Rights Reserved.

, Ibsen Ramos-Bonilla
See Also:
Serialized Form

Field Summary
protected  int columnCount
          Contains the number of columns in panel tables.
protected  java.util.Vector columnNames
          Contains the panel tables column names.
protected  java.util.Vector data
          Contains the panel tables data.
protected  javax.swing.table.TableModel model
          Contains the instance to the table model.
protected  int rowCount
          Contains the number of rows in the panel tables.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableMap()
           
 
Method Summary
 void clear()
          This method clears all the elements from the table.
 java.lang.Class getColumnClass(int index)
          This method returns the class of objects the given column renders.
 int getColumnCount()
          This method returns the column count in the current table model.
 java.lang.String getColumnName(int index)
          This method returns the title of a column for the current table model.
 javax.swing.table.TableModel getModel()
          This method returns a handle for the current table model.
 int getRowCount()
          This method returns the row count in the current table model.
 java.lang.Object getValueAt(int row, int column)
          This method returns the value in a specified cell for the current table model.
 void setModel(javax.swing.table.TableModel model)
          This method sets the current table model with the designated model.
 void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
          This method sets the value in a specified cell for the current table model.
 void tableChanged(javax.swing.event.TableModelEvent e)
          This method fires an event when the table is changed.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected javax.swing.table.TableModel model
Contains the instance to the table model.


columnCount

protected int columnCount
Contains the number of columns in panel tables.


rowCount

protected int rowCount
Contains the number of rows in the panel tables.


columnNames

protected java.util.Vector columnNames
Contains the panel tables column names.


data

protected java.util.Vector data
Contains the panel tables data.

Constructor Detail

TableMap

public TableMap()
Method Detail

getModel

public javax.swing.table.TableModel getModel()
This method returns a handle for the current table model.

Returns:
TableModel - the current model handle.

setModel

public void setModel(javax.swing.table.TableModel model)
This method sets the current table model with the designated model.

Parameters:
model - - the new table model.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
This method returns the value in a specified cell for the current table model.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
row - - the row containing the cell to change.
column - - the column containing the cell to change.
Returns:
Object - the value at the specified table location.

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int aRow,
                       int aColumn)
This method sets the value in a specified cell for the current table model.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Parameters:
aValue - - the value to set in the table.
aRow - - the row containing the cell to change.
aColumn - - the column containing the cell to change.

getRowCount

public int getRowCount()
This method returns the row count in the current table model.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
int - the number of rows in the table.

getColumnCount

public int getColumnCount()
This method returns the column count in the current table model.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
int - the number of columns in tne table.

getColumnName

public java.lang.String getColumnName(int index)
This method returns the title of a column for the current table model.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Parameters:
index - - the selected column.
Returns:
String - the column name.

getColumnClass

public java.lang.Class getColumnClass(int index)
This method returns the class of objects the given column renders.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
index - - the selected column.
Returns:
Class - the column's object type.

clear

public void clear()
This method clears all the elements from the table.


tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
This method fires an event when the table is changed.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener
Parameters:
e - - table model event.


Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.