DESY ACOP Beans Home

de.desy.acop.displayers.table
Class AcopTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by de.desy.acop.displayers.table.AcopTableModel
All Implemented Interfaces:
TableColumnListener, java.io.Serializable, java.util.EventListener, javax.swing.table.TableModel

public class AcopTableModel
extends javax.swing.table.AbstractTableModel
implements javax.swing.table.TableModel, TableColumnListener

AcopTableModel is an implementation of the TableModel used in combinataion with AcopTable. AcopTableModel is a read only model which can hold any number of AcopTableColumns. The model listenes to each of this columns and updates the table according to the changes in the columns. The number of columns in the model can be changed in run time.

Author:
Jaka Bobnar, Cosylab
See Also:
AcopTable, AcopTableColumn, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AcopTableModel()
          Constructs new AcopTableModel
 
Method Summary
 void addColumn(AcopTableColumn column)
          Adds a new column to the model.
 void columnDataChanged(TableColumnEvent e)
          Notifies that the column data has changed.
 java.lang.Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int columnIndex)
           
 int getRowCount()
           
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void removeColumn(AcopTableColumn column)
          Removes a column from the model.
 void setRowCount(int rowCount)
          Sets the number of rows presented in the table.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 
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
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
 

Constructor Detail

AcopTableModel

public AcopTableModel()
Constructs new AcopTableModel

Method Detail

getColumnClass

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

getColumnCount

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

getColumnName

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

getRowCount

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

setRowCount

public void setRowCount(int rowCount)
Sets the number of rows presented in the table.

Parameters:
rowCount -

getValueAt

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

isCellEditable

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

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

addColumn

public void addColumn(AcopTableColumn column)
Adds a new column to the model. Column is added as the most right one.

Parameters:
column - new column to be added

removeColumn

public void removeColumn(AcopTableColumn column)
Removes a column from the model.

Parameters:
column - the column to be removed

columnDataChanged

public void columnDataChanged(TableColumnEvent e)
Description copied from interface: TableColumnListener
Notifies that the column data has changed.

Specified by:
columnDataChanged in interface TableColumnListener


Copyright © 2010. All Rights Reserved.