KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > protocol > http > control > gui > SoapSamplerGui


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java,v 1.12 2004/03/05 01:38:02 sebb Exp $
2
/*
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17 */

18
19 package org.apache.jmeter.protocol.http.control.gui;
20
21 import java.awt.BorderLayout JavaDoc;
22 import java.awt.Dimension JavaDoc;
23
24 import javax.swing.JPanel JavaDoc;
25
26 import org.apache.jmeter.protocol.http.sampler.SoapSampler;
27 import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
28 import org.apache.jmeter.testelement.TestElement;
29 import org.apache.jmeter.util.JMeterUtils;
30 import org.apache.jorphan.gui.JLabeledTextArea;
31 import org.apache.jorphan.gui.JLabeledTextField;
32
33 /**
34  * @version $Revision: 1.12 $ on $Date: 2004/03/05 01:38:02 $
35  */

36 public class SoapSamplerGui extends AbstractSamplerGui
37 {
38     private JLabeledTextField urlField;
39     private JLabeledTextArea soapXml;
40
41     public SoapSamplerGui()
42     {
43         init();
44     }
45
46     public String JavaDoc getLabelResource()
47     {
48         return "soap_sampler_title";
49     }
50
51     /* (non-Javadoc)
52      * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
53      */

54     public TestElement createTestElement()
55     {
56         SoapSampler sampler = new SoapSampler();
57         modifyTestElement(sampler);
58         return sampler;
59     }
60
61     /**
62      * Modifies a given TestElement to mirror the data in the gui components.
63      * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
64      */

65     public void modifyTestElement(TestElement s)
66     {
67         this.configureTestElement(s);
68         if (s instanceof SoapSampler)
69         {
70             SoapSampler sampler = (SoapSampler) s;
71             sampler.setURLData(urlField.getText());
72             sampler.setXmlData(soapXml.getText());
73         }
74     }
75
76     private void init()
77     {
78         setLayout(new BorderLayout JavaDoc());
79         setBorder(makeBorder());
80         
81         add(makeTitlePanel(), BorderLayout.NORTH);
82
83         urlField = new JLabeledTextField(JMeterUtils.getResString("url"), 10);
84         soapXml =
85             new JLabeledTextArea(
86                 JMeterUtils.getResString("soap_data_title"),
87                 null);
88
89         JPanel JavaDoc mainPanel = new JPanel JavaDoc(new BorderLayout JavaDoc());
90         mainPanel.add(urlField, BorderLayout.NORTH);
91         mainPanel.add(soapXml, BorderLayout.CENTER);
92         
93         add(mainPanel, BorderLayout.CENTER);
94     }
95
96     public void configure(TestElement el)
97     {
98         super.configure(el);
99         SoapSampler sampler = (SoapSampler) el;
100         urlField.setText(sampler.getURLData());
101         soapXml.setText(sampler.getXmlData());
102     }
103     
104     public Dimension JavaDoc getPreferredSize()
105     {
106         return getMinimumSize();
107     }
108 }
109
Popular Tags