com.zfqjava.swing
Class AbstractDataGridModel

java.lang.Object
  |
  +--com.zfqjava.swing.AbstractDataGridModel
All Implemented Interfaces:
DataGridModel, java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
DefaultDataGridModel

public abstract class AbstractDataGridModel
extends java.lang.Object
implements DataGridModel, java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  javax.swing.event.EventListenerList listenerList
          List of listeners
 
Constructor Summary
AbstractDataGridModel()
           
 
Method Summary
 void addDataGridModelListener(DataGridModelListener l)
          Adds a listener to the list that is notified each time a change to the data model occurs.
 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.
 void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
          Registers the given observer to begin receiving notifications when undoable edits are made to the model.
protected  void fireCellAttributesChanged(Cell c)
          Notifies all listeners that cell attributes have been changed.
protected  void fireCellAttributesChanged(int rowIndex, int columnIndex)
          Notifies all listeners that cell attributes have been changed.
protected  void fireCellChanged(Cell c)
          Notifies all listeners that all cell object have been changed.
protected  void fireCellChanged(DataGridModelEvent e)
          Notifies all listeners that cell have been changed.
protected  void fireCellClassChanged(Cell c)
          Notifies all listeners that cell class have been changed.
protected  void fireCellClassChanged(int rowIndex, int columnIndex)
          Notifies all listeners that cell class have been changed.
protected  void fireCellEditableChanged(Cell c)
          Notifies all listeners that cell editable have been changed.
protected  void fireCellEditableChanged(int rowIndex, int columnIndex)
          Notifies all listeners that cell editable have been changed.
protected  void fireCellSpanChanged(Cell c)
          Notifies all listeners that cell span have been changed.
protected  void fireCellSpanChanged(int firstRow, int lastRow, int firstColumn, int lastColumn)
          Notifies all listeners that cell span have been changed.
protected  void fireCellValueChanged(Cell c)
          Notifies all listeners that cell value have been changed.
protected  void fireTableCellUpdated(int row, int column)
          Notifies all listeners that the value of the cell at [row, column] has been updated.
protected  void fireTableChanged(javax.swing.event.TableModelEvent e)
          Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.
protected  void fireTableColumnsDeleted(int firstColumn, int lastColumn)
          Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been deleted.
protected  void fireTableColumnsInserted(int firstColumn, int lastColumn)
          Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been inserted.
protected  void fireTableColumnsUpdated(int firstColumn, int lastColumn)
          Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been updated.
protected  void fireTableColumnUpdated(int column)
          Notifies all listeners that the value of the colum at column has been updated.
protected  void fireTableDataChanged()
          Notifies all listeners that all cell values in the table's rows may have changed.
