jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1294517 - in /jmeter/trunk: src/core/org/apache/jmeter/config/gui/ src/core/org/apache/jmeter/resources/ xdocs/
Date Tue, 28 Feb 2012 08:12:13 GMT
Author: pmouawad
Date: Tue Feb 28 08:12:13 2012
New Revision: 1294517

URL: http://svn.apache.org/viewvc?rev=1294517&view=rev
Log:
Bug 52782 - Add a detail button on parameters table to show detail of a Row

Added:
    jmeter/trunk/src/core/org/apache/jmeter/config/gui/RowDetailDialog.java   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java?rev=1294517&r1=1294516&r2=1294517&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java Tue Feb 28 08:12:13
2012
@@ -101,6 +101,8 @@ public class ArgumentsPanel extends Abst
 
     private final boolean enableUpDown;
 
+    private JButton showDetail;
+
     /** Command for adding a row to the table. */
     private static final String ADD = "add"; // $NON-NLS-1$
 
@@ -116,6 +118,9 @@ public class ArgumentsPanel extends Abst
     /** Command for moving a row down in the table. */
     private static final String DOWN = "down"; // $NON-NLS-1$
 
+    /** Command for showing detail. */
+    private static final String DETAIL = "detail"; // $NON-NLS-1$
+
     public static final String COLUMN_RESOURCE_NAMES_0 = "name"; // $NON-NLS-1$
 
     public static final String COLUMN_RESOURCE_NAMES_1 = "value"; // $NON-NLS-1$
@@ -330,6 +335,8 @@ public class ArgumentsPanel extends Abst
             moveUp();
         } else if (action.equals(DOWN)) {
             moveDown();
+        } else if (action.equals(DETAIL)) {
+            showDetail();
         }
     }
 
