planetj.gui
Class CMSmartTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byplanetj.gui.CMTableModel
          extended byplanetj.gui.CMSmartTableModel
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ListSelectionListener, java.io.Serializable, javax.swing.table.TableModel

public class CMSmartTableModel
extends CMTableModel
implements javax.swing.event.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.
 java.lang.Class getColumnClass(int column)
          Insert the method's description here.
 java.util.List getColumnGetterMethodObjects()
          Gets the column getter methods via a List of Method objects.
 java.lang.String[] getColumnGetterMethods()
          Gets the columnGetterMethods property (java.lang.String[]) value.
 java.lang.String getColumnGetterMethods(int index)
          Gets the name of the getter method at the specified index
 java.lang.Integer[] getColumnsContainingIcons()
          Insert the method's description here.
 javax.swing.JTable getJTable()
          Gets the jTable property (javax.swing.JTable) value.
 java.lang.Object getSelectedBusinessObject()
          Gets the selectedBusinessObject property (java.lang.Object) value.
 java.lang.Object getSelectedBusinessObjectAsString()
          Gets the selectedBusinessObject property (java.lang.Object) value as a String.
 java.util.List getSelectedBusinessObjects()
          Gets the selected business objects
 int getSelectedRowIndex()
          Gets the index of the selected row
 int getSelectionMode()
           
 javax.swing.table.TableColumn getTableColumn(int index)
           
 java.lang.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(java.util.List allObjects)
          Sets the allObjects property (java.util.Vector) value.
 void setBusinessObjectsAreInvokable(boolean businessObjectsAreInvokable)
          Sets the businessObjectsAreInvokable property (boolean) value.
 void setColumnGetterMethodObjects(java.util.List pMethodObjects)
          Sets the column getter methods via a List of Method objects.
 void setColumnGetterMethods(int index, java.lang.String columnGetterMethods)
          Sets the column getter method at the specified index
 void setColumnGetterMethods(java.lang.String[] columnGetterMethods)
          Sets the array of getter method names.
 void setColumnsContainingIcons(java.lang.Integer[] newColumnsContainingIcons)
          Insert the method's description here.
 void setJTable(javax.swing.JTable jTable)
          Sets the jTable property (javax.swing.JTable) value.
 void setSelectedBusinessObject(java.lang.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(java.lang.Object o)
           
 void valueChanged(javax.swing.event.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 java.lang.Class getColumnClass(int column)
Insert the method's description here. Creation date: (6/14/00 11:59:43 AM)

Specified by:
getColumnClass in interface javax.swing.table.TableModel

getColumnGetterMethodObjects

public java.util.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 java.lang.String[] getColumnGetterMethods()
Gets the columnGetterMethods property (java.lang.String[]) value.

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

getColumnGetterMethods

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


getColumnsContainingIcons

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

Returns:
int[]

getJTable

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

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

getSelectedBusinessObject

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

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

getSelectedBusinessObjectAsString

public java.lang.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 java.util.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 javax.swing.table.TableColumn getTableColumn(int index)

getValueAt

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

Specified by:
getValueAt in interface javax.swing.table.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 javax.swing.table.TableModel
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(java.util.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(java.util.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(java.lang.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,
                                   java.lang.String columnGetterMethods)
Sets the column getter method at the specified index


setColumnsContainingIcons

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

Parameters:
newColumnsContainingIcons - Integer[]

setJTable

public void setJTable(javax.swing.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(java.lang.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(java.lang.Object o)

valueChanged

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

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