planetj.gui
Class CMSmartTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--planetj.gui.CMTableModel
              |
              +--planetj.gui.CMSmartTableModel
All Implemented Interfaces:
EventListener, ListSelectionListener, Serializable, TableModel

public class CMSmartTableModel
extends CMTableModel
implements ListSelectionListener

CMSmartTableModel allows users to load a table with business objects or row objects per table row. It handles table selection handling and selection modes. This class provides functionality to retrieve the selected business objects or row objects from the table.

Author:
PlanetJ Corporation
See Also:
Serialized Form

Constructor Summary
CMSmartTableModel()
          CMSmartTableModel constructor comment.
 
Method Summary
 boolean getBusinessObjectsAreInvokable()
          Gets the businessObjectsAreInvokable property (boolean) value.
 Class getColumnClass(int column)
          Insert the method's description here.
 List getColumnGetterMethodObjects()
          Gets the column getter methods via a List of Method objects.
 String[] getColumnGetterMethods()
          Gets the columnGetterMethods property (java.lang.String[]) value.
 String getColumnGetterMethods(int index)
          Gets the name of the getter method at the specified index
 Integer[] getColumnsContainingIcons()
          Insert the method's description here.
 JTable getJTable()
          Gets the jTable property (javax.swing.JTable) value.
 Object getSelectedBusinessObject()
          Gets the selectedBusinessObject property (java.lang.Object) value.
 Object getSelectedBusinessObjectAsString()
          Gets the selectedBusinessObject property (java.lang.Object) value as a String.
 List getSelectedBusinessObjects()
          Gets the selected business objects
 int getSelectedRowIndex()
          Gets the index of the selected row
 int getSelectionMode()
           
 TableColumn getTableColumn(int index)
           
 Object getValueAt(int row, int col)
          getValueAt method comment.
 boolean isCellEditable(int row, int col)
          Insert the method's description here.
 int selectNextBusinessObject()
          Selects the next business object in the list and returns the index of the newly selected object.
 int selectPreviousBusinessObject()
          Selects the next business object in the list and returns the index of the newly selected object.
 void setAllObjects(List allObjects)
          Sets the allObjects property (java.util.Vector) value.
 void setBusinessObjectsAreInvokable(boolean businessObjectsAreInvokable)
          Sets the businessObjectsAreInvokable property (boolean) value.
 void setColumnGetterMethodObjects(List pMethodObjects)
          Sets the column getter methods via a List of Method objects.
 void setColumnGetterMethods(int index, String columnGetterMethods)
          Sets the column getter method at the specified index
 void setColumnGetterMethods(String[] columnGetterMethods)
          Sets the array of getter method names.
 void setColumnsContainingIcons(Integer[] newColumnsContainingIcons)
          Insert the method's description here.
 void setJTable(JTable jTable)
          Sets the jTable property (javax.swing.JTable) value.
 void setSelectedBusinessObject(Object selectedBusinessObject)
          Sets the selectedBusinessObject property (java.lang.Object) value.
 void setSelectedRowIndex(int rowIndex)
          Sets the selected row to the specified index
 void setSelectionMode(int newSelectionMode)
          Insert the method's description here.
 void setTableColumn(Object o)
           
 void valueChanged(ListSelectionEvent e)
          Called whenever the value of the selection changes.
 
Methods inherited from class planetj.gui.CMTableModel
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getAllObjects, getBusinessObject, getColumnCount, getColumnName, getColumnNames, getRowCount, getTranslation, removePropertyChangeListener, removePropertyChangeListener, setColumnCount, setColumnName, setColumnNames
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMSmartTableModel

public CMSmartTableModel()
CMSmartTableModel constructor comment.

Method Detail

getBusinessObjectsAreInvokable

public boolean getBusinessObjectsAreInvokable()
Gets the businessObjectsAreInvokable property (boolean) value.

Returns:
The businessObjectsAreInvokable property value.
See Also:
setBusinessObjectsAreInvokable(boolean)

getColumnClass

public Class getColumnClass(int column)
Insert the method's description here. Creation date: (6/14/00 11:59:43 AM)

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

getColumnGetterMethodObjects

public List getColumnGetterMethodObjects()
Gets the column getter methods via a List of Method objects. Using method objects is more efficient than specifying the name of the getter methods with String objects.

Returns:
A List containing Method objects

getColumnGetterMethods

public String[] getColumnGetterMethods()
Gets the columnGetterMethods property (java.lang.String[]) value.

Returns:
The columnGetterMethods property value.
See Also:
setColumnGetterMethods(java.lang.String[])

getColumnGetterMethods

