001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018:
019: package org.apache.jmeter.protocol.ldap.control.gui;
020:
021: import java.awt.BorderLayout;
022:
023: import javax.swing.JPanel;
024:
025: import org.apache.jmeter.protocol.ldap.config.gui.LdapExtConfigGui;
026: import org.apache.jmeter.protocol.ldap.sampler.LDAPExtSampler;
027: import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
028: import org.apache.jmeter.testelement.TestElement;
029:
030: /*******************************************************************************
031: *
032: * author Dolf Smits(Dolf.Smits@Siemens.com) created Aug 09 2003 11:00 AM
033: * company Siemens Netherlands N.V..
034: *
035: * Based on the work of: author T.Elanjchezhiyan(chezhiyan@siptech.co.in)
036: * created Apr 29 2003 11:00 AM company Sip Technologies and Exports Ltd.
037: *
038: ******************************************************************************/
039:
040: public class LdapExtTestSamplerGui extends AbstractSamplerGui {
041: private LdapExtConfigGui ldapDefaultPanel;
042:
043: /***************************************************************************
044: * !ToDo (Constructor description)
045: **************************************************************************/
046: public LdapExtTestSamplerGui() {
047: init();
048: }
049:
050: /**
051: * A newly created component can be initialized with the contents of a Test
052: * Element object by calling this method. The component is responsible for
053: * querying the Test Element object for the relevant information to display
054: * in its GUI.
055: *
056: * @param element
057: * the TestElement to configure
058: */
059: public void configure(TestElement element) {
060: super .configure(element);
061: ldapDefaultPanel.configure(element);
062: }
063:
064: public TestElement createTestElement() {
065: LDAPExtSampler sampler = new LDAPExtSampler();
066: modifyTestElement(sampler);
067: return sampler;
068: }
069:
070: /**
071: * Modifies a given TestElement to mirror the data in the gui components.
072: *
073: * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
074: */
075: public void modifyTestElement(TestElement sampler) {
076: sampler.clear();
077: ((LDAPExtSampler) sampler).addTestElement(ldapDefaultPanel
078: .createTestElement());
079: this .configureTestElement(sampler);
080: }
081:
082: /**
083: * Implements JMeterGUIComponent.clearGui
084: */
085: public void clearGui() {
086: super .clearGui();
087:
088: ldapDefaultPanel.clearGui();
089: }
090:
091: public String getLabelResource() {
092: return "ldapext_testing_title"; // $NON-NLS-1$
093: }
094:
095: private void init() {
096: setLayout(new BorderLayout(0, 5));
097: setBorder(makeBorder());
098: add(makeTitlePanel(), BorderLayout.NORTH);
099: // MAIN PANEL
100: JPanel mainPanel = new JPanel(new BorderLayout(0, 5));
101: ldapDefaultPanel = new LdapExtConfigGui(false);
102: mainPanel.add(ldapDefaultPanel);
103: add(mainPanel, BorderLayout.CENTER);
104: }
105: }
|