mstover1    02/02/20 15:04:26

  Modified:    src/org/apache/jmeter/config Arguments.java
               src/org/apache/jmeter/protocol/http/config
                        MultipartUrlConfig.java
               src/org/apache/jmeter/protocol/http/modifier
                        AnchorModifier.java
               src/org/apache/jmeter/reporters ResultCollector.java
               src/org/apache/jmeter/save/handlers AssertionHandler.java
               src/org/apache/jmeter/visualizers
                        IndGraphTreeVisualizer.java
                        ViewResultsFullVisualizer.java
  Log:
  Fixing various bugs
  
  Revision  Changes    Path
  1.15      +6 -1      jakarta-jmeter/src/org/apache/jmeter/config/Arguments.java
  
  Index: Arguments.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/config/Arguments.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Arguments.java    7 Oct 2001 15:40:30 -0000       1.14
  +++ Arguments.java    20 Feb 2002 23:04:26 -0000      1.15
  @@ -65,7 +65,7 @@
    *  Apache Foundation
    *
    *@author     Michael Stover
  - *@created    $Date: 2001/10/07 15:40:30 $
  + *@created    $Date: 2002/02/20 23:04:26 $
    *@version    1.0
    ***********************************************************/
   
  @@ -221,6 +221,11 @@
                {
                        args.remove(row);
                }
  +     }
  +
  +     public void removeArgument(Argument arg)
  +     {
  +             args.remove(arg);
        }
   
        public void removeAllArguments()
  
  
  
  1.11      +1 -1      
jakarta-jmeter/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
  
  Index: MultipartUrlConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MultipartUrlConfig.java   20 Feb 2002 01:35:32 -0000      1.10
  +++ MultipartUrlConfig.java   20 Feb 2002 23:04:26 -0000      1.11
  @@ -101,7 +101,7 @@
   
        public String getClassLabel()
        {
  -             return "HTTP Request Defaults";
  +             return "HTTP Multipart Request Defaults";
        }
   
                /**
  
  
  
  1.12      +2 -1      
jakarta-jmeter/src/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
  
  Index: AnchorModifier.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AnchorModifier.java       19 Feb 2002 00:05:35 -0000      1.11
  +++ AnchorModifier.java       20 Feb 2002 23:04:26 -0000      1.12
  @@ -79,7 +79,7 @@
    *  Apache
    *
    *@author     Michael Stover
  - *@created    $Date: 2002/02/19 00:05:35 $
  + *@created    $Date: 2002/02/20 23:04:26 $
    *@version    1.0
    ***********************************************************/
   
  @@ -216,6 +216,7 @@
                        replacementArg = 
(Argument)possibleReplacements.get(rand.nextInt(possibleReplacements.size()));
                        arg.setName(replacementArg.getName());
                        arg.setValue(replacementArg.getValue());
  +                     args.removeArgument(replacementArg);
                }
        }
   
  
  
  
  1.20      +6 -1      
jakarta-jmeter/src/org/apache/jmeter/reporters/ResultCollector.java
  
  Index: ResultCollector.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/reporters/ResultCollector.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ResultCollector.java      17 Feb 2002 21:33:36 -0000      1.19
  +++ ResultCollector.java      20 Feb 2002 23:04:26 -0000      1.20
  @@ -180,11 +180,16 @@
                }
         }
   
  -      public void next()
  +      public boolean next()
         {
                  if(current < results.size())
                  {
                                current++;
  +                             return true;
  +               }
  +               else
  +               {
  +                     return false;
                  }
         }
   
  
  
  
  1.2       +1 -1      
jakarta-jmeter/src/org/apache/jmeter/save/handlers/AssertionHandler.java
  
  Index: AssertionHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/save/handlers/AssertionHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AssertionHandler.java     16 Aug 2001 23:36:57 -0000      1.1
  +++ AssertionHandler.java     20 Feb 2002 23:04:26 -0000      1.2
  @@ -74,7 +74,7 @@
                while (iter.hasNext())
                {
                        out.write("\n<testString>");
  -                     out.write(iter.next().toString());
  +                     out.write(JMeterHandler.convertToXML(iter.next().toString()));
                        out.write("</testString>");
                }
        }
  
  
  
  1.4       +31 -36    
