Holger's
Java API

com.antelmann.util.table
Class TableModelCopy

java.lang.Object
  extended by com.antelmann.util.table.TableModelCopy
All Implemented Interfaces:
Serializable, TableModel

public class TableModelCopy
extends Object
implements TableModel, Serializable

provides an unmodifiable copy of any given TableModel; all data is fully copied, so changes of the original model are not reflected on this model. Unexpected behavior may occur if the underlying objects are altered; these changes would not necessarily be reflected in the model.

Since:
18. Januar 2007, 23:16
Author:
Holger Antelmann
See Also:
Serialized Form

Constructor Summary
TableModelCopy(TableModel model)
           
 
Method Summary
 void addColumn(String columnName, Class<?> columnType)
           
 void addRow(Object... values)
           
 void addTableModelListener(TableModelListener l)
          empty implementation, as this model is unmodifiable
static DefaultTableModel createDefaultTableModel(TableModel original)
          note that column class info will be lost
 Class<?> getColumnClass(int column)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
 int getRowCount()
           
 Object getValueAt(int row, int column)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void removeTableModelListener(TableModelListener l)
          empty implementation, as this model is unmodifiable
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableModelCopy

public TableModelCopy(TableModel model)
Method Detail

addRow

public void addRow(Object... values)
            throws IllegalArgumentException
Throws:
IllegalArgumentException

addColumn

public void addColumn(String columnName,
                      Class<?> columnType)

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel

getColumnClass

public Class<?> getColumnClass(int column)
Specified by:
getColumnClass in interface TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel

getValueAt

public Object getValueAt(int row,
                         int column)
Specified by:
getValueAt in interface TableModel

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel

addTableModelListener

public void addTableModelListener(TableModelListener l)
empty implementation, as this model is unmodifiable

Specified by:
addTableModelListener in interface TableModel

removeTableModelListener

public void removeTableModelListener(TableModelListener l)
empty implementation, as this model is unmodifiable

Specified by:
removeTableModelListener in interface TableModel

createDefaultTableModel

public static DefaultTableModel createDefaultTableModel(TableModel original)
note that column class info will be lost



(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads