1 18 19 package org.apache.jmeter.protocol.http.modifier.gui; 20 21 import java.awt.BorderLayout ; 22 23 import javax.swing.JCheckBox ; 24 25 import org.apache.jmeter.gui.util.VerticalPanel; 26 import org.apache.jmeter.processor.gui.AbstractPreProcessorGui; 27 import org.apache.jmeter.protocol.http.modifier.URLRewritingModifier; 28 import org.apache.jmeter.testelement.TestElement; 29 import org.apache.jmeter.util.JMeterUtils; 30 import org.apache.jorphan.gui.JLabeledTextField; 31 32 35 public class URLRewritingModifierGui extends AbstractPreProcessorGui 36 { 37 JLabeledTextField argumentName; 38 JCheckBox pathExt; 39 JCheckBox pathExtNoEquals; 40 JCheckBox pathExtNoQuestionmark; 41 42 public String getLabelResource() 43 { 44 return "http_url_rewriting_modifier_title"; 45 } 46 47 public URLRewritingModifierGui() 48 { 49 init(); 50 } 51 52 private void init() 53 { 54 setLayout(new BorderLayout (0, 5)); 55 setBorder(makeBorder()); 56 57 add(makeTitlePanel(), BorderLayout.NORTH); 58 59 VerticalPanel mainPanel = new VerticalPanel(); 60 61 argumentName = 62 new JLabeledTextField( 63 JMeterUtils.getResString("session_argument_name"), 64 10); 65 mainPanel.add(argumentName); 66 67 pathExt = 68 new JCheckBox (JMeterUtils.getResString("Path_Extension_choice")); 69 mainPanel.add(pathExt); 70 71 pathExtNoEquals = 72 new JCheckBox ( 73 JMeterUtils.getResString("path_extension_dont_use_equals")); 74 mainPanel.add(pathExtNoEquals); 75 76 pathExtNoQuestionmark = 77 new JCheckBox ( 78 JMeterUtils.getResString("path_extension_dont_use_questionmark")); 79 mainPanel.add(pathExtNoQuestionmark); 80 81 add(mainPanel, BorderLayout.CENTER); 82 } 83 84 87 public TestElement createTestElement() 88 { 89 URLRewritingModifier modifier = new URLRewritingModifier(); 90 modifyTestElement(modifier); 91 return modifier; 92 } 93 94 98 public void modifyTestElement(TestElement modifier) 99 { 100 this.configureTestElement(modifier); 101 ((URLRewritingModifier) modifier).setArgumentName( 102 argumentName.getText()); 103 ((URLRewritingModifier) modifier).setPathExtension( 104 pathExt.isSelected()); 105 ((URLRewritingModifier) modifier).setPathExtensionNoEquals( 106 pathExtNoEquals.isSelected()); 107 ((URLRewritingModifier) modifier).setPathExtensionNoQuestionmark( 108 pathExtNoQuestionmark.isSelected()); 109 } 110 111 public void configure(TestElement el) 112 { 113 argumentName.setText(((URLRewritingModifier) el).getArgumentName()); 114 pathExt.setSelected(((URLRewritingModifier) el).isPathExtension()); 115 pathExtNoEquals.setSelected( 116 ((URLRewritingModifier) el).isPathExtensionNoEquals()); 117 pathExtNoQuestionmark.setSelected( 118 ((URLRewritingModifier) el).isPathExtensionNoQuestionmark()); 119 120 super.configure(el); 121 } 122 } 123 | Popular Tags |