01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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.control.gui;
20:
21: import javax.swing.JCheckBox;
22:
23: import org.apache.jmeter.control.TransactionController;
24: import org.apache.jmeter.testelement.TestElement;
25: import org.apache.jmeter.util.JMeterUtils;
26: import org.apache.jorphan.gui.layout.VerticalLayout;
27:
28: /**
29: * A Transaction controller component.
30: *
31: */
32: public class TransactionControllerGui extends AbstractControllerGui {
33:
34: private JCheckBox parent; // If selected, then generate parent sample, otherwise as per original controller
35:
36: /**
37: * Create a new TransactionControllerGui instance.
38: */
39: public TransactionControllerGui() {
40: init();
41: }
42:
43: /* Implements JMeterGUIComponent.createTestElement() */
44: public TestElement createTestElement() {
45: TransactionController lc = new TransactionController();
46: configureTestElement(lc);
47: return lc;
48: }
49:
50: public void configure(TestElement el) {
51: super .configure(el);
52: parent.setSelected(((TransactionController) el).isParent());
53: }
54:
55: /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
56: public void modifyTestElement(TestElement el) {
57: configureTestElement(el);
58: ((TransactionController) el).setParent(parent.isSelected());
59: }
60:
61: public String getLabelResource() {
62: return "transaction_controller_title"; // $NON-NLS-1$
63: }
64:
65: /**
66: * Initialize the GUI components and layout for this component.
67: */
68: private void init() {
69: setLayout(new VerticalLayout(5, VerticalLayout.BOTH,
70: VerticalLayout.TOP));
71: setBorder(makeBorder());
72: add(makeTitlePanel());
73: parent = new JCheckBox(JMeterUtils
74: .getResString("transaction_controller_parent")); // $NON-NLS-1$
75: add(parent);
76: }
77: }
|