borland Packages Class Hierarchy dx.dataset Package
java.util.EventListener +----com.borland.dx.dataset.EditListener
Methods
Implemented by DBEventMonitor, EditAdapter
This interface is used as a notification for row editing before and after edit-related operations are completed and includes
With an EditListener
, you can
DataSet
enable, insert, delete, and update properties can be used to block certain types of editing.Perform row-level validation just before a row is posted. Use the adding()
method for new rows and the updating()
method for modified rows.
Get control after one of these operations. For example, you can initialize values in fields after a row is inserted, but before the user begins data entry.
Process a ValidationException
for all events. An exception class that derives from Exception
can be thrown. These exceptions are caught by the DataSet
event dispatcher and chained into a special ValidationException
. This ValidationException
has an error code of ValidationException.APPLICATION_ERROR
and the message from the exception that was caught. This chained ValidationException
is then thrown so that normal DataSet
error handling can deal with the problem.
If a JBCL StatusBar
or a dbSwing JdbStatusLabel
is bound to a DataSet
, the message from the user thrown exception is displayed in the status bar.
Inserting, adding, and updating methods each have a unique purpose. Insert methods create a new, unposted row. The new, unposted row is sometimes called a pseudo-row
because it does not exist in the data set until it is posted. Add methods work on newly inserted rows when they are about to be or have been posted. Update methods work on existing rows only, at the time that modifications to them are about to be or have been posted.
A simple way for an application to pass an error message to display in the UI involves the EditListener
before event (those that end in "ing"). These events can be wired to throw a Exception("custom message"). In turn, this gets thrown as a chained ValidationException
that copies the "custom message" as the message for the ValidationException
. Since all ValidationExceptions
go to a StatusListener
, for example the JBCL StatusBar
or a dbSwing JdbStatusLabel
control, the custom message displays in the application's UI.
void added(DataSet dataSet)This is an event to notify listeners that a new row is successfully posted to the
DataSet
. This event is fired by DataSet.addRow()
, which inserts, modifies, and posts a row all in one operation.
dataSet
void addError(DataSet dataSet, ReadWriteRow row, DataSetException ex, ErrorResponse response)This is an event to notify listeners when an exception is thrown for row add operations. Call
response.abort()
(the default) to cause the operation to fail with an appropriate DataSetException
or ValidationException
. Call response.retry()
to cause the operation to be retried. Be sure that the retry will succeed or that your code can handle repeated retries. Call response.ignore()
to cause the operation to silently fail without an exception being thrown.
dataSet
row
ex
response
void adding(DataSet dataSet, ReadWriteRow newRow)This is an event to notify listeners before a new row is posted to the
DataSet
. This event is fired by DataSet.addRow()
, which inserts, modifies, and posts a row all in one operation. If a VetoException
or Exception
is thrown inside this method, the post operation is not performed, a ValidationException
with an error code of APPLICATION_ERROR is thrown instead. The adding()
method is called before checks to make sure all required fields are not null. If a VetoException
or Exception
is constructed with a STRING parameter, this STRING is used in the default error handling displays, for example,
throw new VetoException("My error message");
dataSet
newRow
void canceling(DataSet dataSet)This is an event to notify listeners when the editing of a new or existing row in a
DataSet
is about to be canceled. An application might use this event to save undo information.
dataSet
void deleted(DataSet dataSet)This is an event to notify listeners that a successful delete operation has been performed.
dataSet
void deleteError(DataSet dataSet, DataSetException ex, ErrorResponse response)This is an event to notify listeners when an exception is thrown for row delete operations. Call
response.abort()
(the default) to causes the operation to fail with an appropriate DataSetException
or ValidationException
. Call response.retry()
to cause the operation to be retried. Be sure that the retry will succeed or that your code can handle repeated retries. Call response.ignore()
to cause the operation to silently fail without throwing an exception.
dataSet
ex
response
void deleting(DataSet dataSet)This is an event to notify listeners before a row is deleted from the
DataSet
. If a VetoException
or Exception
is thrown inside this method, the delete operation is not performed, a ValidationException
with an error code of APPLICATION_ERROR is thrown instead. If a VetoException
or Exception
is constructed with a STRING parameter, this STRING is used in the default error handling displays, for example,
throw new VetoException("My error message");
dataSet
void editError(DataSet dataSet, Column column, Variant value, DataSetException ex, ErrorResponse response)This is an event to notify listeners when any exceptions occur setting a column value. This includes validation check failures as well as any
VetoExceptions
thrown by a ColumnChangeListener.validating()
event handler. The ErrorResponse
object allows the user to indicate how the error should be handled. Call response.abort()
(the default) to cause the operation to fail with an appropriate DataSetException
or ValidationException
. Call response.retry()
to cause the operation to be retried. Be sure that the retry will succeed or that your code can handle repeated retries. Call response.ignore()
to cause the operation to silently fail without an exception being thrown.
dataSet
column
value
ex
response
void inserted(DataSet dataSet)This is an event to notify listeners that a new, unposted row is inserted into the
DataSet
. This event can be used to initialize row values of new rows.
dataSet
void inserting(DataSet dataSet)This is an event to notify listeners just before a
DataSet
attempts to insert a new, unposted row. If a VetoException
or Exception
is thrown inside this method, the insert operation is not performed, a ValidationException
with an error code of APPLICATION_ERROR is thrown instead. If a VetoException
or Exception
is constructed with a STRING parameter, this STRING is used in the default error handling displays, for example,
throw new VetoException("My error message");
)
dataSet
void modifying(DataSet dataSet)This is an event to notify listeners when a user begins to modify an existing row. If a
VetoException
or Exception
is thrown inside this method, the modify operation is not performed, a ValidationException
with an error code of APPLICATION_ERROR is thrown instead. If a VetoException
or Exception
is constructed with a STRING parameter, this STRING is used in the default error handling displays, for example,
throw new VetoException("My error message");
dataSet
void updated(DataSet dataSet)This is an event to notify listeners that a modified row has been successfully posted to a
DataSet
.
dataSet
void updateError(DataSet dataSet, ReadWriteRow row, DataSetException ex, ErrorResponse response)This is an event to notify listeners when an exception is thrown for row changes. Call
response.abort()
(the default) to cause the operation to fail with an appropriate DataSetException
or ValidationException
. Call response.retry()
to cause the operation to be retried. Be sure that the retry will succeed or that your code can handle repeated retries. Call response.ignore()
to cause the operation to silently fail without an exception being thrown.
dataSet
row
ex
response
void updating(DataSet dataSet, ReadWriteRow newRow, ReadRow oldRow)This is an event to notify listeners before a modified row is posted to the
DataSet
. If an exception is thrown inside this method, the post operation is not performed, a ValidationException
with an error code of APPLICATION_ERROR is thrown instead. The updating()
method is called before checks to make sure all required fields are not null. If a VetoException
or Exception
is constructed with a STRING parameter, this STRING is used in the default error handling displays, for example,
throw new VetoException("My error message");
dataSet
newRow
oldRow