JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.higrid
Class DefaultDataModelListener

java.lang.Object
  |
  +--com.klg.jclass.datasource.DataModelAdapter
        |
        +--com.klg.jclass.higrid.DefaultDataModelListener
All Implemented Interfaces:
DataModelListener, EventListener, ReadOnlyBindingListener, Serializable

public class DefaultDataModelListener
extends DataModelAdapter
implements Serializable

The DefaultDataModelListener class handles DataModelEvents from HiGrid's DataModel. It ensures that the runtime display of the HiGrid instance matches the state of the DataModel.

See Also:
Serialized Form

Field Summary
protected  com.klg.jclass.higrid.RowNode cellRowNode
           
protected  com.klg.jclass.higrid.RowNode lastOpenedRowNode
           
protected  boolean refreshGrid
           
 
Constructor Summary
protected DefaultDataModelListener(com.klg.jclass.higrid.HiGrid grid)
           
 
Method Summary
 void afterChangeOfRowData(com.klg.jclass.datasource.DataModelEvent event)
          A row has changed, re-read all its cells and its status to reflect the new values.
 void afterDeleteRow(com.klg.jclass.datasource.DataModelEvent event)
          Removes the row from the display.
 void afterInsertRow(com.klg.jclass.datasource.DataModelEvent event)
          A new row has been added to the datasource.
 void afterMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent event)
          The global cursor has moved to a new row.
 void afterRequeryRowAndDetails(com.klg.jclass.datasource.DataModelEvent event)
          Re-reads the indicated row and refresh all open children under this row.
 void afterRequeryTable(com.klg.jclass.datasource.DataModelEvent event)
          Re-read this table and refresh all open children in this table.
 void afterReset(com.klg.jclass.datasource.DataModelEvent event)
          Listeners must close all expanded views and reset/reread the root node.
 void beforeCancelAll(com.klg.jclass.datasource.DataModelEvent event)
          Called before all changes are cancelled.
 void beforeCancelRowChanges(com.klg.jclass.datasource.DataModelEvent event)
          Called before all edits to a row are undone.
 void beforeCommitAll(com.klg.jclass.datasource.DataModelEvent event)
          Called before all changes are committed.
 void beforeCommitConditional(com.klg.jclass.datasource.DataModelEvent event)
          Called when the root-level bookmark for a subtree changes.
 void beforeCommitRow(com.klg.jclass.datasource.DataModelEvent event)
          Called before single row is committed to data source.
 void beforeDeleteRow(com.klg.jclass.datasource.DataModelEvent event)
          Called before a row is [logically] deleted.
 void beforeDeleteTable(com.klg.jclass.datasource.DataModelEvent event)
          The indicated DataTable will be deleted and flushed from the cache.
 void beforeEditCell(com.klg.jclass.datasource.DataModelEvent event)
          Called before a cell is edited.
 void beforeInsertRow(com.klg.jclass.datasource.DataModelEvent event)
          Called before a row is inserted.
 void beforeMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent event)
          The global cursor will move to a new row.
 void beforeRequery(com.klg.jclass.datasource.DataModelEvent event)
          Called when either DataTableModel.requeryRowAndDetails() or DataTableModel.requeryRow() is called.
 void beforeReset(com.klg.jclass.datasource.DataModelEvent event)
          Called before entire grid is reset.
 void beginEvents(com.klg.jclass.datasource.DataModelEvent event)
          Notification that multiple events are coming.
 void endEvents(com.klg.jclass.datasource.DataModelEvent event)
          Notification that multiple events are complete.
protected  com.klg.jclass.higrid.RowNode getLastOpenedRowNode()
          Retrieves the rowNode last opened by the UI.
 void initialize(com.klg.jclass.datasource.DataModelEvent event)
          For internal use only Used by the JCData bean.
protected  boolean isAncestor(com.klg.jclass.higrid.RowNode rowNode, long row)
           
