1 18 19 package org.apache.jmeter.protocol.tcp.control.gui; 20 21 import java.awt.BorderLayout ; 22 23 import javax.swing.BorderFactory ; 24 import org.apache.jmeter.config.gui.LoginConfigGui; 25 import org.apache.jmeter.gui.util.VerticalPanel; 26 import org.apache.jmeter.protocol.tcp.config.gui.TCPConfigGui; 27 import org.apache.jmeter.protocol.tcp.sampler.TCPSampler; 28 import org.apache.jmeter.samplers.gui.AbstractSamplerGui; 29 import org.apache.jmeter.testelement.TestElement; 30 import org.apache.jmeter.util.JMeterUtils; 31 32 35 public class TCPSamplerGui extends AbstractSamplerGui 36 { 37 38 private LoginConfigGui loginPanel; 39 40 private TCPConfigGui TcpDefaultPanel; 41 42 public TCPSamplerGui() 43 { 44 init(); 45 } 46 47 public void configure(TestElement element) 48 { 49 super.configure(element); 50 loginPanel.configure(element); 51 TcpDefaultPanel.configure(element); 52 } 53 54 public TestElement createTestElement() 55 { 56 TCPSampler sampler = new TCPSampler(); 57 modifyTestElement(sampler); 58 return sampler; 59 } 60 61 65 public void modifyTestElement(TestElement sampler) 66 { 67 sampler.clear(); 68 ((TCPSampler) sampler).addTestElement( 69 TcpDefaultPanel.createTestElement()); 70 ((TCPSampler) sampler).addTestElement(loginPanel.createTestElement()); 71 this.configureTestElement(sampler); 72 } 73 74 public String getLabelResource() 75 { 76 return "tcp_sample_title"; 77 } 78 79 private void init() 80 { 81 setLayout(new BorderLayout (0, 5)); 82 setBorder(makeBorder()); 83 84 add(makeTitlePanel(), BorderLayout.NORTH); 85 86 VerticalPanel mainPanel = new VerticalPanel(); 87 88 TcpDefaultPanel = new TCPConfigGui(false); 89 mainPanel.add(TcpDefaultPanel); 90 91 loginPanel = new LoginConfigGui(false); 92 loginPanel.setBorder( 93 BorderFactory.createTitledBorder( 94 JMeterUtils.getResString("login_config"))); 95 mainPanel.add(loginPanel); 96 97 add(mainPanel, BorderLayout.CENTER); 98 } 99 } 100 | Popular Tags |