com.isti.util.gui
Class ValueJTableModel

java.lang.Object
  extended bycom.isti.util.gui.ValueJTableModel
All Implemented Interfaces:
javax.swing.table.TableModel, ValueTableModel

public class ValueJTableModel
extends java.lang.Object
implements javax.swing.table.TableModel, ValueTableModel


Field Summary
protected  javax.swing.event.EventListenerList listenerList
          Storage for the listeners registered with this model.
 
Constructor Summary
ValueJTableModel(ValueTableModel vtm)
          Creates the value GUI table model.
 
Method Summary
 void addTableModelListener(javax.swing.event.TableModelListener listener)
          Adds a listener to the table model.
 void fireTableChanged(javax.swing.event.TableModelEvent event)
          Sends the specified event to all registered listeners.
 void fireTableDataChanged()
          Sends a TableModelEvent to all registered listeners to inform them that the table data has changed.
 java.lang.Class getColumnClass(int columnIndex)
          Returns the Class for all Object instances in the specified column.
 int getColumnCount()
          Returns the number of columns in the model.
 int getColumnIndex(java.lang.String columnName)
          Gets the column index for the specified column name.
 java.lang.String getColumnName(int columnIndex)
          Returns the name of a column in the model.
 int getRowCount()
          Returns the number of rows in the model.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Returns the value (Object) at a particular cell in the table.
 void importValues(ValueTableModel vtm)
          Import the values from the value table model for all rows.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns true if the specified cell is editable, and false if it is not.
static void main(java.lang.String[] args)
           
 void removeTableModelListener(javax.swing.event.TableModelListener listener)
          Removes a listener from the table model so that it will no longer receive notification of changes to the table model.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          Sets the value at a particular cell in the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
Storage for the listeners registered with this model.

Constructor Detail

ValueJTableModel

public ValueJTableModel(ValueTableModel vtm)
Creates the value GUI table model.

Parameters:
vtm - the value table model.
Method Detail

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener listener)
Adds a listener to the table model. The listener will receive notification of all changes to the table model.

Specified by:
addTableModelListener in interface javax.swing.table.TableModel
Parameters:
listener - the listener.

fireTableChanged

public void fireTableChanged(javax.swing.event.TableModelEvent event)
Sends the specified event to all registered listeners.

Parameters:
event - the event to send.

fireTableDataChanged

public void fireTableDataChanged()
Sends a TableModelEvent to all registered listeners to inform them that the table data has changed.


getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Returns the Class for all Object instances in the specified column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
columnIndex - the column index.
Returns:
The class.

getColumnCount

public int getColumnCount()
Returns the number of columns in the model.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
The column count

getColumnIndex

public int getColumnIndex(java.lang.String columnName)
Gets the column index for the specified column name.

Specified by:
getColumnIndex in interface ValueTableModel
Parameters:
columnName - the column name.
Returns:
the column index or -1 if none.

getColumnName

public java.lang.String getColumnName(int columnIndex)
Returns the name of a column in the model.

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

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
The row count.

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Returns the value (Object) at a particular cell in the table.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
The value at the specified cell.

importValues

public void importValues(ValueTableModel vtm)
Import the values from the value table model for all rows.

Specified by:
importValues in interface ValueTableModel
Parameters:
vtm - the value table model.

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns true if the specified cell is editable, and false if it is not.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Parameters:
rowIndex - the row index of the cell.
columnIndex - the column index of the cell.
Returns:
true if the cell is editable, false otherwise.

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener listener)
Removes a listener from the table model so that it will no longer receive notification of changes to the table model.

Specified by:
removeTableModelListener in interface javax.swing.table.TableModel
Parameters:
listener - the listener to remove.

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets the value at a particular cell in the table.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Parameters:
aValue - the value (null permitted).
rowIndex - the row index.
columnIndex - the column index.

main

public static void main(java.lang.String[] args)