jakarta-jmeter/src/org/apache/jmeter/visualizers/IndGraphTreeVisualizer.java
  
  Index: IndGraphTreeVisualizer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/IndGraphTreeVisualizer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IndGraphTreeVisualizer.java       23 Dec 2001 04:28:52 -0000      1.3
  +++ IndGraphTreeVisualizer.java       20 Feb 2002 23:04:26 -0000      1.4
  @@ -168,11 +168,7 @@
                SampleResult res = null;
                String sampleName = null;               // name of the main page
                String sampleNameChild = null;  // name of the component in the main 
page
  -             if(model.getCurrentSample() == null)
  -             {
  -                     model.next();
  -             }
  -             while((res = model.getCurrentSample()) != null)
  +             while(model.next() && (res = model.getCurrentSample()) != null)
                {
                        // don't use SampleResult.SAMPLE_LABEL 'cos that is only set
                        // if the url exist
  @@ -221,7 +217,7 @@
                                        COLOR_INCREMENT);
                                colorMapper.put(sampleName, currColor);
                        }
  -                     ArrayList arrayList = 
  +                     ArrayList arrayList =
                                (ArrayList)res.getValue(SampleResult.RESULT_LIST);
                        if(arrayList != null)
                        {
  @@ -232,13 +228,13 @@
                                        SampleResult child = (SampleResult)iter.next();
                                        sampleNameChild = (String)
                                                
child.getValue(SampleResult.DISPLAY_NAME);
  -                                     String combinedName = sampleName + SEPARATOR + 
  +                                     String combinedName = sampleName + SEPARATOR +
                                                sampleNameChild;
                                        if(catClass.isDebugEnabled())
                                        {
                                                catClass.debug(
                                                        "updateGui1 : "
  -                                                     + "Looking for child sample 
entry - " 
  +                                                     + "Looking for child sample 
entry - "
                                                        + combinedName);
                                        }
                                        node = (DefaultMutableTreeNode)
  @@ -250,44 +246,43 @@
                                        if(node != null)
                                        {
                                                // update entry
  -                                             nodeSampleResult = 
  +                                             nodeSampleResult =
                                                        
(SampleResult)node.getUserObject();
  -                                             java.util.List list = 
  +                                             java.util.List list =
                                                        
(java.util.List)nodeSampleResult.getValue(SAMPLES);
  -                                             // just keep the time instead of the 
whole sample 
  +                                             // just keep the time instead of the 
whole sample
                                                // object to minimize memory usage
                                                list.add(child);
                                        }
                                        else
                                        {
                                                // create new entry
  -                                             DefaultMutableTreeNode leafNode = 
  +                                             DefaultMutableTreeNode leafNode =
                                                        new 
DefaultMutableTreeNode(child);
  -                                             treeModel.insertNodeInto(leafNode, 
currNode, 
  +                                             treeModel.insertNodeInto(leafNode, 
currNode,
                                                        leafIndex++);
                                                java.util.List list = new 
java.util.LinkedList();
  -                                             // just keep the time instead of the 
whole sample 
  +                                             // just keep the time instead of the 
whole sample
                                                // object to minimize memory usage
                                                list.add(child);
                                                child.putValue(SAMPLES, list);
                                                ht.put(combinedName, leafNode);
  -                                             currColor = 
  +                                             currColor =
                                                        
ColorHelper.changeColorCyclicIncrement(
                                                                currColor, 
COLOR_INCREMENT);
  -                                             colorMapper.put(combinedName, 
currColor);       
  +                                             colorMapper.put(combinedName, 
currColor);
                                        }
                                }
                        }
  -                     model.next();
                }
                catClass.debug("End : updateGui1");
  -     }
  +     }
   
        /**
         * Given a <code>TreePath</code> returns a string which contains all
         * the path concatenated but separated with a specified <code>String</code>.
  -      * 
  -      * @param treePath      the <code>TreePath</code> to be converted to 
  +      *
  +      * @param treePath      the <code>TreePath</code> to be converted to
         *                              <code>String</code>
         * @param separator     separate each path with this
         */
  @@ -332,7 +327,7 @@
                if(treePath != null)
                {
                        String sampleName = getTreePath(treePath, SEPARATOR);
  -                     DefaultMutableTreeNode node = 
  +                     DefaultMutableTreeNode node =
                                (DefaultMutableTreeNode)ht.get(sampleName);
                        if(catClass.isDebugEnabled())
                        {
  @@ -348,7 +343,7 @@
                                }
                                if(res != null)
                                {
  -                                     java.util.List list = 
  +                                     java.util.List list =
                                                (java.util.List)res.getValue(SAMPLES);
                                        Graphics g = resultPanel.getGraphics();
                                        Dimension d = resultPanel.getSize();
  @@ -391,7 +386,7 @@
         * @param treePath      treePath of this sample
         * @param g                     where the plotting should be done
         */
  -     protected void drawSample(int i, SampleResult oneSample, TreePath treePath, 
  +     protected void drawSample(int i, SampleResult oneSample, TreePath treePath,
                Graphics g)
        {
                catClass.debug("Start : drawSample1");
  @@ -413,7 +408,7 @@
                SampleResult lastSample = null;
                SampleResult res = null;
                // if the sample has other components then resultList won't be null
  -             ArrayList resultList = 
  +             ArrayList resultList =
                        (ArrayList)oneSample.getValue(SampleResult.RESULT_LIST);
                StringBuffer sampleNameBuff = new StringBuffer();
                sampleNameBuff.append(getTreePath(treePath, SEPARATOR));
  @@ -422,19 +417,19 @@
                if(catClass.isDebugEnabled())
                {
                        catClass.debug("drawSample1 : Total time - " + totalTime);
  -                     catClass.debug("drawSample1 : Looking up samples for - " + 
  +                     catClass.debug("drawSample1 : Looking up samples for - " +
                                sampleName);
                }
                // get the max value of the graph so far
                // get max value from main node
                // component at 0 is root while component at 1 is the main node
                String mainComponent = treePath.getPathComponent(1).toString();
  -             DefaultMutableTreeNode mainNode = 
  +             DefaultMutableTreeNode mainNode =
                        (DefaultMutableTreeNode)ht.get(mainComponent);
                if(catClass.isDebugEnabled())
                {
                        catClass.debug("drawSample1 : mainComponent - " + 
mainComponent);
  -                     catClass.debug("drawSample1 : mainNode for mainComponent - " + 
  +                     catClass.debug("drawSample1 : mainNode for mainComponent - " +
                                mainNode);
                }
   //           SampleResult mainSampleResult = (SampleResult)mainNode.getUserObject();
  @@ -450,13 +445,13 @@
                max = maxLong.longValue();
                if(catClass.isDebugEnabled())
                {
  -//                   catClass.debug("drawSample1 : Component storing max - " + 
  +//                   catClass.debug("drawSample1 : Component storing max - " +
   //                           mainNode);
                        catClass.debug("drawSample1 : Max - " + max);
                }
                if(totalTime > max)
                {
  -//                   mainSampleResult.putValue(SampleResult.TOTAL_TIME, 
  +//                   mainSampleResult.putValue(SampleResult.TOTAL_TIME,
   //                           new Long(totalTime));
                        maxHash.put(mainComponent, new Long(totalTime));
                }
  @@ -508,9 +503,9 @@
                                String combinedName = sampleName + SEPARATOR + 
sampleNameChild;
                                if(catClass.isDebugEnabled())
                                {
  -                                     catClass.debug("drawSample1 : componentRes - " 
+ 
  +                                     catClass.debug("drawSample1 : componentRes - " 
+
                                                combinedName + " loading time - " +
  -                                 componentRes.getTime());
  +                                                     componentRes.getTime());
                                }
                                node = (DefaultMutableTreeNode)ht.get(combinedName);
                                res = (SampleResult)node.getUserObject();
  @@ -531,15 +526,15 @@
                                data += lastLevel;
                                if(catClass.isDebugEnabled())
                                {
  -                                     catClass.debug("drawSample1 : componentRes 
data - " + 
  +                                     catClass.debug("drawSample1 : componentRes 
data - " +
                                                data);
                                        catClass.debug("drawSample1 : componentRes 
datay - " +
                                                datay);
                                }
                                currColor = (Color)colorMapper.get(combinedName);
                                g.setColor(currColor);
  -                             g.drawLine((prevX)%d.width, 
  -                                             d.height - datay, x%d.width, 
  +                             g.drawLine((prevX)%d.width,
  +                                             d.height - datay, x%d.width,
                                                d.height - data);
                                lastLevel = data;
                                lastLevely = datay;
  @@ -624,7 +619,7 @@
                catClass.debug("End : clear1");
        }
   
  -     private class ColorRenderer extends DefaultTreeCellRenderer 
  +     private class ColorRenderer extends DefaultTreeCellRenderer
        {
                public Component getTreeCellRendererComponent(
                        JTree tree, Object value, boolean sel, boolean expanded,
  @@ -639,7 +634,7 @@
                        if(catClass.isDebugEnabled())
                        {
                                catClass.debug("getTreeCellRendererComponent1 : row - 
" + row);
  -                             catClass.debug("getTreeCellRendererComponent1 : 
treePath - " + 
  +                             catClass.debug("getTreeCellRendererComponent1 : 
treePath - " +
                                        treePath);
                        }
                        String sampleName = null;
  
  
  
  1.8       +185 -156  
jakarta-jmeter/src/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
  
  Index: ViewResultsFullVisualizer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ViewResultsFullVisualizer.java    16 Feb 2002 03:21:42 -0000      1.7
  +++ ViewResultsFullVisualizer.java    20 Feb 2002 23:04:26 -0000      1.8
  @@ -52,110 +52,124 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  - package org.apache.jmeter.visualizers;
  -
  +package org.apache.jmeter.visualizers;
   import java.awt.*;
  -import java.util.*;
   import java.awt.event.*;
  +import java.util.*;
   import javax.swing.*;
  -import javax.swing.tree.*;
   import javax.swing.event.*;
  +import javax.swing.tree.*;
  +import junit.framework.*;
  +import org.apache.jmeter.gui.*;
  +import org.apache.jmeter.gui.tree.*;
  +import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFull;
   import org.apache.jmeter.reporters.ResultCollector;
   import org.apache.jmeter.samplers.SampleResult;
   import org.apache.jmeter.samplers.Sampler;
  -import org.apache.jmeter.gui.*;
  -import org.apache.jmeter.gui.tree.*;
  -
   import org.apache.log4j.*;
  -import junit.framework.*;
  -
  -import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFull;
  -/**
  - *  Allows the tester to view the textual response from sampling an Entry. This
  - *  also allows to "single step through" the sampling process via a nice
  - *  "Continue" button.
  +/****************************************
  + * Allows the tester to view the textual response from sampling an Entry. This
  + * also allows to "single step through" the sampling process via a nice
  + * "Continue" button.
    *
  - *@author     Khor Soon Hin
  - *@created    2001/07/25
  - *@version    $Revision: 1.7 $ $Date: 2002/02/16 03:21:42 $
  - */
  + *@author    Khor Soon Hin
  + *@created   2001/07/25
  + *@version   $Revision: 1.8 $ $Date: 2002/02/20 23:04:26 $
  + ***************************************/
   public class ViewResultsFullVisualizer extends ViewResultsVisualizer implements
  -  TreeSelectionListener, ModelSupported
  +             TreeSelectionListener, ModelSupported
   {
  -  protected DefaultMutableTreeNode root;
  -  protected DefaultTreeModel treeModel;
  -  protected GridBagLayout gridBag;
  -  protected GridBagConstraints gbc;
  -  protected JPanel resultPanel;
  -  protected JScrollPane treePane;
  -  protected JScrollPane resultPane;
  -  protected JSplitPane treeSplitPane;
  -  protected JTree jTree;
  -  protected int childIndex;
  -
  -  private static Category catClass =
  -      Category.getInstance(ViewResultsFullVisualizer.class.getName());
  -
  -  public static final Color SERVER_ERROR_COLOR = Color.red;
  -  public static final Color CLIENT_ERROR_COLOR = Color.blue;
  -  public static final Color REDIRECT_COLOR = Color.green;
  -
  -  ResultCollector model;
  -
  -  public ViewResultsFullVisualizer()
  -  {
  -      super();
  -      this.setLayout(new GridLayout(1,1));
  -      catClass.debug("Start : ViewResultsFullVisualizer1");
  -      catClass.debug("End : ViewResultsFullVisualizer1");
  -  }
  -
  -  /**
  -     * Set the reporter type this visualizer will work with
  -     *
  -     * @param model  reporter instance
  -     */
  -  public void setModel(Object model)
  -  {
  -      catClass.debug("Start : setModel1");
  -      this.model = (ResultCollector)model;
  -      this.model.setListener(this);
  -      init();
  -      catClass.debug("End : setModel1");
  -  }
  -
  -  /**
  -     * Initialize this visualizer
  -     */
  -     private void init()
  +
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     public final static Color SERVER_ERROR_COLOR = Color.red;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     public final static Color CLIENT_ERROR_COLOR = Color.blue;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     public final static Color REDIRECT_COLOR = Color.green;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected DefaultMutableTreeNode root;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected DefaultTreeModel treeModel;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected GridBagLayout gridBag;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected GridBagConstraints gbc;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected JPanel resultPanel;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected JScrollPane treePane;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected JScrollPane resultPane;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected JSplitPane treeSplitPane;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected JTree jTree;
  +     /****************************************
  +      * !ToDo (Field description)
  +      ***************************************/
  +     protected int childIndex;
  +
  +     ResultCollector model;
  +
  +     private static Category catClass =
  +                     
Category.getInstance(ViewResultsFullVisualizer.class.getName());
  +
  +     /****************************************
  +      * !ToDo (Constructor description)
  +      ***************************************/
  +     public ViewResultsFullVisualizer()
  +     {
  +             super();
  +             this.setLayout(new GridLayout(1, 1));
  +             catClass.debug("Start : ViewResultsFullVisualizer1");
  +             catClass.debug("End : ViewResultsFullVisualizer1");
  +     }
  +
  +     /****************************************
  +      * Set the reporter type this visualizer will work with
  +      *
  +      *@param model  reporter instance
  +      ***************************************/
  +     public void setModel(Object model)
        {
  -       catClass.debug("Start : init1");
  -       SampleResult rootSampleResult = new SampleResult();
  -       rootSampleResult.putValue(SampleResult.DISPLAY_NAME, "Root");
  -       root = new DefaultMutableTreeNode(rootSampleResult);
  -       treeModel = new DefaultTreeModel(root);
  -       jTree = new JTree(treeModel);
  -       jTree.getSelectionModel().setSelectionMode(
  -              TreeSelectionModel.SINGLE_TREE_SELECTION);
  -       jTree.addTreeSelectionListener(this);
  -       treePane = new JScrollPane(jTree);
  -       gridBag = new GridBagLayout();
  -       gbc = new GridBagConstraints();
  -       resultPanel = new JPanel(gridBag);
  -       resultPane = new JScrollPane(resultPanel);
  -       treeSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
  -              treePane, resultPane);
  -       add(treeSplitPane);
  -       catClass.debug("End : init1");
  +             catClass.debug("Start : setModel1");
  +             this.model = (ResultCollector)model;
  +             this.model.setListener(this);
  +             init();
  +             catClass.debug("End : setModel1");
        }
   
  -  /**
  -     * Update the visualizer with new data
  -     */
  -  public void updateGui()
  -  {
  -      catClass.debug("Start : updateGui1");
  -      SampleResult res = null;
  +     /****************************************
  +      * Update the visualizer with new data
  +      ***************************************/
  +     public void updateGui()
  +     {
  +             catClass.debug("Start : updateGui1");
  +             SampleResult res = null;
                // This is needed 'cos the following while loop will draw till it runs
                // out of samples then exits.  Upon exit, the model.next() will 'cos 
the
                // pointer to the current sample to be on the next sample which will
  @@ -168,57 +182,49 @@
                // needs to be called to set current to point to the first(0th) 
element.
                // Why does current starts with -1, well some other components are 
using
                // it as well and they require it to be so.
  -             if(model.getCurrentSample() == null)
  -             {
  -                     model.next();
  -             }    while((res = model.getCurrentSample()) != null)
  -      {
  -             if(catClass.isDebugEnabled())
  +             while(model.next() && (res = model.getCurrentSample()) != null)
                {
  -               catClass.debug("updateGui1 : sample result - " + res);
  -             }
  -             DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(res);
  -             treeModel.insertNodeInto(currNode, root, childIndex++);
  -             ArrayList arrayList = 
(ArrayList)res.getValue(SampleResult.RESULT_LIST);
  -             if(arrayList != null)
  -             {
  -               Iterator iter = arrayList.iterator();
  -               int leafIndex = 0;
  -               while(iter.hasNext())
  -               {
  -                      SampleResult child = (SampleResult)iter.next();
  -                      if(catClass.isDebugEnabled())
  -                      {
  -                             catClass.debug("updateGui1 : child sample result - " + 
child);
  -                      }
  -                      DefaultMutableTreeNode leafNode =
  -                             new DefaultMutableTreeNode(child);
  -                      treeModel.insertNodeInto(leafNode, currNode, leafIndex++);
  -               }
  +                     if(catClass.isDebugEnabled())
  +                             catClass.debug("updateGui1 : sample result - " + res);
  +
  +                     DefaultMutableTreeNode currNode = new 
DefaultMutableTreeNode(res);
  +                     treeModel.insertNodeInto(currNode, root, childIndex++);
  +                     ArrayList arrayList = 
(ArrayList)res.getValue(SampleResult.RESULT_LIST);
  +                     if(arrayList != null)
  +                     {
  +                             Iterator iter = arrayList.iterator();
  +                             int leafIndex = 0;
  +                             while(iter.hasNext())
  +                             {
  +                                     SampleResult child = (SampleResult)iter.next();
  +                                     if(catClass.isDebugEnabled())
  +                                             catClass.debug("updateGui1 : child 
sample result - " + child);
  +
  +                                     DefaultMutableTreeNode leafNode =
  +                                                     new 
DefaultMutableTreeNode(child);
  +                                     treeModel.insertNodeInto(leafNode, currNode, 
leafIndex++);
  +                             }
  +                     }
                }
  -             model.next();
  -      }
  -      catClass.debug("End : updateGui1");
  -  }
  +             catClass.debug("End : updateGui1");
  +     }
   
  -     /**
  +     /****************************************
         * Clears the visualizer
  -      */
  +      ***************************************/
        public void clear()
        {
                catClass.debug("Start : clear1");
                int totalChild = root.getChildCount();
                if(catClass.isDebugEnabled())
  -             {
                        catClass.debug("clear1 : total child - " + totalChild);
  -             }
  +
                for(int i = 0; i < totalChild; i++)
  -             {
                        // the child to be removed will always be 0 'cos as the nodes 
are removed
                        // the nth node will become (n-1)th
                        treeModel.removeNodeFromParent(
  -                             (DefaultMutableTreeNode)root.getChildAt(0));
  -             }
  +                                     (DefaultMutableTreeNode)root.getChildAt(0));
  +
                resultPanel.removeAll();
                resultPanel.revalidate();
                // reset the child index
  @@ -226,40 +232,38 @@
                catClass.debug("End : clear1");
        }
   
  -     /**
  +     /****************************************
         * Returns the description of this visualizer
         *
  -      * @return    description of this visualizer
  -      */
  +      *@return   description of this visualizer
  +      ***************************************/
        public String toString()
        {
                String desc = "Shows the text results of sampling in tree form";
                if(catClass.isDebugEnabled())
  -             {
  -             catClass.debug("toString1 : Returning description - " + desc);
  -             }
  -              return desc;
  +                     catClass.debug("toString1 : Returning description - " + desc);
  +
  +             return desc;
        }
   
  -     /**
  -      * Sets the bottom pane to correspond to the selected node of the top
  -      * tree
  -      */
  +     /****************************************
  +      * Sets the bottom pane to correspond to the selected node of the top tree
  +      *
  +      *@param e  !ToDo (Parameter description)
  +      ***************************************/
        public void valueChanged(TreeSelectionEvent e)
        {
                catClass.debug("Start : valueChanged1");
                DefaultMutableTreeNode node = 
(DefaultMutableTreeNode)jTree.getLastSelectedPathComponent();
                if(catClass.isDebugEnabled())
  -             {
                        catClass.debug("valueChanged : selected node - " + node);
  -             }
  +
                if(node != null)
                {
                        SampleResult res = (SampleResult)node.getUserObject();
                        if(catClass.isDebugEnabled())
  -                     {
                                catClass.debug("valueChanged1 : sample result - " + 
res);
  -                     }
  +
                        if(res != null)
                        {
                                resultPanel.removeAll();
  @@ -281,24 +285,26 @@
                                String responseCode = 
(String)res.getValue(Sampler.RESPONSE_CODE);
                                int responseLevel = 0;
                                if(responseCode != null)
  -                             {
                                        try
                                        {
  -                                             responseLevel = 
Integer.parseInt(responseCode)/100;
  +                                             responseLevel = 
Integer.parseInt(responseCode) / 100;
                                        }
                                        catch(NumberFormatException 
numberFormatException)
                                        {
                                                // no need to change the foreground 
color
                                        }
  -                             }
  -                             switch(responseLevel)
  +
  +                             switch (responseLevel)
                                {
  -                                     case 3 : 
httpResponseCode.setForeground(REDIRECT_COLOR);
  -                                     case 4 : 
httpResponseCode.setForeground(CLIENT_ERROR_COLOR);
  -                                     case 5 : 
httpResponseCode.setForeground(SERVER_ERROR_COLOR);
  +                                     case 3:
  +                                             
httpResponseCode.setForeground(REDIRECT_COLOR);
  +                                     case 4:
  +                                             
httpResponseCode.setForeground(CLIENT_ERROR_COLOR);
  +                                     case 5:
  +                                             
httpResponseCode.setForeground(SERVER_ERROR_COLOR);
                                }
                                httpResponseCode.setText("HTTP response code : " +
  -                                     responseCode);
  +                                             responseCode);
                                gbc.gridx = 0;
                                gbc.gridy = 1;
                                gridBag.setConstraints(httpResponseCode, gbc);
  @@ -306,7 +312,7 @@
                                // response message label
                                JLabel httpResponseMsg = new JLabel();
                                httpResponseMsg.setText("HTTP response message : " +
  -                                     
(String)res.getValue(Sampler.RESPONSE_MESSAGE));
  +                                             
(String)res.getValue(Sampler.RESPONSE_MESSAGE));
                                gbc.gridx = 0;
                                gbc.gridy = 2;
                                gridBag.setConstraints(httpResponseMsg, gbc);
  @@ -319,17 +325,15 @@
                                if(catClass.isDebugEnabled())
                                {
                                        if(response != null)
  -                                     {
                                                // only first 5 chars are printed 'cos 
for binary files
                                                // it may be quite long to print the 
whole content,
                                                // moreover they contain non-printable 
chars
                                                catClass.debug("valueChanged1 : http 
response - " +
  -                                             response.substring(0,5));
  -                                     }
  +                                                             response.substring(0, 
5));
  +
                                        else
  -                                     {
                                                catClass.debug("valueChanged1 : http 
response - " + response);
  -                                     }
  +
                                }
                                if(response != null)
                                {
  @@ -354,6 +358,31 @@
                        }
                }
                catClass.debug("End : valueChanged1");
  +     }
  +
  +     /****************************************
  +      * Initialize this visualizer
  +      ***************************************/
  +     private void init()
  +     {
  +             catClass.debug("Start : init1");
  +             SampleResult rootSampleResult = new SampleResult();
  +             rootSampleResult.putValue(SampleResult.DISPLAY_NAME, "Root");
  +             root = new DefaultMutableTreeNode(rootSampleResult);
  +             treeModel = new DefaultTreeModel(root);
  +             jTree = new JTree(treeModel);
  +             jTree.getSelectionModel().setSelectionMode(
  +                             TreeSelectionModel.SINGLE_TREE_SELECTION);
  +             jTree.addTreeSelectionListener(this);
  +             treePane = new JScrollPane(jTree);
  +             gridBag = new GridBagLayout();
  +             gbc = new GridBagConstraints();
  +             resultPanel = new JPanel(gridBag);
  +             resultPane = new JScrollPane(resultPanel);
  +             treeSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
  +                             treePane, resultPane);
  +             add(treeSplitPane);
  +             catClass.debug("End : init1");
        }
   }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to