Beispiel #1
0
 /**
  * Modifies a given TestElement to mirror the data in the gui components.
  *
  * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
  */
 @Override
 public void modifyTestElement(TestElement extractor) {
   super.configureTestElement(extractor);
   if (extractor instanceof HtmlExtractor) {
     HtmlExtractor htmlExtractor = (HtmlExtractor) extractor;
     saveScopeSettings(htmlExtractor);
     htmlExtractor.setRefName(refNameField.getText());
     htmlExtractor.setExpression(expressionField.getText());
     htmlExtractor.setAttribute(attributeField.getText());
     htmlExtractor.setDefaultValue(defaultField.getText());
     htmlExtractor.setMatchNumber(matchNumberField.getText());
     if (extractorImplName.getSelectedIndex() < HtmlExtractor.getImplementations().length) {
       htmlExtractor.setExtractor(
           HtmlExtractor.getImplementations()[extractorImplName.getSelectedIndex()]);
     } else {
       htmlExtractor.setExtractor(USE_DEFAULT_EXTRACTOR_IMPL);
     }
   }
 }
Beispiel #2
0
 @Override
 public void configure(TestElement el) {
   super.configure(el);
   if (el instanceof HtmlExtractor) {
     HtmlExtractor htmlExtractor = (HtmlExtractor) el;
     showScopeSettings(htmlExtractor, true);
     expressionField.setText(htmlExtractor.getExpression());
     attributeField.setText(htmlExtractor.getAttribute());
     defaultField.setText(htmlExtractor.getDefaultValue());
     matchNumberField.setText(htmlExtractor.getMatchNumberAsString());
     refNameField.setText(htmlExtractor.getRefName());
     extractorImplName.setSelectedItem(htmlExtractor.getExtractor());
   }
 }
Beispiel #3
0
  private Component makeExtractorPanel() {
    JPanel panel = new HorizontalPanel();
    panel.setBorder(
        BorderFactory.createTitledBorder(
            JMeterUtils.getResString("html_extractor_type"))); // $NON-NLS-1$

    DefaultComboBoxModel m = new DefaultComboBoxModel();
    for (String s : HtmlExtractor.getImplementations()) {
      m.addElement(s);
    }
    m.addElement(USE_DEFAULT_EXTRACTOR_IMPL);
    extractorImplName = new JComboBox(m);
    extractorImplName.setSelectedItem(HtmlExtractor.DEFAULT_EXTRACTOR);
    JLabel label2 = new JLabel(JMeterUtils.getResString("html_extractor_type")); // $NON-NLS-1$
    label2.setLabelFor(extractorImplName);
    panel.add(label2);
    panel.add(extractorImplName);
    return panel;
  }