1 18 19 package org.apache.jmeter.protocol.jdbc.control.gui; 20 21 import java.awt.BorderLayout ; 22 import java.awt.Dimension ; 23 24 import javax.swing.JPanel ; 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 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 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 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 (0, 5)); 85 setBorder(makeBorder()); 86 87 add(makeTitlePanel(), BorderLayout.NORTH); 88 89 JPanel mainPanel = new JPanel (new BorderLayout (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 getPreferredSize() 107 { 108 return getMinimumSize(); 109 } 110 } 111 | Popular Tags |