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 ms...@apache.org on 2002/06/15 04:44:39 UTC

cvs commit: jakarta-jmeter/xdocs/usermanual build-web-test-plan.xml

mstover1    2002/06/14 19:44:39

  Modified:    docs     running.html
               docs/usermanual build-web-test-plan.html
               src_1/org/apache/jmeter/gui NamePanel.java
               src_1/org/apache/jmeter/protocol/http/proxy/gui
                        ProxyControlGui.java
               xdocs/usermanual build-web-test-plan.xml
  Log:
  Improving ProxyControl GUI
  
  Revision  Changes    Path
  1.42      +0 -0      jakarta-jmeter/docs/running.html
  
  Index: running.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/docs/running.html,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  
  
  
  1.17      +1 -1      jakarta-jmeter/docs/usermanual/build-web-test-plan.html
  
  Index: build-web-test-plan.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/docs/usermanual/build-web-test-plan.html,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- build-web-test-plan.html	13 Jun 2002 00:45:15 -0000	1.16
  +++ build-web-test-plan.html	15 Jun 2002 02:44:38 -0000	1.17
  @@ -96,7 +96,7 @@
   												<a href="../usermanual/component_reference.html#HTTP_Request_Defaults">HTTP Request Defaults</a>
   									, and
   
  -												<a href="../usermanual/component_reference.html#File_Reporter">File Reporter</a>
  +												<a href="../usermanual/component_reference.html#Graph_Results">Graph Results</a>
   									.
   						</p>
   							  									 				<p	>
  
  
  
  1.5       +9 -4      jakarta-jmeter/src_1/org/apache/jmeter/gui/NamePanel.java
  
  Index: NamePanel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/gui/NamePanel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NamePanel.java	29 Apr 2002 17:08:08 -0000	1.4
  +++ NamePanel.java	15 Jun 2002 02:44:38 -0000	1.5
  @@ -53,9 +53,13 @@
    * <http://www.apache.org/>.
    */
   package org.apache.jmeter.gui;
  -import java.awt.event.*;
  -import java.util.*;
  -import javax.swing.*;
  +import java.awt.FlowLayout;
  +import java.util.Collection;
  +
  +import javax.swing.JLabel;
  +import javax.swing.JPanel;
  +import javax.swing.JPopupMenu;
  +import javax.swing.JTextField;
   import org.apache.jmeter.testelement.TestElement;
   import org.apache.jmeter.testelement.WorkBench;
   import org.apache.jmeter.util.JMeterUtils;
  @@ -159,6 +163,7 @@
   
   	private void init()
   	{
  +		this.setLayout(new FlowLayout(FlowLayout.LEFT));
   		this.add(new JLabel(JMeterUtils.getResString("name")));
   		this.add(nameField);
   	}
  
  
  
  1.4       +164 -84   jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
  
  Index: ProxyControlGui.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProxyControlGui.java	29 Apr 2002 17:08:11 -0000	1.3
  +++ ProxyControlGui.java	15 Jun 2002 02:44:38 -0000	1.4
  @@ -53,21 +53,41 @@
    * <http://www.apache.org/>.
    */
   package org.apache.jmeter.protocol.http.proxy.gui;
  +import java.awt.BorderLayout;
  +import java.awt.FlowLayout;
   import java.awt.Font;
  -import java.awt.Dimension;
  -import java.awt.event.*;
  -import javax.swing.*;
  -import javax.swing.border.*;
  -import org.apache.jmeter.gui.JMeterJListModel;
  +import java.awt.GridBagConstraints;
  +import java.awt.GridBagLayout;
  +import java.awt.event.ActionEvent;
  +import java.awt.event.ActionListener;
  +import java.awt.event.FocusEvent;
  +import java.awt.event.FocusListener;
  +import java.awt.event.KeyEvent;
  +import java.awt.event.KeyListener;
  +import java.util.Arrays;
  +import java.util.Collection;
  +import java.util.Iterator;
  +import java.util.LinkedList;
  +import java.util.List;
  +
  +import javax.swing.BorderFactory;
  +import javax.swing.JButton;
  +import javax.swing.JLabel;
  +import javax.swing.JOptionPane;
  +import javax.swing.JPanel;
  +import javax.swing.JPopupMenu;
  +import javax.swing.JScrollPane;
  +import javax.swing.JTable;
  +import javax.swing.JTextField;
  +import javax.swing.border.Border;
  +import javax.swing.border.EmptyBorder;
   import org.apache.jmeter.gui.JMeterGUIComponent;
   import org.apache.jmeter.gui.NamePanel;
  -import org.apache.jmeter.gui.util.VerticalLayout;
  -import org.apache.jmeter.protocol.http.proxy.ProxyControl;
  -import org.apache.jmeter.util.JMeterUtils;
   import org.apache.jmeter.gui.util.MenuFactory;
  -import java.util.*;
  +import org.apache.jmeter.gui.util.PowerTableModel;
  +import org.apache.jmeter.protocol.http.proxy.ProxyControl;
   import org.apache.jmeter.testelement.TestElement;
  -import org.apache.jmeter.config.ConfigTestElement;
  +import org.apache.jmeter.util.JMeterUtils;
   
   /****************************************
    * Title: Jakarta-JMeter Description: Copyright: Copyright (c) 2001 Company:
  @@ -79,28 +99,30 @@
    ***************************************/
   
   public class ProxyControlGui extends JPanel implements JMeterGUIComponent, ActionListener,
  -		KeyListener
  +		KeyListener,FocusListener
   {
   
   	NamePanel namePanel;
   	JTextField portField;
   
  -	JTextField addIncludeField;
  -	JList includeList;
  -	JButton clearInclude;
   	ProxyControl model;
   
  -	JTextField addExcludeField;
  -	JList excludeList;
  -	JButton clearExclude;
  +	JTable excludeTable;
  +	PowerTableModel excludeModel;
  +	JTable includeTable;
  +	PowerTableModel includeModel;
  +	JButton addExclude,deleteExclude,addInclude,deleteInclude;
   
   	JButton stop, start;
   	private final static String STOP = "stop";
   	private final static String START = "start";
   	private final static String ADD_INCLUDE = "add_include";
   	private final static String ADD_EXCLUDE = "add_exclude";
  -	private final static String CLEAR_INCLUDE = "clear_include";
  -	private final static String CLEAR_EXCLUDE = "clear_exclude";
  +	private final static String DELETE_INCLUDE = "delete_include";
  +	private final static String DELETE_EXCLUDE = "delete_exclude";
  +	
  +	private final static String INCLUDE_COL = JMeterUtils.getResString("patterns_to_include");
  +	private final static String EXCLUDE_COL = JMeterUtils.getResString("patterns_to_exclude");
   
   	/****************************************
   	 * !ToDo (Constructor description)
  @@ -122,13 +144,36 @@
   		ProxyControl element = new ProxyControl();
   		element.setProperty(TestElement.NAME,getName());
   		element.setPort(Integer.parseInt(portField.getText()));
  -		element.setIncludeList(((JMeterJListModel)includeList.getModel()).getData());
  -		element.setExcludeList(((JMeterJListModel)excludeList.getModel()).getData());
  +		setIncludeListInProxyControl(element);
  +		setExcludeListInProxyControl(element);
   		element.setProperty(TestElement.GUI_CLASS, this.getClass().getName());
   		element.setProperty(TestElement.TEST_CLASS, element.getClass().getName());
   		return element;
   	}
   
  +	private void setIncludeListInProxyControl(ProxyControl element) {
  +		List includeList = getDataList(includeModel,INCLUDE_COL);
  +		element.setIncludeList(includeList);
  +	}
  +	
  +	private void setExcludeListInProxyControl(ProxyControl element)
  +	{
  +		List excludeList = getDataList(excludeModel,EXCLUDE_COL);
  +		element.setExcludeList(excludeList);
  +	}
  +
  +	private List getDataList(PowerTableModel model,String colName) {
  +		String[] dataArray = model.getData().getColumn(colName);
  +		List list = new LinkedList();
  +		for(int i = 0;i < dataArray.length;i++)
  +		{
  +			list.add(dataArray[i]);
  +		}
  +		return list;
  +	}
  +	
  +	
  +
   	public void setName(String name)
   	{
   		super.setName(name);
  @@ -155,8 +200,24 @@
   		ProxyControl el = (ProxyControl)element;
   		setName(element.getProperty(TestElement.NAME).toString());
   		portField.setText(element.getProperty(ProxyControl.PORT).toString());
  -		((JMeterJListModel)includeList.getModel()).setData(el.getIncludePatterns());
  -		((JMeterJListModel)excludeList.getModel()).setData(el.getExcludePatterns());
  +		populateTable(includeModel,el.getIncludePatterns().iterator());
  +		populateTable(excludeModel,el.getExcludePatterns().iterator());
  +	}
  +
  +	private void populateTable(PowerTableModel model,Iterator iter) {
  +		while(iter.hasNext())
  +		{
  +			model.addRow(new Object[]{iter.next()});
  +		}
  +	}
  +	
  +	public void focusLost(FocusEvent e)
  +	{
  +		((JTable)e.getSource()).getCellEditor().stopCellEditing();
  +	}
  +	
  +	public void focusGained(FocusEvent e)
  +	{
   	}
   
   	/****************************************
  @@ -183,23 +244,23 @@
   		}
   		else if(command.equals(this.ADD_EXCLUDE))
   		{
  -			String exclude = addExcludeField.getText();
  -			addExcludeField.setText("");
  -			((JMeterJListModel)excludeList.getModel()).addItem(exclude);
  +			excludeModel.addNewRow();
  +			excludeModel.fireTableDataChanged();
   		}
   		else if(command.equals(this.ADD_INCLUDE))
   		{
  -			String include = addIncludeField.getText();
  -			addIncludeField.setText("");
  -			((JMeterJListModel)includeList.getModel()).addItem(include);
  +			includeModel.addNewRow();
  +			includeModel.fireTableDataChanged();
   		}
  -		else if(command.equals(this.CLEAR_EXCLUDE))
  +		else if(command.equals(this.DELETE_EXCLUDE))
   		{
  -			((JMeterJListModel)excludeList.getModel()).clear();
  +			excludeModel.removeRow(excludeTable.getSelectedRow());
  +			excludeModel.fireTableDataChanged();
   		}
  -		else if(command.equals(this.CLEAR_INCLUDE))
  +		else if(command.equals(this.DELETE_INCLUDE))
   		{
  -			((JMeterJListModel)includeList.getModel()).clear();
  +			includeModel.removeRow(includeTable.getSelectedRow());
  +			includeModel.fireTableDataChanged();
   		}
   	}
   
  @@ -254,13 +315,25 @@
   
   	private void init()
   	{
  -		this.setLayout(new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP));
  +		this.setLayout(new GridBagLayout());
  +		GridBagConstraints gbc = new GridBagConstraints();
  +		gbc.anchor = gbc.WEST;
  +		gbc.fill = gbc.BOTH;
  +		gbc.gridheight = 1;
  +		gbc.gridwidth = 1;
  +		gbc.gridx = 0;
  +		gbc.gridy = 0;
  +		gbc.weightx = 1;
  +		gbc.weighty = 1;
   
   		// MAIN PANEL
   		JPanel mainPanel = new JPanel();
  +		add(mainPanel,gbc.clone());
   		Border margin = new EmptyBorder(10, 10, 5, 10);
   		mainPanel.setBorder(margin);
  -		mainPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
  +		mainPanel.setLayout(new GridBagLayout());
  +		//gbc.fill = gbc.NONE;
  +		gbc.weighty = 0;
   
   		// TITLE
   		JLabel panelTitleLabel = new JLabel(JMeterUtils.getResString("proxy_title"));
  @@ -268,17 +341,24 @@
   		int curFontSize = curFont.getSize();
   		curFontSize += 4;
   		panelTitleLabel.setFont(new Font(curFont.getFontName(), curFont.getStyle(), curFontSize));
  -		mainPanel.add(panelTitleLabel);
  +		mainPanel.add(panelTitleLabel,gbc.clone());
  +		gbc.gridy++;
   
   		// NAME
  -		mainPanel.add(namePanel);
  -
  -		mainPanel.add(createPortPanel());
  -		mainPanel.add(createIncludePanel());
  -		mainPanel.add(createExcludePanel());
  -		mainPanel.add(createControls());
  +		mainPanel.add(namePanel,gbc.clone());
  +		gbc.gridy++;
   
  -		this.add(mainPanel);
  +		mainPanel.add(createPortPanel(),gbc.clone());
  +		gbc.gridy++;
  +		gbc.fill = gbc.BOTH;
  +		gbc.weighty = .5;
  +		mainPanel.add(createIncludePanel(),gbc.clone());
  +		gbc.gridy++;
  +		mainPanel.add(createExcludePanel(),gbc.clone());
  +		gbc.gridy++;
  +		gbc.fill = gbc.NONE;
  +		gbc.weighty = 0;
  +		mainPanel.add(createControls(),gbc.clone());
   
   	}
   
  @@ -304,7 +384,7 @@
   
   	private JPanel createPortPanel()
   	{
  -		JPanel panel = new JPanel();
  +		JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   
   		panel.add(new JLabel(JMeterUtils.getResString("port")));
   
  @@ -313,59 +393,59 @@
   		portField.addKeyListener(this);
   		portField.setText("8080");
   		panel.add(portField);
  -
  +		panel.revalidate();
   		return panel;
   	}
   
   	private JPanel createIncludePanel()
   	{
  -		JPanel panel = new JPanel();
  +		JPanel panel = new JPanel(new BorderLayout());
   		panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
   				JMeterUtils.getResString("patterns_to_include")));
  -		panel.add(new JLabel(JMeterUtils.getResString("add_pattern")));
  -
  -		addIncludeField = new JTextField(15);
  -		addIncludeField.addActionListener(this);
  -		addIncludeField.setActionCommand(ADD_INCLUDE);
  -		panel.add(addIncludeField);
  -
  -		includeList = new JList(new JMeterJListModel());
  -		includeList.setMinimumSize(new Dimension(20, 10));
  -		includeList.setBorder(BorderFactory.createEtchedBorder());
  -		includeList.setVisibleRowCount(3);
  -		panel.add(includeList);
  -
  -		clearInclude = new JButton(JMeterUtils.getResString("clear"));
  -		clearInclude.addActionListener(this);
  -		clearInclude.setActionCommand(CLEAR_INCLUDE);
  -		panel.add(clearInclude);
  -
  +		includeTable = new JTable();
  +		includeModel = new PowerTableModel(new String[]{INCLUDE_COL},
  +					new Class[]{String.class});
  +		JScrollPane scroller = new JScrollPane(includeTable);
  +		scroller.setBackground(panel.getBackground());
  +		includeTable.setModel(includeModel);
  +		addInclude = new JButton(JMeterUtils.getResString("add"));
  +		deleteInclude = new JButton(JMeterUtils.getResString("delete"));
  +		addInclude.setActionCommand(ADD_INCLUDE);
  +		deleteInclude.setActionCommand(DELETE_INCLUDE);
  +		addInclude.addActionListener(this);
  +		deleteInclude.addActionListener(this);
  +		panel.add(scroller,BorderLayout.CENTER);
  +		JPanel buttonPanel = new JPanel();
  +		buttonPanel.add(addInclude);
  +		buttonPanel.add(deleteInclude);
  +		panel.add(buttonPanel,BorderLayout.SOUTH);
  +		includeTable.addFocusListener(this);
   		return panel;
   	}
   
   	private JPanel createExcludePanel()
   	{
  -		JPanel panel = new JPanel();
  +		JPanel panel = new JPanel(new BorderLayout());
   		panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
   				JMeterUtils.getResString("patterns_to_exclude")));
  -		panel.add(new JLabel(JMeterUtils.getResString("add_pattern")));
  -
  -		addExcludeField = new JTextField(15);
  -		addExcludeField.addActionListener(this);
  -		addExcludeField.setActionCommand(ADD_EXCLUDE);
  -		panel.add(addExcludeField);
  -
  -		excludeList = new JList(new JMeterJListModel());
  -		excludeList.setMinimumSize(new Dimension(20, 10));
  -		excludeList.setBorder(BorderFactory.createEtchedBorder());
  -		excludeList.setVisibleRowCount(3);
  -		panel.add(excludeList);
  -
  -		clearExclude = new JButton(JMeterUtils.getResString("clear"));
  -		clearExclude.addActionListener(this);
  -		clearExclude.setActionCommand(CLEAR_EXCLUDE);
  -		panel.add(clearExclude);
  -
  +		excludeTable = new JTable();
  +		excludeModel = new PowerTableModel(new String[]{EXCLUDE_COL},
  +					new Class[]{String.class});
  +		JScrollPane scroller = new JScrollPane(excludeTable);
  +		scroller.setBackground(panel.getBackground());
  +		excludeTable.setModel(excludeModel);
  +		addExclude = new JButton(JMeterUtils.getResString("add"));
  +		deleteExclude = new JButton(JMeterUtils.getResString("delete"));
  +		addExclude.setActionCommand(ADD_EXCLUDE);
  +		deleteExclude.setActionCommand(DELETE_EXCLUDE);
  +		addExclude.addActionListener(this);
  +		deleteExclude.addActionListener(this);
  +		panel.add(scroller,BorderLayout.CENTER);
  +		JPanel buttonPanel = new JPanel();
  +		buttonPanel.add(addExclude);
  +		buttonPanel.add(deleteExclude);
  +		panel.add(buttonPanel,BorderLayout.SOUTH);
  +		excludeTable.addFocusListener(this);
   		return panel;
   	}
   }
  
  
  
  1.10      +1 -1      jakarta-jmeter/xdocs/usermanual/build-web-test-plan.xml
  
  Index: build-web-test-plan.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/xdocs/usermanual/build-web-test-plan.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- build-web-test-plan.xml	13 Jun 2002 00:45:19 -0000	1.9
  +++ build-web-test-plan.xml	15 Jun 2002 02:44:39 -0000	1.10
  @@ -17,7 +17,7 @@
   <a href="test_plan.html#thread_group">Thread Group</a>,
   <complink name="HTTP Request"/>,
   <complink name="HTTP Request Defaults"/>, and
  -<complink name="File Reporter"/>.</p>
  +<complink name="Graph Results"/>.</p>
   
   <p>For a more advanced Test Plan, see
   <a href="build-adv-web-test-plan.html">Building an Advanced Web Test Plan</a>.</p>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>