You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2013/01/01 18:26:13 UTC
svn commit: r1427483 - in
/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier:
RegExUserParameters.java gui/RegExUserParametersGui.java
Author: pmouawad
Date: Tue Jan 1 17:26:12 2013
New Revision: 1427483
URL: http://svn.apache.org/viewvc?rev=1427483&view=rev
Log:
Bug 45772 - RegEx User Parameters Post Processor
eol
Bugzilla Id: 45772
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/RegExUserParameters.java (contents, props changed)
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/gui/RegExUserParametersGui.java (contents, props changed)
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/RegExUserParameters.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/RegExUserParameters.java?rev=1427483&r1=1427482&r2=1427483&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/RegExUserParameters.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/RegExUserParameters.java Tue Jan 1 17:26:12 2013
@@ -1,147 +1,147 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.jmeter.protocol.http.modifier;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.jmeter.config.Argument;
-import org.apache.jmeter.processor.PreProcessor;
-import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
-import org.apache.jmeter.samplers.Sampler;
-import org.apache.jmeter.testelement.AbstractTestElement;
-import org.apache.jmeter.testelement.property.PropertyIterator;
-import org.apache.jmeter.threads.JMeterVariables;
-import org.apache.jorphan.logging.LoggingManager;
-import org.apache.log.Logger;
-
-/**
- * This component allows you to specify reference name of a regular expression that extracts names and values of HTTP request parameters.
- * Regular expression group numbers must be specified for parameter's name and also for parameter's value.
- * Replacement will only occur for parameters in the Sampler that uses this RegEx User Parameters which name matches
- */
-public class RegExUserParameters extends AbstractTestElement implements Serializable, PreProcessor {
- private static final String REGEX_GROUP_SUFFIX = "_g";
-
- private static final String MATCH_NR = "matchNr";
-
- /**
- *
- */
- private static final long serialVersionUID = 5486502839185386122L;
-
- private static final Logger log = LoggingManager.getLoggerForClass();
-
- public static final String REG_EX_REF_NAME = "RegExUserParameters.regex_ref_name";// $NON-NLS-1$
-
- public static final String REG_EX_PARAM_NAMES_GR_NR = "RegExUserParameters.param_names_gr_nr";// $NON-NLS-1$
-
- public static final String REG_EX_PARAM_VALUES_GR_NR = "RegExUserParameters.param_values_gr_nr";// $NON-NLS-1$
-
- @Override
- public void process() {
- if (log.isDebugEnabled()) {
- log.debug(Thread.currentThread().getName() + " Running up named: " + getName());//$NON-NLS-1$
- }
- Sampler entry = getThreadContext().getCurrentSampler();
- if (!(entry instanceof HTTPSamplerBase)) {
- return;
- }
-
- Map<String, String> paramMap = buildParamsMap();
- if(paramMap == null || paramMap.isEmpty()){
- log.info("RegExUserParameters element:"+getName()+" => Referenced RegExp was not found, no parameter will be changed");
- return;
- }
-
- HTTPSamplerBase sampler = (HTTPSamplerBase) entry;
- PropertyIterator iter = sampler.getArguments().iterator();
- while (iter.hasNext()) {
- Argument arg = (Argument) iter.next().getObjectValue();
- String oldValue = arg.getValue();
- // if parameter name exists in http request
- // then change its value with value obtained with regular expression
- String val = paramMap.get(arg.getName());
- if (val != null) {
- arg.setValue(val);
- }
- if (log.isDebugEnabled()){
- log.debug("RegExUserParameters element:"+getName()+" => changed parameter: "+arg.getName() +" = "+ arg.getValue()+", was:"+oldValue);
- }
- }
- }
-
- private Map<String, String> buildParamsMap(){
- String regExRefName = getRegExRefName()+"_";
- String grNames = getRegParamNamesGrNr();
- String grValues = getRegExParamValuesGrNr();
- JMeterVariables jmvars = getThreadContext().getVariables();
- // verify if regex groups exists
- if(jmvars.get(regExRefName + MATCH_NR) == null
- || jmvars.get(regExRefName + 1 + REGEX_GROUP_SUFFIX + grNames) == null
- || jmvars.get(regExRefName + 1 + REGEX_GROUP_SUFFIX + grValues) == null){
- return null;
- }
- int n = Integer.parseInt(jmvars.get(regExRefName + MATCH_NR));
- Map<String, String> map = new HashMap<String, String>(n);
- for(int i=1; i<=n; i++){
- map.put(jmvars.get(regExRefName + i + REGEX_GROUP_SUFFIX + grNames),
- jmvars.get(regExRefName + i + REGEX_GROUP_SUFFIX + grValues));
- }
- return map;
- }
-
- /**
- * A new instance is created for each thread group, and the
- * clone() method is then called to create copies for each thread in a
- * thread group.
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() {
- RegExUserParameters up = (RegExUserParameters) super.clone();
- return up;
- }
-
- public void setRegExRefName(String str) {
- setProperty(REG_EX_REF_NAME, str);
- }
-
- public String getRegExRefName() {
- return getPropertyAsString(REG_EX_REF_NAME);
- }
-
- public void setRegExParamNamesGrNr(String str) {
- setProperty(REG_EX_PARAM_NAMES_GR_NR, str);
- }
-
- public String getRegParamNamesGrNr() {
- return getPropertyAsString(REG_EX_PARAM_NAMES_GR_NR);
- }
-
- public void setRegExParamValuesGrNr(String str) {
- setProperty(REG_EX_PARAM_VALUES_GR_NR, str);
- }
-
- public String getRegExParamValuesGrNr() {
- return getPropertyAsString(REG_EX_PARAM_VALUES_GR_NR);
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.protocol.http.modifier;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.jmeter.config.Argument;
+import org.apache.jmeter.processor.PreProcessor;
+import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.apache.jmeter.samplers.Sampler;
+import org.apache.jmeter.testelement.AbstractTestElement;
+import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.threads.JMeterVariables;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * This component allows you to specify reference name of a regular expression that extracts names and values of HTTP request parameters.
+ * Regular expression group numbers must be specified for parameter's name and also for parameter's value.
+ * Replacement will only occur for parameters in the Sampler that uses this RegEx User Parameters which name matches
+ */
+public class RegExUserParameters extends AbstractTestElement implements Serializable, PreProcessor {
+ private static final String REGEX_GROUP_SUFFIX = "_g";
+
+ private static final String MATCH_NR = "matchNr";
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5486502839185386122L;
+
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
+ public static final String REG_EX_REF_NAME = "RegExUserParameters.regex_ref_name";// $NON-NLS-1$
+
+ public static final String REG_EX_PARAM_NAMES_GR_NR = "RegExUserParameters.param_names_gr_nr";// $NON-NLS-1$
+
+ public static final String REG_EX_PARAM_VALUES_GR_NR = "RegExUserParameters.param_values_gr_nr";// $NON-NLS-1$
+
+ @Override
+ public void process() {
+ if (log.isDebugEnabled()) {
+ log.debug(Thread.currentThread().getName() + " Running up named: " + getName());//$NON-NLS-1$
+ }
+ Sampler entry = getThreadContext().getCurrentSampler();
+ if (!(entry instanceof HTTPSamplerBase)) {
+ return;
+ }
+
+ Map<String, String> paramMap = buildParamsMap();
+ if(paramMap == null || paramMap.isEmpty()){
+ log.info("RegExUserParameters element:"+getName()+" => Referenced RegExp was not found, no parameter will be changed");
+ return;
+ }
+
+ HTTPSamplerBase sampler = (HTTPSamplerBase) entry;
+ PropertyIterator iter = sampler.getArguments().iterator();
+ while (iter.hasNext()) {
+ Argument arg = (Argument) iter.next().getObjectValue();
+ String oldValue = arg.getValue();
+ // if parameter name exists in http request
+ // then change its value with value obtained with regular expression
+ String val = paramMap.get(arg.getName());
+ if (val != null) {
+ arg.setValue(val);
+ }
+ if (log.isDebugEnabled()){
+ log.debug("RegExUserParameters element:"+getName()+" => changed parameter: "+arg.getName() +" = "+ arg.getValue()+", was:"+oldValue);
+ }
+ }
+ }
+
+ private Map<String, String> buildParamsMap(){
+ String regExRefName = getRegExRefName()+"_";
+ String grNames = getRegParamNamesGrNr();
+ String grValues = getRegExParamValuesGrNr();
+ JMeterVariables jmvars = getThreadContext().getVariables();
+ // verify if regex groups exists
+ if(jmvars.get(regExRefName + MATCH_NR) == null
+ || jmvars.get(regExRefName + 1 + REGEX_GROUP_SUFFIX + grNames) == null
+ || jmvars.get(regExRefName + 1 + REGEX_GROUP_SUFFIX + grValues) == null){
+ return null;
+ }
+ int n = Integer.parseInt(jmvars.get(regExRefName + MATCH_NR));
+ Map<String, String> map = new HashMap<String, String>(n);
+ for(int i=1; i<=n; i++){
+ map.put(jmvars.get(regExRefName + i + REGEX_GROUP_SUFFIX + grNames),
+ jmvars.get(regExRefName + i + REGEX_GROUP_SUFFIX + grValues));
+ }
+ return map;
+ }
+
+ /**
+ * A new instance is created for each thread group, and the
+ * clone() method is then called to create copies for each thread in a
+ * thread group.
+ *
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() {
+ RegExUserParameters up = (RegExUserParameters) super.clone();
+ return up;
+ }
+
+ public void setRegExRefName(String str) {
+ setProperty(REG_EX_REF_NAME, str);
+ }
+
+ public String getRegExRefName() {
+ return getPropertyAsString(REG_EX_REF_NAME);
+ }
+
+ public void setRegExParamNamesGrNr(String str) {
+ setProperty(REG_EX_PARAM_NAMES_GR_NR, str);
+ }
+
+ public String getRegParamNamesGrNr() {
+ return getPropertyAsString(REG_EX_PARAM_NAMES_GR_NR);
+ }
+
+ public void setRegExParamValuesGrNr(String str) {
+ setProperty(REG_EX_PARAM_VALUES_GR_NR, str);
+ }
+
+ public String getRegExParamValuesGrNr() {
+ return getPropertyAsString(REG_EX_PARAM_VALUES_GR_NR);
+ }
}
\ No newline at end of file
Propchange: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/RegExUserParameters.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/gui/RegExUserParametersGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/gui/RegExUserParametersGui.java?rev=1427483&r1=1427482&r2=1427483&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/gui/RegExUserParametersGui.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/gui/RegExUserParametersGui.java Tue Jan 1 17:26:12 2013
@@ -1,165 +1,165 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.jmeter.protocol.http.modifier.gui;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.List;
-
-import javax.swing.Box;
-import javax.swing.JPanel;
-
-import org.apache.jmeter.processor.gui.AbstractPreProcessorGui;
-import org.apache.jmeter.protocol.http.modifier.RegExUserParameters;
-import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jorphan.gui.JLabeledTextField;
-
-/**
- * GUI for {@link RegExUserParameters}
- */
-public class RegExUserParametersGui extends AbstractPreProcessorGui {
-
- /**
- *
- */
- private static final long serialVersionUID = 3080808672311046276L;
-
- private JLabeledTextField refRegExRefNameField;
-
- private JLabeledTextField paramNamesGrNrField;
-
- private JLabeledTextField paramValuesGrNrField;
-
- public RegExUserParametersGui() {
- super();
- init();
- }
-
- @Override
- public String getLabelResource() {
- return "regex_params_title"; //$NON-NLS-1$
- }
-
- @Override
- public void configure(TestElement el) {
- super.configure(el);
- if (el instanceof RegExUserParameters){
- RegExUserParameters re = (RegExUserParameters) el;
- paramNamesGrNrField.setText(re.getRegParamNamesGrNr());
- paramValuesGrNrField.setText(re.getRegExParamValuesGrNr());
- refRegExRefNameField.setText(re.getRegExRefName());
- }
- }
-
- /**
- * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
- */
- @Override
- public TestElement createTestElement() {
- RegExUserParameters regExUserParams = new RegExUserParameters();
- modifyTestElement(regExUserParams);
- return regExUserParams;
- }
-
- /**
- * 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 RegExUserParameters) {
- RegExUserParameters regExUserParams = (RegExUserParameters) extractor;
- regExUserParams.setRegExRefName(refRegExRefNameField.getText());
- regExUserParams.setRegExParamNamesGrNr(paramNamesGrNrField.getText());
- regExUserParams.setRegExParamValuesGrNr(paramValuesGrNrField.getText());
- }
- }
-
- /**
- * Implements JMeterGUIComponent.clearGui
- */
- @Override
- public void clearGui() {
- super.clearGui();
-
- paramNamesGrNrField.setText(""); //$NON-NLS-1$
- paramValuesGrNrField.setText(""); //$NON-NLS-1$
- refRegExRefNameField.setText(""); //$NON-NLS-1$
- }
-
- private void init() {
- setLayout(new BorderLayout());
- setBorder(makeBorder());
-
- Box box = Box.createVerticalBox();
- box.add(makeTitlePanel());
- add(box, BorderLayout.NORTH);
- add(makeParameterPanel(), BorderLayout.CENTER);
- }
-
- private JPanel makeParameterPanel() {
- refRegExRefNameField = new JLabeledTextField(JMeterUtils.getResString("regex_params_ref_name_field")); //$NON-NLS-1$
- paramNamesGrNrField = new JLabeledTextField(JMeterUtils.getResString("regex_params_names_field")); //$NON-NLS-1$
- paramValuesGrNrField = new JLabeledTextField(JMeterUtils.getResString("regex_params_values_field")); //$NON-NLS-1$
-
- JPanel panel = new JPanel(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
- initConstraints(gbc);
- addField(panel, refRegExRefNameField, gbc);
- resetContraints(gbc);
- addField(panel, paramNamesGrNrField, gbc);
- resetContraints(gbc);
- gbc.weighty = 1;
- addField(panel, paramValuesGrNrField, gbc);
- return panel;
- }
-
- private void addField(JPanel panel, JLabeledTextField field, GridBagConstraints gbc) {
- List item = field.getComponentList();
- panel.add((Component) item.get(0), gbc.clone());
- gbc.gridx++;
- gbc.weightx = 1;
- gbc.fill=GridBagConstraints.HORIZONTAL;
- panel.add((Component) item.get(1), gbc.clone());
- }
-
- // Next line
- private void resetContraints(GridBagConstraints gbc) {
- gbc.gridx = 0;
- gbc.gridy++;
- gbc.weightx = 0;
- gbc.fill=GridBagConstraints.NONE;
- }
-
- private void initConstraints(GridBagConstraints gbc) {
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.NONE;
- gbc.gridheight = 1;
- gbc.gridwidth = 1;
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = 0;
- gbc.weighty = 0;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.protocol.http.modifier.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.List;
+
+import javax.swing.Box;
+import javax.swing.JPanel;
+
+import org.apache.jmeter.processor.gui.AbstractPreProcessorGui;
+import org.apache.jmeter.protocol.http.modifier.RegExUserParameters;
+import org.apache.jmeter.testelement.TestElement;
+import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.gui.JLabeledTextField;
+
+/**
+ * GUI for {@link RegExUserParameters}
+ */
+public class RegExUserParametersGui extends AbstractPreProcessorGui {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3080808672311046276L;
+
+ private JLabeledTextField refRegExRefNameField;
+
+ private JLabeledTextField paramNamesGrNrField;
+
+ private JLabeledTextField paramValuesGrNrField;
+
+ public RegExUserParametersGui() {
+ super();
+ init();
+ }
+
+ @Override
+ public String getLabelResource() {
+ return "regex_params_title"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void configure(TestElement el) {
+ super.configure(el);
+ if (el instanceof RegExUserParameters){
+ RegExUserParameters re = (RegExUserParameters) el;
+ paramNamesGrNrField.setText(re.getRegParamNamesGrNr());
+ paramValuesGrNrField.setText(re.getRegExParamValuesGrNr());
+ refRegExRefNameField.setText(re.getRegExRefName());
+ }
+ }
+
+ /**
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
+ */
+ @Override
+ public TestElement createTestElement() {
+ RegExUserParameters regExUserParams = new RegExUserParameters();
+ modifyTestElement(regExUserParams);
+ return regExUserParams;
+ }
+
+ /**
+ * 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 RegExUserParameters) {
+ RegExUserParameters regExUserParams = (RegExUserParameters) extractor;
+ regExUserParams.setRegExRefName(refRegExRefNameField.getText());
+ regExUserParams.setRegExParamNamesGrNr(paramNamesGrNrField.getText());
+ regExUserParams.setRegExParamValuesGrNr(paramValuesGrNrField.getText());
+ }
+ }
+
+ /**
+ * Implements JMeterGUIComponent.clearGui
+ */
+ @Override
+ public void clearGui() {
+ super.clearGui();
+
+ paramNamesGrNrField.setText(""); //$NON-NLS-1$
+ paramValuesGrNrField.setText(""); //$NON-NLS-1$
+ refRegExRefNameField.setText(""); //$NON-NLS-1$
+ }
+
+ private void init() {
+ setLayout(new BorderLayout());
+ setBorder(makeBorder());
+
+ Box box = Box.createVerticalBox();
+ box.add(makeTitlePanel());
+ add(box, BorderLayout.NORTH);
+ add(makeParameterPanel(), BorderLayout.CENTER);
+ }
+
+ private JPanel makeParameterPanel() {
+ refRegExRefNameField = new JLabeledTextField(JMeterUtils.getResString("regex_params_ref_name_field")); //$NON-NLS-1$
+ paramNamesGrNrField = new JLabeledTextField(JMeterUtils.getResString("regex_params_names_field")); //$NON-NLS-1$
+ paramValuesGrNrField = new JLabeledTextField(JMeterUtils.getResString("regex_params_values_field")); //$NON-NLS-1$
+
+ JPanel panel = new JPanel(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+ initConstraints(gbc);
+ addField(panel, refRegExRefNameField, gbc);
+ resetContraints(gbc);
+ addField(panel, paramNamesGrNrField, gbc);
+ resetContraints(gbc);
+ gbc.weighty = 1;
+ addField(panel, paramValuesGrNrField, gbc);
+ return panel;
+ }
+
+ private void addField(JPanel panel, JLabeledTextField field, GridBagConstraints gbc) {
+ List item = field.getComponentList();
+ panel.add((Component) item.get(0), gbc.clone());
+ gbc.gridx++;
+ gbc.weightx = 1;
+ gbc.fill=GridBagConstraints.HORIZONTAL;
+ panel.add((Component) item.get(1), gbc.clone());
+ }
+
+ // Next line
+ private void resetContraints(GridBagConstraints gbc) {
+ gbc.gridx = 0;
+ gbc.gridy++;
+ gbc.weightx = 0;
+ gbc.fill=GridBagConstraints.NONE;
+ }
+
+ private void initConstraints(GridBagConstraints gbc) {
+ gbc.anchor = GridBagConstraints.NORTHWEST;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.gridheight = 1;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.weightx = 0;
+ gbc.weighty = 0;
+ }
+}
Propchange: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/gui/RegExUserParametersGui.java
------------------------------------------------------------------------------
svn:eol-style = native