You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/07/06 23:47:15 UTC
svn commit: r674351 [2/11] - in /jakarta/jmeter/trunk/src:
components/org/apache/jmeter/config/ components/org/apache/jmeter/control/
components/org/apache/jmeter/control/gui/
components/org/apache/jmeter/extractor/
components/org/apache/jmeter/extract...
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ForeachControlPanel.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ForeachControlPanel.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ForeachControlPanel.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ForeachControlPanel.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -38,176 +38,176 @@
public class ForeachControlPanel extends AbstractControllerGui {
- /**
- * A field allowing the user to specify the input variable the controller
- * should loop.
- */
- private JTextField inputVal;
-
- /**
- * A field allowing the user to specify output variable the controller
- * should return.
- */
- private JTextField returnVal;
-
- // Should we add the "_" separator?
- private JCheckBox useSeparator;
-
- /**
- * Boolean indicating whether or not this component should display its name.
- * If true, this is a standalone component. If false, this component is
- * intended to be used as a subpanel for another component.
- */
- private boolean displayName = true;
-
- /** The name of the infinite checkbox component. */
- private static final String INPUTVAL = "Input Field"; // $NON-NLS-1$
-
- /** The name of the loops field component. */
- private static final String RETURNVAL = "Return Field"; // $NON-NLS-1$
-
- /**
- * Create a new LoopControlPanel as a standalone component.
- */
- public ForeachControlPanel() {
- this(true);
- }
-
- /**
- * Create a new LoopControlPanel as either a standalone or an embedded
- * component.
- *
- * @param displayName
- * indicates whether or not this component should display its
- * name. If true, this is a standalone component. If false, this
- * component is intended to be used as a subpanel for another
- * component.
- */
- public ForeachControlPanel(boolean displayName) {
- this.displayName = displayName;
- init();
- }
-
- /**
- * A newly created component can be initialized with the contents of a Test
- * Element object by calling this method. The component is responsible for
- * querying the Test Element object for the relevant information to display
- * in its GUI.
- *
- * @param element
- * the TestElement to configure
- */
- public void configure(TestElement element) {
- super.configure(element);
- inputVal.setText(((ForeachController) element).getInputValString());
- returnVal.setText(((ForeachController) element).getReturnValString());
- useSeparator.setSelected(((ForeachController) element).getUseSeparator());
- }
-
- /* Implements JMeterGUIComponent.createTestElement() */
- public TestElement createTestElement() {
- ForeachController lc = new ForeachController();
- modifyTestElement(lc);
- return lc;
- }
-
- /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
- public void modifyTestElement(TestElement lc) {
- configureTestElement(lc);
- if (lc instanceof ForeachController) {
- if (inputVal.getText().length() > 0) {
- ((ForeachController) lc).setInputVal(inputVal.getText());
- } else {
- ((ForeachController) lc).setInputVal(""); // $NON-NLS-1$
- }
- if (returnVal.getText().length() > 0) {
- ((ForeachController) lc).setReturnVal(returnVal.getText());
- } else {
- ((ForeachController) lc).setReturnVal(""); // $NON-NLS-1$
- }
- ((ForeachController) lc).setUseSeparator(useSeparator.isSelected());
- }
- }
-
+ /**
+ * A field allowing the user to specify the input variable the controller
+ * should loop.
+ */
+ private JTextField inputVal;
+
+ /**
+ * A field allowing the user to specify output variable the controller
+ * should return.
+ */
+ private JTextField returnVal;
+
+ // Should we add the "_" separator?
+ private JCheckBox useSeparator;
+
+ /**
+ * Boolean indicating whether or not this component should display its name.
+ * If true, this is a standalone component. If false, this component is
+ * intended to be used as a subpanel for another component.
+ */
+ private boolean displayName = true;
+
+ /** The name of the infinite checkbox component. */
+ private static final String INPUTVAL = "Input Field"; // $NON-NLS-1$
+
+ /** The name of the loops field component. */
+ private static final String RETURNVAL = "Return Field"; // $NON-NLS-1$
+
+ /**
+ * Create a new LoopControlPanel as a standalone component.
+ */
+ public ForeachControlPanel() {
+ this(true);
+ }
+
+ /**
+ * Create a new LoopControlPanel as either a standalone or an embedded
+ * component.
+ *
+ * @param displayName
+ * indicates whether or not this component should display its
+ * name. If true, this is a standalone component. If false, this
+ * component is intended to be used as a subpanel for another
+ * component.
+ */
+ public ForeachControlPanel(boolean displayName) {
+ this.displayName = displayName;
+ init();
+ }
+
+ /**
+ * A newly created component can be initialized with the contents of a Test
+ * Element object by calling this method. The component is responsible for
+ * querying the Test Element object for the relevant information to display
+ * in its GUI.
+ *
+ * @param element
+ * the TestElement to configure
+ */
+ public void configure(TestElement element) {
+ super.configure(element);
+ inputVal.setText(((ForeachController) element).getInputValString());
+ returnVal.setText(((ForeachController) element).getReturnValString());
+ useSeparator.setSelected(((ForeachController) element).getUseSeparator());
+ }
+
+ /* Implements JMeterGUIComponent.createTestElement() */
+ public TestElement createTestElement() {
+ ForeachController lc = new ForeachController();
+ modifyTestElement(lc);
+ return lc;
+ }
+
+ /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+ public void modifyTestElement(TestElement lc) {
+ configureTestElement(lc);
+ if (lc instanceof ForeachController) {
+ if (inputVal.getText().length() > 0) {
+ ((ForeachController) lc).setInputVal(inputVal.getText());
+ } else {
+ ((ForeachController) lc).setInputVal(""); // $NON-NLS-1$
+ }
+ if (returnVal.getText().length() > 0) {
+ ((ForeachController) lc).setReturnVal(returnVal.getText());
+ } else {
+ ((ForeachController) lc).setReturnVal(""); // $NON-NLS-1$
+ }
+ ((ForeachController) lc).setUseSeparator(useSeparator.isSelected());
+ }
+ }
+
/**
* Implements JMeterGUIComponent.clearGui
*/
public void clearGui() {
super.clearGui();
-
+
inputVal.setText(""); // $NON-NLS-1$
returnVal.setText(""); // $NON-NLS-1$
useSeparator.setSelected(true);
}
-
- public String getLabelResource() {
- return "foreach_controller_title"; // $NON-NLS-1$
- }
-
- /**
- * Initialize the GUI components and layout for this component.
- */
- private void init() {
- // The Loop Controller panel can be displayed standalone or inside
- // another panel. For standalone, we want to display the TITLE, NAME,
- // etc. (everything). However, if we want to display it within another
- // panel, we just display the Loop Count fields (not the TITLE and
- // NAME).
-
- // Standalone
- if (displayName) {
- setLayout(new BorderLayout(0, 5));
- setBorder(makeBorder());
- add(makeTitlePanel(), BorderLayout.NORTH);
-
- JPanel mainPanel = new JPanel(new BorderLayout());
- mainPanel.add(createLoopCountPanel(), BorderLayout.NORTH);
- add(mainPanel, BorderLayout.CENTER);
- } else {
- // Embedded
- setLayout(new BorderLayout());
- add(createLoopCountPanel(), BorderLayout.NORTH);
- }
- }
-
- /**
- * Create a GUI panel containing the components related to the number of
- * loops which should be executed.
- *
- * @return a GUI panel containing the loop count components
- */
- private JPanel createLoopCountPanel() {
- // JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
- VerticalPanel loopPanel = new VerticalPanel();
-
- // LOOP LABEL
- JLabel inputValLabel = new JLabel(JMeterUtils.getResString("foreach_input")); // $NON-NLS-1$
- JLabel returnValLabel = new JLabel(JMeterUtils.getResString("foreach_output")); // $NON-NLS-1$
-
- // TEXT FIELD
- JPanel inputValSubPanel = new JPanel(new BorderLayout(5, 0));
- inputVal = new JTextField("", 5); // $NON-NLS-1$
- inputVal.setName(INPUTVAL);
- inputValLabel.setLabelFor(inputVal);
- inputValSubPanel.add(inputValLabel, BorderLayout.WEST);
- inputValSubPanel.add(inputVal, BorderLayout.CENTER);
-
- // TEXT FIELD
- JPanel returnValSubPanel = new JPanel(new BorderLayout(5, 0));
- returnVal = new JTextField("", 5); // $NON-NLS-1$
- returnVal.setName(RETURNVAL);
- returnValLabel.setLabelFor(returnVal);
- returnValSubPanel.add(returnValLabel, BorderLayout.WEST);
- returnValSubPanel.add(returnVal, BorderLayout.CENTER);
-
- // Checkbox
- useSeparator = new JCheckBox(JMeterUtils.getResString("foreach_use_separator"), true); // $NON-NLS-1$
-
- loopPanel.add(inputValSubPanel);
- loopPanel.add(returnValSubPanel);
- loopPanel.add(useSeparator);
- return loopPanel;
- }
+ public String getLabelResource() {
+ return "foreach_controller_title"; // $NON-NLS-1$
+ }
+
+ /**
+ * Initialize the GUI components and layout for this component.
+ */
+ private void init() {
+ // The Loop Controller panel can be displayed standalone or inside
+ // another panel. For standalone, we want to display the TITLE, NAME,
+ // etc. (everything). However, if we want to display it within another
+ // panel, we just display the Loop Count fields (not the TITLE and
+ // NAME).
+
+ // Standalone
+ if (displayName) {
+ setLayout(new BorderLayout(0, 5));
+ setBorder(makeBorder());
+ add(makeTitlePanel(), BorderLayout.NORTH);
+
+ JPanel mainPanel = new JPanel(new BorderLayout());
+ mainPanel.add(createLoopCountPanel(), BorderLayout.NORTH);
+ add(mainPanel, BorderLayout.CENTER);
+ } else {
+ // Embedded
+ setLayout(new BorderLayout());
+ add(createLoopCountPanel(), BorderLayout.NORTH);
+ }
+ }
+
+ /**
+ * Create a GUI panel containing the components related to the number of
+ * loops which should be executed.
+ *
+ * @return a GUI panel containing the loop count components
+ */
+ private JPanel createLoopCountPanel() {
+ // JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
+ VerticalPanel loopPanel = new VerticalPanel();
+
+ // LOOP LABEL
+ JLabel inputValLabel = new JLabel(JMeterUtils.getResString("foreach_input")); // $NON-NLS-1$
+ JLabel returnValLabel = new JLabel(JMeterUtils.getResString("foreach_output")); // $NON-NLS-1$
+
+ // TEXT FIELD
+ JPanel inputValSubPanel = new JPanel(new BorderLayout(5, 0));
+ inputVal = new JTextField("", 5); // $NON-NLS-1$
+ inputVal.setName(INPUTVAL);
+ inputValLabel.setLabelFor(inputVal);
+ inputValSubPanel.add(inputValLabel, BorderLayout.WEST);
+ inputValSubPanel.add(inputVal, BorderLayout.CENTER);
+
+ // TEXT FIELD
+ JPanel returnValSubPanel = new JPanel(new BorderLayout(5, 0));
+ returnVal = new JTextField("", 5); // $NON-NLS-1$
+ returnVal.setName(RETURNVAL);
+ returnValLabel.setLabelFor(returnVal);
+ returnValSubPanel.add(returnValLabel, BorderLayout.WEST);
+ returnValSubPanel.add(returnVal, BorderLayout.CENTER);
+
+ // Checkbox
+ useSeparator = new JCheckBox(JMeterUtils.getResString("foreach_use_separator"), true); // $NON-NLS-1$
+
+ loopPanel.add(inputValSubPanel);
+ loopPanel.add(returnValSubPanel);
+ loopPanel.add(useSeparator);
+
+ return loopPanel;
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/IncludeControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/IncludeControllerGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/IncludeControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/IncludeControllerGui.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -33,53 +33,53 @@
// implements UnsharedComponent
{
- private FilePanel includePanel =
+ private FilePanel includePanel =
new FilePanel(JMeterUtils.getResString("include_path"), ".jmx"); //$NON-NLS-1$ //$NON-NLS-2$
- /**
- * Initializes the gui panel for the ModuleController instance.
- */
- public IncludeControllerGui() {
- init();
- }
-
- public String getLabelResource() {
- return "include_controller";//$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#configure(TestElement)
- */
- public void configure(TestElement el) {
- super.configure(el);
- IncludeController controller = (IncludeController) el;
+ /**
+ * Initializes the gui panel for the ModuleController instance.
+ */
+ public IncludeControllerGui() {
+ init();
+ }
+
+ public String getLabelResource() {
+ return "include_controller";//$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#configure(TestElement)
+ */
+ public void configure(TestElement el) {
+ super.configure(el);
+ IncludeController controller = (IncludeController) el;
this.includePanel.setFilename(controller.getIncludePath());
- }
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
- */
- public TestElement createTestElement() {
- IncludeController mc = new IncludeController();
- configureTestElement(mc);
- return mc;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement element) {
- configureTestElement(element);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
+ */
+ public TestElement createTestElement() {
+ IncludeController mc = new IncludeController();
+ configureTestElement(mc);
+ return mc;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement element) {
+ configureTestElement(element);
IncludeController controller = (IncludeController)element;
controller.setIncludePath(this.includePanel.getFilename());
- }
-
+ }
+
/**
* Implements JMeterGUIComponent.clearGui
*/
@@ -88,26 +88,26 @@
includePanel.clearGui();
}
- public JPopupMenu createPopupMenu() {
- JPopupMenu menu = new JPopupMenu();
- JMenu addMenu = MenuFactory.makeMenus(new String[] {
- MenuFactory.CONFIG_ELEMENTS,
- MenuFactory.ASSERTIONS,
- MenuFactory.TIMERS,
- MenuFactory.LISTENERS,
- }, JMeterUtils.getResString("add"), // $NON-NLS-1$
- ActionNames.ADD);
- menu.add(addMenu);
- MenuFactory.addEditMenu(menu, true);
- MenuFactory.addFileMenu(menu);
- return menu;
- }
-
- private void init() {
- setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
- setBorder(makeBorder());
- add(makeTitlePanel());
+ public JPopupMenu createPopupMenu() {
+ JPopupMenu menu = new JPopupMenu();
+ JMenu addMenu = MenuFactory.makeMenus(new String[] {
+ MenuFactory.CONFIG_ELEMENTS,
+ MenuFactory.ASSERTIONS,
+ MenuFactory.TIMERS,
+ MenuFactory.LISTENERS,
+ }, JMeterUtils.getResString("add"), // $NON-NLS-1$
+ ActionNames.ADD);
+ menu.add(addMenu);
+ MenuFactory.addEditMenu(menu, true);
+ MenuFactory.addFileMenu(menu);
+ return menu;
+ }
+
+ private void init() {
+ setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
+ setBorder(makeBorder());
+ add(makeTitlePanel());
add(includePanel);
- }
+ }
}
\ No newline at end of file
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/InterleaveControlGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/InterleaveControlGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/InterleaveControlGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/InterleaveControlGui.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -26,60 +26,60 @@
import org.apache.jorphan.gui.layout.VerticalLayout;
public class InterleaveControlGui extends AbstractControllerGui {
- private JCheckBox style;
+ private JCheckBox style;
- public InterleaveControlGui() {
- init();
- }
-
- public void configure(TestElement el) {
- super.configure(el);
- if (((InterleaveControl) el).getStyle() == InterleaveControl.IGNORE_SUB_CONTROLLERS) {
- style.setSelected(true);
- } else {
- style.setSelected(false);
- }
- }
-
- public TestElement createTestElement() {
- InterleaveControl ic = new InterleaveControl();
- modifyTestElement(ic);
- return ic;
- }
-
- /**
- * Modifies a given TestElement to mirror the data in the gui components.
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement ic) {
- configureTestElement(ic);
- if (style.isSelected()) {
- ((InterleaveControl) ic).setStyle(InterleaveControl.IGNORE_SUB_CONTROLLERS);
- } else {
- ((InterleaveControl) ic).setStyle(InterleaveControl.USE_SUB_CONTROLLERS);
- }
- }
+ public InterleaveControlGui() {
+ init();
+ }
+
+ public void configure(TestElement el) {
+ super.configure(el);
+ if (((InterleaveControl) el).getStyle() == InterleaveControl.IGNORE_SUB_CONTROLLERS) {
+ style.setSelected(true);
+ } else {
+ style.setSelected(false);
+ }
+ }
+
+ public TestElement createTestElement() {
+ InterleaveControl ic = new InterleaveControl();
+ modifyTestElement(ic);
+ return ic;
+ }
+
+ /**
+ * Modifies a given TestElement to mirror the data in the gui components.
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement ic) {
+ configureTestElement(ic);
+ if (style.isSelected()) {
+ ((InterleaveControl) ic).setStyle(InterleaveControl.IGNORE_SUB_CONTROLLERS);
+ } else {
+ ((InterleaveControl) ic).setStyle(InterleaveControl.USE_SUB_CONTROLLERS);
+ }
+ }
/**
* Implements JMeterGUIComponent.clearGui
*/
public void clearGui() {
- super.clearGui();
+ super.clearGui();
style.setSelected(false);
}
-
- public String getLabelResource() {
- return "interleave_control_title"; // $NON-NLS-1$
- }
-
- private void init() {
- setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
- setBorder(makeBorder());
-
- add(makeTitlePanel());
-
- style = new JCheckBox(JMeterUtils.getResString("ignore_subcontrollers")); // $NON-NLS-1$
- add(style);
- }
+
+ public String getLabelResource() {
+ return "interleave_control_title"; // $NON-NLS-1$
+ }
+
+ private void init() {
+ setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
+ setBorder(makeBorder());
+
+ add(makeTitlePanel());
+
+ style = new JCheckBox(JMeterUtils.getResString("ignore_subcontrollers")); // $NON-NLS-1$
+ add(style);
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -44,97 +44,97 @@
/**
* ModuleController Gui.
- *
+ *
*/
public class ModuleControllerGui extends AbstractControllerGui
// implements UnsharedComponent
{
- private JMeterTreeNode selected = null;
+ private JMeterTreeNode selected = null;
- private JComboBox nodes;
+ private JComboBox nodes;
- private DefaultComboBoxModel nodesModel;
+ private DefaultComboBoxModel nodesModel;
- private JLabel warningLabel;
+ private JLabel warningLabel;
+
+ /**
+ * Initializes the gui panel for the ModuleController instance.
+ */
+ public ModuleControllerGui() {
+ init();
+ }
+
+ public String getLabelResource() {
+ return "module_controller_title"; // $NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#configure(TestElement)
+ */
+ public void configure(TestElement el) {
+ super.configure(el);
+ ModuleController controller = (ModuleController) el;
+ this.selected = controller.getSelectedNode();
+ if (selected == null && controller.getNodePath() != null) {
+ warningLabel.setText(JMeterUtils.getResString("module_controller_warning") // $NON-NLS-1$
+ + renderPath(controller.getNodePath()));
+ } else {
+ warningLabel.setText(""); // $NON-NLS-1$
+ }
+ reinitialize();
+ }
+
+ private String renderPath(Collection path) {
+ Iterator iter = path.iterator();
+ StringBuffer buf = new StringBuffer();
+ boolean first = true;
+ while (iter.hasNext()) {
+ if (first) {
+ first = false;
+ iter.next();
+ continue;
+ }
+ buf.append(iter.next());
+ if (iter.hasNext()) {
+ buf.append(" > "); // $NON-NLS-1$
+ }
+ }
+ return buf.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
+ */
+ public TestElement createTestElement() {
+ ModuleController mc = new ModuleController();
+ configureTestElement(mc);
+ if (selected != null) {
+ mc.setSelectedNode(selected);
+ }
+ return mc;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement element) {
+ configureTestElement(element);
+ TreeNodeWrapper tnw = (TreeNodeWrapper) nodesModel.getSelectedItem();
+ if (tnw != null && tnw.getTreeNode() != null) {
+ selected = tnw.getTreeNode();
+ if (selected != null) {
+ ((ModuleController) element).setSelectedNode(selected);
+ }
+ }
+ }
- /**
- * Initializes the gui panel for the ModuleController instance.
- */
- public ModuleControllerGui() {
- init();
- }
-
- public String getLabelResource() {
- return "module_controller_title"; // $NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#configure(TestElement)
- */
- public void configure(TestElement el) {
- super.configure(el);
- ModuleController controller = (ModuleController) el;
- this.selected = controller.getSelectedNode();
- if (selected == null && controller.getNodePath() != null) {
- warningLabel.setText(JMeterUtils.getResString("module_controller_warning") // $NON-NLS-1$
- + renderPath(controller.getNodePath()));
- } else {
- warningLabel.setText(""); // $NON-NLS-1$
- }
- reinitialize();
- }
-
- private String renderPath(Collection path) {
- Iterator iter = path.iterator();
- StringBuffer buf = new StringBuffer();
- boolean first = true;
- while (iter.hasNext()) {
- if (first) {
- first = false;
- iter.next();
- continue;
- }
- buf.append(iter.next());
- if (iter.hasNext()) {
- buf.append(" > "); // $NON-NLS-1$
- }
- }
- return buf.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
- */
- public TestElement createTestElement() {
- ModuleController mc = new ModuleController();
- configureTestElement(mc);
- if (selected != null) {
- mc.setSelectedNode(selected);
- }
- return mc;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement element) {
- configureTestElement(element);
- TreeNodeWrapper tnw = (TreeNodeWrapper) nodesModel.getSelectedItem();
- if (tnw != null && tnw.getTreeNode() != null) {
- selected = tnw.getTreeNode();
- if (selected != null) {
- ((ModuleController) element).setSelectedNode(selected);
- }
- }
- }
-
/**
* Implements JMeterGUIComponent.clearGui
*/
@@ -144,129 +144,129 @@
nodes.setSelectedIndex(-1);
selected = null;
}
-
- public JPopupMenu createPopupMenu() {
- JPopupMenu menu = new JPopupMenu();
- JMenu addMenu = MenuFactory.makeMenus(
- new String[] {
- MenuFactory.CONFIG_ELEMENTS,
- MenuFactory.ASSERTIONS,
- MenuFactory.TIMERS,
- MenuFactory.LISTENERS,
- },
- JMeterUtils.getResString("add"), // $NON-NLS-1$
- ActionNames.ADD);
- menu.add(addMenu);
- MenuFactory.addEditMenu(menu, true);
- MenuFactory.addFileMenu(menu);
- return menu;
- }
-
- private void init() {
- setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
- setBorder(makeBorder());
- add(makeTitlePanel());
-
- // DROP-DOWN MENU
- JPanel modulesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 5));
- JLabel nodesLabel = new JLabel(JMeterUtils.getResString("module_controller_module_to_run")); // $NON-NLS-1$
- modulesPanel.add(nodesLabel);
- nodesModel = new DefaultComboBoxModel();
- nodes = new JComboBox(nodesModel);
+
+ public JPopupMenu createPopupMenu() {
+ JPopupMenu menu = new JPopupMenu();
+ JMenu addMenu = MenuFactory.makeMenus(
+ new String[] {
+ MenuFactory.CONFIG_ELEMENTS,
+ MenuFactory.ASSERTIONS,
+ MenuFactory.TIMERS,
+ MenuFactory.LISTENERS,
+ },
+ JMeterUtils.getResString("add"), // $NON-NLS-1$
+ ActionNames.ADD);
+ menu.add(addMenu);
+ MenuFactory.addEditMenu(menu, true);
+ MenuFactory.addFileMenu(menu);
+ return menu;
+ }
+
+ private void init() {
+ setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
+ setBorder(makeBorder());
+ add(makeTitlePanel());
+
+ // DROP-DOWN MENU
+ JPanel modulesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 5));
+ JLabel nodesLabel = new JLabel(JMeterUtils.getResString("module_controller_module_to_run")); // $NON-NLS-1$
+ modulesPanel.add(nodesLabel);
+ nodesModel = new DefaultComboBoxModel();
+ nodes = new JComboBox(nodesModel);
nodesLabel.setLabelFor(nodes);
- reinitialize();
- modulesPanel.add(nodes);
- warningLabel = new JLabel(""); // $NON-NLS-1$
- modulesPanel.add(warningLabel);
- add(modulesPanel);
- }
-
- private void reinitialize() {
- TreeNodeWrapper current;
- nodesModel.removeAllElements();
- GuiPackage gp = GuiPackage.getInstance();
- JMeterTreeNode root;
- if (gp != null) {
- root = (JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot();
- buildNodesModel(root, "", 0); // $NON-NLS-1$
- }
- if (selected != null) {
- for (int i = 0; i < nodesModel.getSize(); i++) {
- current = (TreeNodeWrapper) nodesModel.getElementAt(i);
- if ((current.getTreeNode() == null && selected == null)
- || (current.getTreeNode() != null && current.getTreeNode().equals(selected))) {
- nodesModel.setSelectedItem(current);
- break;
- }
- }
- }
- }
-
- private void buildNodesModel(JMeterTreeNode node, String parent_name, int level) {
- if (level == 0 && (parent_name == null || parent_name.length() == 0)) {
- nodesModel.addElement(new TreeNodeWrapper(null, "")); // $NON-NLS-1$
- }
- String seperator = " > "; // $NON-NLS-1$
- if (node != null) {
- for (int i = 0; i < node.getChildCount(); i++) {
- StringBuffer name = new StringBuffer();
- JMeterTreeNode cur = (JMeterTreeNode) node.getChildAt(i);
- TestElement te = cur.getTestElement();
- if (te instanceof ThreadGroup) {
- name.append(parent_name);
- name.append(cur.getName());
- name.append(seperator);
- buildNodesModel(cur, name.toString(), level);
- } else if (te instanceof Controller && !(te instanceof ModuleController)) {
- name.append(spaces(level));
- name.append(parent_name);
- name.append(cur.getName());
- TreeNodeWrapper tnw = new TreeNodeWrapper(cur, name.toString());
- nodesModel.addElement(tnw);
- name = new StringBuffer();
- name.append(cur.getName());
- name.append(seperator);
- buildNodesModel(cur, name.toString(), level + 1);
- } else if (te instanceof TestPlan || te instanceof WorkBench) {
- name.append(cur.getName());
- name.append(seperator);
- buildNodesModel(cur, name.toString(), 0);
- }
- }
- }
- }
-
- private String spaces(int level) {
- int multi = 4;
- StringBuffer spaces = new StringBuffer(level * multi);
- for (int i = 0; i < level * multi; i++) {
- spaces.append(" "); // $NON-NLS-1$
- }
- return spaces.toString();
- }
+ reinitialize();
+ modulesPanel.add(nodes);
+ warningLabel = new JLabel(""); // $NON-NLS-1$
+ modulesPanel.add(warningLabel);
+ add(modulesPanel);
+ }
+
+ private void reinitialize() {
+ TreeNodeWrapper current;
+ nodesModel.removeAllElements();
+ GuiPackage gp = GuiPackage.getInstance();
+ JMeterTreeNode root;
+ if (gp != null) {
+ root = (JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot();
+ buildNodesModel(root, "", 0); // $NON-NLS-1$
+ }
+ if (selected != null) {
+ for (int i = 0; i < nodesModel.getSize(); i++) {
+ current = (TreeNodeWrapper) nodesModel.getElementAt(i);
+ if ((current.getTreeNode() == null && selected == null)
+ || (current.getTreeNode() != null && current.getTreeNode().equals(selected))) {
+ nodesModel.setSelectedItem(current);
+ break;
+ }
+ }
+ }
+ }
+
+ private void buildNodesModel(JMeterTreeNode node, String parent_name, int level) {
+ if (level == 0 && (parent_name == null || parent_name.length() == 0)) {
+ nodesModel.addElement(new TreeNodeWrapper(null, "")); // $NON-NLS-1$
+ }
+ String seperator = " > "; // $NON-NLS-1$
+ if (node != null) {
+ for (int i = 0; i < node.getChildCount(); i++) {
+ StringBuffer name = new StringBuffer();
+ JMeterTreeNode cur = (JMeterTreeNode) node.getChildAt(i);
+ TestElement te = cur.getTestElement();
+ if (te instanceof ThreadGroup) {
+ name.append(parent_name);
+ name.append(cur.getName());
+ name.append(seperator);
+ buildNodesModel(cur, name.toString(), level);
+ } else if (te instanceof Controller && !(te instanceof ModuleController)) {
+ name.append(spaces(level));
+ name.append(parent_name);
+ name.append(cur.getName());
+ TreeNodeWrapper tnw = new TreeNodeWrapper(cur, name.toString());
+ nodesModel.addElement(tnw);
+ name = new StringBuffer();
+ name.append(cur.getName());
+ name.append(seperator);
+ buildNodesModel(cur, name.toString(), level + 1);
+ } else if (te instanceof TestPlan || te instanceof WorkBench) {
+ name.append(cur.getName());
+ name.append(seperator);
+ buildNodesModel(cur, name.toString(), 0);
+ }
+ }
+ }
+ }
+
+ private String spaces(int level) {
+ int multi = 4;
+ StringBuffer spaces = new StringBuffer(level * multi);
+ for (int i = 0; i < level * multi; i++) {
+ spaces.append(" "); // $NON-NLS-1$
+ }
+ return spaces.toString();
+ }
}
class TreeNodeWrapper {
- private JMeterTreeNode tn;
+ private JMeterTreeNode tn;
- private String label;
+ private String label;
- private TreeNodeWrapper() {
- }
+ private TreeNodeWrapper() {
+ }
- public TreeNodeWrapper(JMeterTreeNode tn, String label) {
- this.tn = tn;
- this.label = label;
- }
+ public TreeNodeWrapper(JMeterTreeNode tn, String label) {
+ this.tn = tn;
+ this.label = label;
+ }
- public JMeterTreeNode getTreeNode() {
- return tn;
- }
+ public JMeterTreeNode getTreeNode() {
+ return tn;
+ }
- public String toString() {
- return label;
- }
+ public String toString() {
+ return label;
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/OnceOnlyControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/OnceOnlyControllerGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/OnceOnlyControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/OnceOnlyControllerGui.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -23,32 +23,32 @@
import org.apache.jorphan.gui.layout.VerticalLayout;
public class OnceOnlyControllerGui extends AbstractControllerGui {
- public OnceOnlyControllerGui() {
- init();
- }
-
- public TestElement createTestElement() {
- OnceOnlyController oc = new OnceOnlyController();
- modifyTestElement(oc);
- return oc;
- }
-
- /**
- * Modifies a given TestElement to mirror the data in the gui components.
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement oc) {
- configureTestElement(oc);
- }
-
- public String getLabelResource() {
- return "once_only_controller_title"; // $NON-NLS-1$
- }
-
- private void init() {
- setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
- setBorder(makeBorder());
- add(makeTitlePanel());
- }
+ public OnceOnlyControllerGui() {
+ init();
+ }
+
+ public TestElement createTestElement() {
+ OnceOnlyController oc = new OnceOnlyController();
+ modifyTestElement(oc);
+ return oc;
+ }
+
+ /**
+ * Modifies a given TestElement to mirror the data in the gui components.
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement oc) {
+ configureTestElement(oc);
+ }
+
+ public String getLabelResource() {
+ return "once_only_controller_title"; // $NON-NLS-1$
+ }
+
+ private void init() {
+ setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
+ setBorder(makeBorder());
+ add(makeTitlePanel());
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomControlGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomControlGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomControlGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomControlGui.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -27,59 +27,59 @@
import org.apache.jorphan.gui.layout.VerticalLayout;
public class RandomControlGui extends AbstractControllerGui {
- private JCheckBox style;
+ private JCheckBox style;
- public RandomControlGui() {
- init();
- }
-
- public TestElement createTestElement() {
- RandomController ic = new RandomController();
- modifyTestElement(ic);
- return ic;
- }
-
- /**
- * Modifies a given TestElement to mirror the data in the gui components.
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement ic) {
- configureTestElement(ic);
- if (style.isSelected()) {
- ((RandomController) ic).setStyle(InterleaveControl.IGNORE_SUB_CONTROLLERS);
- } else {
- ((RandomController) ic).setStyle(InterleaveControl.USE_SUB_CONTROLLERS);
- }
- }
+ public RandomControlGui() {
+ init();
+ }
+
+ public TestElement createTestElement() {
+ RandomController ic = new RandomController();
+ modifyTestElement(ic);
+ return ic;
+ }
+
+ /**
+ * Modifies a given TestElement to mirror the data in the gui components.
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement ic) {
+ configureTestElement(ic);
+ if (style.isSelected()) {
+ ((RandomController) ic).setStyle(InterleaveControl.IGNORE_SUB_CONTROLLERS);
+ } else {
+ ((RandomController) ic).setStyle(InterleaveControl.USE_SUB_CONTROLLERS);
+ }
+ }
/**
* Implements JMeterGUIComponent.clearGui
*/
public void clearGui() {
- super.clearGui();
+ super.clearGui();
style.setSelected(false);
}
- public void configure(TestElement el) {
- super.configure(el);
- if (((RandomController) el).getStyle() == InterleaveControl.IGNORE_SUB_CONTROLLERS) {
- style.setSelected(true);
- } else {
- style.setSelected(false);
- }
- }
-
- public String getLabelResource() {
- return "random_control_title"; // $NON-NLS-1$
- }
-
- private void init() {
- setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
- setBorder(makeBorder());
- add(makeTitlePanel());
-
- style = new JCheckBox(JMeterUtils.getResString("ignore_subcontrollers")); // $NON-NLS-1$
- add(style);
- }
+ public void configure(TestElement el) {
+ super.configure(el);
+ if (((RandomController) el).getStyle() == InterleaveControl.IGNORE_SUB_CONTROLLERS) {
+ style.setSelected(true);
+ } else {
+ style.setSelected(false);
+ }
+ }
+
+ public String getLabelResource() {
+ return "random_control_title"; // $NON-NLS-1$
+ }
+
+ private void init() {
+ setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
+ setBorder(makeBorder());
+ add(makeTitlePanel());
+
+ style = new JCheckBox(JMeterUtils.getResString("ignore_subcontrollers")); // $NON-NLS-1$
+ add(style);
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomOrderControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomOrderControllerGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomOrderControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/RandomOrderControllerGui.java Sun Jul 6 14:47:12 2008
@@ -5,9 +5,9 @@
* 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.
@@ -21,32 +21,32 @@
/**
* GUI for RandomOrderController.
- *
+ *
*/
public class RandomOrderControllerGui extends LogicControllerGui {
- public String getLabelResource() {
- return "random_order_control_title"; // $NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
- */
- public TestElement createTestElement() {
- RandomOrderController ic = new RandomOrderController();
- modifyTestElement(ic);
- return ic;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(org.apache.jmeter.testelement.TestElement)
- */
- public void modifyTestElement(TestElement ic) {
- configureTestElement(ic);
- }
+ public String getLabelResource() {
+ return "random_order_control_title"; // $NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
+ */
+ public TestElement createTestElement() {
+ RandomOrderController ic = new RandomOrderController();
+ modifyTestElement(ic);
+ return ic;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(org.apache.jmeter.testelement.TestElement)
+ */
+ public void modifyTestElement(TestElement ic) {
+ configureTestElement(ic);
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/SwitchControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/SwitchControllerGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/SwitchControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/SwitchControllerGui.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -29,29 +29,29 @@
import org.apache.jmeter.util.JMeterUtils;
public class SwitchControllerGui extends AbstractControllerGui {
- private static final String SWITCH_LABEL = "switch_controller_label"; // $NON-NLS-1$
+ private static final String SWITCH_LABEL = "switch_controller_label"; // $NON-NLS-1$
- private JTextField switchValue;
+ private JTextField switchValue;
- public SwitchControllerGui() {
- init();
- }
-
- public TestElement createTestElement() {
- SwitchController ic = new SwitchController();
- modifyTestElement(ic);
- return ic;
- }
-
- /**
- * Modifies a given TestElement to mirror the data in the gui components.
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement ic) {
- configureTestElement(ic);
- ((SwitchController) ic).setSelection(switchValue.getText());
- }
+ public SwitchControllerGui() {
+ init();
+ }
+
+ public TestElement createTestElement() {
+ SwitchController ic = new SwitchController();
+ modifyTestElement(ic);
+ return ic;
+ }
+
+ /**
+ * Modifies a given TestElement to mirror the data in the gui components.
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement ic) {
+ configureTestElement(ic);
+ ((SwitchController) ic).setSelection(switchValue.getText());
+ }
/**
* Implements JMeterGUIComponent.clearGui
@@ -61,32 +61,32 @@
switchValue.setText(""); // $NON-NLS-1$
}
- public void configure(TestElement el) {
- super.configure(el);
- switchValue.setText(((SwitchController) el).getSelection());
- }
-
- public String getLabelResource() {
- return "switch_controller_title"; // $NON-NLS-1$
- }
-
- private void init() {
- setLayout(new BorderLayout(0, 5));
- setBorder(makeBorder());
- add(makeTitlePanel(), BorderLayout.NORTH);
-
- JPanel mainPanel = new JPanel(new BorderLayout());
- mainPanel.add(createSwitchPanel(), BorderLayout.NORTH);
- add(mainPanel, BorderLayout.CENTER);
- }
-
- private JPanel createSwitchPanel() {
- JPanel switchPanel = new JPanel(new BorderLayout(5, 0));
- JLabel selectionLabel = new JLabel(JMeterUtils.getResString(SWITCH_LABEL));
- switchValue = new JTextField(""); // $NON-NLS-1$
- selectionLabel.setLabelFor(switchValue);
- switchPanel.add(selectionLabel, BorderLayout.WEST);
- switchPanel.add(switchValue, BorderLayout.CENTER);
- return switchPanel;
- }
+ public void configure(TestElement el) {
+ super.configure(el);
+ switchValue.setText(((SwitchController) el).getSelection());
+ }
+
+ public String getLabelResource() {
+ return "switch_controller_title"; // $NON-NLS-1$
+ }
+
+ private void init() {
+ setLayout(new BorderLayout(0, 5));
+ setBorder(makeBorder());
+ add(makeTitlePanel(), BorderLayout.NORTH);
+
+ JPanel mainPanel = new JPanel(new BorderLayout());
+ mainPanel.add(createSwitchPanel(), BorderLayout.NORTH);
+ add(mainPanel, BorderLayout.CENTER);
+ }
+
+ private JPanel createSwitchPanel() {
+ JPanel switchPanel = new JPanel(new BorderLayout(5, 0));
+ JLabel selectionLabel = new JLabel(JMeterUtils.getResString(SWITCH_LABEL));
+ switchValue = new JTextField(""); // $NON-NLS-1$
+ selectionLabel.setLabelFor(switchValue);
+ switchPanel.add(selectionLabel, BorderLayout.WEST);
+ switchPanel.add(switchValue, BorderLayout.CENTER);
+ return switchPanel;
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ThroughputControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ThroughputControllerGui.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ThroughputControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ThroughputControllerGui.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.control.gui;
@@ -36,59 +36,59 @@
import org.apache.jorphan.gui.layout.VerticalLayout;
public class ThroughputControllerGui extends AbstractControllerGui {
- private JComboBox styleBox;
+ private JComboBox styleBox;
- private int style;
+ private int style;
- private JTextField throughput;
+ private JTextField throughput;
- private JCheckBox perthread;
+ private JCheckBox perthread;
- private boolean isPerThread = true;
-
- private String BYNUMBER_LABEL = JMeterUtils.getResString("throughput_control_bynumber_label"); // $NON-NLS-1$
-
- private String BYPERCENT_LABEL = JMeterUtils.getResString("throughput_control_bypercent_label"); // $NON-NLS-1$
-
- private String THROUGHPUT_LABEL = JMeterUtils.getResString("throughput_control_tplabel"); // $NON-NLS-1$
-
- private String THROUGHPUT = "Througput Field"; // $NON-NLS-1$
-
- private String PERTHREAD_LABEL = JMeterUtils.getResString("throughput_control_perthread_label"); // $NON-NLS-1$
-
- public ThroughputControllerGui() {
- init();
- }
-
- public TestElement createTestElement() {
- ThroughputController tc = new ThroughputController();
- modifyTestElement(tc);
- return tc;
- }
-
- /**
- * Modifies a given TestElement to mirror the data in the gui components.
- *
- * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement tc) {
- configureTestElement(tc);
- ((ThroughputController) tc).setStyle(style);
- ((ThroughputController) tc).setPerThread(isPerThread);
- if (style == ThroughputController.BYNUMBER) {
- try {
- ((ThroughputController) tc).setMaxThroughput(Integer.parseInt(throughput.getText().trim()));
- } catch (NumberFormatException e) {
- ((ThroughputController) tc).setMaxThroughput(throughput.getText());
- }
- } else {
- try {
- ((ThroughputController) tc).setPercentThroughput(Float.parseFloat(throughput.getText().trim()));
- } catch (NumberFormatException e) {
- ((ThroughputController) tc).setPercentThroughput(throughput.getText());
- }
- }
- }
+ private boolean isPerThread = true;
+
+ private String BYNUMBER_LABEL = JMeterUtils.getResString("throughput_control_bynumber_label"); // $NON-NLS-1$
+
+ private String BYPERCENT_LABEL = JMeterUtils.getResString("throughput_control_bypercent_label"); // $NON-NLS-1$
+
+ private String THROUGHPUT_LABEL = JMeterUtils.getResString("throughput_control_tplabel"); // $NON-NLS-1$
+
+ private String THROUGHPUT = "Througput Field"; // $NON-NLS-1$
+
+ private String PERTHREAD_LABEL = JMeterUtils.getResString("throughput_control_perthread_label"); // $NON-NLS-1$
+
+ public ThroughputControllerGui() {
+ init();
+ }
+
+ public TestElement createTestElement() {
+ ThroughputController tc = new ThroughputController();
+ modifyTestElement(tc);
+ return tc;
+ }
+
+ /**
+ * Modifies a given TestElement to mirror the data in the gui components.
+ *
+ * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement tc) {
+ configureTestElement(tc);
+ ((ThroughputController) tc).setStyle(style);
+ ((ThroughputController) tc).setPerThread(isPerThread);
+ if (style == ThroughputController.BYNUMBER) {
+ try {
+ ((ThroughputController) tc).setMaxThroughput(Integer.parseInt(throughput.getText().trim()));
+ } catch (NumberFormatException e) {
+ ((ThroughputController) tc).setMaxThroughput(throughput.getText());
+ }
+ } else {
+ try {
+ ((ThroughputController) tc).setPercentThroughput(Float.parseFloat(throughput.getText().trim()));
+ } catch (NumberFormatException e) {
+ ((ThroughputController) tc).setPercentThroughput(throughput.getText());
+ }
+ }
+ }
/**
* Implements JMeterGUIComponent.clearGui
@@ -100,67 +100,67 @@
perthread.setSelected(true);
}
- public void configure(TestElement el) {
- super.configure(el);
- if (((ThroughputController) el).getStyle() == ThroughputController.BYNUMBER) {
- styleBox.getModel().setSelectedItem(BYNUMBER_LABEL);
- throughput.setText(String.valueOf(((ThroughputController) el).getMaxThroughput()));
- } else {
- styleBox.setSelectedItem(BYPERCENT_LABEL);
- throughput.setText(String.valueOf(((ThroughputController) el).getPercentThroughput()));
- }
- perthread.setSelected(((ThroughputController) el).isPerThread());
- }
-
- public String getLabelResource() {
- return "throughput_control_title"; // $NON-NLS-1$
- }
-
- private void init() {
- setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
- setBorder(makeBorder());
- add(makeTitlePanel());
-
- DefaultComboBoxModel styleModel = new DefaultComboBoxModel();
- styleModel.addElement(BYNUMBER_LABEL);
- styleModel.addElement(BYPERCENT_LABEL);
- styleBox = new JComboBox(styleModel);
- styleBox.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (((String) styleBox.getSelectedItem()).equals(BYNUMBER_LABEL)) {
- style = ThroughputController.BYNUMBER;
- } else {
- style = ThroughputController.BYPERCENT;
- }
- }
- });
- add(styleBox);
-
- // TYPE FIELD
- JPanel tpPanel = new JPanel();
- JLabel tpLabel = new JLabel(THROUGHPUT_LABEL);
- tpPanel.add(tpLabel);
-
- // TEXT FIELD
- throughput = new JTextField(5);
- tpPanel.add(throughput);
- throughput.setName(THROUGHPUT);
- throughput.setText("1"); // $NON-NLS-1$
- // throughput.addActionListener(this);
- tpPanel.add(throughput);
- add(tpPanel);
-
- // PERTHREAD FIELD
- perthread = new JCheckBox(PERTHREAD_LABEL, isPerThread);
- perthread.addItemListener(new ItemListener() {
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == ItemEvent.SELECTED) {
- isPerThread = true;
- } else {
- isPerThread = false;
- }
- }
- });
- add(perthread);
- }
+ public void configure(TestElement el) {
+ super.configure(el);
+ if (((ThroughputController) el).getStyle() == ThroughputController.BYNUMBER) {
+ styleBox.getModel().setSelectedItem(BYNUMBER_LABEL);
+ throughput.setText(String.valueOf(((ThroughputController) el).getMaxThroughput()));
+ } else {
+ styleBox.setSelectedItem(BYPERCENT_LABEL);
+ throughput.setText(String.valueOf(((ThroughputController) el).getPercentThroughput()));
+ }
+ perthread.setSelected(((ThroughputController) el).isPerThread());
+ }
+
+ public String getLabelResource() {
+ return "throughput_control_title"; // $NON-NLS-1$
+ }
+
+ private void init() {
+ setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
+ setBorder(makeBorder());
+ add(makeTitlePanel());
+
+ DefaultComboBoxModel styleModel = new DefaultComboBoxModel();
+ styleModel.addElement(BYNUMBER_LABEL);
+ styleModel.addElement(BYPERCENT_LABEL);
+ styleBox = new JComboBox(styleModel);
+ styleBox.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (((String) styleBox.getSelectedItem()).equals(BYNUMBER_LABEL)) {
+ style = ThroughputController.BYNUMBER;
+ } else {
+ style = ThroughputController.BYPERCENT;
+ }
+ }
+ });
+ add(styleBox);
+
+ // TYPE FIELD
+ JPanel tpPanel = new JPanel();
+ JLabel tpLabel = new JLabel(THROUGHPUT_LABEL);
+ tpPanel.add(tpLabel);
+
+ // TEXT FIELD
+ throughput = new JTextField(5);
+ tpPanel.add(throughput);
+ throughput.setName(THROUGHPUT);
+ throughput.setText("1"); // $NON-NLS-1$
+ // throughput.addActionListener(this);
+ tpPanel.add(throughput);
+ add(tpPanel);
+
+ // PERTHREAD FIELD
+ perthread = new JCheckBox(PERTHREAD_LABEL, isPerThread);
+ perthread.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == ItemEvent.SELECTED) {
+ isPerThread = true;
+ } else {
+ isPerThread = false;
+ }
+ }
+ });
+ add(perthread);
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java Sun Jul 6 14:47:12 2008
@@ -5,15 +5,15 @@
* 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.extractor;
@@ -29,9 +29,9 @@
public class BSFPostProcessor extends BSFTestElement implements Cloneable, PostProcessor, TestBean
{
private static final Logger log = LoggingManager.getLoggerForClass();
-
+
private static final long serialVersionUID = 232L;
-
+
public void process(){
try {
BSFManager mgr = getManager();
@@ -41,5 +41,5 @@
} catch (BSFException e) {
log.warn("Problem in BSF script "+e);
}
- }
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessorBeanInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessorBeanInfo.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessorBeanInfo.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessorBeanInfo.java Sun Jul 6 14:47:12 2008
@@ -5,15 +5,15 @@
* 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.extractor;
@@ -22,8 +22,8 @@
public class BSFPostProcessorBeanInfo extends BSFBeanInfoSupport {
- public BSFPostProcessorBeanInfo() {
- super(BSFPostProcessor.class);
- }
+ public BSFPostProcessorBeanInfo() {
+ super(BSFPostProcessor.class);
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java Sun Jul 6 14:47:12 2008
@@ -5,15 +5,15 @@
* 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.extractor;
@@ -30,29 +30,29 @@
import org.apache.jorphan.util.JMeterException;
import org.apache.log.Logger;
-public class BeanShellPostProcessor extends BeanShellTestElement
+public class BeanShellPostProcessor extends BeanShellTestElement
implements Cloneable, PostProcessor, TestBean
{
private static final Logger log = LoggingManager.getLoggerForClass();
-
+
private static final long serialVersionUID = 4;
-
+
// can be specified in jmeter.properties
private static final String INIT_FILE = "beanshell.postprocessor.init"; //$NON-NLS-1$
protected String getInitFileProperty() {
return INIT_FILE;
}
-
+
public void process() {
JMeterContext jmctx = JMeterContextService.getContext();
SampleResult prev = jmctx.getPreviousResult();
- final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();
- if (prev == null || bshInterpreter == null) {
- log.error("BeanShell not found");
- return;
- }
+ final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();
+ if (prev == null || bshInterpreter == null) {
+ log.error("BeanShell not found");
+ return;
+ }
JMeterVariables vars = jmctx.getVariables();
try {
@@ -65,5 +65,5 @@
} catch (JMeterException e) {
log.warn("Problem in BeanShell script "+e);
}
- }
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessorBeanInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessorBeanInfo.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessorBeanInfo.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessorBeanInfo.java Sun Jul 6 14:47:12 2008
@@ -5,15 +5,15 @@
* 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.extractor;
@@ -22,8 +22,8 @@
public class BeanShellPostProcessorBeanInfo extends BeanShellBeanInfoSupport {
- public BeanShellPostProcessorBeanInfo() {
- super(BeanShellPostProcessor.class);
- }
+ public BeanShellPostProcessorBeanInfo() {
+ super(BeanShellPostProcessor.class);
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessor.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessor.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessor.java Sun Jul 6 14:47:12 2008
@@ -13,7 +13,7 @@
* 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.extractor;
@@ -30,25 +30,25 @@
* Debugging Post-Processor: creates a subSample containing the variables defined in the previous sampler.
*/
public class DebugPostProcessor extends AbstractTestElement implements PostProcessor, TestBean {
-
- public void process(){
- StringBuffer sb = new StringBuffer(100);
- JMeterContext threadContext = getThreadContext();
- PropertyIterator i = threadContext.getCurrentSampler().propertyIterator();
- while(i.hasNext())
- {
- JMeterProperty prop = i.next();
- sb.append(prop.getName());
- sb.append("=");
- sb.append(prop.getStringValue());
- sb.append("\n");
- }
- SampleResult sr = new SampleResult();
- sr.setResponseData(sb.toString().getBytes());
- sr.setDataType("text");
- sr.setSampleLabel(getName());
- sr.setSuccessful(true);
- sr.setSamplerData("SamplerPropertyValues");
- threadContext.getPreviousResult().addSubResult(sr);
- }
+
+ public void process(){
+ StringBuffer sb = new StringBuffer(100);
+ JMeterContext threadContext = getThreadContext();
+ PropertyIterator i = threadContext.getCurrentSampler().propertyIterator();
+ while(i.hasNext())
+ {
+ JMeterProperty prop = i.next();
+ sb.append(prop.getName());
+ sb.append("=");
+ sb.append(prop.getStringValue());
+ sb.append("\n");
+ }
+ SampleResult sr = new SampleResult();
+ sr.setResponseData(sb.toString().getBytes());
+ sr.setDataType("text");
+ sr.setSampleLabel(getName());
+ sr.setSuccessful(true);
+ sr.setSamplerData("SamplerPropertyValues");
+ threadContext.getPreviousResult().addSubResult(sr);
+ }
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessorBeanInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessorBeanInfo.java?rev=674351&r1=674350&r2=674351&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessorBeanInfo.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/DebugPostProcessorBeanInfo.java Sun Jul 6 14:47:12 2008
@@ -5,15 +5,15 @@
* 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.extractor;
@@ -22,8 +22,8 @@
public class DebugPostProcessorBeanInfo extends BeanInfoSupport {
- public DebugPostProcessorBeanInfo() {
- super(DebugPostProcessor.class);
- }
+ public DebugPostProcessorBeanInfo() {
+ super(DebugPostProcessor.class);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org