You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ne...@apache.org on 2001/10/11 14:14:52 UTC

cvs commit: jakarta-jmeter/src/org/apache/jmeter/visualizers ViewResultsFullVisualizer.java

neth        01/10/11 05:14:52

  Modified:    src/org/apache/jmeter/visualizers
                        ViewResultsFullVisualizer.java
  Log:
  Change in ResultCollector that causes current sample to start from '-1' instead of previously '0' requires
  a checking for condition if current sample exists before calling next().
  
  Revision  Changes    Path
  1.5       +28 -8     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ViewResultsFullVisualizer.java	2001/09/13 14:45:10	1.4
  +++ ViewResultsFullVisualizer.java	2001/10/11 12:14:51	1.5
  @@ -77,7 +77,7 @@
    *
    *@author     Khor Soon Hin
    *@created    2001/07/25
  - *@version    $Revision: 1.4 $ $Date: 2001/09/13 14:45:10 $
  + *@version    $Revision: 1.5 $ $Date: 2001/10/11 12:14:51 $
    */
   public class ViewResultsFullVisualizer extends ViewResultsVisualizer implements
     TreeSelectionListener, ModelSupported
  @@ -156,8 +156,27 @@
     {
       catClass.debug("Start : updateGui1");
       SampleResult res = null;
  -    while((res = model.getCurrentSample()) != 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 
  +		// occurred(it hasn't occurred yet otherwise the while loop wouldn't have 
  +		// exited.  Thus we test if the model.getCurrentSample the next time there
  +		// are new samples detected(that's when updateGui() is called.  We don't
  +		// move to the next sample if the current one exist.  Then why don't
  +		// we remove the model.next() before the while loop.  Well, the current
  +		// initially points to the -1 element of the samples that's why model.next()
  +		// 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())
  +      {
  +        catClass.debug("updateGui1 : sample result - " + res);
  +      }
         DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(res);
         treeModel.insertNodeInto(currNode, root, childIndex++);
         ArrayList arrayList = (ArrayList)res.getValue(HTTPSamplerFull.RESULT_LIST);
  @@ -187,20 +206,21 @@
   	 */
   	public void clear()
   	{
  -	 catClass.debug("Start : clear1");
  -	 int totalChild = root.getChildCount();
  -	 if(catClass.isDebugEnabled())
  -	 {
  -		catClass.debug("clear1 : total child - " + totalChild);
  +		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
   		childIndex = 0;
   		catClass.debug("End : clear1");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org