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 ms...@apache.org on 2004/06/12 18:44:35 UTC
cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/gui AuthPanel.java CookiePanel.java HTTPArgumentsPanel.java
mstover1 2004/06/12 09:44:35
Modified: src/components/org/apache/jmeter/modifiers/gui Tag: rel-2_0
UserParametersGui.java
src/core/org/apache/jmeter/config/gui Tag: rel-2_0
SimpleConfigGui.java
src/protocol/http/org/apache/jmeter/protocol/http/gui Tag:
rel-2_0 AuthPanel.java CookiePanel.java
HTTPArgumentsPanel.java
Log:
Somebody put the fix back in for table values that disappear if you change focus without hitting 'Enter' first
Revision Changes Path
No revision
No revision
1.17.2.1 +6 -2 jakarta-jmeter/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java
Index: UserParametersGui.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -r1.17 -r1.17.2.1
--- UserParametersGui.java 5 Mar 2004 01:33:13 -0000 1.17
+++ UserParametersGui.java 12 Jun 2004 16:44:34 -0000 1.17.2.1
@@ -118,6 +118,10 @@
*/
public void modifyTestElement(TestElement params)
{
+ if (paramTable.isEditing())
+ {
+ paramTable.getCellEditor().stopCellEditing();
+ }
((UserParameters) params).setNames(
new CollectionProperty(
UserParameters.NAMES,
No revision
No revision
1.8.2.1 +308 -311 jakarta-jmeter/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java
Index: SimpleConfigGui.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- SimpleConfigGui.java 5 Mar 2004 01:33:48 -0000 1.8
+++ SimpleConfigGui.java 12 Jun 2004 16:44:34 -0000 1.8.2.1
@@ -1,20 +1,20 @@
// $Header$
/*
* Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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.
*
-*/
+ * Licensed 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.config.gui;
@@ -41,307 +41,304 @@
/**
* Default config gui for Configuration Element.
- *
- * @version $Revision$ on $Date$
+ *
+ * @version $Revision$ on $Date$
*/
-public class SimpleConfigGui extends AbstractConfigGui implements ActionListener
+public class SimpleConfigGui extends AbstractConfigGui implements
+ ActionListener
{
- /* This class created for enhancement Bug ID 9101. */
-
- // TODO: This class looks a lot like ArgumentsPanel. What exactly is the
- // difference? Could they be combined?
-
- /** The table of configuration parameters. */
- private JTable table;
-
- /** The model for the parameter table. */
- private PowerTableModel tableModel;
-
- /** A button for adding new parameters to the table. */
- private JButton add;
-
- /** A button for removing parameters from the table. */
- private JButton delete;
-
- /** Command for adding a row to the table. */
- private static final String ADD = "add";
-
- /** Command for removing a row from the table. */
- private static final String DELETE = "delete";
-
- /**
- * 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 names of the columns in the table. */
- public static final String[] COLUMN_NAMES = {
- JMeterUtils.getResString("name"),
- JMeterUtils.getResString("value"),
- JMeterUtils.getResString("metadata")
- };
-
- /**
- * Create a new standalone SimpleConfigGui.
- */
- public SimpleConfigGui()
- {
- this(true);
- }
-
- /**
- * Create a new SimpleConfigGui 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 SimpleConfigGui(boolean displayName)
- {
- this.displayName = displayName;
- init();
- }
-
- public String getLabelResource()
- {
- return "simple_config_element";
- }
-
- /**
- * 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.
- * <p>
- * This implementation retrieves all key/value pairs from the TestElement
- * object and sets these values in the GUI.
- *
- * @param el the TestElement to configure
- */
- public void configure(TestElement el)
- {
- super.configure(el);
- tableModel.clearData();
- PropertyIterator iter = el.propertyIterator();
- while (iter.hasNext())
- {
- JMeterProperty prop = iter.next();
- tableModel.addRow(
- new Object[] { prop.getName(), prop.getStringValue()});
- }
- checkDeleteStatus();
- }
-
- /* Implements JMeterGUIComponent.createTestElement() */
- public TestElement createTestElement()
- {
- TestElement el = new ConfigTestElement();
- modifyTestElement(el);
- return el;
- }
-
- /**
- * Get all of the values from the GUI component and set them in the
- * TestElement.
- *
- * @param el the TestElement to modify
- */
- public void modifyTestElement(TestElement el)
- {
- Data model = tableModel.getData();
- model.reset();
- while (model.next())
- {
- el.setProperty(
- new StringProperty(
- (String) model.getColumnValue(COLUMN_NAMES[0]),
- (String) model.getColumnValue(COLUMN_NAMES[1])));
- }
- super.configureTestElement(el);
- }
-
- /**
- * Initialize the components and layout of this component.
- */
- private void init()
- {
- setLayout(new BorderLayout(0, 10));
-
- if (displayName)
- {
- setBorder(makeBorder());
- add(makeTitlePanel(), BorderLayout.NORTH);
- }
-
- add(createTablePanel(), BorderLayout.CENTER);
- // Force the table to be at least 70 pixels high
- add(Box.createVerticalStrut(70), BorderLayout.WEST);
- add(createButtonPanel(), BorderLayout.SOUTH);
- }
-
-
- /**
- * Invoked when an action occurs. This implementation supports the add
- * and delete buttons.
- *
- * @param e the event that has occurred
- */
- public void actionPerformed(ActionEvent e)
- {
- String action = e.getActionCommand();
- if (action.equals(DELETE))
- {
- deleteArgument();
- }
- else if (action.equals(ADD))
- {
- addArgument();
- }
- }
-
- /**
- * Create a GUI panel containing the table of configuration parameters.
- *
- * @return a GUI panel containing the parameter table
- */
- private Component createTablePanel()
- {
- tableModel =
- new PowerTableModel(
- new String[] { COLUMN_NAMES[0], COLUMN_NAMES[1] },
- new Class[] { String.class, String.class });
-
- table = new JTable(tableModel);
- table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- return makeScrollPane(table);
- }
-
- /**
- * Create a panel containing the add and delete buttons.
- *
- * @return a GUI panel containing the buttons
- */
- private JPanel createButtonPanel()
- {
- add = new JButton(JMeterUtils.getResString("add"));
- add.setActionCommand(ADD);
- add.addActionListener(this);
- add.setEnabled(true);
-
- delete = new JButton(JMeterUtils.getResString("delete"));
- delete.setActionCommand(DELETE);
- delete.addActionListener(this);
-
- checkDeleteStatus();
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.add(add);
- buttonPanel.add(delete);
- return buttonPanel;
- }
-
- /**
- * Enable or disable the delete button depending on whether or not there
- * is a row to be deleted.
- */
- protected void checkDeleteStatus()
- {
- // Disable DELETE if there are no rows in the table to delete.
- if (tableModel.getRowCount() == 0)
- {
+ /* This class created for enhancement Bug ID 9101. */
+
+ // TODO: This class looks a lot like ArgumentsPanel. What exactly is the
+ // difference? Could they be combined?
+ /** The table of configuration parameters. */
+ private JTable table;
+
+ /** The model for the parameter table. */
+ private PowerTableModel tableModel;
+
+ /** A button for adding new parameters to the table. */
+ private JButton add;
+
+ /** A button for removing parameters from the table. */
+ private JButton delete;
+
+ /** Command for adding a row to the table. */
+ private static final String ADD = "add";
+
+ /** Command for removing a row from the table. */
+ private static final String DELETE = "delete";
+
+ /**
+ * 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 names of the columns in the table. */
+ public static final String[] COLUMN_NAMES = {
+ JMeterUtils.getResString("name"), JMeterUtils.getResString("value"),
+ JMeterUtils.getResString("metadata")};
+
+ /**
+ * Create a new standalone SimpleConfigGui.
+ */
+ public SimpleConfigGui()
+ {
+ this(true);
+ }
+
+ /**
+ * Create a new SimpleConfigGui 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 SimpleConfigGui(boolean displayName)
+ {
+ this.displayName = displayName;
+ init();
+ }
+
+ public String getLabelResource()
+ {
+ return "simple_config_element";
+ }
+
+ /**
+ * 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.
+ * <p>
+ * This implementation retrieves all key/value pairs from the TestElement
+ * object and sets these values in the GUI.
+ *
+ * @param el
+ * the TestElement to configure
+ */
+ public void configure(TestElement el)
+ {
+ super.configure(el);
+ tableModel.clearData();
+ PropertyIterator iter = el.propertyIterator();
+ while (iter.hasNext())
+ {
+ JMeterProperty prop = iter.next();
+ tableModel
+ .addRow(new Object[] { prop.getName(), prop.getStringValue()});
+ }
+ checkDeleteStatus();
+ }
+
+ /* Implements JMeterGUIComponent.createTestElement() */
+ public TestElement createTestElement()
+ {
+ TestElement el = new ConfigTestElement();
+ modifyTestElement(el);
+ return el;
+ }
+
+ /**
+ * Get all of the values from the GUI component and set them in the
+ * TestElement.
+ *
+ * @param el
+ * the TestElement to modify
+ */
+ public void modifyTestElement(TestElement el)
+ {
+ if (table.isEditing())
+ {
+ table.getCellEditor().stopCellEditing();
+ }
+ Data model = tableModel.getData();
+ model.reset();
+ while (model.next())
+ {
+ el.setProperty(new StringProperty((String) model
+ .getColumnValue(COLUMN_NAMES[0]), (String) model
+ .getColumnValue(COLUMN_NAMES[1])));
+ }
+ super.configureTestElement(el);
+ }
+
+ /**
+ * Initialize the components and layout of this component.
+ */
+ private void init()
+ {
+ setLayout(new BorderLayout(0, 10));
+
+ if (displayName)
+ {
+ setBorder(makeBorder());
+ add(makeTitlePanel(), BorderLayout.NORTH);
+ }
+
+ add(createTablePanel(), BorderLayout.CENTER);
+ // Force the table to be at least 70 pixels high
+ add(Box.createVerticalStrut(70), BorderLayout.WEST);
+ add(createButtonPanel(), BorderLayout.SOUTH);
+ }
+
+ /**
+ * Invoked when an action occurs. This implementation supports the add and
+ * delete buttons.
+ *
+ * @param e
+ * the event that has occurred
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ String action = e.getActionCommand();
+ if (action.equals(DELETE))
+ {
+ deleteArgument();
+ }
+ else if (action.equals(ADD))
+ {
+ addArgument();
+ }
+ }
+
+ /**
+ * Create a GUI panel containing the table of configuration parameters.
+ *
+ * @return a GUI panel containing the parameter table
+ */
+ private Component createTablePanel()
+ {
+ tableModel = new PowerTableModel(new String[] { COLUMN_NAMES[0],
+ COLUMN_NAMES[1]}, new Class[] { String.class, String.class});
+
+ table = new JTable(tableModel);
+ table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ return makeScrollPane(table);
+ }
+
+ /**
+ * Create a panel containing the add and delete buttons.
+ *
+ * @return a GUI panel containing the buttons
+ */
+ private JPanel createButtonPanel()
+ {
+ add = new JButton(JMeterUtils.getResString("add"));
+ add.setActionCommand(ADD);
+ add.addActionListener(this);
+ add.setEnabled(true);
+
+ delete = new JButton(JMeterUtils.getResString("delete"));
+ delete.setActionCommand(DELETE);
+ delete.addActionListener(this);
+
+ checkDeleteStatus();
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(add);
+ buttonPanel.add(delete);
+ return buttonPanel;
+ }
+
+ /**
+ * Enable or disable the delete button depending on whether or not there is
+ * a row to be deleted.
+ */
+ protected void checkDeleteStatus()
+ {
+ // Disable DELETE if there are no rows in the table to delete.
+ if (tableModel.getRowCount() == 0)
+ {
+ delete.setEnabled(false);
+ }
+ else
+ {
+ delete.setEnabled(true);
+ }
+ }
+
+ /**
+ * Add a new argument row to the table.
+ */
+ protected void addArgument()
+ {
+ // If a table cell is being edited, we should accept the current value
+ // and stop the editing before adding a new row.
+ stopTableEditing();
+
+ tableModel.addNewRow();
+ tableModel.fireTableDataChanged();
+
+ // Enable DELETE (which may already be enabled, but it won't hurt)
+ delete.setEnabled(true);
+
+ // Highlight (select) the appropriate row.
+ int rowToSelect = tableModel.getRowCount() - 1;
+ table.setRowSelectionInterval(rowToSelect, rowToSelect);
+ }
+
+ /**
+ * Stop any editing that is currently being done on the table. This will
+ * save any changes that have already been made.
+ */
+ protected void stopTableEditing()
+ {
+ if (table.isEditing())
+ {
+ TableCellEditor cellEditor = table.getCellEditor(
+ table.getEditingRow(), table.getEditingColumn());
+ cellEditor.stopCellEditing();
+ }
+ }
+
+ /**
+ * Remove the currently selected argument from the table.
+ */
+ protected void deleteArgument()
+ {
+ // If a table cell is being edited, we must cancel the editing before
+ // deleting the row
+ if (table.isEditing())
+ {
+ TableCellEditor cellEditor = table.getCellEditor(
+ table.getEditingRow(), table.getEditingColumn());
+ cellEditor.cancelCellEditing();
+ }
+
+ int rowSelected = table.getSelectedRow();
+
+ if (rowSelected >= 0)
+ {
+
+ //removeProperty(tableModel.getValueAt (
+ // table.getSelectedRow(),0).toString());
+ tableModel.removeRow(rowSelected);
+ tableModel.fireTableDataChanged();
+
+ // Disable DELETE if there are no rows in the table to delete.
+ if (tableModel.getRowCount() == 0)
+ {
delete.setEnabled(false);
- }
- else
- {
- delete.setEnabled(true);
- }
- }
-
- /**
- * Add a new argument row to the table.
- */
- protected void addArgument()
- {
- // If a table cell is being edited, we should accept the current value
- // and stop the editing before adding a new row.
- stopTableEditing();
-
- tableModel.addNewRow();
- tableModel.fireTableDataChanged();
-
- // Enable DELETE (which may already be enabled, but it won't hurt)
- delete.setEnabled(true);
-
- // Highlight (select) the appropriate row.
- int rowToSelect = tableModel.getRowCount() - 1;
- table.setRowSelectionInterval(rowToSelect, rowToSelect);
- }
-
- /**
- * Stop any editing that is currently being done on the table. This will
- * save any changes that have already been made.
- */
- protected void stopTableEditing()
- {
- if (table.isEditing())
- {
- TableCellEditor cellEditor =
- table.getCellEditor(
- table.getEditingRow(),
- table.getEditingColumn());
- cellEditor.stopCellEditing();
- }
- }
-
- /**
- * Remove the currently selected argument from the table.
- */
- protected void deleteArgument()
- {
- // If a table cell is being edited, we must cancel the editing before
- // deleting the row
- if (table.isEditing())
- {
- TableCellEditor cellEditor =
- table.getCellEditor(
- table.getEditingRow(),
- table.getEditingColumn());
- cellEditor.cancelCellEditing();
- }
-
- int rowSelected = table.getSelectedRow();
-
-
- if (rowSelected >= 0)
- {
-
- //removeProperty(tableModel.getValueAt (
- // table.getSelectedRow(),0).toString());
- tableModel.removeRow(rowSelected);
- tableModel.fireTableDataChanged();
+ }
+ else
+ {
+ // Table still contains one or more rows, so highlight (select)
+ // the appropriate one.
+ int rowToSelect = rowSelected;
- // Disable DELETE if there are no rows in the table to delete.
- if (tableModel.getRowCount() == 0)
+ if (rowSelected >= tableModel.getRowCount())
{
- delete.setEnabled(false);
+ rowToSelect = rowSelected - 1;
}
- else
- {
- // Table still contains one or more rows, so highlight (select)
- // the appropriate one.
- int rowToSelect = rowSelected;
-
- if (rowSelected >= tableModel.getRowCount())
- {
- rowToSelect = rowSelected - 1;
- }
-
- table.setRowSelectionInterval(rowToSelect, rowToSelect);
- }
- }
- }
+
+ table.setRowSelectionInterval(rowToSelect, rowToSelect);
+ }
+ }
+ }
}
No revision
No revision
1.15.2.1 +8 -4 jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java
Index: AuthPanel.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- AuthPanel.java 5 Mar 2004 01:38:01 -0000 1.15
+++ AuthPanel.java 12 Jun 2004 16:44:34 -0000 1.15.2.1
@@ -100,6 +100,10 @@
*/
public void modifyTestElement(TestElement el)
{
+ if (authTable.isEditing())
+ {
+ authTable.getCellEditor().stopCellEditing();
+ }
el.clear();
el.addTestElement((TestElement) tableModel.manager.clone());
configureTestElement(el);
1.18.2.1 +6 -2 jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
Index: CookiePanel.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -r1.18 -r1.18.2.1
--- CookiePanel.java 5 Mar 2004 01:38:02 -0000 1.18
+++ CookiePanel.java 12 Jun 2004 16:44:34 -0000 1.18.2.1
@@ -262,6 +262,10 @@
*/
public void modifyTestElement(TestElement cm)
{
+ if (cookieTable.isEditing())
+ {
+ cookieTable.getCellEditor().stopCellEditing();
+ }
cm.clear();
configureTestElement(cm);
if (cm instanceof CookieManager)
1.14.2.1 +2 -1 jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
Index: HTTPArgumentsPanel.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- HTTPArgumentsPanel.java 12 Feb 2004 00:07:12 -0000 1.14
+++ HTTPArgumentsPanel.java 12 Jun 2004 16:44:34 -0000 1.14.2.1
@@ -98,6 +98,7 @@
public TestElement createTestElement()
{
+ stopTableEditing();
Iterator modelData = tableModel.iterator();
Arguments args = new Arguments();
while (modelData.hasNext())
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org