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 kh...@apache.org on 2001/10/08 01:41:00 UTC

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

khammond    01/10/07 16:41:00

  Modified:    src/org/apache/jmeter/visualizers ViewResultsVisualizer.java
  Log:
  New GUI style.
  
  Revision  Changes    Path
  1.17      +121 -93   jakarta-jmeter/src/org/apache/jmeter/visualizers/ViewResultsVisualizer.java
  
  Index: ViewResultsVisualizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/ViewResultsVisualizer.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ViewResultsVisualizer.java	2001/09/05 15:12:58	1.16
  +++ ViewResultsVisualizer.java	2001/10/07 23:41:00	1.17
  @@ -52,14 +52,18 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   package org.apache.jmeter.visualizers;
   
   import java.awt.*;
   import java.util.*;
   import java.awt.event.*;
   import javax.swing.*;
  +import javax.swing.border.*;
  +
   import org.apache.jmeter.reporters.ResultCollector;
   import org.apache.jmeter.gui.*;
  +import org.apache.jmeter.util.JMeterUtils;
   import org.apache.jmeter.samplers.Clearable;
   
   /************************************************************
  @@ -67,100 +71,124 @@
    *  also allows to "single step through" the sampling process via a nice
    *  "Continue" button.
    *
  - *@author     $Author: bloritsch $
  - *@created    $Date: 2001/09/05 15:12:58 $
  - *@version    $Revision: 1.16 $ $Date: 2001/09/05 15:12:58 $
  + *@author     $Author: khammond $
  + *@created    $Date: 2001/10/07 23:41:00 $
  + *@version    $Revision: 1.17 $ $Date: 2001/10/07 23:41:00 $
    ***********************************************************/
   public class ViewResultsVisualizer extends JPanel implements ModelSupported, ActionListener,Clearable
   {
  -
  -    private JTextArea display;
  -    private JButton next;
  -    private JTextField label;
  -    private ResultCollector model;
  -
  -    /************************************************************
  -     *  !ToDo (Constructor description)
  -     ***********************************************************/
  -    public ViewResultsVisualizer()
  -    {
  -        super();
  -    }
  -
  -    public void setModel(Object model)
  -    {
  -        this.model = (ResultCollector)model;
  -        this.model.setListener(this);
  -        init();
  -    }
  -
  -    private void init()
  -    {
  -        label = new JTextField();
  -        display = new JTextArea();
  -        next = new JButton("Next");
  -        next.addActionListener(this);
  -        setLayout(new GridBagLayout());
  -        GridBagConstraints gbc = new GridBagConstraints();
  -        gbc.gridx = gbc.gridy = 0;
  -        gbc.fill = gbc.BOTH;
  -        gbc.weightx = 1;
  -        gbc.weighty = 0;
  -        this.add(label, gbc.clone());
  -
  -        gbc.gridy++;
  -        gbc.weighty = 1;
  -        this.add(new JScrollPane(display), gbc.clone());
  -
  -        gbc.gridy++;
  -        gbc.fill = gbc.NONE;
  -        gbc.weightx = gbc.weighty = 0;
  -        gbc.anchor = gbc.CENTER;
  -        this.add(next, gbc.clone());
  -    }
  -
  -    /************************************************************
  -     *  !ToDoo (Method description)
  -     *
  -     *@return    !ToDo (Return description)
  -     ***********************************************************/
  -    public void updateGui()
  -    {
  -        if(label.getText().equals(""))
  -        {
  -            model.next();
  -            label.setText(model.getSampleLabel());
  -            display.setText(model.getTextResponse());
  -        }
  -    }
  -
  -    /************************************************************
  -     *  !ToDo (Method description)
  -     ***********************************************************/
  -    public void clear()
  -    {
  -        label.setText("");
  -        display.setText("");
  -    }
  -
  -    /************************************************************
  -     *  !ToDo (Method description)
  -     *
  -     *@param  e  !ToDo (Parameter description)
  -     ***********************************************************/
  -    public void actionPerformed(ActionEvent e)
  -    {
  -        label.setText("");
  -        updateGui();
  -    }
  -
  -    /************************************************************
  -     *  !ToDo (Method description)
  -     *
  -     *@return    !ToDo (Return description)
  -     ***********************************************************/
  -    public String toString()
  -    {
  -        return "Show text response from sample";
  -    }
  +	private JTextArea display;
  +	private JButton next;
  +	private JTextField label;
  +	private ResultCollector model;
  +
  +	/************************************************************
  +	*  !ToDo (Constructor description)
  +	***********************************************************/
  +	public ViewResultsVisualizer()
  +	{
  +		super();
  +	}
  +
  +	public void setModel(Object model)
  +	{
  +		this.model = (ResultCollector)model;
  +		this.model.setListener(this);
  +		init();
  +	}
  +
  +	private void init()
  +	{
  +		this.setLayout(new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP));
  +
  +		// MAIN PANEL
  +		JPanel mainPanel = new JPanel();
  +		Border margin = new EmptyBorder(10, 10, 5, 10);
  +		mainPanel.setBorder(margin);
  +		mainPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
  +
  +		// TITLE
  +		JLabel panelTitleLabel = new JLabel(JMeterUtils.getResString("view_results_title"));
  +		Font curFont = panelTitleLabel.getFont();
  +		int curFontSize = curFont.getSize();
  +		curFontSize += 4;
  +		panelTitleLabel.setFont(new Font(curFont.getFontName(), curFont.getStyle(), curFontSize));
  +		mainPanel.add(panelTitleLabel);
  +
  +		// NAME
  +		mainPanel.add(new NamePanel(model));
  +
  +		// INNER PANEL
  +		JPanel innerPanel = new JPanel();
  +		innerPanel.setPreferredSize(new Dimension(640, 480));
  +		label = new JTextField();
  +		display = new JTextArea();
  +		next = new JButton("Next");
  +		next.addActionListener(this);
  +		innerPanel.setLayout(new GridBagLayout());
  +		GridBagConstraints gbc = new GridBagConstraints();
  +		gbc.gridx = gbc.gridy = 0;
  +		gbc.fill = gbc.BOTH;
  +		gbc.weightx = 1;
  +		gbc.weighty = 0;
  +		innerPanel.add(label, gbc.clone());
  +
  +		gbc.gridy++;
  +		gbc.weighty = 1;
  +		innerPanel.add(new JScrollPane(display), gbc.clone());
  +
  +		gbc.gridy++;
  +		gbc.fill = gbc.NONE;
  +		gbc.weightx = gbc.weighty = 0;
  +		gbc.anchor = gbc.CENTER;
  +		innerPanel.add(next, gbc.clone());
  +
  +		mainPanel.add(innerPanel);
  +		this.add(mainPanel);
  +	}
  +
  +	/************************************************************
  +	*  !ToDoo (Method description)
  +	*
  +	*@return    !ToDo (Return description)
  +	***********************************************************/
  +	public void updateGui()
  +	{
  +		if(label.getText().equals(""))
  +		{
  +			model.next();
  +			label.setText(model.getSampleLabel());
  +			display.setText(model.getTextResponse());
  +		}
  +	}
  +
  +	/************************************************************
  +	*  !ToDo (Method description)
  +	***********************************************************/
  +	public void clear()
  +	{
  +		label.setText("");
  +		display.setText("");
  +	}
  +
  +	/************************************************************
  +	*  !ToDo (Method description)
  +	*
  +	*@param  e  !ToDo (Parameter description)
  +	***********************************************************/
  +	public void actionPerformed(ActionEvent e)
  +	{
  +		label.setText("");
  +		updateGui();
  +	}
  +
  +	/************************************************************
  +	*  !ToDo (Method description)
  +	*
  +	*@return    !ToDo (Return description)
  +	***********************************************************/
  +	public String toString()
  +	{
  +		return "Show text response from sample";
  +	}
   }
  
  
  

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