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