protected  com.klg.jclass.higrid.RowNode moveCurrentCell(com.klg.jclass.higrid.RowNode rowNode, boolean excludeRow)
          Possibly move the current cell position out of the given row node and its children.
 void originatorNavigateRow(com.klg.jclass.datasource.DataModelEvent event)
          The current row has been deleted and the originator of the deletion should now reposition the global cursor to a new, valid row.
protected  void refresh()
          Refresh higrid.
protected  void refreshRow(com.klg.jclass.higrid.RowNode rowNode)
          Refresh the indicated row
protected  void setLastOpenedRowNode(com.klg.jclass.higrid.RowNode rowNode)
          Sets the rowNode last opened by the UI.
protected  boolean updateEditStatus(long row)
          Update the edit status for an existing row node for a given bookmark
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

refreshGrid

protected boolean refreshGrid

cellRowNode

protected com.klg.jclass.higrid.RowNode cellRowNode

lastOpenedRowNode

protected com.klg.jclass.higrid.RowNode lastOpenedRowNode
Constructor Detail

DefaultDataModelListener

protected DefaultDataModelListener(com.klg.jclass.higrid.HiGrid grid)
Method Detail

beforeInsertRow

public void beforeInsertRow(com.klg.jclass.datasource.DataModelEvent event)
Called before a row is inserted. Can be cancelled. If not cancelled will be followed by afterInsertRow().

Specified by:
beforeInsertRow in interface DataModelListener
Overrides:
beforeInsertRow in class DataModelAdapter
See Also:
DataTableModel.addRow(com.klg.jclass.datasource.DataModelListener)

beforeReset

public void beforeReset(com.klg.jclass.datasource.DataModelEvent event)
Called before entire grid is reset. Can be cancelled. If not cancelled will be followed by afterReset(). This will result from a call to DataModel.requeryAll().

Specified by:
beforeReset in interface DataModelListener
Overrides:
beforeReset in class DataModelAdapter
See Also:
DataModel.requeryAll(com.klg.jclass.datasource.DataModelListener)

beforeRequery

public void beforeRequery(com.klg.jclass.datasource.DataModelEvent event)
Called when either DataTableModel.requeryRowAndDetails() or DataTableModel.requeryRow() is called. If not cancelled will be followed by an,

Specified by:
beforeRequery in interface DataModelListener
Overrides:
beforeRequery in class DataModelAdapter
See Also:
DataTableModel.requeryRow(com.klg.jclass.datasource.DataModelListener, long), DataTableModel.requeryRowAndDetails(com.klg.jclass.datasource.DataModelListener, long)

beforeEditCell

public void beforeEditCell(com.klg.jclass.datasource.DataModelEvent event)
Called before a cell is edited. Can be cancelled.

Specified by:
beforeEditCell in interface DataModelListener
Overrides:
beforeEditCell in class DataModelAdapter
See Also:
DataTableModel.updateCell(com.klg.jclass.datasource.DataModelListener, long, java.lang.String, java.lang.Object)

beforeDeleteRow

public void beforeDeleteRow(com.klg.jclass.datasource.DataModelEvent event)
Called before a row is [logically] deleted. Can be cancelled. If not cancelled will be followed by an afterDeleteRow90 or a afterChangeOfRowData() if the commit policy is COMMIT_MANUALLY or COMMIT_LEAVING_ANCESTOR.

Specified by:
beforeDeleteRow in interface DataModelListener
Overrides:
beforeDeleteRow in class DataModelAdapter
See Also:
DataTableModel.deleteRow(com.klg.jclass.datasource.DataModelListener, long), MetaDataModel.getCommitPolicy()

beforeCommitAll

public void beforeCommitAll(com.klg.jclass.datasource.DataModelEvent event)
Called before all changes are committed. Can be cancelled. All modified, deleted and inserted rows at all levels are about to be committed. beforeDeleteRow() and afterChangeOfRowData() will follow depending on the operations performed on the modified rows being saved. Results from a call to DataModel.updateAll.

Specified by:
beforeCommitAll in interface DataModelListener
Overrides:
beforeCommitAll in class DataModelAdapter
See Also:
DataModel.updateAll(com.klg.jclass.datasource.DataModelListener)

