KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > protocol > java > control > gui > JavaTestSamplerGui


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/JavaTestSamplerGui.java,v 1.13 2004/03/05 01:38:42 sebb Exp $
2
/*
3  * Copyright 2002-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.java.control.gui;
20
21 import java.awt.BorderLayout JavaDoc;
22
23 import org.apache.jmeter.protocol.java.config.JavaConfig;
24 import org.apache.jmeter.protocol.java.config.gui.JavaConfigGui;
25 import org.apache.jmeter.protocol.java.sampler.JavaSampler;
26 import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
27 import org.apache.jmeter.testelement.TestElement;
28
29 /**
30  * The <code>JavaTestSamplerGui</code> class provides the user interface
31  * for the {@link JavaSampler}.
32  *
33  * @version $Revision: 1.13 $ on $Date: 2004/03/05 01:38:42 $
34  */

35 public class JavaTestSamplerGui extends AbstractSamplerGui
36 {
37     /** Panel containing the configuration options. */
38     private JavaConfigGui javaPanel = null;
39
40     /**
41      * Constructor for JavaTestSamplerGui
42      */

43     public JavaTestSamplerGui()
44     {
45         super();
46         init();
47     }
48
49     public String JavaDoc getLabelResource()
50     {
51         return "java_request";
52     }
53
54     /**
55      * Initialize the GUI components and layout.
56      */

57     private void init()
58     {
59         setLayout(new BorderLayout JavaDoc(0, 5));
60         setBorder(makeBorder());
61         
62         add(makeTitlePanel(), BorderLayout.NORTH);
63
64         javaPanel = new JavaConfigGui(false);
65
66         add(javaPanel, BorderLayout.CENTER);
67     }
68
69     /* Implements JMeterGuiComponent.createTestElement() */
70     public TestElement createTestElement()
71     {
72         JavaSampler sampler = new JavaSampler();
73         modifyTestElement(sampler);
74         return sampler;
75     }
76
77     /* Implements JMeterGuiComponent.modifyTestElement(TestElement) */
78     public void modifyTestElement(TestElement sampler)
79     {
80         sampler.clear();
81         JavaConfig config = (JavaConfig) javaPanel.createTestElement();
82         configureTestElement(sampler);
83         sampler.addTestElement(config);
84     }
85
86     /* Overrides AbstractJMeterGuiComponent.configure(TestElement) */
87     public void configure(TestElement el)
88     {
89         super.configure(el);
90         javaPanel.configure(el);
91     }
92 }
93
94
Popular Tags