org.openjump.core.apitools.tables
Class StandardPirolTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.openjump.core.apitools.tables.StandardPirolTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
StatisticOverViewTableModel

public abstract class StandardPirolTableModel
extends javax.swing.table.AbstractTableModel

standard implementation for a table model.

Version:
$Rev: 2451 $
Author:
Ole Rahn

FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement
See Also:
Serialized Form

Field Summary
protected  java.lang.String[] colNames
          array that holds information on the names for the table columns
protected  java.util.Vector rows
          each element of this vector represents a single row of the table.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
StandardPirolTableModel(java.lang.String[] colNames)
           
 
Method Summary
 void addRow(java.lang.Object[] newRow)
          simple method to add a row to the table.
 void clearTable()
          deletes all data from the table (also imforms the GUI)
 int findColumn(java.lang.String columnName)
           
 java.lang.String[] getColNames()
           
abstract  java.lang.Class getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int column)
           
 int getRowCount()
           
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
abstract  boolean isCellEditable(int rowIndex, int columnIndex)
           
protected  void setColNames(java.lang.String[] colNames)
          Setting new column names will flush the table, if the new array has not the same length as the old one!
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, 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
 

Field Detail

rows

protected java.util.Vector rows
each element of this vector represents a single row of the table. Internally, a row is represented by a Object[].


colNames

protected java.lang.String[] colNames
array that holds information on the names for the table columns

Constructor Detail

StandardPirolTableModel

public StandardPirolTableModel(java.lang.String[] colNames)
Method Detail

getColumnCount

public int getColumnCount()

getRowCount

public int getRowCount()

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

clearTable

public void clearTable()
deletes all data from the table (also imforms the GUI)


findColumn

public int findColumn(java.lang.String columnName)
Overrides:
findColumn in class javax.swing.table.AbstractTableModel
Parameters:
columnName - name of column to get the index for
Returns:
the index of the column with the given name

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)

isCellEditable

public abstract boolean isCellEditable(int rowIndex,
                                       int columnIndex)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

getColumnClass

public abstract java.lang.Class getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

addRow

public void addRow(java.lang.Object[] newRow)
simple method to add a row to the table. (It better matches the given column nummer and column types!!)

Parameters:
newRow -

getColNames

public java.lang.String[] getColNames()
Returns:
array containing the names of the columns

setColNames

protected void setColNames(java.lang.String[] colNames)
Setting new column names will flush the table, if the new array has not the same length as the old one!

Parameters:
colNames - array containing new column names