public String getColumnGetterMethods(int index)
Gets the name of the getter method at the specified index


getColumnsContainingIcons

public Integer[] getColumnsContainingIcons()
Insert the method's description here. Creation date: (6/14/00 11:12:34 AM)

Returns:
int[]

getJTable

public JTable getJTable()
Gets the jTable property (javax.swing.JTable) value.

Returns:
The jTable property value.
See Also:
setJTable(javax.swing.JTable)

getSelectedBusinessObject

public Object getSelectedBusinessObject()
Gets the selectedBusinessObject property (java.lang.Object) value.

Returns:
The selectedBusinessObject property value.
See Also:
setSelectedBusinessObject(java.lang.Object)

getSelectedBusinessObjectAsString

public Object getSelectedBusinessObjectAsString()
Gets the selectedBusinessObject property (java.lang.Object) value as a String.

Returns:
The selectedBusinessObject property value.
See Also:
setSelectedBusinessObject(java.lang.Object)

getSelectedBusinessObjects

public List getSelectedBusinessObjects()
Gets the selected business objects


getSelectedRowIndex

public int getSelectedRowIndex()
Gets the index of the selected row

Returns:
int

getSelectionMode

public int getSelectionMode()

getTableColumn

public TableColumn getTableColumn(int index)

getValueAt

public Object getValueAt(int row,
                         int col)
getValueAt method comment.

Specified by:
getValueAt in interface TableModel
Specified by:
getValueAt in class CMTableModel

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Insert the method's description here. Creation date: (08/15/2000 7:14:39 PM)

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - int
col - int
Returns:
boolean

selectNextBusinessObject

public int selectNextBusinessObject()
Selects the next business object in the list and returns the index of the newly selected object. If there is no object selected upon invocation, the first object in the list is selected. If we are at the end of the list, the last item is repeatedly selected and returned.

Returns:
int

selectPreviousBusinessObject

public int selectPreviousBusinessObject()
Selects the next business object in the list and returns the index of the newly selected object. If there is no object selected upon invocation, the first object in the list is selected. If we are at the end of the list, the last item is repeatedly selected and returned.

Returns:
int

setAllObjects

public void setAllObjects(List allObjects)
Sets the allObjects property (java.util.Vector) value.

Overrides:
setAllObjects in class CMTableModel
Parameters:
allObjects - The new value for the property.
See Also:
CMTableModel.getAllObjects()

setBusinessObjectsAreInvokable

public void setBusinessObjectsAreInvokable(boolean businessObjectsAreInvokable)
Sets the businessObjectsAreInvokable property (boolean) value.

Parameters:
businessObjectsAreInvokable - The new value for the property.
See Also:
getBusinessObjectsAreInvokable()

setColumnGetterMethodObjects

public void setColumnGetterMethodObjects(List pMethodObjects)
Sets the column getter methods via a List of Method objects. This is more efficient than setting them by specifying the name of the getter methods with String objects.

Parameters:
pMethodObjects - A List containing Method objects

setColumnGetterMethods

public void setColumnGetterMethods(String[] columnGetterMethods)
Sets the array of getter method names. These may be used to retrieve the display values for columns. It is more efficient to set the getter methods by passing in a List of Method objects.


setColumnGetterMethods

public void setColumnGetterMethods(int index,
                                   String columnGetterMethods)
Sets the column getter method at the specified index


setColumnsContainingIcons

public void setColumnsContainingIcons(Integer[] newColumnsContainingIcons)
Insert the method's description here. Creation date: (6/14/00 11:12:34 AM)

Parameters:
newColumnsContainingIcons - Integer[]

setJTable

public void setJTable(JTable jTable)
Sets the jTable property (javax.swing.JTable) value.

Parameters:
jTable - The new value for the property.
See Also:
getJTable()

setSelectedBusinessObject

public void setSelectedBusinessObject(Object selectedBusinessObject)
Sets the selectedBusinessObject property (java.lang.Object) value.

Parameters:
selectedBusinessObject - The new value for the property.
See Also:
getSelectedBusinessObject()

setSelectedRowIndex

public void setSelectedRowIndex(int rowIndex)
Sets the selected row to the specified index

Parameters:
rowIndex - int

setSelectionMode

public void setSelectionMode(int newSelectionMode)
Insert the method's description here. Creation date: (6/14/00 4:11:19 PM)


setTableColumn

public void setTableColumn(Object o)

valueChanged

public void valueChanged(ListSelectionEvent e)
Called whenever the value of the selection changes.

Specified by:
valueChanged in interface ListSelectionListener
Parameters:
e - the event that characterizes the change.