beforeCancelAll

public void beforeCancelAll(com.klg.jclass.datasource.DataModelEvent event)
Called before all changes are cancelled. Can be cancelled. afterInsertRow() and afterChangeOfRowData() can follow this event.

Specified by:
beforeCancelAll in interface DataModelListener
Overrides:
beforeCancelAll in class DataModelAdapter
See Also:
DataModel.cancelAll(com.klg.jclass.datasource.DataModelListener)

beforeCancelRowChanges

public void beforeCancelRowChanges(com.klg.jclass.datasource.DataModelEvent event)
Called before all edits to a row are undone. Can be cancelled An afterDeleteRow() or afterChangeOfRowData() will follow.

Specified by:
beforeCancelRowChanges in interface DataModelListener
Overrides:
beforeCancelRowChanges in class DataModelAdapter
See Also:
DataTableModel.cancelRowChanges(com.klg.jclass.datasource.DataModelListener, long)

beforeCommitConditional

public void beforeCommitConditional(com.klg.jclass.datasource.DataModelEvent event)
Called when the root-level bookmark for a subtree changes. When this happens those nodes in the previous subtree which are not COMMIT_MANUALLY are committed. Can be cancelled. If cancelled the cursor moves but the changes are automatically committed.

Specified by:
beforeCommitConditional in interface DataModelListener
Overrides:
beforeCommitConditional in class DataModelAdapter

beforeCommitRow

public void beforeCommitRow(com.klg.jclass.datasource.DataModelEvent event)
Called before single row is committed to data source. Can be cancelled in which case the row edits are not written to the datasource and the rows status remains modified. afterDeleteRow() or afterChangeOfRowData() will follow depending on the status of the row to be committed.

Specified by:
beforeCommitRow in interface DataModelListener
Overrides:
beforeCommitRow in class DataModelAdapter
See Also:
DataTableModel.commitRow(com.klg.jclass.datasource.DataModelListener, long)

beforeMoveToCurrentRow

public void beforeMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent event)
The global cursor will move to a new row. Can be cancelled.

Specified by:
beforeMoveToCurrentRow in interface DataModelListener
Overrides:
beforeMoveToCurrentRow in class DataModelAdapter

beforeDeleteTable

public void beforeDeleteTable(com.klg.jclass.datasource.DataModelEvent event)
The indicated DataTable will be deleted and flushed from the cache. Can be cancelled.

Specified by:
beforeDeleteTable in interface DataModelListener
Overrides:
beforeDeleteTable in class DataModelAdapter

afterChangeOfRowData

public void afterChangeOfRowData(com.klg.jclass.datasource.DataModelEvent event)
A row has changed, re-read all its cells and its status to reflect the new values. If this event is the result of a cell edit call DataModelEvent.getColumn() to get the name of the column which changed. If getColumn() returns "", re-read the entire row. Called when

Specified by:
afterChangeOfRowData in interface ReadOnlyBindingListener
Overrides:
afterChangeOfRowData in class DataModelAdapter

afterInsertRow

public void afterInsertRow(com.klg.jclass.datasource.DataModelEvent event)
A new row has been added to the datasource. Listeners need to display the row.

Specified by:
afterInsertRow in interface ReadOnlyBindingListener
Overrides:
afterInsertRow in class DataModelAdapter

afterDeleteRow

public void afterDeleteRow(com.klg.jclass.datasource.DataModelEvent event)
Removes the row from the display. A row has been physically deleted and needs to be removed from the display or has been logically deleted but the showDeletedRows property has been set to false. Called when,

Specified by:
afterDeleteRow in interface ReadOnlyBindingListener
Overrides:
afterDeleteRow in class DataModelAdapter

afterReset

public void afterReset(com.klg.jclass.datasource.DataModelEvent event)
Listeners must close all expanded views and reset/reread the root node. The previous pointer to the root node is no longer valid. Call DataModel.getDataTableTree().getRoot() for the new root table. Called when the datasource has been reset.

