kcassell 2003/02/26 13:46:55
Modified: src/protocol/http/org/apache/jmeter/protocol/http/config/gui
UrlConfigGui.java MultipartUrlConfigGui.java
HttpDefaultsGui.java
Log:
Reformatted to Turbine standards.
Revision Changes Path
1.6 +262 -246
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java
Index: UrlConfigGui.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlConfigGui.java 24 Dec 2002 11:48:49 -0000 1.5
+++ UrlConfigGui.java 26 Feb 2003 21:46:55 -0000 1.6
@@ -2,7 +2,7 @@
* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,8 @@
* <http://www.apache.org/>.
*/
package org.apache.jmeter.protocol.http.config.gui;
+
+
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
@@ -76,6 +78,7 @@
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.util.JMeterUtils;
+
/****************************************
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
@@ -87,249 +90,262 @@
public class UrlConfigGui extends JPanel
{
- /****************************************
- * !ToDo (Field description)
- ***************************************/
- protected HTTPArgumentsPanel argsPanel;
- private static String DOMAIN = "domain";
- private static String PORT = "port";
- private static String PROTOCOL = "protocol";
- private static String PATH = "path";
- private static String FOLLOW_REDIRECTS = "follow_redirects";
- private static String USE_KEEPALIVE = "use_keepalive";
- private static String POST = "post";
- private static String GET = "get";
- private static String SEND_PARAM = "sendparam";
-
- private JTextField domain;
- private JTextField port;
- private JTextField protocol;
- private JTextField path;
- private JCheckBox followRedirects;
- private JCheckBox useKeepAlive;
- private JRadioButton post;
- private JRadioButton get;
-
-
- /****************************************
- * !ToDo (Constructor description)
- ***************************************/
- public UrlConfigGui()
- {
- init();
- }
-
-
- protected void configureTestElement(TestElement mc)
- {
- mc.setProperty(TestElement.NAME, getName());
- mc.setProperty(TestElement.GUI_CLASS, this.getClass().getName());
- mc.setProperty(TestElement.TEST_CLASS, mc.getClass().getName());
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- public TestElement createTestElement()
- {
- ConfigTestElement element = new ConfigTestElement();
- this.configureTestElement(element);
- Arguments args = (Arguments)argsPanel.createTestElement();
- HTTPArgument.convertArgumentsToHTTP(args);
- element.setProperty(HTTPSampler.ARGUMENTS, args);
- element.setProperty(HTTPSampler.DOMAIN, domain.getText());
- element.setProperty(HTTPSampler.PORT, port.getText());
- element.setProperty(HTTPSampler.PROTOCOL, protocol.getText());
- element.setProperty(HTTPSampler.METHOD, (post.isSelected() ? "POST" :
"GET"));
- element.setProperty(HTTPSampler.PATH, path.getText());
- element.setProperty(HTTPSampler.FOLLOW_REDIRECTS, new
Boolean(followRedirects.isSelected()));
- element.setProperty(HTTPSampler.USE_KEEPALIVE, new
Boolean(useKeepAlive.isSelected()));
- return element;
- }
-
- public void configureSampler(HTTPSampler sampler)
- {
- sampler.setArguments((Arguments)argsPanel.createTestElement());
- sampler.setDomain(domain.getText());
- sampler.setProtocol(protocol.getText());
- sampler.setPath(path.getText());
- sampler.setFollowRedirects(followRedirects.isSelected());
- sampler.setUseKeepAlive(useKeepAlive.isSelected());
- if(port.getText().length() > 0)
- {
- sampler.setPort(Integer.parseInt(port.getText()));
- }
- sampler.setMethod((post.isSelected() ? "POST" : "GET"));
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- [EMAIL PROTECTED] el !ToDo (Parameter description)
- ***************************************/
- public void configure(TestElement el)
- {
- setName((String)el.getProperty(TestElement.NAME));
-
argsPanel.configure((TestElement)el.getProperty(HTTPSampler.ARGUMENTS));
- domain.setText((String)el.getProperty(HTTPSampler.DOMAIN));
- port.setText((String)el.getPropertyAsString(HTTPSampler.PORT));
- protocol.setText((String)el.getProperty(HTTPSampler.PROTOCOL));
- if("POST".equals(el.getProperty(HTTPSampler.METHOD)))
- {
- post.setSelected(true);
- get.setSelected(false);
- }
- else
- {
- get.setSelected(true);
- post.setSelected(false);
- }
- path.setText((String)el.getProperty(HTTPSampler.PATH));
-
followRedirects.setSelected(((AbstractTestElement)el).getPropertyAsBoolean(HTTPSampler.FOLLOW_REDIRECTS));
-
useKeepAlive.setSelected(((AbstractTestElement)el).getPropertyAsBoolean(HTTPSampler.USE_KEEPALIVE));
- }
-
- /****************************************
- * !ToDo (Method description)
- ***************************************/
- protected void init()
- {
- this.setLayout(new BorderLayout());
-
- JPanel webServerPanel = new JPanel();
- webServerPanel.setLayout(new BorderLayout());
-
webServerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("web_server")));
- webServerPanel.add(getDomainPanel(),BorderLayout.NORTH);
- webServerPanel.add(getPortPanel(),BorderLayout.SOUTH);
-
- JPanel webRequestPanel = new JPanel();
- webRequestPanel.setLayout(new BorderLayout());
-
webRequestPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("web_request")));
- JPanel northPanel = new JPanel(new BorderLayout());
- northPanel.add(getProtocolAndMethodPanel(),BorderLayout.NORTH);
- northPanel.add(getPathPanel(),BorderLayout.SOUTH);
- webRequestPanel.add(northPanel,BorderLayout.NORTH);
- webRequestPanel.add(getParameterPanel(),BorderLayout.CENTER);
-
- this.add(webServerPanel,BorderLayout.NORTH);
- this.add(webRequestPanel,BorderLayout.CENTER);
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- protected JPanel getPortPanel()
- {
- JPanel portP = new JPanel(new FlowLayout(FlowLayout.LEFT));
- portP.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
- portP.add(new JLabel(JMeterUtils.getResString("web_server_port")));
-
- port = new JTextField(6);
-
- port.setName(PORT);
- portP.add(port);
-
- return portP;
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- protected JPanel getDomainPanel()
- {
- JPanel domainP = new JPanel(new FlowLayout(FlowLayout.LEFT));
- domainP.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
- domainP.add(new JLabel(JMeterUtils.getResString("web_server_domain")));
-
- domain = new JTextField(20);
- domain.setName(DOMAIN);
- domainP.add(domain);
-
- return domainP;
- }
-
- /****************************************
- * This method defines the Panel for the
- * HTTP path, 'Follow Redirects' and
- * 'Use KeepAlive' elements.
- *
- [EMAIL PROTECTED] JPanel The Panel for the path,
- * 'Follow Redirects' and 'Use KeepAlive' elements.
- ***************************************/
- protected JPanel getPathPanel()
- {
- JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
- panel.add(new JLabel(JMeterUtils.getResString("path")));
-
- path = new JTextField(15);
- path.setName(PATH);
- panel.add(path);
-
- followRedirects= new
JCheckBox(JMeterUtils.getResString("follow_redirects"));
- followRedirects.setName(FOLLOW_REDIRECTS);
- // Set this by default so as to stay compliant with the old
- // behaviour:
- followRedirects.setSelected(true);
- panel.add(followRedirects);
-
- useKeepAlive = new
JCheckBox(JMeterUtils.getResString("use_keepalive"));
- useKeepAlive.setName(USE_KEEPALIVE);
- useKeepAlive.setSelected(true);
- panel.add(useKeepAlive);
-
- return panel;
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- protected JPanel getProtocolAndMethodPanel()
- {
- JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
-
- // PROTOCOL
- panel.add(new JLabel(JMeterUtils.getResString("protocol")));
- protocol = new JTextField(4);
- protocol.setName(PROTOCOL);
- panel.add(protocol);
-
- // METHOD
- post = new JRadioButton(JMeterUtils.getResString("url_config_post"));
- get = new JRadioButton(JMeterUtils.getResString("url_config_get"));
- ButtonGroup methodButtonGroup = new ButtonGroup();
- methodButtonGroup.add(post);
- methodButtonGroup.add(get);
-
- panel.add(Box.createRigidArea(new Dimension(5, 0)));
- panel.add(new JLabel(JMeterUtils.getResString("method")));
-
- post.setSelected(true);
-
- panel.add(get);
- panel.add(post);
-
- return panel;
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- protected JPanel getParameterPanel()
- {
- argsPanel = new HTTPArgumentsPanel();
+ /****************************************
+ * !ToDo (Field description)
+ ***************************************/
+ protected HTTPArgumentsPanel argsPanel;
+ private static String DOMAIN = "domain";
+ private static String PORT = "port";
+ private static String PROTOCOL = "protocol";
+ private static String PATH = "path";
+ private static String FOLLOW_REDIRECTS = "follow_redirects";
+ private static String USE_KEEPALIVE = "use_keepalive";
+ private static String POST = "post";
+ private static String GET = "get";
+ private static String SEND_PARAM = "sendparam";
+
+ private JTextField domain;
+ private JTextField port;
+ private JTextField protocol;
+ private JTextField path;
+ private JCheckBox followRedirects;
+ private JCheckBox useKeepAlive;
+ private JRadioButton post;
+ private JRadioButton get;
+
+ /****************************************
+ * !ToDo (Constructor description)
+ ***************************************/
+ public UrlConfigGui()
+ {
+ init();
+ }
+
+ protected void configureTestElement(TestElement mc)
+ {
+ mc.setProperty(TestElement.NAME, getName());
+ mc.setProperty(TestElement.GUI_CLASS, this.getClass().getName());
+ mc.setProperty(TestElement.TEST_CLASS, mc.getClass().getName());
+ }
+
+ /****************************************
+ * !ToDo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ public TestElement createTestElement()
+ {
+ ConfigTestElement element = new ConfigTestElement();
+
+ this.configureTestElement(element);
+ Arguments args = (Arguments) argsPanel.createTestElement();
+
+ HTTPArgument.convertArgumentsToHTTP(args);
+ element.setProperty(HTTPSampler.ARGUMENTS, args);
+ element.setProperty(HTTPSampler.DOMAIN, domain.getText());
+ element.setProperty(HTTPSampler.PORT, port.getText());
+ element.setProperty(HTTPSampler.PROTOCOL, protocol.getText());
+ element.setProperty(HTTPSampler.METHOD,
+ (post.isSelected() ? "POST" : "GET"));
+ element.setProperty(HTTPSampler.PATH, path.getText());
+ element.setProperty(HTTPSampler.FOLLOW_REDIRECTS,
+ new Boolean(followRedirects.isSelected()));
+ element.setProperty(HTTPSampler.USE_KEEPALIVE,
+ new Boolean(useKeepAlive.isSelected()));
+ return element;
+ }
+
+ public void configureSampler(HTTPSampler sampler)
+ {
+ sampler.setArguments((Arguments) argsPanel.createTestElement());
+ sampler.setDomain(domain.getText());
+ sampler.setProtocol(protocol.getText());
+ sampler.setPath(path.getText());
+ sampler.setFollowRedirects(followRedirects.isSelected());
+ sampler.setUseKeepAlive(useKeepAlive.isSelected());
+ if (port.getText().length() > 0)
+ {
+ sampler.setPort(Integer.parseInt(port.getText()));
+ }
+ sampler.setMethod((post.isSelected() ? "POST" : "GET"));
+ }
+
+ /****************************************
+ * !ToDo (Method description)
+ *
+ [EMAIL PROTECTED] el !ToDo (Parameter description)
+ ***************************************/
+ public void configure(TestElement el)
+ {
+ setName((String) el.getProperty(TestElement.NAME));
+ argsPanel.configure((TestElement) el.getProperty(HTTPSampler.ARGUMENTS));
+ domain.setText((String) el.getProperty(HTTPSampler.DOMAIN));
+ port.setText((String) el.getPropertyAsString(HTTPSampler.PORT));
+ protocol.setText((String) el.getProperty(HTTPSampler.PROTOCOL));
+ if ("POST".equals(el.getProperty(HTTPSampler.METHOD)))
+ {
+ post.setSelected(true);
+ get.setSelected(false);
+ }
+ else
+ {
+ get.setSelected(true);
+ post.setSelected(false);
+ }
+ path.setText((String) el.getProperty(HTTPSampler.PATH));
+ followRedirects.setSelected(((AbstractTestElement)
el).getPropertyAsBoolean(HTTPSampler.FOLLOW_REDIRECTS));
+ useKeepAlive.setSelected(((AbstractTestElement)
el).getPropertyAsBoolean(HTTPSampler.USE_KEEPALIVE));
+ }
+
+ /****************************************
+ * !ToDo (Method description)
+ ***************************************/
+ protected void init()
+ {
+ this.setLayout(new BorderLayout());
+
+ JPanel webServerPanel = new JPanel();
+
+ webServerPanel.setLayout(new BorderLayout());
+
webServerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
+ JMeterUtils.getResString("web_server")));
+ webServerPanel.add(getDomainPanel(), BorderLayout.NORTH);
+ webServerPanel.add(getPortPanel(), BorderLayout.SOUTH);
+
+ JPanel webRequestPanel = new JPanel();
+
+ webRequestPanel.setLayout(new BorderLayout());
+
webRequestPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
+ JMeterUtils.getResString("web_request")));
+ JPanel northPanel = new JPanel(new BorderLayout());
+
+ northPanel.add(getProtocolAndMethodPanel(), BorderLayout.NORTH);
+ northPanel.add(getPathPanel(), BorderLayout.SOUTH);
+ webRequestPanel.add(northPanel, BorderLayout.NORTH);
+ webRequestPanel.add(getParameterPanel(), BorderLayout.CENTER);
+
+ this.add(webServerPanel, BorderLayout.NORTH);
+ this.add(webRequestPanel, BorderLayout.CENTER);
+ }
+
+ /****************************************
+ * !ToDoo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ protected JPanel getPortPanel()
+ {
+ JPanel portP = new JPanel(new FlowLayout(FlowLayout.LEFT));
+
+ portP.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
+ portP.add(new JLabel(JMeterUtils.getResString("web_server_port")));
+
+ port = new JTextField(6);
+
+ port.setName(PORT);
+ portP.add(port);
+
+ return portP;
+ }
+
+ /****************************************
+ * !ToDoo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ protected JPanel getDomainPanel()
+ {
+ JPanel domainP = new JPanel(new FlowLayout(FlowLayout.LEFT));
+
+ domainP.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
+ domainP.add(new JLabel(JMeterUtils.getResString("web_server_domain")));
+
+ domain = new JTextField(20);
+ domain.setName(DOMAIN);
+ domainP.add(domain);
+
+ return domainP;
+ }
+
+ /****************************************
+ * This method defines the Panel for the
+ * HTTP path, 'Follow Redirects' and
+ * 'Use KeepAlive' elements.
+ *
+ [EMAIL PROTECTED] JPanel The Panel for the path,
+ * 'Follow Redirects' and 'Use KeepAlive' elements.
+ ***************************************/
+ protected JPanel getPathPanel()
+ {
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+
+ panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
+ panel.add(new JLabel(JMeterUtils.getResString("path")));
+
+ path = new JTextField(15);
+ path.setName(PATH);
+ panel.add(path);
+
+ followRedirects = new
JCheckBox(JMeterUtils.getResString("follow_redirects"));
+ followRedirects.setName(FOLLOW_REDIRECTS);
+ // Set this by default so as to stay compliant with the old
+ // behaviour:
+ followRedirects.setSelected(true);
+ panel.add(followRedirects);
+
+ useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive"));
+ useKeepAlive.setName(USE_KEEPALIVE);
+ useKeepAlive.setSelected(true);
+ panel.add(useKeepAlive);
+
+ return panel;
+ }
+
+ /****************************************
+ * !ToDoo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ protected JPanel getProtocolAndMethodPanel()
+ {
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+
+ panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
+
+ // PROTOCOL
+ panel.add(new JLabel(JMeterUtils.getResString("protocol")));
+ protocol = new JTextField(4);
+ protocol.setName(PROTOCOL);
+ panel.add(protocol);
+
+ // METHOD
+ post = new JRadioButton(JMeterUtils.getResString("url_config_post"));
+ get = new JRadioButton(JMeterUtils.getResString("url_config_get"));
+ ButtonGroup methodButtonGroup = new ButtonGroup();
+
+ methodButtonGroup.add(post);
+ methodButtonGroup.add(get);
+
+ panel.add(Box.createRigidArea(new Dimension(5, 0)));
+ panel.add(new JLabel(JMeterUtils.getResString("method")));
+
+ post.setSelected(true);
+
+ panel.add(get);
+ panel.add(post);
+
+ return panel;
+ }
+
+ /****************************************
+ * !ToDoo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ protected JPanel getParameterPanel()
+ {
+ argsPanel = new HTTPArgumentsPanel();
- return argsPanel;
- }
+ return argsPanel;
+ }
}
1.5 +218 -202
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java
Index: MultipartUrlConfigGui.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MultipartUrlConfigGui.java 17 Oct 2002 19:47:19 -0000 1.4
+++ MultipartUrlConfigGui.java 26 Feb 2003 21:46:55 -0000 1.5
@@ -2,7 +2,7 @@
* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,8 @@
* <http://www.apache.org/>.
*/
package org.apache.jmeter.protocol.http.config.gui;
+
+
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -71,6 +73,7 @@
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.gui.layout.VerticalLayout;
+
/****************************************
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
@@ -82,205 +85,218 @@
public class MultipartUrlConfigGui extends UrlConfigGui implements ActionListener
{
- JTextField filenameField;
- JTextField paramNameField;
- JTextField mimetypeField;
- JLabel filenameLabel;
- JLabel paramNameLabel;
- JLabel mimetypeLabel;
- JButton browseFileButton;
- private static String FILENAME = "filename";
- private static String BROWSE = "browse";
- private static String PARAMNAME = "paramname";
- private static String MIMETYPE = "mimetype";
-
- /****************************************
- * !ToDo (Constructor description)
- ***************************************/
- public MultipartUrlConfigGui()
- {
- super();
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- public TestElement createTestElement()
- {
- TestElement ce = super.createTestElement();
- configureTestElement(ce);
- ce.setProperty(HTTPSampler.MIMETYPE, mimetypeField.getText());
- ce.setProperty(HTTPSampler.FILE_NAME, filenameField.getText());
- ce.setProperty(HTTPSampler.FILE_FIELD, paramNameField.getText());
- return ce;
- }
-
- public void configureSampler(HTTPSampler sampler)
- {
- sampler.setMimetype(mimetypeField.getText());
- sampler.setFileField(paramNameField.getText());
- sampler.setFilename(filenameField.getText());
- super.configureSampler(sampler);
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- [EMAIL PROTECTED] el !ToDo (Parameter description)
- ***************************************/
- public void configure(TestElement el)
- {
- super.configure(el);
- mimetypeField.setText((String)el.getProperty(HTTPSampler.MIMETYPE));
- filenameField.setText((String)el.getProperty(HTTPSampler.FILE_NAME));
- paramNameField.setText((String)el.getProperty(HTTPSampler.FILE_FIELD));
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- public String getStaticLabel()
- {
- return JMeterUtils.getResString("url_multipart_config_title");
- }
-
- /****************************************
- * !ToDo (Method description)
- ***************************************/
- public void updateGui() { }
-
-
- /****************************************
- * !ToDo (Method description)
- *
- [EMAIL PROTECTED] e !ToDo (Parameter description)
- ***************************************/
- public void actionPerformed(ActionEvent e)
- {
- String name = e.getActionCommand();
- if(name.equals(BROWSE))
- {
- JFileChooser chooser = FileDialoger.promptToOpenFile();
- if(chooser == null)
- {
- return;
- }
- File file = chooser.getSelectedFile();
- if(file != null)
- {
- filenameField.setText(file.getPath());
- }
- }
- }
-
- /****************************************
- * !ToDo (Method description)
- ***************************************/
- protected void init()
- {
- this.setLayout(new BorderLayout());
-
- // WEB SERVER PANEL
- JPanel webServerPanel = new JPanel();
- webServerPanel.setLayout(new BorderLayout());
-
webServerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("web_server")));
- webServerPanel.add(getDomainPanel(),BorderLayout.NORTH);
- webServerPanel.add(getPortPanel(),BorderLayout.SOUTH);
-
- // WEB REQUEST PANEL
- JPanel webRequestPanel = new JPanel(new BorderLayout());
- JPanel northPanel = new JPanel(new BorderLayout());
-
webRequestPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("web_request")));
- northPanel.add(getProtocolAndMethodPanel(),BorderLayout.NORTH);
- northPanel.add(getPathPanel(),BorderLayout.SOUTH);
- webRequestPanel.add(northPanel,BorderLayout.NORTH);
- webRequestPanel.add(getParameterPanel(),BorderLayout.CENTER);
- webRequestPanel.add(getFilePanel(),BorderLayout.SOUTH);
-
- // If displayName is TRUE, then this GUI is not embedded in another
GUI.
- this.add(webServerPanel,BorderLayout.NORTH);
- this.add(webRequestPanel,BorderLayout.CENTER);
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- protected JPanel getFilePanel()
- {
- // FILE PANEL (all main components are add to this panel)
- JPanel filePanel = new JPanel();
- filePanel.setLayout(new VerticalLayout(1, VerticalLayout.LEFT));
- filePanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
-
- // SEND FILE LABEL
- JLabel sendFileLabel = new
JLabel(JMeterUtils.getResString("send_file"));
- filePanel.add(sendFileLabel);
-
- // FILENAME PANEL (contains filename label and text field and Browse
button)
- JPanel filenamePanel = new JPanel();
- filenamePanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
-
- // --- FILENAME LABEL
- filenameLabel = new
JLabel(JMeterUtils.getResString("send_file_filename_label"));
- filenameLabel.setEnabled(true);
-
- // --- FILENAME TEXT FIELD
- filenameField = new JTextField(15);
- filenameField.setEnabled(true);
- filenameField.setName(FILENAME);
-
- // --- BROWSE BUTTON
- browseFileButton = new
JButton(JMeterUtils.getResString("send_file_browse"));
- browseFileButton.setEnabled(true);
- browseFileButton.setActionCommand(BROWSE);
- browseFileButton.addActionListener(this);
-
- filenamePanel.add(filenameLabel);
- filenamePanel.add(filenameField);
- filenamePanel.add(browseFileButton);
-
- // PARAM NAME PANEL (contains param name label and text field)
- JPanel paramNamePanel = new JPanel();
- paramNamePanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
-
- // --- PARAM NAME LABEL
- paramNameLabel = new
JLabel(JMeterUtils.getResString("send_file_param_name_label"));
- paramNameLabel.setEnabled(true);
-
- // --- PARAM NAME TEXT FIELD
- paramNameField = new JTextField(15);
- paramNameField.setName(PARAMNAME);
- paramNameField.setEnabled(true);
-
- paramNamePanel.add(paramNameLabel);
- paramNamePanel.add(paramNameField);
-
- // MIME TYPE PANEL (contains mime type label and text field)
- JPanel mimePanel = new JPanel();
- mimePanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
-
- // --- MIME TYPE LABEL
- mimetypeLabel = new
JLabel(JMeterUtils.getResString("send_file_mime_label"));
- mimetypeLabel.setEnabled(true);
-
- // --- MIME TYPE TEXT FIELD
- mimetypeField = new JTextField(15);
- mimetypeField.setEnabled(true);
- mimetypeField.setName(MIMETYPE);
-
- mimePanel.add(mimetypeLabel);
- mimePanel.add(mimetypeField);
-
- filePanel.add(filenamePanel);
- filePanel.add(paramNamePanel);
- filePanel.add(mimePanel);
+ JTextField filenameField;
+ JTextField paramNameField;
+ JTextField mimetypeField;
+ JLabel filenameLabel;
+ JLabel paramNameLabel;
+ JLabel mimetypeLabel;
+ JButton browseFileButton;
+ private static String FILENAME = "filename";
+ private static String BROWSE = "browse";
+ private static String PARAMNAME = "paramname";
+ private static String MIMETYPE = "mimetype";
+
+ /****************************************
+ * !ToDo (Constructor description)
+ ***************************************/
+ public MultipartUrlConfigGui()
+ {
+ super();
+ }
+
+ /****************************************
+ * !ToDo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ public TestElement createTestElement()
+ {
+ TestElement ce = super.createTestElement();
+
+ configureTestElement(ce);
+ ce.setProperty(HTTPSampler.MIMETYPE, mimetypeField.getText());
+ ce.setProperty(HTTPSampler.FILE_NAME, filenameField.getText());
+ ce.setProperty(HTTPSampler.FILE_FIELD, paramNameField.getText());
+ return ce;
+ }
+
+ public void configureSampler(HTTPSampler sampler)
+ {
+ sampler.setMimetype(mimetypeField.getText());
+ sampler.setFileField(paramNameField.getText());
+ sampler.setFilename(filenameField.getText());
+ super.configureSampler(sampler);
+ }
+
+ /****************************************
+ * !ToDo (Method description)
+ *
+ [EMAIL PROTECTED] el !ToDo (Parameter description)
+ ***************************************/
+ public void configure(TestElement el)
+ {
+ super.configure(el);
+ mimetypeField.setText((String) el.getProperty(HTTPSampler.MIMETYPE));
+ filenameField.setText((String) el.getProperty(HTTPSampler.FILE_NAME));
+ paramNameField.setText((String) el.getProperty(HTTPSampler.FILE_FIELD));
+ }
+
+ /****************************************
+ * !ToDoo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ public String getStaticLabel()
+ {
+ return JMeterUtils.getResString("url_multipart_config_title");
+ }
+
+ /****************************************
+ * !ToDo (Method description)
+ ***************************************/
+ public void updateGui()
+ {}
+
+ /****************************************
+ * !ToDo (Method description)
+ *
+ [EMAIL PROTECTED] e !ToDo (Parameter description)
+ ***************************************/
+ public void actionPerformed(ActionEvent e)
+ {
+ String name = e.getActionCommand();
+
+ if (name.equals(BROWSE))
+ {
+ JFileChooser chooser = FileDialoger.promptToOpenFile();
+
+ if (chooser == null)
+ {
+ return;
+ }
+ File file = chooser.getSelectedFile();
+
+ if (file != null)
+ {
+ filenameField.setText(file.getPath());
+ }
+ }
+ }
+
+ /****************************************
+ * !ToDo (Method description)
+ ***************************************/
+ protected void init()
+ {
+ this.setLayout(new BorderLayout());
+
+ // WEB SERVER PANEL
+ JPanel webServerPanel = new JPanel();
+
+ webServerPanel.setLayout(new BorderLayout());
+
webServerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
+ JMeterUtils.getResString("web_server")));
+ webServerPanel.add(getDomainPanel(), BorderLayout.NORTH);
+ webServerPanel.add(getPortPanel(), BorderLayout.SOUTH);
+
+ // WEB REQUEST PANEL
+ JPanel webRequestPanel = new JPanel(new BorderLayout());
+ JPanel northPanel = new JPanel(new BorderLayout());
+
+
webRequestPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
+ JMeterUtils.getResString("web_request")));
+ northPanel.add(getProtocolAndMethodPanel(), BorderLayout.NORTH);
+ northPanel.add(getPathPanel(), BorderLayout.SOUTH);
+ webRequestPanel.add(northPanel, BorderLayout.NORTH);
+ webRequestPanel.add(getParameterPanel(), BorderLayout.CENTER);
+ webRequestPanel.add(getFilePanel(), BorderLayout.SOUTH);
+
+ // If displayName is TRUE, then this GUI is not embedded in another GUI.
+ this.add(webServerPanel, BorderLayout.NORTH);
+ this.add(webRequestPanel, BorderLayout.CENTER);
+ }
+
+ /****************************************
+ * !ToDoo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ protected JPanel getFilePanel()
+ {
+ // FILE PANEL (all main components are add to this panel)
+ JPanel filePanel = new JPanel();
+
+ filePanel.setLayout(new VerticalLayout(1, VerticalLayout.LEFT));
+ filePanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
+
+ // SEND FILE LABEL
+ JLabel sendFileLabel = new JLabel(JMeterUtils.getResString("send_file"));
+
+ filePanel.add(sendFileLabel);
+
+ // FILENAME PANEL (contains filename label and text field and Browse button)
+ JPanel filenamePanel = new JPanel();
+
+ filenamePanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
+
+ // --- FILENAME LABEL
+ filenameLabel = new
JLabel(JMeterUtils.getResString("send_file_filename_label"));
+ filenameLabel.setEnabled(true);
+
+ // --- FILENAME TEXT FIELD
+ filenameField = new JTextField(15);
+ filenameField.setEnabled(true);
+ filenameField.setName(FILENAME);
+
+ // --- BROWSE BUTTON
+ browseFileButton = new
JButton(JMeterUtils.getResString("send_file_browse"));
+ browseFileButton.setEnabled(true);
+ browseFileButton.setActionCommand(BROWSE);
+ browseFileButton.addActionListener(this);
+
+ filenamePanel.add(filenameLabel);
+ filenamePanel.add(filenameField);
+ filenamePanel.add(browseFileButton);
+
+ // PARAM NAME PANEL (contains param name label and text field)
+ JPanel paramNamePanel = new JPanel();
+
+ paramNamePanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
+
+ // --- PARAM NAME LABEL
+ paramNameLabel = new
JLabel(JMeterUtils.getResString("send_file_param_name_label"));
+ paramNameLabel.setEnabled(true);
+
+ // --- PARAM NAME TEXT FIELD
+ paramNameField = new JTextField(15);
+ paramNameField.setName(PARAMNAME);
+ paramNameField.setEnabled(true);
+
+ paramNamePanel.add(paramNameLabel);
+ paramNamePanel.add(paramNameField);
+
+ // MIME TYPE PANEL (contains mime type label and text field)
+ JPanel mimePanel = new JPanel();
+
+ mimePanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
+
+ // --- MIME TYPE LABEL
+ mimetypeLabel = new
JLabel(JMeterUtils.getResString("send_file_mime_label"));
+ mimetypeLabel.setEnabled(true);
+
+ // --- MIME TYPE TEXT FIELD
+ mimetypeField = new JTextField(15);
+ mimetypeField.setEnabled(true);
+ mimetypeField.setName(MIMETYPE);
+
+ mimePanel.add(mimetypeLabel);
+ mimePanel.add(mimetypeField);
+
+ filePanel.add(filenamePanel);
+ filePanel.add(paramNamePanel);
+ filePanel.add(mimePanel);
- return filePanel;
- }
+ return filePanel;
+ }
}
1.5 +136 -73
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/HttpDefaultsGui.java
Index: HttpDefaultsGui.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/HttpDefaultsGui.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HttpDefaultsGui.java 24 Dec 2002 11:48:49 -0000 1.4
+++ HttpDefaultsGui.java 26 Feb 2003 21:46:55 -0000 1.5
@@ -1,4 +1,61 @@
+/*
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache JMeter" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache JMeter", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.jmeter.protocol.http.config.gui;
+
+
import java.awt.BorderLayout;
import java.awt.Font;
@@ -15,6 +72,8 @@
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.gui.JLabeledTextField;
import org.apache.jorphan.gui.layout.VerticalLayout;
+
+
/**
* @author Administrator
*
@@ -23,77 +82,81 @@
*/
public class HttpDefaultsGui extends AbstractConfigGui
{
- JLabeledTextField protocol;
- JLabeledTextField domain;
- JLabeledTextField path;
- JLabeledTextField port;
- HTTPArgumentsPanel argPanel;
-
- public HttpDefaultsGui()
- {
- super();
- init();
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- [EMAIL PROTECTED] !ToDo (Return description)
- ***************************************/
- public String getStaticLabel()
- {
- return JMeterUtils.getResString("url_config_title");
- }
-
- /**
- * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
- */
- public TestElement createTestElement()
- {
- ConfigTestElement config = new ConfigTestElement();
- super.configureTestElement(config);
- config.setProperty(HTTPSampler.PROTOCOL,protocol.getText());
- config.setProperty(HTTPSampler.DOMAIN,domain.getText());
- config.setProperty(HTTPSampler.PATH,path.getText());
- config.setProperty(HTTPSampler.ARGUMENTS,argPanel.createTestElement());
- config.setProperty(HTTPSampler.PORT,port.getText());
- return config;
- }
-
- public void configure(TestElement el)
- {
- super.configure(el);
- protocol.setText(el.getPropertyAsString(HTTPSampler.PROTOCOL));
- domain.setText(el.getPropertyAsString(HTTPSampler.DOMAIN));
- path.setText(el.getPropertyAsString(HTTPSampler.PATH));
- port.setText(el.getPropertyAsString(HTTPSampler.PORT));
- argPanel.configure((TestElement)el.getProperty(HTTPSampler.ARGUMENTS));
- }
-
- private void init()
- {
- Border margin = new EmptyBorder(10, 10, 5, 10);
- this.setBorder(margin);
- this.setLayout(new BorderLayout());
- argPanel = new HTTPArgumentsPanel();
- this.add(argPanel,BorderLayout.CENTER);
- protocol = new
JLabeledTextField(JMeterUtils.getResString("url_config_protocol"));
- domain = new
JLabeledTextField(JMeterUtils.getResString("web_server_domain"));
- path = new JLabeledTextField(JMeterUtils.getResString("path"));
- port = new
JLabeledTextField(JMeterUtils.getResString("web_server_port"));
- JPanel topPanel = new JPanel(new
VerticalLayout(5,VerticalLayout.LEFT));
- JLabel title = new
JLabel(JMeterUtils.getResString("url_config_title"));
- Font curFont = title.getFont();
- int curFontSize = curFont.getSize();
- curFontSize += 4;
- title.setFont(new Font(curFont.getFontName(), curFont.getStyle(),
curFontSize));
-
- topPanel.add(title);
- topPanel.add(getNamePanel());
- topPanel.add(protocol);
- topPanel.add(domain);
- topPanel.add(path);
- topPanel.add(port);
- this.add(topPanel,BorderLayout.NORTH);
- }
+ JLabeledTextField protocol;
+ JLabeledTextField domain;
+ JLabeledTextField path;
+ JLabeledTextField port;
+ HTTPArgumentsPanel argPanel;
+
+ public HttpDefaultsGui()
+ {
+ super();
+ init();
+ }
+
+ /****************************************
+ * !ToDoo (Method description)
+ *
+ [EMAIL PROTECTED] !ToDo (Return description)
+ ***************************************/
+ public String getStaticLabel()
+ {
+ return JMeterUtils.getResString("url_config_title");
+ }
+
+ /**
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
+ */
+ public TestElement createTestElement()
+ {
+ ConfigTestElement config = new ConfigTestElement();
+
+ super.configureTestElement(config);
+ config.setProperty(HTTPSampler.PROTOCOL, protocol.getText());
+ config.setProperty(HTTPSampler.DOMAIN, domain.getText());
+ config.setProperty(HTTPSampler.PATH, path.getText());
+ config.setProperty(HTTPSampler.ARGUMENTS, argPanel.createTestElement());
+ config.setProperty(HTTPSampler.PORT, port.getText());
+ return config;
+ }
+
+ public void configure(TestElement el)
+ {
+ super.configure(el);
+ protocol.setText(el.getPropertyAsString(HTTPSampler.PROTOCOL));
+ domain.setText(el.getPropertyAsString(HTTPSampler.DOMAIN));
+ path.setText(el.getPropertyAsString(HTTPSampler.PATH));
+ port.setText(el.getPropertyAsString(HTTPSampler.PORT));
+ argPanel.configure((TestElement) el.getProperty(HTTPSampler.ARGUMENTS));
+ }
+
+ private void init()
+ {
+ Border margin = new EmptyBorder(10, 10, 5, 10);
+
+ this.setBorder(margin);
+ this.setLayout(new BorderLayout());
+ argPanel = new HTTPArgumentsPanel();
+ this.add(argPanel, BorderLayout.CENTER);
+ protocol = new
JLabeledTextField(JMeterUtils.getResString("url_config_protocol"));
+ domain = new
JLabeledTextField(JMeterUtils.getResString("web_server_domain"));
+ path = new JLabeledTextField(JMeterUtils.getResString("path"));
+ port = new JLabeledTextField(JMeterUtils.getResString("web_server_port"));
+ JPanel topPanel = new JPanel(new VerticalLayout(5, VerticalLayout.LEFT));
+ JLabel title = new JLabel(JMeterUtils.getResString("url_config_title"));
+ Font curFont = title.getFont();
+ int curFontSize = curFont.getSize();
+
+ curFontSize += 4;
+ title.setFont(new Font(curFont.getFontName(), curFont.getStyle(),
+ curFontSize));
+
+ topPanel.add(title);
+ topPanel.add(getNamePanel());
+ topPanel.add(protocol);
+ topPanel.add(domain);
+ topPanel.add(path);
+ topPanel.add(port);
+ this.add(topPanel, BorderLayout.NORTH);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]