JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.datasource
Class DataModelEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.klg.jclass.datasource.DataModelEvent
All Implemented Interfaces:
Serializable

public class DataModelEvent
extends EventObject

DataModelEvent describes changes to the data source. Interested listeners can then query this data source to reflect the changes in their display.

These "BEFORE_" events can be ignored. They are simply to allow users to cancel the event.

These events are the minimum to which a listener must respond. Other events.

See Also:
Serialized Form

Field Summary
static int AFTER_CHANGE_OF_ROW_DATA
          A row has changed, re-read all its cells and its status to reflect the new values.
static int AFTER_DELETE_ROW
          Removes the row from the display.
static int AFTER_INSERT_ROW
          A new row has been added to the datasource.
static int AFTER_MOVE_TO_CURRENT_ROW
          The global cursor has moved to a new row.
static int AFTER_REQUERY_ROW_AND_DETAILS
          Re-reads the indicated row and refresh all open children under this row.
static int AFTER_REQUERY_TABLE
          Re-read this table and refresh all open children in this table.
static int AFTER_RESET
          Listeners must close all expanded views and reset/reread the root node.
protected  Vector ancestors
           
static int BEFORE_CANCEL_ALL
          Event fired before all changes are cancelled.
static int BEFORE_CANCEL_ROW_CHANGES
          Event fired before all edits to a row are undone.
static int BEFORE_COMMIT_ALL
          Event fired before all changes are committed.
static int BEFORE_COMMIT_CONDITIONAL
          Called when the root-level bookmark for a subtree changes.
static int BEFORE_COMMIT_ROW
          Called before single row is committed to data source.
static int BEFORE_DELETE_ROW
          Event fired before a row is [logically] deleted.
static int BEFORE_DELETE_TABLE
          The indicated DataTable will be deleted and flushed from the cache.
static int BEFORE_EDIT_CELL
          Event fired before a cell is edited.
static int BEFORE_INSERT_ROW
          Event fired before a row is inserted.
static int BEFORE_MOVE_TO_CURRENT_ROW
          The global cursor will move to a new row.
static int BEFORE_REQUERY
          Event fired when either DataTableModel.requeryRowAndDetails() or DataTableModel.requeryRow() is called.
static int BEFORE_RESET
          Event fired before entire grid is reset.
static int BEGIN_EVENTS
          Notification that multiple events are coming.
protected  long bookmark
           
protected  boolean cancelled
           
protected  String column
           
protected  int command
           
static int END_EVENTS
          Notification that multiple events are complete.
static int INITIALIZE
          For internal use only Used in the JCData.
static int NOT_APPLICABLE
          The rowIndex or bookmark does not apply for this event
protected  com.klg.jclass.datasource.DataModelListener originator
           
static int ORIGINATOR_NAVIGATE_ROW
          The current row has been deleted and the originator of the deletion should now reposition the global cursor to a new, valid row.
protected  int rowIndex
           
protected  com.klg.jclass.datasource.DataTableModel table
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
DataModelEvent(Object source, com.klg.jclass.datasource.DataModelListener originator, com.klg.jclass.datasource.DataTableModel table, long bookmark, String column, int command)
          Constructor for DataModelEvent.
 
Method Summary
 void cancelProposedAction()
          Cancels the proposed action.
 Vector getAncestorBookmarks()
          Returns a list of the bookmarks which comprise the path from the root to the event node.
 long getBookmark()
          Returns the bookmark of the changed row
 boolean getCancelled()
          Sees if proposed action was cancelled by listener.
 String getColumn()
          Returns a string indicating which column changed, or "" in the case where the column is not applicable.
 int getCommand()
          Gets the command which indicates what action should be taken.
 com.klg.jclass.datasource.DataModelListener getOriginator()
          Returns the DataModelListener which initiated this event.
 int getRowIndex()
          Returns the row index of the changed row.
 com.klg.jclass.datasource.DataTableModel getTable()
          Returns the DataTableModel related to this event.
 boolean isCancelable()
          Returns true if this event can be cancelled.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEFORE_INSERT_ROW

public static final int BEFORE_INSERT_ROW
Event fired before a row is inserted. Can be cancelled. If not cancelled this event will be followed by an AFTER_INSERT_ROW event.

See Also:
DataTableModel.addRow(com.klg.jclass.datasource.DataModelListener), Constant Field Values

BEFORE_RESET

