FileDocCategorySizeDatePackage
GraphMBeanAttributeAction.javaAPI DocJBoss 4.2.16299Fri Jul 13 21:02:14 BST 2007org.jboss.console.manager.interfaces.impl

GraphMBeanAttributeAction

public class GraphMBeanAttributeAction extends Object implements org.jboss.console.navtree.AppletTreeAction
see
author
Sacha Labourey.
version
$Revision: 57191 $

Revisions:

3 janv. 2003 Sacha Labourey:

  • First implementation

Fields Summary
protected ObjectName
targetObjectName
protected String
attr
protected transient org.jfree.chart.ChartFrame
frame
protected transient MBeanXYDataset
dataset
Constructors Summary
public GraphMBeanAttributeAction()


    
   
   
public GraphMBeanAttributeAction(ObjectName pName, String attr)

      this.targetObjectName = pName;
      this.attr = attr;
   
Methods Summary
public voiddoAction(org.jboss.console.navtree.TreeContext tc, org.jboss.console.navtree.AppletBrowser applet)

      try
      {
         if (frame == null)
         {
            //tc.getRemoteMBeanInvoker ().invoke(targetObjectName, actionName, params, signature);
            dataset = new MBeanXYDataset();
            JFreeChart chart = ChartFactory.createXYLineChart(
                    "JMX Attribute: " + attr, "count", attr, dataset,
                    PlotOrientation.VERTICAL,
                    true,
                    true,
                    false
            );
            UpdateThread update = new UpdateThread(dataset, tc);

            Thread thread = new Thread(update);
            thread.start();
            frame = new ChartFrame("JMX Attribute: " + attr, chart);
            frame.getChartPanel().setPreferredSize(new java.awt.Dimension(500, 270));
            frame.pack();
         }
         else
         {
            dataset.clear();
         }
         frame.show();
         frame.requestFocus();
      }
      catch (Exception displayed)
      {
         displayed.printStackTrace();
      }