| Programming with JViews Maps > Introducing the Main Classes > Map Specific Manager Properties > Thread Monitoring |
Thread Monitoring |
INDEX
PREVIOUS
NEXT
|
The IlvThreadedActivityMonitorProperty class is a named property used to attach a IlvThreadedActivityMonitor to an IlvManager.
This threaded monitor is a centralized object with which threads should register their activities. The activities, that is, tasks, must also notify this controller of their progress.
All activity listeners registered with this controller are notified in turn of any activity progress. The IlvThreadedActivityMonitorPanel is one such important listener. This Bean provides the user with feedback on activities that are currently running, see Using the GUI Beans.
The source code for the Map Builder demonstration, which contains all of the code described in this section, can be found at <installdir>/jviews-maps81/samples/mapbuilder/index.html
You can access the threaded activity monitor by calling:
IlvThreadedActivityMonitor mon = IlvThreadedActivityMonitorProperty.GetThreadedActivityMonitor(manager);
It is the responsibility of each thread to register, update and un-register their activities to provide the user with correct information on the background tasks that are running:
mon.updateActivityProgress(activityID,10,"doing something long"); ... do something long that takes 10% of total time... mon.updateActivityProgress(activityID,20,"doing another thing"); ...
Setting the activity progress to 100% or un-registering the activity removes it from the list currently managed by the monitor.
You can also register your own objects as listeners to changes in the activity monitor with lines of code such as:
mon.addActivityListener(new IlvThreadedActivityMonitor.ActivityListener() {
public void activityChanged(ActivityEvent e) {
if(e.getEventType() == IlvThreadedActivityMonitor.ActivityEvent.ACTIVITY_REMOVED) {
... an activity just ended, do something.
}
});
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |