1 18 19 package org.apache.jmeter.reporters.gui; 20 21 import java.awt.BorderLayout ; 22 23 import javax.swing.Box ; 24 import javax.swing.JCheckBox ; 25 import javax.swing.JLabel ; 26 import javax.swing.JPanel ; 27 import javax.swing.JTextField ; 28 29 import org.apache.jmeter.reporters.ResultSaver; 30 import org.apache.jmeter.processor.gui.AbstractPostProcessorGui; 31 import org.apache.jmeter.testelement.TestElement; 32 import org.apache.jmeter.util.JMeterUtils; 33 import org.apache.jorphan.util.JOrphanUtils; 34 35 41 public class ResultSaverGui extends AbstractPostProcessorGui 42 { 43 44 private JTextField filename; 45 private JCheckBox errorsOnly; 46 47 public ResultSaverGui() 48 { 49 super(); 50 init(); 51 } 52 53 56 public String getLabelResource() 57 { 58 return "resultsaver_title"; } 60 61 64 public void configure(TestElement el) 65 { 66 super.configure(el); 67 filename.setText(el.getPropertyAsString(ResultSaver.FILENAME)); 68 errorsOnly.setSelected(el.getPropertyAsBoolean(ResultSaver.ERRORS_ONLY)); 69 } 70 71 74 public TestElement createTestElement() 75 { 76 ResultSaver ResultSaver = new ResultSaver(); 77 modifyTestElement(ResultSaver); 78 return ResultSaver; 79 } 80 81 85 public void modifyTestElement(TestElement te) 86 { 87 super.configureTestElement(te); 88 te.setProperty(ResultSaver.FILENAME, filename.getText()); 89 te.setProperty(ResultSaver.ERRORS_ONLY, 90 JOrphanUtils.booleanToString(errorsOnly.isSelected())); 91 } 92 93 private void init() 94 { 95 setLayout(new BorderLayout ()); 96 setBorder(makeBorder()); 97 Box box = Box.createVerticalBox(); 98 box.add(makeTitlePanel()); 99 box.add(createFilenamePanel()); 100 errorsOnly = 101 new JCheckBox (JMeterUtils.getResString("resultsaver_errors")); box.add(errorsOnly); 103 add(box,BorderLayout.NORTH); 104 105 } 107 private JPanel createFilenamePanel() { 109 JLabel label = 110 new JLabel (JMeterUtils.getResString("resultsaver_prefix")); 112 filename = new JTextField (10); 113 filename.setName(ResultSaver.FILENAME); 114 label.setLabelFor(filename); 115 116 JPanel filenamePanel = new JPanel (new BorderLayout (5, 0)); 117 filenamePanel.add(label, BorderLayout.WEST); 118 filenamePanel.add(filename, BorderLayout.CENTER); 119 return filenamePanel; 120 } 121 122 } 123 | Popular Tags |