jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1854638 - in /jmeter/trunk: src/components/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/functions/gui/ src/core/org/apache/jmeter/gui/action/ src/protocol/http/org/apache/jmeter/protocol/http/gui/action/ xdocs/
Date Sat, 02 Mar 2019 11:03:38 GMT
Author: pmouawad
Date: Sat Mar  2 11:03:38 2019
New Revision: 1854638

URL: http://svn.apache.org/viewvc?rev=1854638&view=rev
Log:
Bug 63220 - Function Helper Dialog,Export transactions for report and Import from cURL disappear
being master JFrame.


Bugzilla Id: 63220

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/gui/action/ExportTransactionAndSamplerNames.java
    jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/CreateFunctionDialog.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeCommand.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/gui/action/ExportTransactionAndSamplerNames.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/gui/action/ExportTransactionAndSamplerNames.java?rev=1854638&r1=1854637&r2=1854638&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/gui/action/ExportTransactionAndSamplerNames.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/gui/action/ExportTransactionAndSamplerNames.java
Sat Mar  2 11:03:38 2019
@@ -133,7 +133,7 @@ public class ExportTransactionAndSampler
         if(sampleNames.isEmpty()) {
             log.warn("No transaction exported using regexp '{}', modify property '{}' to
fix this problem",
                     TRANSACTIONS_REGEX_PATTERN, "report_transactions_pattern");
-            showResult("No transaction exported using regexp '"
+            showResult(e, "No transaction exported using regexp '"
                     +TRANSACTIONS_REGEX_PATTERN
                     +"', modify property 'report_transactions_pattern' to fix this problem");
         } else {
@@ -146,7 +146,7 @@ public class ExportTransactionAndSampler
             log.info("Exported transactions: jmeter.reportgenerator.exporter.html.series_filter=^({})(-success|-failure)?$",

                     result);
 
-            showResult("jmeter.reportgenerator.exporter.html.series_filter=^("
+            showResult(e, "jmeter.reportgenerator.exporter.html.series_filter=^("
                     +result
                     +")(-success|-failure)?$");
             
@@ -155,11 +155,12 @@ public class ExportTransactionAndSampler
 
     /**
      * Display result in popup
+     * @param event {@link ActionEvent}
      * @param result String 
      */
-    private static final void showResult(String result) {
-        EscapeDialog messageDialog = new EscapeDialog(GuiPackage.getInstance().getMainFrame(),
-                JMeterUtils.getResString("export_transactions_title"), true); //$NON-NLS-1$
+    private final void showResult(ActionEvent event, String result) {
+        EscapeDialog messageDialog = new EscapeDialog(getParentFrame(event),
+                JMeterUtils.getResString("export_transactions_title"), false); //$NON-NLS-1$
         Container contentPane = messageDialog.getContentPane();
         contentPane.setLayout(new BorderLayout());
         contentPane.add(new JLabel(

Modified: jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java?rev=1854638&r1=1854637&r2=1854638&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java Sat Mar  2 11:03:38
2019
@@ -64,6 +64,7 @@ import org.apache.jmeter.threads.ThreadG
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jmeter.util.LocaleChangeEvent;
 import org.apache.jmeter.util.LocaleChangeListener;
+import org.apache.jorphan.documentation.VisibleForTesting;
 import org.apache.jorphan.gui.ComponentUtil;
 import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.gui.JLabeledChoice;
@@ -92,8 +93,13 @@ public class FunctionHelper extends JDia
     
     private JMeterVariables jMeterVariables = new JMeterVariables();
 
+    @VisibleForTesting
     public FunctionHelper() {
-        super((JFrame) null, JMeterUtils.getResString("function_helper_title"), false); //$NON-NLS-1$
+        super();
+    }
+    
+    public FunctionHelper(JFrame parent) {
+        super(parent, JMeterUtils.getResString("function_helper_title"), false); //$NON-NLS-1$
         init();
         JMeterUtils.addLocaleChangeListener(this);
     }

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java?rev=1854638&r1=1854637&r2=1854638&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java Sat Mar  2 11:03:38
2019
@@ -18,11 +18,17 @@
 
 package org.apache.jmeter.gui.action;
 
+import java.awt.Component;
+import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.io.File;
 import java.text.MessageFormat;
 
+import javax.swing.JFrame;
+import javax.swing.JMenuItem;
 import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
 
 import org.apache.jmeter.exceptions.IllegalUserActionException;
 import org.apache.jmeter.gui.GuiPackage;
@@ -135,4 +141,28 @@ public abstract class AbstractAction imp
         }
         return true;
     }
+    
+    /**
+     * @param event {@link ActionEvent} 
+     * @return parent Window
+     */
+    protected final JFrame getParentFrame(ActionEvent event) {
+        JFrame parent = null;
+        Object source = event.getSource();
+        if (source instanceof JMenuItem) {
+            JMenuItem item = (JMenuItem) source;
+            Component comp = item.getParent();
+            if (comp instanceof JPopupMenu) {
+                JPopupMenu popup = (JPopupMenu) comp;
+                comp = popup.getInvoker();
+                Window window = SwingUtilities.windowForComponent((Component) comp);
+                if (window instanceof JFrame) {
+                    parent = (JFrame) window;
+                }
+            }
+        } else {
+            parent = GuiPackage.getInstance().getMainFrame();
+        }
+        return parent;
+    }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/CreateFunctionDialog.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/CreateFunctionDialog.java?rev=1854638&r1=1854637&r2=1854638&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/CreateFunctionDialog.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/CreateFunctionDialog.java Sat Mar 
2 11:03:38 2019
@@ -25,7 +25,6 @@ import java.util.Set;
 import org.apache.jmeter.functions.gui.FunctionHelper;
 
 public class CreateFunctionDialog extends AbstractAction {
-    private final FunctionHelper helper;
 
     private static final Set<String> commands;
     static {
@@ -34,7 +33,7 @@ public class CreateFunctionDialog extend
     }
 
     public CreateFunctionDialog() {
-        helper = new FunctionHelper();
+        super();
     }
 
     /**
@@ -46,7 +45,8 @@ public class CreateFunctionDialog extend
     }
 
     @Override
-    public void doAction(ActionEvent arg0) {
+    public void doAction(ActionEvent event) {
+        FunctionHelper helper = new FunctionHelper(getParentFrame(event));
         helper.setVisible(true);
     }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeCommand.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeCommand.java?rev=1854638&r1=1854637&r2=1854638&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeCommand.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeCommand.java Sat Mar  2 11:03:38
2019
@@ -18,16 +18,11 @@
 
 package org.apache.jmeter.gui.action;
 
-import java.awt.Component;
-import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.util.HashSet;
 import java.util.Set;
 
 import javax.swing.JFrame;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.SwingUtilities;
 
 /**
  * Search nodes for a text
@@ -60,22 +55,11 @@ public class SearchTreeCommand extends A
      * @return A freshly created search dialog with the parent frame that could be
      *         found, or no parent otherwise.
      */
-    private SearchTreeDialog createSearchDialog(Object source) {
-        JFrame parent = null;
-        if (source instanceof JMenuItem) {
-            JMenuItem item = (JMenuItem) source;
-            Component comp = item.getParent();
-            if (comp instanceof JPopupMenu) {
-                JPopupMenu popup = (JPopupMenu) comp;
-                comp = popup.getInvoker();
-                Window window = SwingUtilities.windowForComponent((Component) comp);
-                if (window instanceof JFrame) {
-                    parent = (JFrame) window;
-                }
-            }
-        }
+    private SearchTreeDialog createSearchDialog(ActionEvent event) {
+        JFrame parent = getParentFrame(event);
         return new SearchTreeDialog(parent);
     }
+
     
     /**
      * @see Command#doAction(ActionEvent)
@@ -84,7 +68,7 @@ public class SearchTreeCommand extends A
     public void doAction(ActionEvent e) {
         // we create the dialog upon first display event only
         if (dialog == null) {
-            dialog = createSearchDialog(e.getSource());
+            dialog = createSearchDialog(e);
         }
         dialog.setVisible(true);
     }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java?rev=1854638&r1=1854637&r2=1854638&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
Sat Mar  2 11:03:38 2019
@@ -109,14 +109,15 @@ public class ParseCurlCommandAction exte
 
     @Override
     public void doAction(ActionEvent e) {
-        showInputDialog();
+        showInputDialog(e);
     }
     
     /**
      * Show popup where user can import cURL command
+     * @param event {@link ActionEvent}
      */
-    private final void showInputDialog() {
-        EscapeDialog messageDialog = new EscapeDialog(GuiPackage.getInstance().getMainFrame(),
+    private final void showInputDialog(ActionEvent event) {
+        EscapeDialog messageDialog = new EscapeDialog(getParentFrame(event),
                 JMeterUtils.getResString("curl_import"), false); //$NON-NLS-1$
         Container contentPane = messageDialog.getContentPane();
         contentPane.setLayout(new BorderLayout());

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1854638&r1=1854637&r2=1854638&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Mar  2 11:03:38 2019
@@ -167,6 +167,7 @@ Summary
 <h3>General</h3>
 <ul>
     <li><bug>63201</bug>SearchTreeDialog disappears behind master JFrame.
Contributed by Benoit Vatan (benoit.vatan at gmail.com)</li>
+    <li><bug></bug><code>Function Helper Dialog</code>, <code>Export
transactions for report</code> and <code>Import from cURL</code> disappear
being master JFrame. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>63207</bug>java.lang.NullPointerException: null when run Jmeter
5.1 with proxy options</li>
 </ul>
 



Mime
View raw message