KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > protocol > ldap > control > gui > LdapTestSamplerGui


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java,v 1.6 2004/03/05 01:39:07 sebb Exp $
2
/*
3  * Copyright 2003-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.ldap.control.gui;
20
21 import java.awt.BorderLayout JavaDoc;
22
23 import javax.swing.BorderFactory JavaDoc;
24
25 import org.apache.jmeter.config.gui.LoginConfigGui;
26 import org.apache.jmeter.gui.util.VerticalPanel;
27 import org.apache.jmeter.protocol.ldap.config.gui.LdapConfigGui;
28 import org.apache.jmeter.protocol.ldap.sampler.LDAPSampler;
29 import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
30 import org.apache.jmeter.testelement.TestElement;
31 import org.apache.jmeter.util.JMeterUtils;
32
33 /**
34  * Created Apr 29 2003 11:52 AM
35  * @version $Revision: 1.6 $ Last updated: $Date: 2004/03/05 01:39:07 $
36  */

37 public class LdapTestSamplerGui extends AbstractSamplerGui
38 {
39     private LoginConfigGui loginPanel;
40     private LdapConfigGui ldapDefaultPanel;
41
42     public LdapTestSamplerGui()
43     {
44         init();
45     }
46
47     /**
48      * A newly created component can be initialized with the contents of
49      * a Test Element object by calling this method. The component is
50      * responsible for querying the Test Element object for the
51      * relevant information to display in its GUI.
52      *
53      * @param element the TestElement to configure
54      */

55     public void configure(TestElement element)
56     {
57         super.configure(element);
58         loginPanel.configure(element);
59         ldapDefaultPanel.configure(element);
60     }
61
62     public TestElement createTestElement()
63     {
64         LDAPSampler sampler = new LDAPSampler();
65         modifyTestElement(sampler);
66         return sampler;
67     }
68
69     /**
70      * Modifies a given TestElement to mirror the data in the gui components.
71      * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
72      */

73     public void modifyTestElement(TestElement sampler)
74     {
75         sampler.clear();
76         ((LDAPSampler) sampler).addTestElement(
77             ldapDefaultPanel.createTestElement());
78         ((LDAPSampler)sampler).addTestElement(loginPanel.createTestElement());
79         this.configureTestElement(sampler);
80     }
81
82     public String JavaDoc getLabelResource()
83     {
84         return "ldap_testing_title";
85     }
86     
87     private void init()
88     {
89         setLayout(new BorderLayout JavaDoc(0, 5));
90         setBorder(makeBorder());
91         // MAIN PANEL
92
VerticalPanel mainPanel = new VerticalPanel();
93         loginPanel = new LoginConfigGui(false);
94         ldapDefaultPanel = new LdapConfigGui(false);
95         loginPanel.setBorder(
96             BorderFactory.createTitledBorder(
97                 JMeterUtils.getResString("login_config")));
98         add(makeTitlePanel(),BorderLayout.NORTH);
99         mainPanel.add(loginPanel);
100         mainPanel.add(ldapDefaultPanel);
101         add(mainPanel,BorderLayout.CENTER);
102     }
103 }
104
Popular Tags