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 se...@apache.org on 2008/07/06 23:47:15 UTC

svn commit: r674351 [6/11] - in /jakarta/jmeter/trunk/src: components/org/apache/jmeter/config/ components/org/apache/jmeter/control/ components/org/apache/jmeter/control/gui/ components/org/apache/jmeter/extractor/ components/org/apache/jmeter/extract...

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java Sun Jul  6 14:47:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.visualizers;
@@ -43,185 +43,185 @@
  * This class implements the visualizer for displaying the distribution graph.
  * Distribution graphs are useful for standard benchmarks and viewing the
  * distribution of data points. Results tend to clump together.
- * 
+ *
  * Created May 25, 2004
  */
 public class DistributionGraphVisualizer extends AbstractVisualizer implements ImageVisualizer, GraphListener,
-		Clearable {
-	SamplingStatCalculator model;
+        Clearable {
+    SamplingStatCalculator model;
 
-	private JPanel graphPanel = null;
+    private JPanel graphPanel = null;
 
-	private DistributionGraph graph;
+    private DistributionGraph graph;
 
-	private JTextField noteField;
+    private JTextField noteField;
 
-	private int delay = 10;
-
-	private int counter = 0;
-
-	/**
-	 * Constructor for the GraphVisualizer object.
-	 */
-	public DistributionGraphVisualizer() {
-		model = new SamplingStatCalculator("Distribution");
-		graph = new DistributionGraph(model);
-		graph.setBackground(Color.white);
-		init();
-	}
-
-	/**
-	 * Gets the Image attribute of the GraphVisualizer object.
-	 * 
-	 * @return the Image value
-	 */
-	public Image getImage() {
-		Image result = graph.createImage(graph.getWidth(), graph.getHeight());
-
-		graph.paintComponent(result.getGraphics());
-
-		return result;
-	}
-
-	public synchronized void updateGui() {
-		if (graph.getWidth() < 10) {
-			graph.setPreferredSize(new Dimension(getWidth() - 40, getHeight() - 160));
-		}
-		graphPanel.updateUI();
-		graph.repaint();
-	}
-
-	public synchronized void updateGui(Sample s) {
-		// We have received one more sample
-		if (delay == counter) {
-			updateGui();
-			counter = 0;
-		} else {
-			counter++;
-		}
-	}
-
-	public synchronized void add(SampleResult res) {
-		model.addSample(res);
-		updateGui(model.getCurrentSample());
-	}
-
-	public String getLabelResource() {
-		return "distribution_graph_title"; // $NON-NLS-1$
-	}
-
-	public synchronized void clearData() {
-		this.graph.clearData();
-		model.clear();
-		repaint();
-	}
-
-	public String toString() {
-		return "Show the samples in a distribution graph";
-	}
-
-	/**
-	 * Initialize the GUI.
-	 */
-	private void init() {
-		this.setLayout(new BorderLayout());
-
-		// MAIN PANEL
-		Border margin = new EmptyBorder(10, 10, 5, 10);
-
-		this.setBorder(margin);
-
-		// Set up the graph with header, footer, Y axis and graph display
-		JPanel lgraphPanel = new JPanel(new BorderLayout());
-		lgraphPanel.add(createGraphPanel(), BorderLayout.CENTER);
-		lgraphPanel.add(createGraphInfoPanel(), BorderLayout.SOUTH);
-
-		// Add the main panel and the graph
-		this.add(makeTitlePanel(), BorderLayout.NORTH);
-		this.add(lgraphPanel, BorderLayout.CENTER);
-	}
-
-	// Methods used in creating the GUI
-
-	/**
-	 * Creates a scroll pane containing the actual graph of the results.
-	 * 
-	 * @return a scroll pane containing the graph
-	 */
-	private Component createGraphPanel() {
-		graphPanel = new JPanel();
-		graphPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.lightGray, Color.darkGray));
-		graphPanel.add(graph);
-		graphPanel.setBackground(Color.white);
-		return graphPanel;
-	}
-
-	// /**
-	// * Creates one of the fields used to display the graph's current
-	// * values.
-	// *
-	// * @param color the color used to draw the value. By convention
-	// * this is the same color that is used to draw the
-	// * graph for this value and in the choose panel.
-	// * @param length the number of digits which the field should be
-	// * able to display
-	// *
-	// * @return a text field configured to display one of the
-	// * current graph values
-	// */
-	// private JTextField createInfoField(Color color, int length)
-	// {
-	// JTextField field = new JTextField(length);
-	// field.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
-	// field.setEditable(false);
-	// field.setForeground(color);
-	// field.setBackground(getBackground());
-	//
-	// // The text field should expand horizontally, but have
-	// // a fixed height
-	// field.setMaximumSize(new Dimension(
-	// field.getMaximumSize().width,
-	// field.getPreferredSize().height));
-	// return field;
-	// }
-
-	/**
-	 * Creates a label for one of the fields used to display the graph's current
-	 * values. Neither the label created by this method or the
-	 * <code>field</code> passed as a parameter is added to the GUI here.
-	 * 
-	 * @param labelResourceName
-	 *            the name of the label resource. This is used to look up the
-	 *            label text using {@link JMeterUtils#getResString(String)}.
-	 * @param field
-	 *            the field this label is being created for.
-	 */
-	private JLabel createInfoLabel(String labelResourceName, JTextField field) {
-		JLabel label = new JLabel(JMeterUtils.getResString(labelResourceName));
-		label.setForeground(field.getForeground());
-		label.setLabelFor(field);
-		return label;
-	}
-
-	/**
-	 * Creates the information Panel at the bottom
-	 * 
-	 * @return
-	 */
-	private Box createGraphInfoPanel() {
-		Box graphInfoPanel = Box.createHorizontalBox();
-		this.noteField = new JTextField();
-		graphInfoPanel.add(this.createInfoLabel("distribution_note1", this.noteField)); // $NON-NLS-1$
-		return graphInfoPanel;
-	}
-
-	/**
-	 * Method implements Printable, which is suppose to return the correct
-	 * internal component. The Action class can then print or save the graphics
-	 * to a file.
-	 */
-	public JComponent getPrintableComponent() {
-		return this.graphPanel;
-	}
+    private int delay = 10;
+
+    private int counter = 0;
+
+    /**
+     * Constructor for the GraphVisualizer object.
+     */
+    public DistributionGraphVisualizer() {
+        model = new SamplingStatCalculator("Distribution");
+        graph = new DistributionGraph(model);
+        graph.setBackground(Color.white);
+        init();
+    }
+
+    /**
+     * Gets the Image attribute of the GraphVisualizer object.
+     *
+     * @return the Image value
+     */
+    public Image getImage() {
+        Image result = graph.createImage(graph.getWidth(), graph.getHeight());
+
+        graph.paintComponent(result.getGraphics());
+
+        return result;
+    }
+
+    public synchronized void updateGui() {
+        if (graph.getWidth() < 10) {
+            graph.setPreferredSize(new Dimension(getWidth() - 40, getHeight() - 160));
+        }
+        graphPanel.updateUI();
+        graph.repaint();
+    }
+
+    public synchronized void updateGui(Sample s) {
+        // We have received one more sample
+        if (delay == counter) {
+            updateGui();
+            counter = 0;
+        } else {
+            counter++;
+        }
+    }
+
+    public synchronized void add(SampleResult res) {
+        model.addSample(res);
+        updateGui(model.getCurrentSample());
+    }
+
+    public String getLabelResource() {
+        return "distribution_graph_title"; // $NON-NLS-1$
+    }
+
+    public synchronized void clearData() {
+        this.graph.clearData();
+        model.clear();
+        repaint();
+    }
+
+    public String toString() {
+        return "Show the samples in a distribution graph";
+    }
+
+    /**
+     * Initialize the GUI.
+     */
+    private void init() {
+        this.setLayout(new BorderLayout());
+
+        // MAIN PANEL
+        Border margin = new EmptyBorder(10, 10, 5, 10);
+
+        this.setBorder(margin);
+
+        // Set up the graph with header, footer, Y axis and graph display
+        JPanel lgraphPanel = new JPanel(new BorderLayout());
+        lgraphPanel.add(createGraphPanel(), BorderLayout.CENTER);
+        lgraphPanel.add(createGraphInfoPanel(), BorderLayout.SOUTH);
+
+        // Add the main panel and the graph
+        this.add(makeTitlePanel(), BorderLayout.NORTH);
+        this.add(lgraphPanel, BorderLayout.CENTER);
+    }
+
+    // Methods used in creating the GUI
+
+    /**
+     * Creates a scroll pane containing the actual graph of the results.
+     *
+     * @return a scroll pane containing the graph
+     */
+    private Component createGraphPanel() {
+        graphPanel = new JPanel();
+        graphPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.lightGray, Color.darkGray));
+        graphPanel.add(graph);
+        graphPanel.setBackground(Color.white);
+        return graphPanel;
+    }
+
+    // /**
+    // * Creates one of the fields used to display the graph's current
+    // * values.
+    // *
+    // * @param color the color used to draw the value. By convention
+    // * this is the same color that is used to draw the
+    // * graph for this value and in the choose panel.
+    // * @param length the number of digits which the field should be
+    // * able to display
+    // *
+    // * @return a text field configured to display one of the
+    // * current graph values
+    // */
+    // private JTextField createInfoField(Color color, int length)
+    // {
+    // JTextField field = new JTextField(length);
+    // field.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
+    // field.setEditable(false);
+    // field.setForeground(color);
+    // field.setBackground(getBackground());
+    //
+    // // The text field should expand horizontally, but have
+    // // a fixed height
+    // field.setMaximumSize(new Dimension(
+    // field.getMaximumSize().width,
+    // field.getPreferredSize().height));
+    // return field;
+    // }
+
+    /**
+     * Creates a label for one of the fields used to display the graph's current
+     * values. Neither the label created by this method or the
+     * <code>field</code> passed as a parameter is added to the GUI here.
+     *
+     * @param labelResourceName
+     *            the name of the label resource. This is used to look up the
+     *            label text using {@link JMeterUtils#getResString(String)}.
+     * @param field
+     *            the field this label is being created for.
+     */
+    private JLabel createInfoLabel(String labelResourceName, JTextField field) {
+        JLabel label = new JLabel(JMeterUtils.getResString(labelResourceName));
+        label.setForeground(field.getForeground());
+        label.setLabelFor(field);
+        return label;
+    }
+
+    /**
+     * Creates the information Panel at the bottom
+     *
+     * @return
+     */
+    private Box createGraphInfoPanel() {
+        Box graphInfoPanel = Box.createHorizontalBox();
+        this.noteField = new JTextField();
+        graphInfoPanel.add(this.createInfoLabel("distribution_note1", this.noteField)); // $NON-NLS-1$
+        return graphInfoPanel;
+    }
+
+    /**
+     * Method implements Printable, which is suppose to return the correct
+     * internal component. The Action class can then print or save the graphics
+     * to a file.
+     */
+    public JComponent getPrintableComponent() {
+        return this.graphPanel;
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/Graph.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/Graph.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/Graph.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/Graph.java Sun Jul  6 14:47:12 2008
@@ -5,15 +5,15 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and limitations
  * under the License.
- *  
+ *
  */
 
 package org.apache.jmeter.visualizers;
@@ -36,221 +36,221 @@
 
 /**
  * Implements a simple graph for displaying performance results.
- * 
+ *
  */
 public class Graph extends JComponent implements Scrollable, Clearable {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	private boolean wantData = true;
+    private boolean wantData = true;
 
-	private boolean wantAverage = true;
+    private boolean wantAverage = true;
 
-	private boolean wantDeviation = true;
+    private boolean wantDeviation = true;
 
-	private boolean wantThroughput = true;
-
-	private boolean wantMedian = true;
-
-	private SamplingStatCalculator model;
-
-	private static final int width = 2000;
-
-	private long graphMax = 1;
-
-	private double throughputMax = 1;
-
-	/**
-	 * Constructor for the Graph object.
-	 */
-	public Graph() {
-		this.setPreferredSize(new Dimension(width, 100));
-	}
-
-	/**
-	 * Constructor for the Graph object.
-	 */
-	public Graph(SamplingStatCalculator model) {
-		this();
-		setModel(model);
-	}
-
-	/**
-	 * Sets the Model attribute of the Graph object.
-	 */
-	private void setModel(Object model) {
-		this.model = (SamplingStatCalculator) model;
-		repaint();
-	}
-
-	/**
-	 * Gets the PreferredScrollableViewportSize attribute of the Graph object.
-	 * 
-	 * @return the PreferredScrollableViewportSize value
-	 */
-	public Dimension getPreferredScrollableViewportSize() {
-		return this.getPreferredSize();
-		// return new Dimension(width, 400);
-	}
-
-	/**
-	 * Gets the ScrollableUnitIncrement attribute of the Graph object.
-	 * 
-	 * @return the ScrollableUnitIncrement value
-	 */
-	public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
-		return 5;
-	}
-
-	/**
-	 * Gets the ScrollableBlockIncrement attribute of the Graph object.
-	 * 
-	 * @return the ScrollableBlockIncrement value
-	 */
-	public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
-		return (int) (visibleRect.width * .9);
-	}
-
-	/**
-	 * Gets the ScrollableTracksViewportWidth attribute of the Graph object.
-	 * 
-	 * @return the ScrollableTracksViewportWidth value
-	 */
-	public boolean getScrollableTracksViewportWidth() {
-		return false;
-	}
-
-	/**
-	 * Gets the ScrollableTracksViewportHeight attribute of the Graph object.
-	 * 
-	 * @return the ScrollableTracksViewportHeight value
-	 */
-	public boolean getScrollableTracksViewportHeight() {
-		return true;
-	}
-
-	/**
-	 * Clears this graph.
-	 */
-	public void clearData() {
-		graphMax = 1;
-		throughputMax = 1;
-	}
-
-	public void enableData(boolean value) {
-		this.wantData = value;
-	}
-
-	public void enableAverage(boolean value) {
-		this.wantAverage = value;
-	}
-
-	public void enableMedian(boolean value) {
-		this.wantMedian = value;
-	}
-
-	public void enableDeviation(boolean value) {
-		this.wantDeviation = value;
-	}
-
-	public void enableThroughput(boolean value) {
-		this.wantThroughput = value;
-	}
-
-	public void updateGui(final Sample oneSample) {
-		long h = model.getPercentPoint((float) 0.90).longValue();
-		boolean repaint = false;
-		if ((oneSample.getCount() % 20 == 0 || oneSample.getCount() < 20) && h > (graphMax * 1.2) || graphMax > (h * 1.2)) {
-			if (h >= 1) {
+    private boolean wantThroughput = true;
+
+    private boolean wantMedian = true;
+
+    private SamplingStatCalculator model;
+
+    private static final int width = 2000;
+
+    private long graphMax = 1;
+
+    private double throughputMax = 1;
+
+    /**
+     * Constructor for the Graph object.
+     */
+    public Graph() {
+        this.setPreferredSize(new Dimension(width, 100));
+    }
+
+    /**
+     * Constructor for the Graph object.
+     */
+    public Graph(SamplingStatCalculator model) {
+        this();
+        setModel(model);
+    }
+
+    /**
+     * Sets the Model attribute of the Graph object.
+     */
+    private void setModel(Object model) {
+        this.model = (SamplingStatCalculator) model;
+        repaint();
+    }
+
+    /**
+     * Gets the PreferredScrollableViewportSize attribute of the Graph object.
+     *
+     * @return the PreferredScrollableViewportSize value
+     */
+    public Dimension getPreferredScrollableViewportSize() {
+        return this.getPreferredSize();
+        // return new Dimension(width, 400);
+    }
+
+    /**
+     * Gets the ScrollableUnitIncrement attribute of the Graph object.
+     *
+     * @return the ScrollableUnitIncrement value
+     */
+    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
+        return 5;
+    }
+
+    /**
+     * Gets the ScrollableBlockIncrement attribute of the Graph object.
+     *
+     * @return the ScrollableBlockIncrement value
+     */
+    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
+        return (int) (visibleRect.width * .9);
+    }
+
+    /**
+     * Gets the ScrollableTracksViewportWidth attribute of the Graph object.
+     *
+     * @return the ScrollableTracksViewportWidth value
+     */
+    public boolean getScrollableTracksViewportWidth() {
+        return false;
+    }
+
+    /**
+     * Gets the ScrollableTracksViewportHeight attribute of the Graph object.
+     *
+     * @return the ScrollableTracksViewportHeight value
+     */
+    public boolean getScrollableTracksViewportHeight() {
+        return true;
+    }
+
+    /**
+     * Clears this graph.
+     */
+    public void clearData() {
+        graphMax = 1;
+        throughputMax = 1;
+    }
+
+    public void enableData(boolean value) {
+        this.wantData = value;
+    }
+
+    public void enableAverage(boolean value) {
+        this.wantAverage = value;
+    }
+
+    public void enableMedian(boolean value) {
+        this.wantMedian = value;
+    }
+
+    public void enableDeviation(boolean value) {
+        this.wantDeviation = value;
+    }
+
+    public void enableThroughput(boolean value) {
+        this.wantThroughput = value;
+    }
+
+    public void updateGui(final Sample oneSample) {
+        long h = model.getPercentPoint((float) 0.90).longValue();
+        boolean repaint = false;
+        if ((oneSample.getCount() % 20 == 0 || oneSample.getCount() < 20) && h > (graphMax * 1.2) || graphMax > (h * 1.2)) {
+            if (h >= 1) {
                 graphMax = h;
             } else {
                 graphMax = 1;
             }
-			repaint = true;
-		}
-		if (model.getMaxThroughput() > throughputMax) {
-			throughputMax = model.getMaxThroughput() * 1.3;
-			repaint = true;
-		}
-		if (repaint) {
-			repaint();
-			return;
-		}
-		final int xPos = model.getCount();
-
-		SwingUtilities.invokeLater(new Runnable() {
-			public void run() {
-				Graphics g = getGraphics();
-
-				if (g != null) {
-					drawSample(xPos, oneSample, g);
-				}
-			}
-		});
-	}
+            repaint = true;
+        }
+        if (model.getMaxThroughput() > throughputMax) {
+            throughputMax = model.getMaxThroughput() * 1.3;
+            repaint = true;
+        }
+        if (repaint) {
+            repaint();
+            return;
+        }
+        final int xPos = model.getCount();
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                Graphics g = getGraphics();
+
+                if (g != null) {
+                    drawSample(xPos, oneSample, g);
+                }
+            }
+        });
+    }
 
