User: juhalindfors
Date: 01/04/18 08:03:16
Modified: src/org/jboss/admin/monitor MonitorFrame.java
MonitorPane.java
Added: src/org/jboss/admin/monitor InvocationTimeStatsView.java
Removed: src/org/jboss/admin/monitor StatsView.java
Log:
Invocation stats are now updated.
Revision Changes Path
1.4 +4 -3 admin/src/org/jboss/admin/monitor/MonitorFrame.java
Index: MonitorFrame.java
===================================================================
RCS file: /cvsroot/jboss/admin/src/org/jboss/admin/monitor/MonitorFrame.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MonitorFrame.java 2001/04/16 21:55:19 1.3
+++ MonitorFrame.java 2001/04/18 15:03:16 1.4
@@ -158,6 +158,7 @@
MethodTreeNode methodNode = (MethodTreeNode)node;
monitor.setGraphModel(methodNode.getGraphModel());
+ monitor.setStatsView((GraphModelListener)methodNode.getStatsView());
monitor.repaint();
}
@@ -169,11 +170,11 @@
monitor.repaint();
}
- // right just display empty stats for all branches
// will do "summary" displays later
else {
- monitor.setGraphModel(emptyGraphModel);
- monitor.repaint();
+ // don't change view
+ //monitor.setGraphModel(emptyGraphModel);
+ //monitor.repaint();
}
}
1.3 +1 -1 admin/src/org/jboss/admin/monitor/MonitorPane.java
Index: MonitorPane.java
===================================================================
RCS file: /cvsroot/jboss/admin/src/org/jboss/admin/monitor/MonitorPane.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MonitorPane.java 2001/04/16 21:55:19 1.2
+++ MonitorPane.java 2001/04/18 15:03:16 1.3
@@ -90,7 +90,7 @@
// Create the initial graph view. This view's model will be changed
// according to to the node selected in the application tree.
graph = new GraphView();
- stats = new StatsView();
+ stats = new InvocationTimeStatsView();
graph.getModel().addGraphModelListener(stats);
EtchedBorder graphLines = new EtchedBorder();
1.1 admin/src/org/jboss/admin/monitor/InvocationTimeStatsView.java
Index: InvocationTimeStatsView.java
===================================================================
package org.jboss.admin.monitor;
// standard imports
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.util.Locale;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
// non-standard class dependencies
import org.jboss.admin.monitor.event.GraphModelListener;
import org.jboss.admin.monitor.event.GraphModelEvent;
import org.hs.jfc.FormPanel;
import org.gjt.lindfors.util.LocalizationSupport;
/**
* ...
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>
*/
public class InvocationTimeStatsView extends JPanel
implements GraphModelListener, MonitorResourceConstants {
// superclass implements Serializable
/**
* Support class for localization. Used for loading language resource bundles
* and retrieving localized info.
*
* Initialized in the constructor.
*/
private transient LocalizationSupport lang = null;
private int totalInvocations = 0;
private int totalInvocationTime = 0;
private JLabel averageTime = new JLabel("0");
private JLabel numberOfInvocations = new JLabel("0");
/*
*************************************************************************
*
* CONSTRUCTORS
*
*************************************************************************
*/
/*
* Default constructor
*/
public InvocationTimeStatsView() {
super(new FlowLayout(FlowLayout.LEFT));
//setLocale(getParent().getLocale());
lang = new LocalizationSupport(LANG_PKG, Locale.getDefault());
add(createLayout());
}
/*
*************************************************************************
*
* IMPLEMENTS GRAPH_MODEL_LISTENER INTERFACE
*
*************************************************************************
*/
public void valueAppended(GraphModelEvent evt) {
int value = (int)evt.getValue();
// Ignore zero additions; there will be lots of these if the
// continuous graph update is being used, no need to count them
if (value <= 0)
return;
++totalInvocations;
totalInvocationTime += value;
averageTime.setText(String.valueOf(totalInvocationTime / totalInvocations));
averageTime.repaint();
numberOfInvocations.setText(String.valueOf(totalInvocations));
numberOfInvocations.repaint();
}
public void limitChanged(GraphModelEvent evt) {
// [TODO] graph listener adapter
}
/*
*************************************************************************
*
* PRIVATE INSTANCE METHODS
*
*************************************************************************
*/
private JComponent createLayout() {
FormPanel p = new FormPanel();
JLabel average = new JLabel(lang.getLabel(AVG_INVOCATION_TIME) + ":");
JLabel total = new JLabel(lang.getLabel(TOTAL_INVOCATION_COUNT) +
":");
JLabel millisecs = new JLabel("ms");
p.add(average, averageTime, 1, 1); // row 1, col 1
p.add(millisecs, 1, 2);
p.add(total, numberOfInvocations, 2, 1);
return p;
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development