borland Packages Class Hierarchy dbswing Package
java.lang.Object +----com.borland.dbswing.DBEventMonitor
Constructors Properties Methods
Implements AccessListener, ColumnChangeListener, ColumnPaintListener, DataChangeListener, Designable, EditListener, LoadListener, NavigationListener, OpenListener, StatusListener, ComponentListener, Serializable, EventListener
DBEventMonitor
is a non-visual component that listens for and
sends DataSet
event information to a PrintStream
(by default, the
stdout device). It is intended to be used as an unobtrusive debugging aid for applications which process DataSet
events. It also provides a simple and interactive way to learn about the kinds of events generated by DataSets
and when they are fired. A single DBEventMonitor
can be used to display messages from several DataSets
. You can selectively monitor events you are interested in
by setting DBEventMonitor
properties.
There are three ways to set up a DBEventMonitor
for use in your
application:
dataAwareComponentContainer
property to the container
(usually this is a JFrame
, but it could also be a JPanel
) containing the DataSets
whose events you want to monitor. DBEventMonitor
then automatically searches for components inside the container, adding itself as an event listener to any DataSets
and Columns
it finds.
You can explicitly specify an array of data-aware components to monitor using the dataSetAwareComponents
property. When using this approach, however, be sure that each data-aware component you specify has already had its dataSet
property set, as DBEventMonitor
immediately asks each component for its DataSet
value and cannot monitor a component if its dataSet
property has not been set yet.
For the monitoring of DataSets
in a non-visual application,
you can set the dataSets
property to an array of DataSets
you want to monitor. Note that when monitoring events using the
dataSets
property, event listeners are registered
for DataSet
events only, and not Column
events.
Monitoring for almost all the events is enabled by default. The exceptions are ColumnPaint
and RowFilter
, which produce considerable output that you aren't likely to find useful. Also CalcAggFields
and CalcFields
aren't monitored by default unless there is a CalcAggFields
or CalcFields
listener attached to the DataSet
.
To prevent the monitoring of specific events, set the property that enables monitoring to false
. For example, to prevent the monitoring of DataChangeEvents
, set enableDataChangeListener
to false
.
Note that for some events, only a single event listener can be
registered (for example, ColumnChangeListener
). In these cases, if an
event listener has already been registered and if it is possible to
get a reference to the existing event listener, DBEventMonitor
registers itself as the single event listener and forwards the event to the original event listener. Where it is not possible to get a reference to the existing event listener, DBEventMonitor
cannot monitor the event and outputs
a message indicating so. Setting the dataAwareComponentContainer
or dataSetAwareComponents
property to null
removes DBEventMonitor
from the event-listener chain and restores the original event listeners.
If you are debugging an application and it can't register its event listeners because DBEventMonitor
has already registered itself as a listener, then you must arrange for the dataSetAwareComponents
, dataAwareComponentContainer
,
or dataSets
property to be set after all your listeners have been registered. In particular, to monitor CalcFields
or CalcAggFields
events, you must ensure that your listeners are already registered before DBEventMonitor
, as DBEventMonitor
doesn't register itself as a CalcFields
or CalcAggFields
listener unless another listener has already been registered.
When using the dataAwareComponentContainer
property, note that DBEventMonitor
waits until after the container and its contents have been realized before attaching itself as an event listener. By this time, any DataSets
attached to data-aware components are already open, and DBEventMonitor
has missed some events. If you need to monitor such events, use either the dataSets
or dataSetAwareComponents
properties.
public DBEventMonitor()Creates a
DBEventMonitor
component.
public Container getDataAwareComponentContainer() public void setDataAwareComponentContainer(Container container)Returns and sets the container of data-aware components that
DBEventMonitor
should monitor. If this property and either the dataAwareComponents
or DataSets
property are set simultaneously, the most recently set property takes precedence.
public DataSetAware[] getDataSetAwareComponents() public void setDataSetAwareComponents(DataSetAware[] dataAwareComponents)Returns and sets the array of data-aware components that
DBEventMonitor
should monitor. If this property and either the dataAwareComponentContainer
or DataSets
property are set simultaneously, the most recently set property takes precedence.
public DataSet[] getDataSets() public void setDataSets(DataSet[] userSetDataSets)Returns and sets the array of
DataSets
that DBEventMonitor
should monitor. If this property and either the dataAwareComponents
or dataAwareComponentContainer
property are set simultaneously, the most recently set property takes precedence.
public boolean isEnableAccessListener() public void setEnableAccessListener(boolean enableAccessListener)Determines whether
DBEventMonitor
listens for AccessEvents
; if enableAccessListener
is true
, it listens for the events.
public boolean isEnableCalcAggFieldsListener() public void setEnableCalcAggFieldsListener(boolean enableCalcAggFieldsListener)Determines whether
DBEventMonitor
is a listener for notification that rows in the DataSet
having a calculation on an aggregate column have been added, deleted, or modified; if enableCalcAggFieldsListener
is true
, it listens for notifications.
public boolean isEnableCalcFieldsListener() public void setEnableCalcFieldsListener(boolean enableCalcFieldsListener)Determines whether
DBEventMonitor
is a listener for notification that rows in the DataSet
having a calculation on a column have been added, deleted, or modified; if enableCalcFieldsListener
is true
, it listens for notifications.
public boolean isEnableColumnChangeListener() public void setEnableColumnChangeListener(boolean enableColumnChangeListener)Determines whether
DBEventMonitor
is a listener for notification that data in a column has changed; if enableColumnChangeListener
is true
, it listens for notifications.
public boolean isEnableColumnPaintListener() public void setEnableColumnPaintListener(boolean enableColumnPaintListener)Determines whether
DBEventMonitor
is a listener for notification of the painting of a value in a column; if enableColumnPaintListener
is true
, it listens for notifications.
public boolean isEnabled() public void setEnabled(boolean enabled)Returns and sets whether the event monitor is enabled. If enabled is
true
, the event monitor monitors most events by default. The exceptions are ColumnPaint
and RowFilter
, which produce considerable output that you aren't likely to find useful. Also CalcAggFields
and CalcFields
aren't monitored by default unless there is a CalcAggFields
or CalcFields
listener attached to the DataSet
.
When enabled
is set to false
, all event monitoring ceases.
To prevent the monitoring of specific events, set the property that enables monitoring to false
. For example, to prevent the monitoring of DataChangeEvents
, set enableDataChangeListener
to false
.
public boolean isEnableDataChangeListener() public void setEnableDataChangeListener(boolean enableDataChangeListener)Determines whether
DBEventMonitor
listens for DataChangeEvents
; if enableDataChangeListener
is true
, it listens for the events.
public boolean isEnableEditListener() public void setEnableEditListener(boolean enableEditListener)Determines whether
DBEventMonitor
is a listener for notification of row editing in the DataSet
; if enableEditListener
is true
, it listens for notifications.
public boolean isEnableLoadListener() public void setEnableLoadListener(boolean enableLoadListener)Determines whether
DBEventMonitor
is a listener for notification that a load operation on a StorageDataSet
has been completed; if enableLoadListener
is true
, it listens for notifications.
public boolean isEnableNavigationListener() public void setEnableNavigationListener(boolean enableNavigationListener)Determines whether
DBEventMonitor
listens for NavigationEvents
; if enableNavigationListener
is true
, it listens for the events.
public boolean isEnableOpenListener() public void setEnableOpenListener(boolean enableOpenListener)Determines whether
DBEventMonitor
is a listener for notification that a DataSet
has opened or closed; if enableOpenListener
is true
, it listens for notifications.
public boolean isEnableResolverListener() public void setEnableResolverListener(boolean enableResolverListener)Determines whether
DBEventMonitor
is a listener for notification before and after a StorageDataSet
is resolved; if enableResolverListener
is true
, it listens for notifications.
public boolean isEnableRowFilterListener() public void setEnableRowFilterListener(boolean enableRowFilterListener)Determines whether
DBEventMonitor
is a listener for notification that a row is being added or updated; if enableRowFilterListener
is true
, it listens for notifications.
public boolean isEnableStatusListener() public void setEnableStatusListener(boolean enableStatusListener)Determines whether
DBEventMonitor
listens for StatusEvents
; if enableStatusListener
is true
, it listens for the events.
public PrintStream getPrintStream() public void setPrintStream(PrintStream out)Returns and sets the
PrintStream
used for event output. By default, System.out is used.