KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > control > gui > InterleaveControlGui


1 // $Header: /home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/control/gui/InterleaveControlGui.java,v 1.15 2004/03/05 01:32:37 sebb Exp $
2
/*
3  * Copyright 2001-2004 The Apache Software Foundation.
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
19 package org.apache.jmeter.control.gui;
20
21 import javax.swing.JCheckBox JavaDoc;
22
23 import org.apache.jmeter.control.InterleaveControl;
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  * @version $Revision: 1.15 $ on $Date: 2004/03/05 01:32:37 $
30  */

31 public class InterleaveControlGui extends AbstractControllerGui
32 {
33     private JCheckBox JavaDoc style;
34
35     public InterleaveControlGui()
36     {
37         init();
38     }
39
40     public void configure(TestElement el)
41     {
42         super.configure(el);
43         if (((InterleaveControl) el).getStyle()
44             == InterleaveControl.IGNORE_SUB_CONTROLLERS)
45         {
46             style.setSelected(true);
47         }
48         else
49         {
50             style.setSelected(false);
51         }
52     }
53
54     public TestElement createTestElement()
55     {
56         InterleaveControl ic = new InterleaveControl();
57         modifyTestElement(ic);
58         return ic;
59     }
60
61     /**
62      * Modifies a given TestElement to mirror the data in the gui components.
63      * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
64      */

65     public void modifyTestElement(TestElement ic)
66     {
67         configureTestElement(ic);
68         if (style.isSelected())
69         {
70             ((InterleaveControl) ic).setStyle(
71                 InterleaveControl.IGNORE_SUB_CONTROLLERS);
72         }
73         else
74         {
75             ((InterleaveControl) ic).setStyle(
76                 InterleaveControl.USE_SUB_CONTROLLERS);
77         }
78     }
79
80     public String JavaDoc getLabelResource()
81     {
82         return "interleave_control_title";
83     }
84
85     private void init()
86     {
87         setLayout(
88             new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP));
89         setBorder(makeBorder());
90
91         add(makeTitlePanel());
92
93         style =
94             new JCheckBox JavaDoc(JMeterUtils.getResString("ignore_subcontrollers"));
95         add(style);
96     }
97 }
98
Popular Tags