protected  void fireTableRowsDeleted(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted.
protected  void fireTableRowsInserted(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted.
protected  void fireTableRowsUpdated(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated.
protected  void fireTableRowUpdated(int row)
          Notifies all listeners that the value of the row at row has been updated.
protected  void fireTableStructureChanged()
          Notifies all listeners that the table's structure has changed.
protected  void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
          Notifies all listeners that have registered interest for notification on this event type.
 java.lang.Class getColumnClass(int columnIndex)
          Returns Object.class regardless of columnIndex.
 java.lang.String getColumnName(int column)
          Returns a default name for the column using spreadsheet conventions: A, B, C, ...
 DataGridModelListener[] getDataGridModelListeners()
          Returns an array of all the data grid model listeners registered on this model.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this AbstractTableModel.
 javax.swing.event.TableModelListener[] getTableModelListeners()
          Returns an array of all the table model listeners registered on this model.
 javax.swing.event.UndoableEditListener[] getUndoableEditListeners()
          Returns an array of all the undoable edit listeners registered on this model.
 void removeDataGridModelListener(DataGridModelListener l)
          Removes a listener from the list that is notified each time a change to the data model occurs.
 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 removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
          Unregisters the given observer from the notification list so it will no longer receive updates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.zfqjava.swing.DataGridModel
getCellAttributes, getCellClass, getCellSpans, getCellSpans, getSpannedCells, hasCellSpans, hasCellSpans, isSpannedCell, merge, setCellAttributes, setCellClass, setCellEditable, setColumnClass, setColumnCount, setColumnName, setRowCount, split
 
Methods inherited from interface javax.swing.table.TableModel
getColumnCount, getRowCount, getValueAt, isCellEditable, setValueAt
 

Field Detail

listenerList

protected transient javax.swing.event.EventListenerList listenerList
List of listeners
Constructor Detail

AbstractDataGridModel

public AbstractDataGridModel()
Method Detail

getColumnName

public java.lang.String getColumnName(int column)
Returns a default name for the column using spreadsheet conventions: A, B, C, ... Z, AA, AB, etc. If column cannot be found, returns an empty string.
Specified by:
getColumnName in interface javax.swing.table.TableModel
Parameters:
column - the column being queried
Returns:
a string containing the default name of column

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Returns Object.class regardless of columnIndex.
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
columnIndex - the column being queried
Returns:
the Object.class

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

getTableModelListeners

public javax.swing.event.TableModelListener[] getTableModelListeners()
Returns an array of all the table model listeners registered on this model.
Returns:
all of this model's TableModelListeners or an empty array if no table model listeners are currently registered
See Also:
addTableModelListener(javax.swing.event.TableModelListener), removeTableModelListener(javax.swing.event.TableModelListener)

fireTableDataChanged

protected 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, EventListenerList, JTable.tableChanged(TableModelEvent)

fireTableStructureChanged

protected 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, EventListenerList

fireTableRowsInserted

protected 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, EventListenerList

fireTableRowsUpdated

protected 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, EventListenerList

fireTableRowsDeleted

protected 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, EventListenerList

fireTableColumnsInserted

protected void fireTableColumnsInserted(int firstColumn,
                                        int lastColumn)
Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been inserted.
Parameters:
firstColumn - the first column
lastColumn - the last column
Since:
JDataGrid 1.1
See Also:
TableModelEvent, EventListenerList

fireTableColumnsUpdated

protected void fireTableColumnsUpdated(int firstColumn,
                                       int lastColumn)
Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been updated.
Parameters:
firstColumn - the first column
lastColumn - the last column
Since:
JDataGrid 1.1
See Also:
TableModelEvent, EventListenerList

fireTableColumnsDeleted

protected void fireTableColumnsDeleted(int firstColumn,
                                       int lastColumn)
Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been deleted.
Parameters:
firstColumn - the first column
lastColumn - the last column
Since:
JDataGrid 1.1
See Also:
TableModelEvent, EventListenerList

fireTableColumnUpdated

protected void fireTableColumnUpdated(int column)
Notifies all listeners that the value of the colum at column has been updated.
Parameters:
column - column which has been updated
See Also:
TableModelEvent, EventListenerList

fireTableRowUpdated

protected void fireTableRowUpdated(int row)
Notifies all listeners that the value of the row at row has been updated.
Parameters:
row - row which has been updated
Since:
JDataGrid 1.1
See Also:
TableModelEvent, EventListenerList

fireTableCellUpdated

protected 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, EventListenerList

fireTableChanged

protected 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, EventListenerList

addDataGridModelListener

public void addDataGridModelListener(DataGridModelListener l)
Adds a listener to the list that is notified each time a change to the data model occurs.
Specified by:
addDataGridModelListener in interface DataGridModel
Parameters:
l - the DataGridModelListener

removeDataGridModelListener

public void removeDataGridModelListener(DataGridModelListener l)
Removes a listener from the list that is notified each time a change to the data model occurs.
Specified by:
removeDataGridModelListener in interface DataGridModel
Parameters:
l - the DataGridModelListener

getDataGridModelListeners

public DataGridModelListener[] getDataGridModelListeners()
Returns an array of all the data grid model listeners registered on this model.
Returns:
all of this model's DataGridModelListeners or an empty array if no data grid model listeners are currently registered
See Also:
addDataGridModelListener(com.zfqjava.swing.event.DataGridModelListener), removeDataGridModelListener(com.zfqjava.swing.event.DataGridModelListener)

fireCellAttributesChanged

protected void fireCellAttributesChanged(int rowIndex,
                                         int columnIndex)
Notifies all listeners that cell attributes have been changed.
Parameters:
rowIndex - the row index of the cell
columnIndex - the column index of the cell
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellAttributesChanged

protected void fireCellAttributesChanged(Cell c)
Notifies all listeners that cell attributes have been changed.
Parameters:
c - the specified cell
Since:
JDataGrid 1.1
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellClassChanged

protected void fireCellClassChanged(int rowIndex,
                                    int columnIndex)
Notifies all listeners that cell class have been changed.
Parameters:
rowIndex - the row index of the cell
columnIndex - the column index of the cell
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellClassChanged

protected void fireCellClassChanged(Cell c)
Notifies all listeners that cell class have been changed.
Parameters:
c - the specified cell
Since:
JDataGrid 1.1
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellEditableChanged

protected void fireCellEditableChanged(int rowIndex,
                                       int columnIndex)
Notifies all listeners that cell editable have been changed.
Parameters:
rowIndex - the row index of the cell
columnIndex - the column index of the cell
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellEditableChanged

protected void fireCellEditableChanged(Cell c)
Notifies all listeners that cell editable have been changed.
Parameters:
c - the specified cell
Since:
JDataGrid 1.1
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellSpanChanged

protected void fireCellSpanChanged(Cell c)
Notifies all listeners that cell span have been changed.
Parameters:
c - the spanned cell
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellSpanChanged

protected void fireCellSpanChanged(int firstRow,
                                   int lastRow,
                                   int firstColumn,
                                   int lastColumn)
Notifies all listeners that cell span have been changed.
Parameters:
firstRow - the first row index of the specified cell area
lastRow - the last row index of the specified cell area
firstColumn - the first column index of the specified cell area
lastColumn - the last column index of the specified cell area

fireCellValueChanged

protected void fireCellValueChanged(Cell c)
Notifies all listeners that cell value have been changed.
Parameters:
c - the specified cell
Since:
JDataGrid 1.1
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellChanged

protected void fireCellChanged(Cell c)
Notifies all listeners that all cell object have been changed.
Parameters:
c - the specified cell
Since:
JDataGrid 1.1
See Also:
fireCellChanged(com.zfqjava.swing.cell.Cell)

fireCellChanged

protected void fireCellChanged(DataGridModelEvent e)
Notifies all listeners that cell have been changed.

addUndoableEditListener

public void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
Registers the given observer to begin receiving notifications when undoable edits are made to the model.
Specified by:
addUndoableEditListener in interface DataGridModel
Parameters:
listener - the observer to register
See Also:
UndoableEditEvent

removeUndoableEditListener

public void removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
Unregisters the given observer from the notification list so it will no longer receive updates.
Specified by:
removeUndoableEditListener in interface DataGridModel
Parameters:
listener - the observer to register
See Also:
UndoableEditEvent

getUndoableEditListeners

public javax.swing.event.UndoableEditListener[] getUndoableEditListeners()
Returns an array of all the undoable edit listeners registered on this model.
Returns:
all of this model's UndoableEditListeners or an empty array if no undoable edit listeners are currently registered
See Also:
addUndoableEditListener(javax.swing.event.UndoableEditListener), removeUndoableEditListener(javax.swing.event.UndoableEditListener)

fireUndoableEditHappened

protected void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
See Also:
EventListenerList

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of all the objects currently registered as FooListeners upon this AbstractTableModel. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a model m for its table model listeners with the following code:

TableModelListener[] tmls = (TableModelListener[])(m.getListeners(TableModelListener.class));
If no such listeners exist, this method returns an empty array.
Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this component, or an empty array if no such listeners have been added
Throws:
ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
See Also:
getTableModelListeners()


Copyright © 2001-2003 Extreme Component, Inc. All rights reserved.