1 18 19 package org.apache.jmeter.protocol.http.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.protocol.http.sampler.SoapSampler; 27 import org.apache.jmeter.samplers.gui.AbstractSamplerGui; 28 import org.apache.jmeter.testelement.TestElement; 29 import org.apache.jmeter.util.JMeterUtils; 30 import org.apache.jorphan.gui.JLabeledTextArea; 31 import org.apache.jorphan.gui.JLabeledTextField; 32 33 36 public class SoapSamplerGui extends AbstractSamplerGui 37 { 38 private JLabeledTextField urlField; 39 private JLabeledTextArea soapXml; 40 41 public SoapSamplerGui() 42 { 43 init(); 44 } 45 46 public String getLabelResource() 47 { 48 return "soap_sampler_title"; 49 } 50 51 54 public TestElement createTestElement() 55 { 56 SoapSampler sampler = new SoapSampler(); 57 modifyTestElement(sampler); 58 return sampler; 59 } 60 61 65 public void modifyTestElement(TestElement s) 66 { 67 this.configureTestElement(s); 68 if (s instanceof SoapSampler) 69 { 70 SoapSampler sampler = (SoapSampler) s; 71 sampler.setURLData(urlField.getText()); 72 sampler.setXmlData(soapXml.getText()); 73 } 74 } 75 76 private void init() 77 { 78 setLayout(new BorderLayout ()); 79 setBorder(makeBorder()); 80 81 add(makeTitlePanel(), BorderLayout.NORTH); 82 83 urlField = new JLabeledTextField(JMeterUtils.getResString("url"), 10); 84 soapXml = 85 new JLabeledTextArea( 86 JMeterUtils.getResString("soap_data_title"), 87 null); 88 89 JPanel mainPanel = new JPanel (new BorderLayout ()); 90 mainPanel.add(urlField, BorderLayout.NORTH); 91 mainPanel.add(soapXml, BorderLayout.CENTER); 92 93 add(mainPanel, BorderLayout.CENTER); 94 } 95 96 public void configure(TestElement el) 97 { 98 super.configure(el); 99 SoapSampler sampler = (SoapSampler) el; 100 urlField.setText(sampler.getURLData()); 101 soapXml.setText(sampler.getXmlData()); 102 } 103 104 public Dimension getPreferredSize() 105 { 106 return getMinimumSize(); 107 } 108 } 109 | Popular Tags |