@@ -383,6 +390,20 @@ public class ArgumentsPanel extends Abst
     }
 
     /**
+     * Show Row Detail
+     */
+    private void showDetail() {
+        cancelEditing();
+
+        int[] rowsSelected = table.getSelectedRows();
+        if (rowsSelected.length == 1) {
+            table.clearSelection();
+            RowDetailDialog detailDialog = new RowDetailDialog(tableModel, rowsSelected[0]);
+            detailDialog.setVisible(true);
+        } 
+    }
+    
+    /**
      * Remove the currently selected argument from the table.
      */
     protected void deleteArgument() {
@@ -585,6 +606,10 @@ public class ArgumentsPanel extends Abst
      * @return a GUI panel containing the buttons
      */
     private JPanel makeButtonPanel() {
+        showDetail = new JButton(JMeterUtils.getResString("detail")); // $NON-NLS-1$
+        showDetail.setActionCommand(DETAIL);
+        showDetail.setEnabled(true);
+        
         add = new JButton(JMeterUtils.getResString("add")); // $NON-NLS-1$
         add.setActionCommand(ADD);
         add.setEnabled(true);
@@ -610,9 +635,11 @@ public class ArgumentsPanel extends Abst
         if (this.background != null) {
             buttonPanel.setBackground(this.background);
         }
+        showDetail.addActionListener(this);
         add.addActionListener(this);
         addFromClipboard.addActionListener(this);
         delete.addActionListener(this);
+        buttonPanel.add(showDetail);
         buttonPanel.add(add);
         buttonPanel.add(addFromClipboard);
         buttonPanel.add(delete);

Added: jmeter/trunk/src/core/org/apache/jmeter/config/gui/RowDetailDialog.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/config/gui/RowDetailDialog.java?rev=1294517&view=auto
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/config/gui/RowDetailDialog.java (added)
+++ jmeter/trunk/src/core/org/apache/jmeter/config/gui/RowDetailDialog.java Tue Feb 28 08:12:13
2012
@@ -0,0 +1,200 @@
+/*
+ * 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.config.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import org.apache.jmeter.gui.action.KeyStrokes;
+import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.gui.ComponentUtil;
+import org.apache.jorphan.gui.JLabeledTextArea;
+import org.apache.jorphan.gui.JLabeledTextField;
+import org.apache.jorphan.gui.ObjectTableModel;
+
+/**
+ * Show detail of a Row 
+ */
+public class RowDetailDialog extends JDialog implements ActionListener {
+
+	/**
+     * 
+     */
+    private static final long serialVersionUID = 6578889215615435475L;
+
+    /** Command for moving a row up in the table. */
+    private static final String NEXT = "next"; // $NON-NLS-1$
+
+    /** Command for moving a row down in the table. */
+    private static final String PREVIOUS = "previous"; // $NON-NLS-1$
+
+    /** Command for CANCEL. */
+    private static final String CLOSE = "close"; // $NON-NLS-1$
+
+    private static final String UPDATE = "update"; // $NON-NLS-1$
+    
+	private JLabeledTextField nameTF;
+
+    private JLabeledTextArea valueTA;
+
+    private JButton updateButton;
+
+    private JButton nextButton;
+
+    private JButton previousButton;
+
+    private JButton closeButton;
+
+	/**
+	 * Hide Window on ESC
+	 */
+	private transient ActionListener enterActionListener = new ActionListener() {
+		public void actionPerformed(ActionEvent actionEvent) {
+			doUpdate(actionEvent);
+			setVisible(false);
+		}	
+	};
+	
+	/**
+	 * Do search on Enter
+	 */
+	private transient ActionListener escapeActionListener = new ActionListener() {
+		public void actionPerformed(ActionEvent actionEvent) {
+			setVisible(false);
+		}	
+	};
+
+
+    private ObjectTableModel tableModel;
+
+
+    private int selectedRow;
+	
+	public RowDetailDialog(ObjectTableModel tableModel, int selectedRow) {
+        super((JFrame) null, JMeterUtils.getResString("search_tree_title"), true); //$NON-NLS-1$
+        this.tableModel = tableModel;
+        this.selectedRow = selectedRow;
+        init();
+    }
+
+    private void init() {
+        this.getContentPane().setLayout(new BorderLayout(10,10));
+
+        nameTF = new JLabeledTextField(JMeterUtils.getResString("name"), 20); //$NON-NLS-1$
+        valueTA = new JLabeledTextArea(JMeterUtils.getResString("value")); //$NON-NLS-1$
+        valueTA.setPreferredSize(new Dimension(150, 300));
+        nameTF.setPreferredSize(new Dimension((int)Math.round(getWidth()*0.8), 40));
+        setValues(selectedRow);
+        JPanel detailPanel = new JPanel();
+        detailPanel.setLayout(new BorderLayout());
+        //detailPanel.setBorder(BorderFactory.createEmptyBorder(7, 3, 3, 3));
+        detailPanel.add(nameTF, BorderLayout.NORTH);
+        detailPanel.add(valueTA, BorderLayout.CENTER);
+        
+        JPanel mainPanel = new JPanel();
+        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+        mainPanel.setBorder(BorderFactory.createEmptyBorder(7, 3, 3, 3));
+        mainPanel.add(detailPanel, BorderLayout.CENTER);
+
+        JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+        
+        updateButton = new JButton(JMeterUtils.getResString("update")); //$NON-NLS-1$
+        updateButton.setActionCommand(UPDATE);
+        updateButton.addActionListener(this);
+        closeButton = new JButton(JMeterUtils.getResString("close")); //$NON-NLS-1$
+        closeButton.setActionCommand(CLOSE);
+        closeButton.addActionListener(this);
+        nextButton = new JButton(JMeterUtils.getResString("next")); //$NON-NLS-1$
+        nextButton.setActionCommand(NEXT);
+        nextButton.addActionListener(this);
+        nextButton.setEnabled(selectedRow < tableModel.getRowCount()-1);
+        previousButton = new JButton(JMeterUtils.getResString("previous")); //$NON-NLS-1$
+        previousButton.setActionCommand(PREVIOUS);
+        previousButton.addActionListener(this);
+        previousButton.setEnabled(selectedRow > 0);
+
+        buttonsPanel.add(updateButton);
+        buttonsPanel.add(previousButton);
+        buttonsPanel.add(nextButton);
+        buttonsPanel.add(closeButton);
+        mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
+        this.getContentPane().add(mainPanel);
+        mainPanel.registerKeyboardAction(enterActionListener, KeyStrokes.ENTER, JComponent.WHEN_IN_FOCUSED_WINDOW);
+        mainPanel.registerKeyboardAction(escapeActionListener, KeyStrokes.ESC, JComponent.WHEN_IN_FOCUSED_WINDOW);
+    	nameTF.requestFocusInWindow();
+
+        this.pack();
+        ComponentUtil.centerComponentInWindow(this);
+    }
+
+    /**
+     * Do search
+     * @param e {@link ActionEvent}
+     */
+    public void actionPerformed(ActionEvent e) {
+        String action = e.getActionCommand();
+    	if(action.equals(CLOSE)) {
+    		this.setVisible(false);
+    	} 
+    	else if(action.equals(NEXT)) {
+    	    selectedRow++;
+            previousButton.setEnabled(true);
+    	    nextButton.setEnabled(selectedRow < tableModel.getRowCount()-1);
+    	    setValues(selectedRow);
+    	} 
+    	else if(action.equals(PREVIOUS)) {
+            selectedRow--;
+            nextButton.setEnabled(true);
+            previousButton.setEnabled(selectedRow > 0);
+            setValues(selectedRow);
+        } 
+    	else if(action.equals(UPDATE)) { 	   
+            doUpdate(e);
+    	}
+    }
+
+    /**
+     * Set TextField and TA values from model
+     * @param selectedRow Selected row
+     */
+	private void setValues(int selectedRow) {
+        nameTF.setText((String)tableModel.getValueAt(selectedRow, 0));
+        valueTA.setText((String)tableModel.getValueAt(selectedRow, 1));
+    }
+	
+	/**
+	 * Update model values
+	 * @param actionEvent
+	 */
+    protected void doUpdate(ActionEvent actionEvent) {
+        tableModel.setValueAt(nameTF.getText(), selectedRow, 0);
+        tableModel.setValueAt(valueTA.getText(), selectedRow, 1);
+    }
+}
\ No newline at end of file

Propchange: jmeter/trunk/src/core/org/apache/jmeter/config/gui/RowDetailDialog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1294517&r1=1294516&r2=1294517&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Tue Feb 28 08:12:13
2012
@@ -154,6 +154,7 @@ clear=Clear
 clear_all=Clear All
 clear_cache_per_iter=Clear cache each iteration?
 clear_cookies_per_iter=Clear cookies each iteration?
+close=Close
 column_delete_disallowed=Deleting this column is not permitted
 column_number=Column number of CSV file | next | *alias
 compare=Compare
@@ -212,6 +213,7 @@ delete_user=Delete User
 deltest=Deletion test
 deref=Dereference aliases
 description=Description
+detail=Detail
 disable=Disable
 distribution_graph_title=Distribution Graph (alpha)
 distribution_note1=The graph will update every 10 samples
@@ -590,6 +592,7 @@ monitor_performance_title=Performance Gr
 name=Name\:
 new=New
 newdn=New distinguished name
+next=Next
 no=Norwegian
 number_of_threads=Number of Threads (users)\:
 obsolete_test_element=This test element is obsolete
@@ -620,6 +623,7 @@ post_as_rawbody=RAW Body
 post_body=Post Body
 post_body_raw=Raw Post Body
 post_thread_group_title=tearDown Thread Group
+previous=Previous
 property_as_field_label={0}\:
 property_default_param=Default value
 property_edit=Edit
@@ -1005,6 +1009,7 @@ uniform_timer_memo=Adds a random delay w
 uniform_timer_range=Random Delay Maximum (in milliseconds)\:
 uniform_timer_title=Uniform Random Timer
 up=Up
+update=Update
 update_per_iter=Update Once Per Iteration
 upload=File Upload
 upper_bound=Upper Bound

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1294517&r1=1294516&r2=1294517&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties Tue Feb 28 08:12:13
2012
@@ -148,6 +148,7 @@ clear=Nettoyer
 clear_all=Nettoyer tout
 clear_cache_per_iter=Nettoyer le cache \u00E0 chaque it\u00E9ration ?
 clear_cookies_per_iter=Nettoyer les cookies \u00E0 chaque it\u00E9ration ?
+close=Fermer
 column_delete_disallowed=Supprimer cette colonne n'est pas possible
 column_number=Num\u00E9ro de colonne du fichier CSV | next | *alias
 compare=Comparaison
@@ -206,6 +207,7 @@ delete_user=Supprimer l'utilisateur
 deltest=Suppression
 deref=D\u00E9r\u00E9f\u00E9rencement des alias
 description=Description
+detail=D\u00E9tail
 disable=D\u00E9sactiver
 distribution_graph_title=Graphique de distribution (alpha)
 distribution_note1=Ce graphique se mettra \u00E0 jour tous les 10 \u00E9chantillons
@@ -584,6 +586,7 @@ monitor_performance_title=Graphique de p
 name=Nom \:
 new=Nouveau
 newdn=Nouveau DN
+next=Suivant
 no=Norv\u00E9gien
 number_of_threads=Nombre d'unit\u00E9s (utilisateurs) \:
 obsolete_test_element=Cet \u00E9l\u00E9ment de test est obsol\u00E8te
@@ -614,6 +617,7 @@ post_as_rawbody=Donn\u00E9es brutes
 post_body=Donn\u00E9es POST
 post_body_raw=Donn\u00E9es POST brutes
 post_thread_group_title=Groupe d'unit\u00E9s de fin
+previous=Pr\u00E9c\u00E9dent
 property_as_field_label={0}\:
 property_default_param=Valeur par d\u00E9faut
 property_edit=Editer
@@ -999,6 +1003,7 @@ uniform_timer_memo=Ajoute un d\u00E9lai 
 uniform_timer_range=D\u00E9viation al\u00E9atoire maximum (en millisecondes) \:
 uniform_timer_title=Compteur de temps al\u00E9atoire uniforme
 up=Monter
+update=Mettre \u00E0 jour
 update_per_iter=Mettre \u00E0 jour une fois par it\u00E9ration
 upload=Fichier \u00E0 uploader
 upper_bound=Borne sup\u00E9rieure

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1294517&r1=1294516&r2=1294517&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Tue Feb 28 08:12:13 2012
@@ -149,6 +149,7 @@ When doing replacement of User Defined V
 <ul>
 <li>Bug 45839 - Test Action : Allow premature exit from a loop</li>
 <li>Bug 52614 - MailerModel.sendMail has strange way to calculate debug setting</li>
+<li>Bug 52782 - Add a detail button on parameters table to show detail of a Row</li>
 </ul>
 
 <h2>Non-functional changes</h2>



Mime
View raw message