org.scopemvc.view.swing
Class STableModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--org.scopemvc.view.swing.SAbstractListModel
              |
              +--org.scopemvc.view.swing.STableModel
All Implemented Interfaces:
javax.swing.ListModel, ModelBindable, ModelChangeListener, Refreshable, java.io.Serializable, javax.swing.table.TableModel

public class STableModel
extends SAbstractListModel
implements javax.swing.table.TableModel

Version:
$Revision: 1.12 $ $Date: 2002/09/05 15:41:49 $
Author:
Steve Meyfroidt
, Daniel Michalik
See Also:
STable, Serialized Form

Field Summary
protected  java.lang.String[] columnNames
          TODO: describe of the Field
protected  boolean[] columnsEditable
          if null editable when read-write property else read-only
protected  Selector[] columnSelectors
          TODO: describe of the Field
protected  PropertyManager manager
          TODO: describe of the Field
protected  javax.swing.JTable table
          TODO: describe of the Field
 
Fields inherited from class org.scopemvc.view.swing.SAbstractListModel
listModel, sizeSelector
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
STableModel(javax.swing.JTable inTable)
          Constructor for the STableModel object
 
Method Summary
 void addListDataListener(javax.swing.event.ListDataListener l)
          Adds an element to the ListDataListener attribute of the STableModel object
 void addTableModelListener(javax.swing.event.TableModelListener l)
          Adds a listener to the list that's notified each time a change to the data model occurs.
protected  void fireContentsChanged(java.lang.Object source, int index0, int index1)
          TODO: document the method
protected  void fireIntervalAdded(java.lang.Object source, int index0, int index1)
          TODO: document the method
protected  void fireIntervalRemoved(java.lang.Object source, int index0, int index1)
          TODO: document the method
 void fireTableCellUpdated(int row, int column)
          Notifies all listeners that the value of the cell at [row, column] has been updated.
 void fireTableChanged(javax.swing.event.TableModelEvent e)
          Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.
 void fireTableDataChanged()
          Notifies all listeners that all cell values in the table's rows may have changed.
 void fireTableRowsDeleted(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow] , inclusive, have been deleted.
 void fireTableRowsInserted(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow] , inclusive, have been inserted.
 void fireTableRowsUpdated(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow] , inclusive, have been updated.
 void fireTableStructureChanged()
          Notifies all listeners that the table's structure has changed.
 java.lang.Class getColumnClass(int inColumn)
          Gets the column class
 int getColumnCount()
          Gets the column count
 java.lang.String getColumnName(int inColumn)
          Gets the column name
protected  Selector getColumnSelector(int inColumn)
          Gets the column selector
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Returns an array of all the listeners of the given type that were added to this model.
protected  PropertyManager getPropertyManager()
          Gets the property manager
 int getRowCount()
          Gets the row count
 java.lang.Object getValueAt(int inRow, int inColumn)
          Gets the value at
 boolean isCellEditable(int inRow, int inColumn)
          Gets the cell editable
 void removeListDataListener(javax.swing.event.ListDataListener l)
          TODO: document the method
 void removeTableModelListener(javax.swing.event.TableModelListener l)
          Removes a listener from the list that's notified each time a change to the data model occurs.
 void setColumnNames(java.lang.String[] inNames)
          Sets the column names
 void setColumnSelectors(Selector[] inSelectors)
          Sets the column selectors
 void setColumnSelectorStrings(java.lang.String[] inSelectorStrings)
          Sets the column selector strings
 void setEditableColumns(boolean[] inEditables)
          Sets the editable columns
protected  void setShownModel(java.lang.Object inModel)
          Called internally from updateFromProperty().
 void setValueAt(java.lang.Object inValue, int inRow, int inColumn)
          Sets the value at
 
Methods inherited from class org.scopemvc.view.swing.SAbstractListModel
containsElement, doModelChanged, getBoundModel, getElementAt, getSelector, getShownModel, getSize, getSizeSelector, getViewValue, isSorted, modelChanged, refresh, setBoundModel, setComparator, setListModel, setSelector, setSelectorString, setSizeSelector, setSizeSelectorString, setSorted, setSorted, updateFromProperty, validationFailed, validationSuccess
 
Methods inherited from class javax.swing.AbstractListModel
getListDataListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnSelectors

protected Selector[] columnSelectors
TODO: describe of the Field


columnNames

protected java.lang.String[] columnNames
TODO: describe of the Field


columnsEditable

protected boolean[] columnsEditable
if null editable when read-write property else read-only


manager

protected PropertyManager manager
TODO: describe of the Field


table

protected javax.swing.JTable table
TODO: describe of the Field

Constructor Detail

STableModel

public STableModel(javax.swing.JTable inTable)
Constructor for the STableModel object

Parameters:
inTable - TODO: Describe the Parameter
Method Detail

getRowCount

public int getRowCount()
Gets the row count

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
The rowCount value

getColumnCount

public int getColumnCount()
Gets the column count

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
The columnCount value

getColumnName

public java.lang.String getColumnName(int inColumn)
Gets the column name

Specified by:
getColumnName in interface javax.swing.table.TableModel
Parameters:
inColumn - TODO: Describe the Parameter
Returns:
The columnName value

getColumnClass

public java.lang.Class getColumnClass(int inColumn)
Gets the column class

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
inColumn - TODO: Describe the Parameter
Returns:
The columnClass value

isCellEditable

public boolean isCellEditable(int inRow,
                              int inColumn)
