/* Copyright 2000 Charles G. Wright * This software may be distributed under the terms of the * GNU General Public License. * * $Id: CWmonitoredElements.java,v 1.1 2000-06-15 10:14:52-05 chuckles Exp chuckles $ */ import java.util.*; import java.awt.*; /**
The purpose of this class is to maintain a list of all * information that can be displayed as output. The information * can be retrieved from a variety of classes. If a class can * supply information for monitoring, it must implement the * CWmonitorable interface, meaning that it implements *
The class also manages a set of List objects that are used to
* select monitored information. As monitored elements are added,
* a string representing that object is added to each registered List.
*/
public class CWmonitoredElements {
private static Vector elements = new Vector();
// List objects that must be kept in sync with this list.
// As elements are added to the elements list, we need to
// add corresponding entries to the List objects.
// Right now, the List(s) must be created first.
public static Vector lists = new Vector();
//---------------------------------------------------
/** Register all of the monitorable elements for a given class.*/
public static void addElements(CWmonitorable obj){
for (int i = 0; i < obj.getFields().length; i++){
addElement(obj, i);
}
}
//----------------------------------------------------
/** Add a monitorable element to the list.*/
public static void addElement(CWmonitorable obj, int fi){
java.awt.List li;
// Create a monitorable element and add to the vector.
CWmonitoredElement me = new CWmonitoredElement(obj, fi);
elements.addElement(me);
// create a string of the form