public static final int BEFORE_RESET
Event fired before entire grid is reset. Can be cancelled. If not cancelled this event will be followed by an AFTER_RESET event. This event will result from a call to DataModel.requeryAll().

See Also:
DataModel.requeryAll(com.klg.jclass.datasource.DataModelListener), Constant Field Values

BEFORE_REQUERY

public static final int BEFORE_REQUERY
Event fired when either DataTableModel.requeryRowAndDetails() or DataTableModel.requeryRow() is called. If not cancelled this event will be followed by an,

See Also:
DataTableModel.requeryRow(com.klg.jclass.datasource.DataModelListener, long), DataTableModel.requeryRowAndDetails(com.klg.jclass.datasource.DataModelListener, long), Constant Field Values

BEFORE_EDIT_CELL

public static final int BEFORE_EDIT_CELL
Event fired before a cell is edited. Can be cancelled.

See Also:
DataTableModel.updateCell(com.klg.jclass.datasource.DataModelListener, long, java.lang.String, java.lang.Object), Constant Field Values

BEFORE_DELETE_ROW

public static final int BEFORE_DELETE_ROW
Event fired before a row is [logically] deleted. Can be cancelled. If not cancelled this event will be followed by an AFTER_DELETE_ROW or a AFTER_CHANGE_OF_ROW_DATA message if the commit policy is COMMIT_MANUALLY or COMMIT_LEAVING_ANCESTOR.

See Also:
DataTableModel.deleteRow(com.klg.jclass.datasource.DataModelListener, long), MetaDataModel.getCommitPolicy(), Constant Field Values

BEFORE_COMMIT_ALL

public static final int BEFORE_COMMIT_ALL
Event fired before all changes are committed. Can be cancelled. All modified, deleted and inserted rows at all levels are about to be committed. BEFORE_DELETE_ROW and AFTER_CHANGE_OF_ROW_DATA events will follow depending on the operations performed on the modified rows being saved. Results from a call to DataModel.updateAll.

See Also:
DataModel.updateAll(com.klg.jclass.datasource.DataModelListener), Constant Field Values

BEFORE_CANCEL_ALL

public static final int BEFORE_CANCEL_ALL
Event fired before all changes are cancelled. Can be cancelled. AFTER_INSERT_ROW and AFTER_CHANGE_OR_ROW_DATA events can follow this event.

See Also:
DataModel.cancelAll(com.klg.jclass.datasource.DataModelListener), Constant Field Values

BEFORE_CANCEL_ROW_CHANGES

public static final int BEFORE_CANCEL_ROW_CHANGES
Event fired before all edits to a row are undone. Can be cancelled An AFTER_DELETE_ROW or AFTER_CHANGE_OF_ROW_DATA event will follow.

See Also:
DataTableModel.cancelRowChanges(com.klg.jclass.datasource.DataModelListener, long), Constant Field Values

BEFORE_COMMIT_CONDITIONAL

public static final int BEFORE_COMMIT_CONDITIONAL
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.

See Also:
Constant Field Values

BEFORE_COMMIT_ROW

public static final int BEFORE_COMMIT_ROW
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. AFTER_DELETE_ROW or AFTER_CHANGE_OF_ROW_DATA events will followed depending on the status of the row to be committed.

See Also:
DataTableModel.commitRow(com.klg.jclass.datasource.DataModelListener, long), Constant Field Values

BEFORE_MOVE_TO_CURRENT_ROW

public static final int BEFORE_MOVE_TO_CURRENT_ROW
The global cursor will move to a new row. Can be cancelled.

See Also:
Constant Field Values

BEFORE_DELETE_TABLE

public static final int BEFORE_DELETE_TABLE
The indicated DataTable will be deleted and flushed from the cache. Can be cancelled.

See Also:
Constant Field Values

AFTER_CHANGE_OF_ROW_DATA

public static final int AFTER_CHANGE_OF_ROW_DATA
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

See Also:
Constant Field Values

AFTER_INSERT_ROW

public static final int AFTER_INSERT_ROW
A new row has been added to the datasource. Listeners need to display the row. Rows are always added to the end of DataTableModels.

See Also:
Constant Field Values

AFTER_DELETE_ROW

public static final int AFTER_DELETE_ROW
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,

See Also:
Constant Field Values

AFTER_RESET

public static final int AFTER_RESET
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.

See Also:
DataModel.requeryAll(com.klg.jclass.datasource.DataModelListener), Constant Field Values

