KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > protocol > jdbc > control > gui > JdbcTestSampleGui


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/control/gui/Attic/JdbcTestSampleGui.java,v 1.9 2004/03/05 01:39:07 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.protocol.jdbc.control.gui;
20
21 import java.awt.BorderLayout JavaDoc;
22 import java.awt.Dimension JavaDoc;
23
24 import javax.swing.JPanel JavaDoc;
25
26 import org.apache.jmeter.gui.util.VerticalPanel;
27 import org.apache.jmeter.protocol.jdbc.config.gui.DbConfigGui;
28 import org.apache.jmeter.protocol.jdbc.config.gui.PoolConfigGui;
29 import org.apache.jmeter.protocol.jdbc.config.gui.SqlConfigGui;
30 import org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler;
31 import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
32 import org.apache.jmeter.testelement.TestElement;
33
34 /**
35  * @version $Revision: 1.9 $ on $Date: 2004/03/05 01:39:07 $
36  */

37 public class JdbcTestSampleGui extends AbstractSamplerGui
38 {
39
40     private PoolConfigGui poolGui;
41     private DbConfigGui dbGui;
42     private SqlConfigGui sqlGui;
43
44     public JdbcTestSampleGui()
45     {
46         init();
47     }
48
49     public void configure(TestElement element)
50     {
51         super.configure(element);
52         dbGui.configure(element);
53         poolGui.configure(element);
54         sqlGui.configure(element);
55     }
56
57     public String JavaDoc getLabelResource()
58     {
59         return "database_testing_title";
60     }
61
62     public TestElement createTestElement()
63     {
64         JDBCSampler sampler = new JDBCSampler();
65         modifyTestElement(sampler);
66         return sampler;
67     }
68
69     /**
70      * Modifies a given TestElement to mirror the data in the gui components.
71      * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
72      */

73     public void modifyTestElement(TestElement sampler)
74     {
75         sampler.clear();
76         sampler.addTestElement(dbGui.createTestElement());
77         sampler.addTestElement(poolGui.createTestElement());
78         sampler.addTestElement(sqlGui.createTestElement());
79         configureTestElement(sampler);
80     }
81
82     private void init()
83     {
84         setLayout(new BorderLayout JavaDoc(0, 5));
85         setBorder(makeBorder());
86
87         add(makeTitlePanel(), BorderLayout.NORTH);
88
89         JPanel JavaDoc mainPanel = new JPanel JavaDoc(new BorderLayout JavaDoc(0, 5));
90
91         VerticalPanel connPanel = new VerticalPanel();
92         dbGui = new DbConfigGui(false);
93         connPanel.add(dbGui);
94
95         poolGui = new PoolConfigGui(false);
96         connPanel.add(poolGui);
97
98         mainPanel.add(connPanel, BorderLayout.NORTH);
99
100         sqlGui = new SqlConfigGui(false);
101         mainPanel.add(sqlGui, BorderLayout.CENTER);
102
103         add(mainPanel, BorderLayout.CENTER);
104     }
105
106     public Dimension JavaDoc getPreferredSize()
107     {
108         return getMinimumSize();
109     }
110 }
111
Popular Tags