skip to main content
Programmer's documentation > Developing with the JViews Charts SDK > Using Load-On-Demand > How to listen to events
 
How to listen to events
The load-on-demand mechanism generates events that describe changes in the status of data tiles. Such events are sent by the tile controller and are implemented by the DataTileEvent class. To be notified of these events, you can add a DataTileListener to the corresponding controller by using the following code:
 controller.addDataTileListener(new DataTileListener()
{ public void dataTileChanged(DataTileEvent evt) { System.out.println(evt);
  } });
In this example, all the changes to the data tiles are printed to the standard output.
The generated events occur after the following actions:
*The loading of a tile starts or completes.
*A tile is added to or retrieved from the cache.
*A tile is released.
*An error occurred while loading a tile.
For a list of the event types related to each of these actions, please refer to the Reference Manual.
The isAdjusting method allows you to know whether an event is part of a series of several other events (for example, changing the visible range of a chart can trigger several loading events). This mechanism allows you to postpone event handling until the sequence ends. When this happens, an ADJUSTMENT_END event is sent.
The file CachedTileListener.java of the load-on-demand example shows you how listeners can be used to monitor changes in the cached status of data tiles.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.