Gets the cell editable

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Parameters:
inRow - TODO: Describe the Parameter
inColumn - TODO: Describe the Parameter
Returns:
The cellEditable value

getValueAt

public java.lang.Object getValueAt(int inRow,
                                   int inColumn)
Gets the value at

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
inRow - TODO: Describe the Parameter
inColumn - TODO: Describe the Parameter
Returns:
The valueAt value

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of all the listeners of the given type that were added to this model.

Overrides:
getListeners in class javax.swing.AbstractListModel
Parameters:
listenerType - TODO: Describe the Parameter
Returns:
The listeners value

setColumnSelectors

public void setColumnSelectors(Selector[] inSelectors)
Sets the column selectors

Parameters:
inSelectors - The new columnSelectors value

setColumnSelectorStrings

public void setColumnSelectorStrings(java.lang.String[] inSelectorStrings)
Sets the column selector strings

Parameters:
inSelectorStrings - The new columnSelectorStrings value

setColumnNames

public void setColumnNames(java.lang.String[] inNames)
Sets the column names

Parameters:
inNames - The new columnNames value

setEditableColumns

public void setEditableColumns(boolean[] inEditables)
Sets the editable columns

Parameters:
inEditables - The new editableColumns value

setValueAt

public void setValueAt(java.lang.Object inValue,
                       int inRow,
                       int inColumn)
Sets the value at

Specified by:
setValueAt in interface javax.swing.table.TableModel
Parameters:
inValue - The new valueAt value
inRow - The new valueAt value
inColumn - The new valueAt value

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener l)
Adds an element to the ListDataListener attribute of the STableModel object

Specified by:
addListDataListener in interface javax.swing.ListModel
Overrides:
addListDataListener in class javax.swing.AbstractListModel
Parameters:
l - The element to be added to the ListDataListener attribute

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener l)
TODO: document the method

Specified by:
removeListDataListener in interface javax.swing.ListModel
Overrides:
removeListDataListener in class javax.swing.AbstractListModel
Parameters:
l - TODO: Describe the Parameter

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener l)
Adds a listener to the list that's notified each time a change to the data model occurs.

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

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener l)
Removes a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeTableModelListener in interface javax.swing.table.TableModel
Parameters:
l - the TableModelListener

fireTableDataChanged

public void fireTableDataChanged()
Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.

See Also:
TableModelEvent

fireTableStructureChanged

public void fireTableStructureChanged()
Notifies all listeners that the table's structure has changed. The number of columns in the table, and the names and types of the new columns may be different from the previous state. If the JTable receives this event and its autoCreateColumnsFromModel flag is set it discards any table columns that it had and reallocates default columns in the order they appear in the model. This is the same as calling setModel(TableModel) on the JTable.

See Also:
TableModelEvent

fireTableRowsInserted

public void fireTableRowsInserted(int firstRow,
                                  int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow] , inclusive, have been inserted.

Parameters:
firstRow - the first row
lastRow - the last row
See Also:
TableModelEvent

fireTableRowsUpdated

public void fireTableRowsUpdated(int firstRow,
                                 int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow] , inclusive, have been updated.

Parameters:
firstRow - the first row
lastRow - the last row
See Also:
TableModelEvent

fireTableRowsDeleted

public void fireTableRowsDeleted(int firstRow,
                                 int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow] , inclusive, have been deleted.

Parameters:
firstRow - the first row
lastRow - the last row
See Also:
TableModelEvent

fireTableCellUpdated

public void fireTableCellUpdated(int row,
                                 int column)
Notifies all listeners that the value of the cell at [row, column] has been updated.

Parameters:
row - row of cell which has been updated
column - column of cell which has been updated
See Also:
TableModelEvent

fireTableChanged

public void fireTableChanged(javax.swing.event.TableModelEvent e)
Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.

Parameters:
e - the event to be forwarded
See Also:
addTableModelListener(javax.swing.event.TableModelListener), TableModelEvent

getColumnSelector

protected Selector getColumnSelector(int inColumn)
Gets the column selector

Parameters:
inColumn - TODO: Describe the Parameter
Returns:
The columnSelector value

getPropertyManager

protected PropertyManager getPropertyManager()
Gets the property manager

Returns:
The propertyManager value

setShownModel

protected void setShownModel(java.lang.Object inModel)
Called internally from updateFromProperty().

Overrides:
setShownModel in class SAbstractListModel
Parameters:
inModel - The new shownModel value

fireContentsChanged

protected void fireContentsChanged(java.lang.Object source,
                                   int index0,
                                   int index1)
TODO: document the method

Overrides:
fireContentsChanged in class javax.swing.AbstractListModel
Parameters:
source - TODO: Describe the Parameter
index0 - TODO: Describe the Parameter
index1 - TODO: Describe the Parameter

fireIntervalAdded

protected void fireIntervalAdded(java.lang.Object source,
                                 int index0,
                                 int index1)
TODO: document the method

Overrides:
fireIntervalAdded in class javax.swing.AbstractListModel
Parameters:
source - TODO: Describe the Parameter
index0 - TODO: Describe the Parameter
index1 - TODO: Describe the Parameter

fireIntervalRemoved

protected void fireIntervalRemoved(java.lang.Object source,
                                   int index0,
                                   int index1)
TODO: document the method

Overrides:
fireIntervalRemoved in class javax.swing.AbstractListModel
Parameters:
source - TODO: Describe the Parameter
index0 - TODO: Describe the Parameter
index1 - TODO: Describe the Parameter


Copyright © 2000-2002 The Scope Team. All Rights Reserved.