BEGIN_EVENTS

public static final int BEGIN_EVENTS
Notification that multiple events are coming. Multiple events will be nested between BEGIN_EVENTS and END_EVENTS events. Allows listeners to treat the events as a batch, to, for example, reduce repaints.

See Also:
Constant Field Values

END_EVENTS

public static final int END_EVENTS
Notification that multiple events are complete. Multiple events will be nested between BEGIN_EVENTS and END_EVENTS events. Allows listeners to treat the events as a batch, to, for example, reduce repaints. Called when

See Also:
Constant Field Values

AFTER_MOVE_TO_CURRENT_ROW

public static final int AFTER_MOVE_TO_CURRENT_ROW
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().

See Also:
Constant Field Values

INITIALIZE

public static final int INITIALIZE
For internal use only Used in the JCData.

See Also:
Constant Field Values

ORIGINATOR_NAVIGATE_ROW

public static final int ORIGINATOR_NAVIGATE_ROW
The current row has been deleted and the originator of the deletion should now reposition the global cursor to a new, valid row.

See Also:
Constant Field Values

AFTER_REQUERY_ROW_AND_DETAILS

public static final int AFTER_REQUERY_ROW_AND_DETAILS
Re-reads the indicated row and refresh all open children under this row.

See Also:
Constant Field Values

AFTER_REQUERY_TABLE

public static final int AFTER_REQUERY_TABLE
Re-read this table and refresh all open children in this table.

See Also:
Constant Field Values

NOT_APPLICABLE

public static final int NOT_APPLICABLE
The rowIndex or bookmark does not apply for this event

See Also:
Constant Field Values

rowIndex

protected int rowIndex

command

protected int command

bookmark

protected long bookmark

column

protected String column

ancestors

protected Vector ancestors

cancelled

protected boolean cancelled

table

protected com.klg.jclass.datasource.DataTableModel table

originator

protected com.klg.jclass.datasource.DataModelListener originator
Constructor Detail

DataModelEvent

public DataModelEvent(Object source,
                      com.klg.jclass.datasource.DataModelListener originator,
                      com.klg.jclass.datasource.DataTableModel table,
                      long bookmark,
                      String column,
                      int command)
               throws DataModelException
Constructor for DataModelEvent.

Parameters:
source - the containing DataModel
originator - the DataModelListener which initiated this action
table - the DataTableModel in which the change occurred
column - an String specifying which column changed
command - an int indicating the what need to be done
Throws:
DataModelException - If data model exceptions occur within the construction of the event.
Method Detail

getTable

public com.klg.jclass.datasource.DataTableModel getTable()
Returns the DataTableModel related to this event.

Returns:
the DataTableModel which is the source of this event.
See Also:
DataTableModel

getRowIndex

public int getRowIndex()
Returns the row index of the changed row.

Returns:
a int indicating the current ordinal position of the row in the DataTable

getBookmark

public long getBookmark()
Returns the bookmark of the changed row

Returns:
a long which uniquely identifies a row

getColumn

public String getColumn()
Returns a string indicating which column changed, or "" in the case where the column is not applicable.

Returns:
the column name of the changed column

getCommand

public int getCommand()
Gets the command which indicates what action should be taken.

Returns:
an int, which is one of the constants from this class, indicating the required action.

getAncestorBookmarks

public Vector getAncestorBookmarks()
Returns a list of the bookmarks which comprise the path from the root to the event node. The event node's bookmark is the last in the list.

Returns:
a Vector of bookmarks from the root to the event node.

cancelProposedAction

public void cancelProposedAction()
Cancels the proposed action. Call this method to veto the pending action. The default is to accept the change (false). If isCancelable() returns false the cancel request is ignored.

See Also:
isCancelable(), getCancelled()

getCancelled

public boolean getCancelled()
Sees if proposed action was cancelled by listener. See if a listener vetoed the proposed action.

Returns:
a boolean: true if cancelled.
See Also:
cancelProposedAction()

isCancelable

public boolean isCancelable()
Returns true if this event can be cancelled. Cancelling an event cancels the operation which generated the event.

Returns:
true if this event can be cancelled.

getOriginator

public com.klg.jclass.datasource.DataModelListener getOriginator()
Returns the DataModelListener which initiated this event. This is useful when responding to events to know if additional processing is necessary based on whether you were the originator or not.

Returns:
the DataModelListener which is the object which initated this event

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