Specified by:
afterReset in interface ReadOnlyBindingListener
Overrides:
afterReset in class DataModelAdapter
See Also:
DataModel.requeryAll(com.klg.jclass.datasource.DataModelListener)

afterMoveToCurrentRow

public void afterMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent event)
The global cursor has moved to a new row. Listeners should position their cursor on the indicated row. In a master-detail relationship child levels should refresh themselves to reflect data sets which correspond to the new parent row by calling DataModel.getCurrentDataTable() or for field controls, DataModel.getCurrentDataItem().

Specified by:
afterMoveToCurrentRow in interface ReadOnlyBindingListener
Overrides:
afterMoveToCurrentRow in class DataModelAdapter

afterRequeryRowAndDetails

public void afterRequeryRowAndDetails(com.klg.jclass.datasource.DataModelEvent event)
Re-reads the indicated row and refresh all open children under this row.

Specified by:
afterRequeryRowAndDetails in interface ReadOnlyBindingListener
Overrides:
afterRequeryRowAndDetails in class DataModelAdapter

afterRequeryTable

public void afterRequeryTable(com.klg.jclass.datasource.DataModelEvent event)
Re-read this table and refresh all open children in this table.

Specified by:
afterRequeryTable in interface ReadOnlyBindingListener
Overrides:
afterRequeryTable in class DataModelAdapter

beginEvents

public void beginEvents(com.klg.jclass.datasource.DataModelEvent event)
Notification that multiple events are coming. Multiple events will be nested between beginEvents() and endEvents(). Allows listeners to treat the events as a batch, to, for example, reduce repaints.

Specified by:
beginEvents in interface ReadOnlyBindingListener
Overrides:
beginEvents in class DataModelAdapter

endEvents

public void endEvents(com.klg.jclass.datasource.DataModelEvent event)
Notification that multiple events are complete. Multiple events will be nested between beginEvents() and endEvents(). Allows listeners to treat the events as a batch, to, for example, reduce repaints. Called when

Specified by:
endEvents in interface ReadOnlyBindingListener
Overrides:
endEvents in class DataModelAdapter

originatorNavigateRow

public void originatorNavigateRow(com.klg.jclass.datasource.DataModelEvent event)
The current row has been deleted and the originator of the deletion should now reposition the global cursor to a new, valid row.

Specified by:
originatorNavigateRow in interface DataModelListener
Overrides:
originatorNavigateRow in class DataModelAdapter

initialize

public void initialize(com.klg.jclass.datasource.DataModelEvent event)
For internal use only Used by the JCData bean.

Specified by:
initialize in interface ReadOnlyBindingListener
Overrides:
initialize in class DataModelAdapter

getLastOpenedRowNode

protected com.klg.jclass.higrid.RowNode getLastOpenedRowNode()
Retrieves the rowNode last opened by the UI.

Returns:
the rowNode last opened by the UI.

setLastOpenedRowNode

protected void setLastOpenedRowNode(com.klg.jclass.higrid.RowNode rowNode)
Sets the rowNode last opened by the UI.


refreshRow

protected void refreshRow(com.klg.jclass.higrid.RowNode rowNode)
Refresh the indicated row

Parameters:
rowNode - The row node to refresh.

refresh

protected void refresh()
Refresh higrid.


updateEditStatus

protected boolean updateEditStatus(long row)
Update the edit status for an existing row node for a given bookmark

Parameters:
row - The bookmark of the row node
Returns:
True if row node is updated successfully, else false.

moveCurrentCell

protected com.klg.jclass.higrid.RowNode moveCurrentCell(com.klg.jclass.higrid.RowNode rowNode,
                                                        boolean excludeRow)
Possibly move the current cell position out of the given row node and its children.

Parameters:
rowNode - The row node.
excludeRow - True if the row node is excluded from the cell move.
Returns:
The row node for the new cell position

isAncestor

protected boolean isAncestor(com.klg.jclass.higrid.RowNode rowNode,
                             long row)

Copyright © 2004 Quest Software Inc..
All rights reserved.