com.taursys.swing
Class MTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bycom.taursys.swing.MTableModel
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, java.io.Serializable, javax.swing.table.TableModel

public class MTableModel
extends javax.swing.table.AbstractTableModel
implements javax.swing.event.ChangeListener

MTableModel is a table model for use with the MTable. It provides binding to data in a ListValueHolder. You must set the listValueHolder and columnNames properties to use this model.

Version:
1.0
Author:
Marty Phelan
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
MTableModel()
          Constructs a new MTableModel
 
Method Summary
 void addColumn(java.lang.String columnName)
           
protected  ListValueHolder createDefaultListValueHolder()
           
 int findColumn(java.lang.String columnName)
           
 java.lang.Class getColumnClass(int col)
           
 int getColumnCount()
           
 int getColumnIndex(java.lang.String columnName)
           
 java.lang.String getColumnName(int col)
           
 java.lang.String[] getColumnNames()
           
 java.util.List getList()
          Gets the List that the internal ListValueHolder will use.
 javax.swing.ListSelectionModel getListSelectionModel()
           
 ListValueHolder getListValueHolder()
           
 int getRowCount()
           
 java.lang.Object getValueAt(int row, int col)
           
 java.lang.Class getValueObjectClass()
          Returns the class of the value object.
 boolean isCellEditable(int parm1, int parm2)
           
 void removeColumn(java.lang.String columnName)
           
 void setColumnNames(java.lang.String[] newColumnNames)
           
 void setList(java.util.List newList)
          Sets the List that the internal ListValueHolder will use.
 void setListSelectionModel(javax.swing.ListSelectionModel newListSelectionModel)
           
 void setListValueHolder(ListValueHolder newListValueHolder)
           
 void setValueObjectClass(java.lang.Class newValueObjectClass)
          Sets the class of the value object.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTableModel

public MTableModel()
Constructs a new MTableModel

Method Detail

createDefaultListValueHolder

protected ListValueHolder createDefaultListValueHolder()

setValueObjectClass

public void setValueObjectClass(java.lang.Class newValueObjectClass)
Sets the class of the value object. Only needed if the valueObject itself can be null. If set, this takes presidence over the actual class of the valueObject. This property is only effective if the internal ListValueHolder is an instanceof VOListValueHolder (which is the default).


getValueObjectClass

public java.lang.Class getValueObjectClass()
Returns the class of the value object. Only needed if the valueObject itself can be null. If set, this takes presidence over the actual class of the valueObject. This property is only effective if the internal ListValueHolder is an instanceof VOListValueHolder (which is the default).


setList

public void setList(java.util.List newList)
Sets the List that the internal ListValueHolder will use. This property is only effective if the internal ListValueHolder is an instanceof VOListValueHolder (which is the default).


getList

public java.util.List getList()
Gets the List that the internal ListValueHolder will use. This property is only effective if the internal ListValueHolder is an instanceof VOListValueHolder (which is the default).


isCellEditable

public boolean isCellEditable(int parm1,
                              int parm2)
Specified by:
isCellEditable in interface javax.swing.table.TableModel

getColumnCount

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

getColumnName

public java.lang.String getColumnName(int col)
Specified by:
getColumnName in interface javax.swing.table.TableModel

findColumn

public int findColumn(java.lang.String columnName)

getValueAt

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

getRowCount

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

getColumnClass

public java.lang.Class getColumnClass(int col)
Specified by:
getColumnClass in interface javax.swing.table.TableModel

setListValueHolder

public void setListValueHolder(ListValueHolder newListValueHolder)

getListValueHolder

public ListValueHolder getListValueHolder()

setListSelectionModel

public void setListSelectionModel(javax.swing.ListSelectionModel newListSelectionModel)

getListSelectionModel

public javax.swing.ListSelectionModel getListSelectionModel()

setColumnNames

public void setColumnNames(java.lang.String[] newColumnNames)

getColumnNames

public java.lang.String[] getColumnNames()

getColumnIndex

public int getColumnIndex(java.lang.String columnName)

addColumn

public void addColumn(java.lang.String columnName)

removeColumn

public void removeColumn(java.lang.String columnName)

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener


Copyright © 2007 Martin T Phelan. All Rights Reserved.