1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. 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; 22 23 import javax.swing.JPanel; 24 25 import org.apache.jmeter.protocol.ldap.config.gui.LdapExtConfigGui; 26 import org.apache.jmeter.protocol.ldap.sampler.LDAPExtSampler; 27 import org.apache.jmeter.samplers.gui.AbstractSamplerGui; 28 import org.apache.jmeter.testelement.TestElement; 29 30 /******************************************************************************* 31 * 32 * author Dolf Smits(Dolf.Smits@Siemens.com) created Aug 09 2003 11:00 AM 33 * company Siemens Netherlands N.V.. 34 * 35 * Based on the work of: author T.Elanjchezhiyan(chezhiyan@siptech.co.in) 36 * created Apr 29 2003 11:00 AM company Sip Technologies and Exports Ltd. 37 * 38 ******************************************************************************/ 39 40 public class LdapExtTestSamplerGui extends AbstractSamplerGui { 41 private LdapExtConfigGui ldapDefaultPanel; 42 43 /*************************************************************************** 44 * !ToDo (Constructor description) 45 **************************************************************************/ 46 public LdapExtTestSamplerGui() { 47 init(); 48 } 49 50 /** 51 * A newly created component can be initialized with the contents of a Test 52 * Element object by calling this method. The component is responsible for 53 * querying the Test Element object for the relevant information to display 54 * in its GUI. 55 * 56 * @param element 57 * the TestElement to configure 58 */ 59 public void configure(TestElement element) { 60 super.configure(element); 61 ldapDefaultPanel.configure(element); 62 } 63 64 public TestElement createTestElement() { 65 LDAPExtSampler sampler = new LDAPExtSampler(); 66 modifyTestElement(sampler); 67 return sampler; 68 } 69 70 /** 71 * Modifies a given TestElement to mirror the data in the gui components. 72 * 73 * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement) 74 */ 75 public void modifyTestElement(TestElement sampler) { 76 sampler.clear(); 77 ((LDAPExtSampler) sampler).addTestElement(ldapDefaultPanel.createTestElement()); 78 this.configureTestElement(sampler); 79 } 80 81 /** 82 * Implements JMeterGUIComponent.clearGui 83 */ 84 public void clearGui() { 85 super.clearGui(); 86 87 ldapDefaultPanel.clearGui(); 88 } 89 90 public String getLabelResource() { 91 return "ldapext_testing_title"; // $NON-NLS-1$ 92 } 93 94 private void init() { 95 setLayout(new BorderLayout(0, 5)); 96 setBorder(makeBorder()); 97 add(makeTitlePanel(), BorderLayout.NORTH); 98 // MAIN PANEL 99 JPanel mainPanel = new JPanel(new BorderLayout(0, 5)); 100 ldapDefaultPanel = new LdapExtConfigGui(false); 101 mainPanel.add(ldapDefaultPanel); 102 add(mainPanel, BorderLayout.CENTER); 103 } 104 }