Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/sampler/control/gui/ProducerSamplerGui.java


1   /**
2    *
3    * Copyright 2004 Protique Ltd
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  package org.activemq.sampler.control.gui;
19  
20  import org.apache.jmeter.config.gui.LoginConfigGui;
21  import org.apache.jmeter.gui.util.VerticalPanel;
22  import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
23  import org.apache.jmeter.testelement.TestElement;
24  import org.apache.jmeter.util.JMeterUtils;
25  import org.activemq.sampler.config.gui.ProducerConfigGui;
26  import org.activemq.sampler.Producer;
27  
28  import javax.swing.BorderFactory;
29  
30  import java.awt.BorderLayout;
31  
32  /**
33   * Form in JMeter to enter default values for generating the sampler set.
34   */
35  public class ProducerSamplerGui extends AbstractSamplerGui {
36  
37      //private LoginConfigGui loginPanel;
38      private ProducerConfigGui TcpDefaultPanel;
39  
40      /**
41       * Constructor for the ProducerSamplerGui object
42       */
43      public ProducerSamplerGui() {
44  
45          init();
46      }
47  
48      /**
49       * Method for configuring the ProducerSamplerGui
50       *
51       * @param element
52       */
53      public void configure(TestElement element) {
54  
55          super.configure(element);
56          //loginPanel.configure(element);
57          TcpDefaultPanel.configure(element);
58      }
59  
60      /**
61       * Method for creating test elements
62       *
63       * @return returns a sampler
64       */
65      public TestElement createTestElement() {
66  
67          Producer sampler = new Producer();
68          modifyTestElement(sampler);
69          return sampler;
70      }
71  
72      /**
73       * Method to modify test elements
74       *
75       * @param sampler
76       */
77      public void modifyTestElement(TestElement sampler) {
78  
79          sampler.clear();
80          ((Producer) sampler).addTestElement(TcpDefaultPanel.createTestElement());
81          //((Producer) sampler).addTestElement(loginPanel.createTestElement());
82          this.configureTestElement(sampler);
83      }
84  
85      /**
86       * Getter method for the LabelResource property.
87       *
88       * @return String constant "producer_sample_title"
89       */
90      public String getLabelResource() {
91  
92          return "producer_sample_title";
93      }
94  
95      /**
96       * Method to initialize ProducerSamplerGui. Sets up the layout of the GUI.
97       */
98      private void init() {
99  
100         setLayout(new BorderLayout(0, 5));
101         setBorder(makeBorder());
102 
103         add(makeTitlePanel(), BorderLayout.NORTH);
104 
105         VerticalPanel mainPanel = new VerticalPanel();
106 
107         TcpDefaultPanel = new ProducerConfigGui(false);
108         mainPanel.add(TcpDefaultPanel);
109 
110         //loginPanel = new LoginConfigGui(false);
111         //loginPanel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("login_config")));
112         //mainPanel.add(loginPanel);
113 
114         add(mainPanel, BorderLayout.CENTER);
115     }
116 }