-	public void paintComponent(Graphics g) {
-		super.paintComponent(g);
+    public void paintComponent(Graphics g) {
+        super.paintComponent(g);
 
         List samples = model.getSamples();
         synchronized (samples ) {
-			Iterator e = samples.iterator();
+            Iterator e = samples.iterator();
+
+            for (int i = 0; e.hasNext(); i++) {
+                Sample s = (Sample) e.next();
+
+                drawSample(i, s, g);
+            }
+        }
+    }
 
-			for (int i = 0; e.hasNext(); i++) {
-				Sample s = (Sample) e.next();
+    private void drawSample(int x, Sample oneSample, Graphics g) {
+        // int width = getWidth();
+        int height = getHeight();
+        log.debug("Drawing a sample at " + x);
+        if (wantData) {
+            int data = (int) (oneSample.getData() * height / graphMax);
 
-				drawSample(i, s, g);
-			}
-		}
-	}
-
-	private void drawSample(int x, Sample oneSample, Graphics g) {
-		// int width = getWidth();
-		int height = getHeight();
-		log.debug("Drawing a sample at " + x);
-		if (wantData) {
-			int data = (int) (oneSample.getData() * height / graphMax);
-
-			if (oneSample.isSuccess()) {
-				g.setColor(Color.black);
-			} else {
-				g.setColor(JMeterColor.YELLOW);
-			}
-			g.drawLine(x % width, height - data, x % width, height - data - 1);
-			log.debug("Drawing coords = " + (x % width) + "," + (height - data));
-		}
-
-		if (wantAverage) {
-			int average = (int) (oneSample.getAverage() * height / graphMax);
-
-			g.setColor(Color.blue);
-			g.drawLine(x % width, height - average, x % width, (height - average - 1));
-		}
-
-		if (wantMedian) {
-			int median = (int) (oneSample.getMedian() * height / graphMax);
-
-			g.setColor(JMeterColor.purple);
-			g.drawLine(x % width, height - median, x % width, (height - median - 1));
-		}
-
-		if (wantDeviation) {
-			int deviation = (int) (oneSample.getDeviation() * height / graphMax);
-
-			g.setColor(Color.red);
-			g.drawLine(x % width, height - deviation, x % width, (height - deviation - 1));
-		}
-		if (wantThroughput) {
-			int throughput = (int) (oneSample.getThroughput() * height / throughputMax);
-
-			g.setColor(JMeterColor.dark_green);
-			g.drawLine(x % width, height - throughput, x % width, (height - throughput - 1));
-		}
-	}
-
-	/**
-	 * @return Returns the graphMax.
-	 */
-	public long getGraphMax() {
-		return graphMax;
-	}
+            if (oneSample.isSuccess()) {
+                g.setColor(Color.black);
+            } else {
+                g.setColor(JMeterColor.YELLOW);
+            }
+            g.drawLine(x % width, height - data, x % width, height - data - 1);
+            log.debug("Drawing coords = " + (x % width) + "," + (height - data));
+        }
+
+        if (wantAverage) {
+            int average = (int) (oneSample.getAverage() * height / graphMax);
+
+            g.setColor(Color.blue);
+            g.drawLine(x % width, height - average, x % width, (height - average - 1));
+        }
+
+        if (wantMedian) {
+            int median = (int) (oneSample.getMedian() * height / graphMax);
+
+            g.setColor(JMeterColor.purple);
+            g.drawLine(x % width, height - median, x % width, (height - median - 1));
+        }
+
+        if (wantDeviation) {
+            int deviation = (int) (oneSample.getDeviation() * height / graphMax);
+
+            g.setColor(Color.red);
+            g.drawLine(x % width, height - deviation, x % width, (height - deviation - 1));
+        }
+        if (wantThroughput) {
+            int throughput = (int) (oneSample.getThroughput() * height / throughputMax);
+
+            g.setColor(JMeterColor.dark_green);
+            g.drawLine(x % width, height - throughput, x % width, (height - throughput - 1));
+        }
+    }
+
+    /**
+     * @return Returns the graphMax.
+     */
+    public long getGraphMax() {
+        return graphMax;
+    }
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccum.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccum.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccum.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccum.java Sun Jul  6 14:47:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.visualizers;
@@ -41,357 +41,357 @@
 
 /**
  * Draws the graph.
- * 
+ *
  * Created 2001/08/11
  */
 public class GraphAccum extends JComponent implements Scrollable, GraphAccumListener {
 
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	private GraphAccumModel model;
+    private GraphAccumModel model;
 
-	private GraphAccumVisualizer visualizer;
+    private GraphAccumVisualizer visualizer;
 
-	/** Ensure that the legends are only drawn once. */
-	private boolean noLegendYet = true;
+    /** Ensure that the legends are only drawn once. */
+    private boolean noLegendYet = true;
 
-	/**
-	 * Keep track of previous point. Needed to draw a line joining the previous
-	 * point with the current one.
-	 */
-	private Point[] previousPts;
-
-	/**
-	 * Ensure that previousPts is allocated once only. It'll be reused at each
-	 * drawSample. It can't be allocated outside drawSample 'cos the sample is
-	 * only passed in here.
-	 */
-	private boolean previousPtsAlloc = false;
-
-	protected final static int width = 2000;
-
-	private final static int PLOT_X_WIDTH = 10;
-
-	/**
-	 * Constructor.
-	 */
-	public GraphAccum() {
-		log.debug("Start : GraphAnnum1");
-		log.debug("End : GraphAnnum1");
-	}
-
-	/**
-	 * Constructor with model set.
-	 * 
-	 * @param model
-	 *            model which this object represents
-	 */
-	public GraphAccum(GraphAccumModel model) {
-		this();
-		log.debug("Start : GraphAnnum2");
-		setModel(model);
-		log.debug("End : GraphAnnum2");
-	}
-
-	/**
-	 * Set model which this object represents.
-	 * 
-	 * @param model
-	 *            model which this object represents
-	 */
-	private void setModel(Object model) {
-		log.debug("Start : setModel1");
-		this.model = (GraphAccumModel) model;
-		this.model.addGraphAccumListener(this);
-		repaint();
-		log.debug("End : setModel1");
-	}
-
-	/**
-	 * Set the visualizer.
-	 * 
-	 * @param visualizer
-	 *            visualizer of this object
-	 */
-	public void setVisualizer(Object visualizer) {
-		if (log.isDebugEnabled()) {
-			log.debug("setVisualizer1 : Setting visualizer - " + visualizer);
-		}
-		this.visualizer = (GraphAccumVisualizer) visualizer;
-	}
-
-	/**
-	 * The legend is only printed once during sampling. This sets the variable
-	 * that indicates whether the legend has been printed yet or not.
-	 * 
-	 * @param value
-	 *            variable that indicates whether the legend has been printed
-	 *            yet
-	 */
-	public void setNoLegendYet(boolean value) {
-		noLegendYet = value;
-	}
-
-	/**
-	 * Gets the PreferredScrollableViewportSize attribute of the Graph object.
-	 * 
-	 * @return the PreferredScrollableViewportSize value
-	 */
-	public Dimension getPreferredScrollableViewportSize() {
-		return this.getPreferredSize();
-	}
-
-	/**
-	 * Gets the ScrollableUnitIncrement attribute of the Graph object.
-	 * 
-	 * @return the ScrollableUnitIncrement value
-	 */
-	public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
-		return 5;
-	}
-
-	/**
-	 * Gets the ScrollableBlockIncrement attribute of the Graph object.
-	 * 
-	 * @return the ScrollableBlockIncrement value
-	 */
-	public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
-		return (int) (visibleRect.width * .9);
-	}
-
-	/**
-	 * Gets the ScrollableTracksViewportWidth attribute of the Graph object.
-	 * 
-	 * @return the ScrollableTracksViewportWidth value
-	 */
-	public boolean getScrollableTracksViewportWidth() {
-		return false;
-	}
-
-	/**
-	 * Gets the ScrollableTracksViewportHeight attribute of the Graph object.
-	 * 
-	 * @return the ScrollableTracksViewportHeight value
-	 */
-	public boolean getScrollableTracksViewportHeight() {
-		return true;
-	}
-
-	/**
-	 * The legend is only printed once during sampling. This returns the
-	 * variable that indicates whether the legend has been printed yet or not.
-	 * 
-	 * @return value variable that indicates whether the legend has been printed
-	 *         yet
-	 */
-	public boolean getNoLegendYet() {
-		return noLegendYet;
-	}
-
-	/**
-	 * Redraws the gui.
-	 */
-	public void updateGui() {
-		log.debug("Start : updateGui1");
-		repaint();
-		log.debug("End : updateGui1");
-	}
-
-	/**
-	 * Redraws the gui if no rescaling of the graph is needed.
-	 * 
-	 * @param oneSample
-	 *            sample to be added
-	 */
-	public void updateGui(final SampleResult oneSample) {
-		log.debug("Start : updateGui2");
-		final int xPos = model.getSampleCount();
-
-		SwingUtilities.invokeLater(new Runnable() {
-			public void run() {
-				Graphics g = getGraphics();
-
-				if (g != null) {
-					drawSample(xPos * PLOT_X_WIDTH, oneSample, g);
-				}
-			}
-		});
-		log.debug("End : updateGui2");
-	}
-
-	public void paintComponent(Graphics g) {
-		super.paintComponent(g);
-		log.debug("Start : paintComponent1");
-
-		synchronized (model.getList()) {
-			// For repainting set this to false because all the points needs to
-			// be redrawn so no need(shouldn't) use the previousPts.
-			previousPtsAlloc = false;
-			Iterator e = model.getList().iterator();
-
-			for (int i = 0; e.hasNext(); i++) {
-				SampleResult s = (SampleResult) e.next();
-
-				drawSample(i * PLOT_X_WIDTH, s, g);
-			}
-		}
-		log.debug("End : paintComponent1");
-	}
-
-	/**
-	 * Clears this graph.
-	 */
-	public void clearData() {
-		setNoLegendYet(true);
-		((JPanel) visualizer.getWhiteCanvas()).removeAll();
-		previousPts = null;
-	}
-
-	private void drawSample(int x, SampleResult oneSample, Graphics g) {
-		log.debug("Start : drawSample1");
-
-		// Used to keep track of accumulated load times of components.
-		int lastLevel = 0;
-
-		// Number of components
-		int compCount = 0;
-
-		SampleResult[] resultList = oneSample.getSubResults();
-		int resultListCount = 0;
-
-		// Allocate previousPts only the first time
-		if (!previousPtsAlloc) {
-			resultListCount += resultList.length;
-			previousPts = new Point[resultListCount + 2];
-		}
-
-		Color currColor = Color.black;
-		JPanel lPanel = (JPanel) visualizer.getWhiteCanvas();
-		JPanel legendPanel = new JPanel();
-		GridBagLayout gridBag = new GridBagLayout();
-		GridBagConstraints gbc = new GridBagConstraints();
-
-		legendPanel.setLayout(gridBag);
-		lPanel.add(legendPanel);
-		Dimension d = this.getSize();
-
-		// Set the total time to load the sample
-		long totalTime = oneSample.getTime();
-
-		// If the page has other components then set the total time to be that
-		// including all its components' load time.
-		if (log.isDebugEnabled()) {
-			log.debug("drawSample1 : total time - " + totalTime);
-		}
-		int data = (int) (totalTime * d.height / model.getMax());
-
-		g.setColor(currColor);
-		if (!previousPtsAlloc) {
-			// If first dot, just draw the point.
-			g.drawLine(x % width, d.height - data, x % width, d.height - data - 1);
-		} else {
-			// Otherwise, draw from previous point.
-			g.drawLine((previousPts[0].x) % width, previousPts[0].y, x % width, d.height - data);
-		}
-
-		// Store current total time point
-		previousPts[0] = new Point(x % width, d.height - data);
-		if (noLegendYet) {
-			gbc.gridx = 0;
-			gbc.gridy = compCount++;
-			gbc.anchor = GridBagConstraints.WEST;
-			gbc.weightx = 1.0;
-			gbc.insets = new Insets(0, 10, 0, 0);
-			JLabel totalTimeLabel = new JLabel("Total time - " + oneSample.toString());
-
-			totalTimeLabel.setForeground(currColor);
-			gridBag.setConstraints(totalTimeLabel, gbc);
-			legendPanel.add(totalTimeLabel);
-		}
-
-		// Plot the time of the page itself without all its components
-		if (log.isDebugEnabled()) {
-			log.debug("drawSample1 : main page load time - " + oneSample.getTime());
-		}
-		data = (int) (oneSample.getTime() * d.height / model.getMax());
-		currColor = ColorHelper.changeColorCyclicIncrement(currColor, 40);
-		g.setColor(currColor);
-		if (!previousPtsAlloc) {
-			// If first dot, just draw the point
-			g.drawLine(x % width, d.height - data, x % width, d.height - data - 1);
-		} else {
-			// Otherwise, draw from previous point
-			g.drawLine((previousPts[1].x) % width, previousPts[1].y, x % width, d.height - data);
-		}
-		// Store load time without components
-		previousPts[1] = new Point(x % width, d.height - data);
-		if (noLegendYet) {
-			gbc.gridx = 0;
-			gbc.gridy = compCount++;
-			gbc.anchor = GridBagConstraints.WEST;
-			gbc.weightx = 1.0;
-			gbc.insets = new Insets(0, 10, 0, 0);
-			JLabel mainTimeLabel = new JLabel(oneSample.toString());
-
-			mainTimeLabel.setForeground(currColor);
-			gridBag.setConstraints(mainTimeLabel, gbc);
-			legendPanel.add(mainTimeLabel);
-		}
-		lastLevel += data;
-		// Plot the times of the total times components
-		int currPreviousPts = 2;
-
-		if (resultList != null) {
-			for (int i = 0; i < resultList.length; i++) {
-				SampleResult componentRes = resultList[i];
-
-				if (log.isDebugEnabled()) {
-					log.debug("drawSample1 : componentRes - " + componentRes.getSampleLabel() + " loading time - "
-							+ componentRes.getTime());
-				}
-				data = (int) (componentRes.getTime() * d.height / model.getMax());
-				data += lastLevel;
-				currColor = ColorHelper.changeColorCyclicIncrement(currColor, 100);
-				g.setColor(currColor);
-				if (!previousPtsAlloc) {
-					// If first dot, just draw the point
-					g.drawLine(x % width, d.height - data, x % width, d.height - data - 1);
-				} else {
-					// Otherwise, draw from previous point
-					g.drawLine((previousPts[currPreviousPts].x) % width, previousPts[currPreviousPts].y, x % width,
-							d.height - data);
-				}
-				// Store the current plot
-				previousPts[currPreviousPts++] = new Point(x % width, d.height - data);
-				if (noLegendYet) {
-					gbc.gridx = 0;
-					gbc.gridy = compCount++;
-					gbc.anchor = GridBagConstraints.WEST;
-					gbc.weightx = 1.0;
-					gbc.insets = new Insets(0, 10, 0, 0);
-					JLabel compTimeLabel = new JLabel(componentRes.getSampleLabel());
-
-					compTimeLabel.setForeground(currColor);
-					gridBag.setConstraints(compTimeLabel, gbc);
-					legendPanel.add(compTimeLabel);
-				}
-				lastLevel = data;
-			}
-		}
-
-		if (noLegendYet) {
-			noLegendYet = false;
-			lPanel.repaint();
-			lPanel.revalidate();
-		}
-
-		// Set the previousPtsAlloc to true here and not after allocation
-		// because the rest of the codes also depend on previousPtsAlloc to be
-		// false if first time plotting the graph i.e. there are no previous
-		// points.
-		if (!previousPtsAlloc) {
-			previousPtsAlloc = true;
-		}
-		log.debug("End : drawSample1");
-	}
+    /**
+     * Keep track of previous point. Needed to draw a line joining the previous
+     * point with the current one.
+     */
+    private Point[] previousPts;
+
+    /**
+     * Ensure that previousPts is allocated once only. It'll be reused at each
+     * drawSample. It can't be allocated outside drawSample 'cos the sample is
+     * only passed in here.
+     */
+    private boolean previousPtsAlloc = false;
+
+    protected final static int width = 2000;
+
+    private final static int PLOT_X_WIDTH = 10;
+
+    /**
+     * Constructor.
+     */
+    public GraphAccum() {
+        log.debug("Start : GraphAnnum1");
+        log.debug("End : GraphAnnum1");
+    }
+
+    /**
+     * Constructor with model set.
+     *
+     * @param model
+     *            model which this object represents
+     */
+    public GraphAccum(GraphAccumModel model) {
+        this();
+        log.debug("Start : GraphAnnum2");
+        setModel(model);
+        log.debug("End : GraphAnnum2");
+    }
+
+    /**
+     * Set model which this object represents.
+     *
+     * @param model
+     *            model which this object represents
+     */
+    private void setModel(Object model) {
+        log.debug("Start : setModel1");
+        this.model = (GraphAccumModel) model;
+        this.model.addGraphAccumListener(this);
+        repaint();
+        log.debug("End : setModel1");
+    }
+
+    /**
+     * Set the visualizer.
+     *
+     * @param visualizer
+     *            visualizer of this object
+     */
+    public void setVisualizer(Object visualizer) {
+        if (log.isDebugEnabled()) {
+            log.debug("setVisualizer1 : Setting visualizer - " + visualizer);
+        }
+        this.visualizer = (GraphAccumVisualizer) visualizer;
+    }
+
+    /**
+     * The legend is only printed once during sampling. This sets the variable
+     * that indicates whether the legend has been printed yet or not.
+     *
+     * @param value
+     *            variable that indicates whether the legend has been printed
+     *            yet
+     */
+    public void setNoLegendYet(boolean value) {
+        noLegendYet = value;
+    }
+
+    /**
+     * Gets the PreferredScrollableViewportSize attribute of the Graph object.
+     *
+     * @return the PreferredScrollableViewportSize value
+     */
+    public Dimension getPreferredScrollableViewportSize() {
+        return this.getPreferredSize();
+    }
+
+    /**
+     * Gets the ScrollableUnitIncrement attribute of the Graph object.
+     *
+     * @return the ScrollableUnitIncrement value
+     */
+    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
+        return 5;
+    }
+
+    /**
+     * Gets the ScrollableBlockIncrement attribute of the Graph object.
+     *
+     * @return the ScrollableBlockIncrement value
+     */
+    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
+        return (int) (visibleRect.width * .9);
+    }
+
+    /**
+     * Gets the ScrollableTracksViewportWidth attribute of the Graph object.
+     *
+     * @return the ScrollableTracksViewportWidth value
+     */
+    public boolean getScrollableTracksViewportWidth() {
+        return false;
+    }
+
+    /**
+     * Gets the ScrollableTracksViewportHeight attribute of the Graph object.
+     *
+     * @return the ScrollableTracksViewportHeight value
+     */
+    public boolean getScrollableTracksViewportHeight() {
+        return true;
+    }
+
+    /**
+     * The legend is only printed once during sampling. This returns the
+     * variable that indicates whether the legend has been printed yet or not.
+     *
+     * @return value variable that indicates whether the legend has been printed
+     *         yet
+     */
+    public boolean getNoLegendYet() {
+        return noLegendYet;
+    }
+
+    /**
+     * Redraws the gui.
+     */
+    public void updateGui() {
+        log.debug("Start : updateGui1");
+        repaint();
+        log.debug("End : updateGui1");
+    }
+
+    /**
+     * Redraws the gui if no rescaling of the graph is needed.
+     *
+     * @param oneSample
+     *            sample to be added
+     */
+    public void updateGui(final SampleResult oneSample) {
+        log.debug("Start : updateGui2");
+        final int xPos = model.getSampleCount();
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                Graphics g = getGraphics();
+
+                if (g != null) {
+                    drawSample(xPos * PLOT_X_WIDTH, oneSample, g);
+                }
+            }
+        });
+        log.debug("End : updateGui2");
+    }
+
+    public void paintComponent(Graphics g) {
+        super.paintComponent(g);
+        log.debug("Start : paintComponent1");
+
+        synchronized (model.getList()) {
+            // For repainting set this to false because all the points needs to
+            // be redrawn so no need(shouldn't) use the previousPts.
+            previousPtsAlloc = false;
+            Iterator e = model.getList().iterator();
+
+            for (int i = 0; e.hasNext(); i++) {
+                SampleResult s = (SampleResult) e.next();
+
+                drawSample(i * PLOT_X_WIDTH, s, g);
+            }
+        }
+        log.debug("End : paintComponent1");
+    }
+
+    /**
+     * Clears this graph.
+     */
+    public void clearData() {
+        setNoLegendYet(true);
+        ((JPanel) visualizer.getWhiteCanvas()).removeAll();
+        previousPts = null;
+    }
+
+    private void drawSample(int x, SampleResult oneSample, Graphics g) {
+        log.debug("Start : drawSample1");
+
+        // Used to keep track of accumulated load times of components.
+        int lastLevel = 0;
+
+        // Number of components
+        int compCount = 0;
+
+        SampleResult[] resultList = oneSample.getSubResults();
+        int resultListCount = 0;
+
+        // Allocate previousPts only the first time
+        if (!previousPtsAlloc) {
+            resultListCount += resultList.length;
+            previousPts = new Point[resultListCount + 2];
+        }
+
+        Color currColor = Color.black;
+        JPanel lPanel = (JPanel) visualizer.getWhiteCanvas();
+        JPanel legendPanel = new JPanel();
+        GridBagLayout gridBag = new GridBagLayout();
+        GridBagConstraints gbc = new GridBagConstraints();
+
+        legendPanel.setLayout(gridBag);
+        lPanel.add(legendPanel);
+        Dimension d = this.getSize();
+
+        // Set the total time to load the sample
+        long totalTime = oneSample.getTime();
+
+        // If the page has other components then set the total time to be that
+        // including all its components' load time.
+        if (log.isDebugEnabled()) {
+            log.debug("drawSample1 : total time - " + totalTime);
+        }
+        int data = (int) (totalTime * d.height / model.getMax());
+
+        g.setColor(currColor);
+        if (!previousPtsAlloc) {
+            // If first dot, just draw the point.
+            g.drawLine(x % width, d.height - data, x % width, d.height - data - 1);
+        } else {
+            // Otherwise, draw from previous point.
+            g.drawLine((previousPts[0].x) % width, previousPts[0].y, x % width, d.height - data);
+        }
+
+        // Store current total time point
+        previousPts[0] = new Point(x % width, d.height - data);
+        if (noLegendYet) {
+            gbc.gridx = 0;
+            gbc.gridy = compCount++;
+            gbc.anchor = GridBagConstraints.WEST;
+            gbc.weightx = 1.0;
+            gbc.insets = new Insets(0, 10, 0, 0);
+            JLabel totalTimeLabel = new JLabel("Total time - " + oneSample.toString());
+
+            totalTimeLabel.setForeground(currColor);
+            gridBag.setConstraints(totalTimeLabel, gbc);
+            legendPanel.add(totalTimeLabel);
+        }
+
+        // Plot the time of the page itself without all its components
+        if (log.isDebugEnabled()) {
+            log.debug("drawSample1 : main page load time - " + oneSample.getTime());
+        }
+        data = (int) (oneSample.getTime() * d.height / model.getMax());
+        currColor = ColorHelper.changeColorCyclicIncrement(currColor, 40);
+        g.setColor(currColor);
+        if (!previousPtsAlloc) {
+            // If first dot, just draw the point
+            g.drawLine(x % width, d.height - data, x % width, d.height - data - 1);
+        } else {
+            // Otherwise, draw from previous point
+            g.drawLine((previousPts[1].x) % width, previousPts[1].y, x % width, d.height - data);
+        }
+        // Store load time without components
+        previousPts[1] = new Point(x % width, d.height - data);
+        if (noLegendYet) {
+            gbc.gridx = 0;
+            gbc.gridy = compCount++;
+            gbc.anchor = GridBagConstraints.WEST;
+            gbc.weightx = 1.0;
+            gbc.insets = new Insets(0, 10, 0, 0);
+            JLabel mainTimeLabel = new JLabel(oneSample.toString());
+
+            mainTimeLabel.setForeground(currColor);
+            gridBag.setConstraints(mainTimeLabel, gbc);
+            legendPanel.add(mainTimeLabel);
+        }
+        lastLevel += data;
+        // Plot the times of the total times components
+        int currPreviousPts = 2;
+
+        if (resultList != null) {
+            for (int i = 0; i < resultList.length; i++) {
+                SampleResult componentRes = resultList[i];
+
+                if (log.isDebugEnabled()) {
+                    log.debug("drawSample1 : componentRes - " + componentRes.getSampleLabel() + " loading time - "
+                            + componentRes.getTime());
+                }
+                data = (int) (componentRes.getTime() * d.height / model.getMax());
+                data += lastLevel;
+                currColor = ColorHelper.changeColorCyclicIncrement(currColor, 100);
+                g.setColor(currColor);
+                if (!previousPtsAlloc) {
+                    // If first dot, just draw the point
+                    g.drawLine(x % width, d.height - data, x % width, d.height - data - 1);
+                } else {
+                    // Otherwise, draw from previous point
+                    g.drawLine((previousPts[currPreviousPts].x) % width, previousPts[currPreviousPts].y, x % width,
+                            d.height - data);
+                }
+                // Store the current plot
+                previousPts[currPreviousPts++] = new Point(x % width, d.height - data);
+                if (noLegendYet) {
+                    gbc.gridx = 0;
+                    gbc.gridy = compCount++;
+                    gbc.anchor = GridBagConstraints.WEST;
+                    gbc.weightx = 1.0;
+                    gbc.insets = new Insets(0, 10, 0, 0);
+                    JLabel compTimeLabel = new JLabel(componentRes.getSampleLabel());
+
+                    compTimeLabel.setForeground(currColor);
+                    gridBag.setConstraints(compTimeLabel, gbc);
+                    legendPanel.add(compTimeLabel);
+                }
+                lastLevel = data;
+            }
+        }
+
+        if (noLegendYet) {
+            noLegendYet = false;
+            lPanel.repaint();
+            lPanel.revalidate();
+        }
+
+        // Set the previousPtsAlloc to true here and not after allocation
+        // because the rest of the codes also depend on previousPtsAlloc to be
+        // false if first time plotting the graph i.e. there are no previous
+        // points.
+        if (!previousPtsAlloc) {
+            previousPtsAlloc = true;
+        }
+        log.debug("End : drawSample1");
+    }
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumListener.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumListener.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumListener.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumListener.java Sun Jul  6 14:47:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.visualizers;
@@ -26,7 +26,7 @@
  */
 
 public interface GraphAccumListener {
-	public void updateGui(SampleResult s);
+    public void updateGui(SampleResult s);
 
-	public void updateGui();
+    public void updateGui();
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumModel.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumModel.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumModel.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumModel.java Sun Jul  6 14:47:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.visualizers;
@@ -31,167 +31,167 @@
 
 /**
  * The model that collects the average of the set of pages to be sampled.
- * 
+ *
  */
 
 public class GraphAccumModel implements Clearable, Serializable {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	protected String name;
+    protected String name;
 
-	protected List samples;
+    protected List samples;
 
-	protected List listeners;
+    protected List listeners;
 
-	protected long averageSum = 0;
-
-	protected long variationSum = 0;
-
-	protected long counter = 0;
-
-	protected long previous = 0;
-
-	protected long max = 1;
-
-	protected boolean bigChange = false;
-
-	protected SampleResult current;
-
-	/**
-	 * Constructor.
-	 */
-	public GraphAccumModel() {
-		log.debug("Start : GraphAccumModel1");
-		listeners = new LinkedList();
-		samples = Collections.synchronizedList(new LinkedList());
-		log.debug("End : GraphAccumModel1");
-	}
-
-	/**
-	 * Sets the Name attribute of the GraphModel object.
-	 * 
-	 * @param name
-	 *            the new Name value
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	/**
-	 * Gets the SampleCount attribute of the GraphAccumModel object.
-	 * 
-	 * @return the SampleCount value
-	 */
-	public int getSampleCount() {
-		return samples.size();
-	}
-
-	/**
-	 * Gets the List attribute of the GraphAccumModel object.
-	 * 
-	 * @return the List value
-	 */
-	public List getList() {
-		return samples;
-	}
-
-	/**
-	 * Gets the Name attribute of the GraphModel object.
-	 * 
-	 * @return the Name value
-	 */
-	public String getName() {
-		return name;
-	}
-
-	/**
-	 * Gets the Max attribute of the GraphAccumModel object.
-	 * 
-	 * @return the Max value
-	 */
-	public long getMax() {
-		log.debug("getMax1 : Returning - " + max);
-		return max;
-	}
-
-	/**
-	 * Adds a feature to the ModelListener attribute of the GraphAccumModel
-	 * object.
-	 * 
-	 * @param listener
-	 *            the feature to be added to the GraphAccumListener attribute.
-	 */
-	public void addGraphAccumListener(GraphAccumListener listener) {
-		listeners.add(listener);
-	}
-
-	/**
-	 * Clear the results.
-	 */
-	public void clearData() {
-		log.debug("Start : clear1");
-		samples.clear();
-		max = 1;
-		bigChange = true;
-		this.fireDataChanged();
-		log.debug("End : clear1");
-	}
-
-	/**
-	 * Add the new sample to the results.
-	 * 
-	 * @param res
-	 *            sample containing the results
-	 */
-	public void addNewSample(SampleResult res) {
-		log.debug("Start : addNewSample1");
-		// Set time to time taken to load this url without components (e.g.
-		// images etc)
-		long totalTime = res.getTime();
-
-		if (log.isDebugEnabled()) {
-			log.debug("addNewSample1 : time - " + totalTime);
-			log.debug("addNewSample1 : max - " + max);
-		}
-		if (totalTime > max) {
-			bigChange = true;
-			max = totalTime;
-		}
-		current = res;
-		samples.add(res);
-		log.debug("End : addNewSample1");
-		fireDataChanged();
-	}
-
-	/**
-	 * Depending on whether the graph needs to be rescale call the appropriate
-	 * methods.
-	 */
-	protected void fireDataChanged() {
-		log.debug("Start : fireDataChanged1");
-		Iterator iter = listeners.iterator();
-
-		if (bigChange) {
-			while (iter.hasNext()) {
-				((GraphAccumListener) iter.next()).updateGui();
-			}
-			bigChange = false;
-		} else {
-			quickUpdate(current);
-		}
-		log.debug("End : fireDataChanged1");
-	}
-
-	/**
-	 * The sample to be added did not exceed the current set of samples so do
-	 * not need to rescale graph.
-	 */
-	protected void quickUpdate(SampleResult s) {
-		Iterator iter = listeners.iterator();
-		{
-			while (iter.hasNext()) {
-				((GraphAccumListener) iter.next()).updateGui(s);
-			}
-		}
-	}
+    protected long averageSum = 0;
+
+    protected long variationSum = 0;
+
+    protected long counter = 0;
+
+    protected long previous = 0;
+
+    protected long max = 1;
+
+    protected boolean bigChange = false;
+
+    protected SampleResult current;
+
+    /**
+     * Constructor.
+     */
+    public GraphAccumModel() {
+        log.debug("Start : GraphAccumModel1");
+        listeners = new LinkedList();
+        samples = Collections.synchronizedList(new LinkedList());
+        log.debug("End : GraphAccumModel1");
+    }
+
+    /**
+     * Sets the Name attribute of the GraphModel object.
+     *
+     * @param name
+     *            the new Name value
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Gets the SampleCount attribute of the GraphAccumModel object.
+     *
+     * @return the SampleCount value
+     */
+    public int getSampleCount() {
+        return samples.size();
+    }
+
+    /**
+     * Gets the List attribute of the GraphAccumModel object.
+     *
+     * @return the List value
+     */
+    public List getList() {
+        return samples;
+    }
+
+    /**
+     * Gets the Name attribute of the GraphModel object.
+     *
+     * @return the Name value
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Gets the Max attribute of the GraphAccumModel object.
+     *
+     * @return the Max value
+     */
+    public long getMax() {
+        log.debug("getMax1 : Returning - " + max);
+        return max;
+    }
+
+    /**
+     * Adds a feature to the ModelListener attribute of the GraphAccumModel
+     * object.
+     *
+     * @param listener
+     *            the feature to be added to the GraphAccumListener attribute.
+     */
+    public void addGraphAccumListener(GraphAccumListener listener) {
+        listeners.add(listener);
+    }
+
+    /**
+     * Clear the results.
+     */
+    public void clearData() {
+        log.debug("Start : clear1");
+        samples.clear();
+        max = 1;
+        bigChange = true;
+        this.fireDataChanged();
+        log.debug("End : clear1");
+    }
+
+    /**
+     * Add the new sample to the results.
+     *
+     * @param res
+     *            sample containing the results
+     */
+    public void addNewSample(SampleResult res) {
+        log.debug("Start : addNewSample1");
+        // Set time to time taken to load this url without components (e.g.
+        // images etc)
+        long totalTime = res.getTime();
+
+        if (log.isDebugEnabled()) {
+            log.debug("addNewSample1 : time - " + totalTime);
+            log.debug("addNewSample1 : max - " + max);
+        }
+        if (totalTime > max) {
+            bigChange = true;
+            max = totalTime;
+        }
+        current = res;
+        samples.add(res);
+        log.debug("End : addNewSample1");
+        fireDataChanged();
+    }
+
+    /**
+     * Depending on whether the graph needs to be rescale call the appropriate
+     * methods.
+     */
+    protected void fireDataChanged() {
+        log.debug("Start : fireDataChanged1");
+        Iterator iter = listeners.iterator();
+
+        if (bigChange) {
+            while (iter.hasNext()) {
+                ((GraphAccumListener) iter.next()).updateGui();
+            }
+            bigChange = false;
+        } else {
+            quickUpdate(current);
+        }
+        log.debug("End : fireDataChanged1");
+    }
+
+    /**
+     * The sample to be added did not exceed the current set of samples so do
+     * not need to rescale graph.
+     */
+    protected void quickUpdate(SampleResult s) {
+        Iterator iter = listeners.iterator();
+        {
+            while (iter.hasNext()) {
+                ((GraphAccumListener) iter.next()).updateGui(s);
+            }
+        }
+    }
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumVisualizer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumVisualizer.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumVisualizer.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphAccumVisualizer.java Sun Jul  6 14:47:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.visualizers;
@@ -42,145 +42,145 @@
  * This class implements a statistical analyser that plots the accumulated time
  * taken to load each set of pages. The number of plots is equivalent to the
  * number of times the set of pages is configured to load.
- * 
- * 
+ *
+ *
  * Created 2001/08/11
  */
 public class GraphAccumVisualizer extends AbstractVisualizer implements ImageVisualizer, GraphAccumListener, Clearable {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	protected transient GraphAccumModel model;
+    protected transient GraphAccumModel model;
 
-	protected transient GraphAccum graph;
+    protected transient GraphAccum graph;
 
-	protected transient JPanel legendPanel;
+    protected transient JPanel legendPanel;
 
-	/**
-	 * Constructor.
-	 */
-	public GraphAccumVisualizer() {
-		super();
-		model = new GraphAccumModel();
-		model.addGraphAccumListener(this);
-		init();
-		log.debug("Start : GraphAccumVisualizer1");
-		log.debug("End : GraphAccumVisualizer1");
-	}
-
-	public String getLabelResource() {
-		return "graph_full_results_title"; // $NON-NLS-1$
-	}
-
-	public void add(SampleResult res) {
-		model.addNewSample(res);
-	}
-
-	/**
-	 * Returns the panel where labels can be added.
-	 * 
-	 * @return a panel where labels can be added
-	 */
-	public Object getWhiteCanvas() {
-		return legendPanel;
-	}
-
-	/**
-	 * Gets the Image attribute of the GraphVisualizer object.
-	 * 
-	 * @return the Image value
-	 */
-	public Image getImage() {
-		log.debug("Start : getImage1");
-		Image result = graph.createImage(graph.getWidth(), graph.getHeight());
-
-		graph.paintComponent(result.getGraphics());
-		log.debug("End : getImage1");
-		return result;
-	}
-
-	/**
-	 * Updates the gui to reflect changes.
-	 */
-	public void updateGui() {
-		log.debug("Start : updateGui1");
-		graph.updateGui();
-		log.debug("End : updateGui1");
-	}
-
-	/**
-	 * Updates gui to reflect small changes.
-	 * 
-	 * @param s
-	 *            sample to be added to plot
-	 */
-	public void updateGui(SampleResult s) {
-		log.debug("Start : updateGui2");
-		log.debug("End : updateGui2");
-	}
-
-	/**
-	 * Clear this visualizer data.
-	 */
-	public synchronized void clearData() {
-		model.clearData();
-		graph.clearData();
-		log.debug("Start : clear1");
-		repaint();
-		log.debug("End : clear1");
-	}
-
-	/**
-	 * Returns a description of this instance.
-	 * 
-	 * @return description of this instance
-	 */
-	public String toString() {
-		String toString = "Show the samples analysys as dot plots";
-
-		log.debug("toString1 : Returning - " + toString);
-		return toString;
-	}
-
-	/**
-	 * Setup all the swing components.
-	 */
-	private void init() {
-		log.debug("Start : init1");
-		graph = new GraphAccum(model);
-		graph.setVisualizer(this);
-
-		this.setLayout(new BorderLayout());
-
-		// MAIN PANEL
-		JPanel mainPanel = new JPanel();
-		Border margin = new EmptyBorder(10, 10, 5, 10);
-
-		mainPanel.setBorder(margin);
-		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
-
-		// TITLE
-		JLabel panelTitleLabel = new JLabel(JMeterUtils.getResString("graph_full_results_title")); // $NON-NLS-1$
-		Font curFont = panelTitleLabel.getFont();
-		int curFontSize = curFont.getSize();
-
-		curFontSize += 4;
-		panelTitleLabel.setFont(new Font(curFont.getFontName(), curFont.getStyle(), curFontSize));
-		mainPanel.add(panelTitleLabel);
-
-		mainPanel.add(getNamePanel());
-		mainPanel.add(getFilePanel());
-
-		JScrollPane graphScrollPanel = new JScrollPane(graph, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
-				JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
-
-		graphScrollPanel.setViewportBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
-		legendPanel = new JPanel();
-
-		JScrollPane legendScrollPanel = new JScrollPane(legendPanel);
-		JSplitPane graphSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, graphScrollPanel, legendScrollPanel);
-
-		this.add(mainPanel, BorderLayout.NORTH);
-		this.add(graphSplitPane, BorderLayout.CENTER);
-		log.debug("End : init1");
-	}
+    /**
+     * Constructor.
+     */
+    public GraphAccumVisualizer() {
+        super();
+        model = new GraphAccumModel();
+        model.addGraphAccumListener(this);
+        init();
+        log.debug("Start : GraphAccumVisualizer1");
+        log.debug("End : GraphAccumVisualizer1");
+    }
+
+    public String getLabelResource() {
+        return "graph_full_results_title"; // $NON-NLS-1$
+    }
+
+    public void add(SampleResult res) {
+        model.addNewSample(res);
+    }
+
+    /**
+     * Returns the panel where labels can be added.
+     *
+     * @return a panel where labels can be added
+     */
+    public Object getWhiteCanvas() {
+        return legendPanel;
+    }
+
+    /**
+     * Gets the Image attribute of the GraphVisualizer object.
+     *
+     * @return the Image value
+     */
+    public Image getImage() {
+        log.debug("Start : getImage1");
+        Image result = graph.createImage(graph.getWidth(), graph.getHeight());
+
+        graph.paintComponent(result.getGraphics());
+        log.debug("End : getImage1");
+        return result;
+    }
+
+    /**
+     * Updates the gui to reflect changes.
+     */
+    public void updateGui() {
+        log.debug("Start : updateGui1");
+        graph.updateGui();
+        log.debug("End : updateGui1");
+    }
+
+    /**
+     * Updates gui to reflect small changes.
+     *
+     * @param s
+     *            sample to be added to plot
+     */
+    public void updateGui(SampleResult s) {
+        log.debug("Start : updateGui2");
+        log.debug("End : updateGui2");
+    }
+
+    /**
+     * Clear this visualizer data.
+     */
+    public synchronized void clearData() {
+        model.clearData();
+        graph.clearData();
+        log.debug("Start : clear1");
+        repaint();
+        log.debug("End : clear1");
+    }
+
+    /**
+     * Returns a description of this instance.
+     *
+     * @return description of this instance
+     */
+    public String toString() {
+        String toString = "Show the samples analysys as dot plots";
+
+        log.debug("toString1 : Returning - " + toString);
+        return toString;
+    }
+
+    /**
+     * Setup all the swing components.
+     */
+    private void init() {
+        log.debug("Start : init1");
+        graph = new GraphAccum(model);
+        graph.setVisualizer(this);
+
+        this.setLayout(new BorderLayout());
+
+        // MAIN PANEL
+        JPanel mainPanel = new JPanel();
+        Border margin = new EmptyBorder(10, 10, 5, 10);
+
+        mainPanel.setBorder(margin);
+        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+
+        // TITLE
+        JLabel panelTitleLabel = new JLabel(JMeterUtils.getResString("graph_full_results_title")); // $NON-NLS-1$
+        Font curFont = panelTitleLabel.getFont();
+        int curFontSize = curFont.getSize();
+
+        curFontSize += 4;
+        panelTitleLabel.setFont(new Font(curFont.getFontName(), curFont.getStyle(), curFontSize));
+        mainPanel.add(panelTitleLabel);
+
+        mainPanel.add(getNamePanel());
+        mainPanel.add(getFilePanel());
+
+        JScrollPane graphScrollPanel = new JScrollPane(graph, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
+                JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+
+        graphScrollPanel.setViewportBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
+        legendPanel = new JPanel();
+
+        JScrollPane legendScrollPanel = new JScrollPane(legendPanel);
+        JSplitPane graphSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, graphScrollPanel, legendScrollPanel);
+
+        this.add(mainPanel, BorderLayout.NORTH);
+        this.add(graphSplitPane, BorderLayout.CENTER);
+        log.debug("End : init1");
+    }
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphListener.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphListener.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphListener.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphListener.java Sun Jul  6 14:47:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.visualizers;
@@ -24,7 +24,7 @@
  */
 
 public interface GraphListener {
-	public void updateGui(Sample s);
+    public void updateGui(Sample s);
 
-	public void updateGui();
+    public void updateGui();
 }



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