Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime
In directory usw-pr-cvs1:/tmp/cvs-serv29691
Modified Files:
AllocThreadMethodR.java AllocThreadTraceR.java
AllocTraceR.java AllocTypeMethodR.java AllocTypeR.java
AllocTypeThreadMethodR.java AllocTypeThreadR.java
AllocTypeThreadTraceR.java AllocTypeTraceR.java
CPUThreadMethodR.java CPUThreadTraceR.java CPUTraceR.java
MethodR.java MonThreadMethodR.java MonThreadTraceR.java
MonTraceR.java ThreadR.java
Log Message:
implemented alloc-cpu-mon-listeners.
Index: AllocThreadMethodR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocThreadMethodR.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** AllocThreadMethodR.java 2 Jul 2002 20:27:02 -0000 1.7
--- AllocThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.8
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 75,78 ****
--- 76,83 ----
allocThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 271,278 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 276,289 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 316,319 ****
--- 327,332 ----
return getThreadR() + "-" + getLocation();
}
+
+ // ---------- listeners
public void removeChildrenListener(int type, ChildrenListener listener) {
***************
*** 325,335 ****
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 338,376 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocThreadTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocThreadTraceR.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** AllocThreadTraceR.java 2 Jul 2002 20:27:02 -0000 1.6
--- AllocThreadTraceR.java 11 Jul 2002 18:17:23 -0000 1.7
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 73,76 ****
--- 74,81 ----
allocTypeThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 271,278 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 276,289 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 319,322 ****
--- 330,335 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 327,337 ****
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 340,378 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTraceR.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** AllocTraceR.java 2 Jul 2002 20:27:02 -0000 1.7
--- AllocTraceR.java 11 Jul 2002 18:17:23 -0000 1.8
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 77,80 ****
--- 78,85 ----
allocThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs new object with info.
* @param sid Object with data from communication layer.
***************
*** 267,274 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 272,285 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 319,322 ****
--- 330,335 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 327,337 ****
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 340,378 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocTypeMethodR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeMethodR.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** AllocTypeMethodR.java 2 Jul 2002 20:27:02 -0000 1.7
--- AllocTypeMethodR.java 11 Jul 2002 18:17:23 -0000 1.8
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 73,76 ****
--- 74,81 ----
allocTypeThreadMethods);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 261,268 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 266,279 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 289,292 ****
--- 300,305 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 297,307 ****
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 310,348 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocTypeR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeR.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** AllocTypeR.java 2 Jul 2002 20:27:02 -0000 1.5
--- AllocTypeR.java 11 Jul 2002 18:17:23 -0000 1.6
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 77,80 ****
--- 78,85 ----
allocTypeThreads);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** This constructor will find it's component class on its own through
* RtImage.
***************
*** 340,347 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 345,358 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 380,383 ****
--- 391,396 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 388,398 ****
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 401,439 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocTypeThreadMethodR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadMethodR.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** AllocTypeThreadMethodR.java 2 Jul 2002 20:27:02 -0000 1.7
--- AllocTypeThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.8
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 76,79 ****
--- 77,84 ----
allocTypeThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 306,313 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 311,324 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 328,331 ****
--- 339,344 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 336,346 ****
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 349,387 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocTypeThreadR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadR.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** AllocTypeThreadR.java 2 Jul 2002 20:27:02 -0000 1.8
--- AllocTypeThreadR.java 11 Jul 2002 18:17:23 -0000 1.9
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 73,76 ****
--- 74,81 ----
allocTypeThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 268,275 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 273,286 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 304,307 ****
--- 315,320 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 312,322 ****
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 325,363 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocTypeThreadTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadTraceR.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** AllocTypeThreadTraceR.java 2 Jul 2002 20:27:02 -0000 1.6
--- AllocTypeThreadTraceR.java 11 Jul 2002 18:17:23 -0000 1.7
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 70,73 ****
--- 71,78 ----
private long sizeTotalInstances;
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 294,301 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 299,312 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 316,326 ****
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
}
--- 327,367 ----
}
! // ---------- listeners
!
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireAllocStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==AllocStatListener.class) {
+ // Lazily create the event:
+ if (allocEvent == null)
+ allocEvent = new AllocStatEvent(this);
+ ((AllocStatListener)listeners[i+1]).allocStatChanged(
+ allocEvent);
+ }
+ }
+ }
}
Index: AllocTypeTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeTraceR.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** AllocTypeTraceR.java 2 Jul 2002 20:27:02 -0000 1.7
--- AllocTypeTraceR.java 11 Jul 2002 18:17:23 -0000 1.8
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 72,75 ****
--- 73,80 ----
allocTypeThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 270,277 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 275,288 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 299,302 ****
--- 310,315 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 307,317 ****
}
! public void addAllocStatListener( AllocStatListener listener) {
! // PENDING
}
! public void removeAllocStatListener( AllocStatListener listener) {
! // PENDING
}
-
}
--- 320,358 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
! }
!
! /**
! * Notifies all listeners that have registered interest for
! * notification on this event type. The event instance
! * is lazily created.
! */
! protected void fireAllocStatChanged() {
! // Guaranteed to return a non-null array
! Object[] listeners = listenerList.getListenerList();
! // Process the listeners last to first, notifying
! // those that are interested in this event
! for (int i = listeners.length-2; i>=0; i-=2) {
! if (listeners[i]==AllocStatListener.class) {
! // Lazily create the event:
! if (allocEvent == null)
! allocEvent = new AllocStatEvent(this);
! ((AllocStatListener)listeners[i+1]).allocStatChanged(
! allocEvent);
! }
! }
}
}
Index: CPUThreadMethodR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/CPUThreadMethodR.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** CPUThreadMethodR.java 2 Jul 2002 20:27:02 -0000 1.5
--- CPUThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.6
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 70,73 ****
--- 71,78 ----
cpuThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient CPUStatEvent CPUEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 242,247 ****
*/
void setData(IProf.sCpuStatData cpuData) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
}
--- 247,256 ----
*/
void setData(IProf.sCpuStatData cpuData) {
! if (hits!=cpuData.hits ||
! pureTime!=cpuData.pureTime) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
! fireCPUStatChanged();
! }
}
***************
*** 280,283 ****
--- 289,294 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 288,298 ****
}
! public void addCPUStatListener(CPUStatListener listener) {
! // PENDING
}
! public void removeCPUStatListener(CPUStatListener listener) {
! // PENDING
}
}
--- 299,337 ----
}
! /**
! * Removes an <code>CPUStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeCPUStatListener(CPUStatListener l) {
! listenerList.remove(CPUStatListener.class, l);
}
! /**
! * Adds an <code>CPUStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addCPUStatListener(CPUStatListener l) {
! listenerList.add(CPUStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireCPUStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CPUStatListener.class) {
+ // Lazily create the event:
+ if (CPUEvent == null)
+ CPUEvent = new CPUStatEvent(this);
+ ((CPUStatListener)listeners[i+1]).CPUStatChanged(
+ CPUEvent);
+ }
+ }
+ }
}
Index: CPUThreadTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/CPUThreadTraceR.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** CPUThreadTraceR.java 2 Jul 2002 20:27:02 -0000 1.5
--- CPUThreadTraceR.java 11 Jul 2002 18:17:23 -0000 1.6
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 64,67 ****
--- 65,72 ----
private long pureTime;
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient CPUStatEvent CPUEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 239,244 ****
*/
void setData(IProf.sCpuStatData cpuData) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
}
--- 244,253 ----
*/
void setData(IProf.sCpuStatData cpuData) {
! if (hits!=cpuData.hits ||
! pureTime!=cpuData.pureTime) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
! fireCPUStatChanged();
! }
}
***************
*** 279,289 ****
}
! public void addCPUStatListener(CPUStatListener listener) {
! // PENDING
}
! public void removeCPUStatListener(CPUStatListener listener) {
! // PENDING
}
}
--- 288,328 ----
}
! // ---------- listeners
!
! /**
! * Removes an <code>CPUStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeCPUStatListener(CPUStatListener l) {
! listenerList.remove(CPUStatListener.class, l);
}
! /**
! * Adds an <code>CPUStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addCPUStatListener(CPUStatListener l) {
! listenerList.add(CPUStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireCPUStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CPUStatListener.class) {
+ // Lazily create the event:
+ if (CPUEvent == null)
+ CPUEvent = new CPUStatEvent(this);
+ ((CPUStatListener)listeners[i+1]).CPUStatChanged(
+ CPUEvent);
+ }
+ }
+ }
}
Index: CPUTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/CPUTraceR.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** CPUTraceR.java 2 Jul 2002 20:27:02 -0000 1.6
--- CPUTraceR.java 11 Jul 2002 18:17:23 -0000 1.7
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 72,75 ****
--- 73,80 ----
cpuThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient CPUStatEvent CPUEvent;
+
/** Constructs new object with info.
* @param sid Object with data from communication layer.
***************
*** 233,238 ****
*/
void setData(IProf.sCpuStatData cpuData) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
}
--- 238,247 ----
*/
void setData(IProf.sCpuStatData cpuData) {
! if (hits!=cpuData.hits ||
! pureTime!=cpuData.pureTime) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
! fireCPUStatChanged();
! }
}
***************
*** 277,280 ****
--- 286,291 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 285,295 ****
}
! public void addCPUStatListener(CPUStatListener listener) {
! // PENDING
}
! public void removeCPUStatListener(CPUStatListener listener) {
! // PENDING
}
! }
--- 296,334 ----
}
! /**
! * Removes an <code>CPUStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeCPUStatListener(CPUStatListener l) {
! listenerList.remove(CPUStatListener.class, l);
}
! /**
! * Adds an <code>CPUStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addCPUStatListener(CPUStatListener l) {
! listenerList.add(CPUStatListener.class, l);
}
! /**
! * Notifies all listeners that have registered interest for
! * notification on this event type. The event instance
! * is lazily created.
! */
! protected void fireCPUStatChanged() {
! // Guaranteed to return a non-null array
! Object[] listeners = listenerList.getListenerList();
! // Process the listeners last to first, notifying
! // those that are interested in this event
! for (int i = listeners.length-2; i>=0; i-=2) {
! if (listeners[i]==CPUStatListener.class) {
! // Lazily create the event:
! if (CPUEvent == null)
! CPUEvent = new CPUStatEvent(this);
! ((CPUStatListener)listeners[i+1]).CPUStatChanged(
! CPUEvent);
! }
! }
! }
! }
\ No newline at end of file
Index: MethodR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MethodR.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** MethodR.java 2 Jul 2002 20:27:02 -0000 1.7
--- MethodR.java 11 Jul 2002 18:17:23 -0000 1.8
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 98,101 ****
--- 99,108 ----
monThreadMethods);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient AllocStatEvent allocEvent;
+ protected transient CPUStatEvent CPUEvent;
+ protected transient MonStatEvent monEvent;
+
/** Constructs new object with info.
* @param sid Object with data from communication layer.
***************
*** 413,420 ****
*/
void setData(IProf.sAllocStatData allocData) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
}
--- 420,433 ----
*/
void setData(IProf.sAllocStatData allocData) {
! if (numLiveInstances!=allocData.allocNumInstancesLive ||
! numTotalInstances!=allocData.allocNumInstancesTotal ||
! sizeLiveInstances!=allocData.allocSizeInstancesLive ||
! sizeTotalInstances!=allocData.allocSizeInstancesTotal) {
! numLiveInstances=allocData.allocNumInstancesLive;
! numTotalInstances=allocData.allocNumInstancesTotal;
! sizeLiveInstances=allocData.allocSizeInstancesLive;
! sizeTotalInstances=allocData.allocSizeInstancesTotal;
! fireAllocStatChanged();
! }
}
***************
*** 423,428 ****
*/
void setData(IProf.sCpuStatData cpuData) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
}
--- 436,445 ----
*/
void setData(IProf.sCpuStatData cpuData) {
! if (hits!=cpuData.hits ||
! pureTime!=cpuData.pureTime) {
! hits=cpuData.hits;
! pureTime=cpuData.pureTime;
! fireCPUStatChanged();
! }
}
***************
*** 431,436 ****
*/
void setData(IProf.sMonStatData monData) {
! monitorHits=monData.hits;
! time=monData.time;
}
--- 448,457 ----
*/
void setData(IProf.sMonStatData monData) {
! if (monitorHits!=monData.hits ||
! time!=monData.time) {
! monitorHits=monData.hits;
! time=monData.time;
! fireMonStatChanged();
! }
}
***************
*** 477,480 ****
--- 498,503 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 485,511 ****
}
! public void addAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void removeAllocStatListener(AllocStatListener listener) {
! // PENDING
}
! public void removeMonStatListener(MonStatListener listener) {
! // PENDING
}
! public void addCPUStatListener(CPUStatListener listener) {
! // PENDING
}
! public void removeCPUStatListener(CPUStatListener listener) {
! // PENDING
}
! public void addMonStatListener(MonStatListener listener) {
! // PENDING
}
}
--- 508,620 ----
}
! /**
! * Removes an <code>AllocStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeAllocStatListener(AllocStatListener l) {
! listenerList.remove(AllocStatListener.class, l);
}
! /**
! * Adds an <code>AllocStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addAllocStatListener(AllocStatListener l) {
! listenerList.add(AllocStatListener.class, l);
}
! /**
! * Notifies all listeners that have registered interest for
! * notification on this event type. The event instance
! * is lazily created.
! */
! protected void fireAllocStatChanged() {
! // Guaranteed to return a non-null array
! Object[] listeners = listenerList.getListenerList();
! // Process the listeners last to first, notifying
! // those that are interested in this event
! for (int i = listeners.length-2; i>=0; i-=2) {
! if (listeners[i]==AllocStatListener.class) {
! // Lazily create the event:
! if (allocEvent == null)
! allocEvent = new AllocStatEvent(this);
! ((AllocStatListener)listeners[i+1]).allocStatChanged(
! allocEvent);
! }
! }
}
! /**
! * Removes an <code>CPUStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeCPUStatListener(CPUStatListener l) {
! listenerList.remove(CPUStatListener.class, l);
}
! /**
! * Adds an <code>CPUStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addCPUStatListener(CPUStatListener l) {
! listenerList.add(CPUStatListener.class, l);
}
! /**
! * Notifies all listeners that have registered interest for
! * notification on this event type. The event instance
! * is lazily created.
! */
! protected void fireCPUStatChanged() {
! // Guaranteed to return a non-null array
! Object[] listeners = listenerList.getListenerList();
! // Process the listeners last to first, notifying
! // those that are interested in this event
! for (int i = listeners.length-2; i>=0; i-=2) {
! if (listeners[i]==CPUStatListener.class) {
! // Lazily create the event:
! if (CPUEvent == null)
! CPUEvent = new CPUStatEvent(this);
! ((CPUStatListener)listeners[i+1]).CPUStatChanged(
! CPUEvent);
! }
! }
! }
!
! /**
! * Removes an <code>MonStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeMonStatListener(MonStatListener l) {
! listenerList.remove(MonStatListener.class, l);
}
+ /**
+ * Adds an <code>MonStatListener</code> to this object.
+ * @param l the listener to be added
+ */
+ public void addMonStatListener(MonStatListener l) {
+ listenerList.add(MonStatListener.class, l);
+ }
+
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireMonStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==MonStatListener.class) {
+ // Lazily create the event:
+ if (monEvent == null)
+ monEvent = new MonStatEvent(this);
+ ((MonStatListener)listeners[i+1]).monStatChanged(
+ monEvent);
+ }
+ }
+ }
}
Index: MonThreadMethodR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MonThreadMethodR.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** MonThreadMethodR.java 2 Jul 2002 20:27:02 -0000 1.5
--- MonThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.6
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 70,73 ****
--- 71,78 ----
monThreadTraces);
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient MonStatEvent monEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 242,247 ****
*/
void setData(IProf.sMonStatData monData) {
! monitorHits=monData.hits;
! time=monData.time;
}
--- 247,256 ----
*/
void setData(IProf.sMonStatData monData) {
! if (monitorHits!=monData.hits ||
! time!=monData.time) {
! monitorHits=monData.hits;
! time=monData.time;
! fireMonStatChanged();
! }
}
***************
*** 280,283 ****
--- 289,294 ----
}
+ // ---------- listeners
+
public void removeChildrenListener(int type, ChildrenListener listener) {
// PENDING
***************
*** 288,298 ****
}
! public void addMonStatListener(MonStatListener listener) {
! // PENDING
}
! public void removeMonStatListener(MonStatListener listener) {
! // PENDING
}
}
--- 299,337 ----
}
! /**
! * Removes an <code>MonStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeMonStatListener(MonStatListener l) {
! listenerList.remove(MonStatListener.class, l);
}
! /**
! * Adds an <code>MonStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addMonStatListener(MonStatListener l) {
! listenerList.add(MonStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireMonStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==MonStatListener.class) {
+ // Lazily create the event:
+ if (monEvent == null)
+ monEvent = new MonStatEvent(this);
+ ((MonStatListener)listeners[i+1]).monStatChanged(
+ monEvent);
+ }
+ }
+ }
}
Index: MonThreadTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MonThreadTraceR.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** MonThreadTraceR.java 2 Jul 2002 20:27:02 -0000 1.5
--- MonThreadTraceR.java 11 Jul 2002 18:17:23 -0000 1.6
***************
*** 36,39 ****
--- 36,40 ----
import java.util.*;
+ import javax.swing.event.EventListenerList;
import net.sourceforge.javaprofiler.jpi.*;
import net.sourceforge.javaprofiler.jpiimpl.commun.IProf;
***************
*** 64,67 ****
--- 65,72 ----
private long time;
+ /** A list of event listeners for this component. */
+ protected EventListenerList listenerList = new EventListenerList();
+ protected transient MonStatEvent monEvent;
+
/** Constructs multi-rooted object
* @param typeId Identification of <code>AllocTypeR</code> object. Should
***************
*** 239,244 ****
*/
void setData(IProf.sMonStatData monData) {
! monitorHits=monData.hits;
! time=monData.time;
}
--- 244,253 ----
*/
void setData(IProf.sMonStatData monData) {
! if (monitorHits!=monData.hits ||
! time!=monData.time) {
! monitorHits=monData.hits;
! time=monData.time;
! fireMonStatChanged();
! }
}
***************
*** 279,289 ****
}
! public void addMonStatListener(MonStatListener listener) {
! // PENDING
}
! public void removeMonStatListener(MonStatListener listener) {
! // PENDING
}
}
--- 288,328 ----
}
! // ---------- listeners
!
! /**
! * Removes an <code>MonStatListener</code> from this object.
! * @param l the listener to be removed
! */
! public void removeMonStatListener(MonStatListener l) {
! listenerList.remove(MonStatListener.class, l);
}
! /**
! * Adds an <code>MonStatListener</code> to this object.
! * @param l the listener to be added
! */
! public void addMonStatListener(MonStatListener l) {
! listenerList.add(MonStatListener.class, l);
}
+ /**
+ * Notifies all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created.
+ */
+ protected void fireMonStatChanged() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==MonStatListener.class) {
+ // Lazily create the event:
+ if (monEvent == null)
+ monEvent = new MonStatEvent(this);
+ ((MonStatListener)listeners[i+1]).monStatChanged(
+ monEvent);
+ }
+ }
+ }
}
Index: MonTraceR.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MonTraceR.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** MonTr...
[truncated message content] |