jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ago...@apache.org
Subject svn commit: r1811449 - in /jmeter/trunk: src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java src/core/org/apache/jmeter/functions/gui/FunctionHelper.java xdocs/changes.xml xdocs/images/screenshots/function_helper_dialog.png
Date Sat, 07 Oct 2017 21:26:55 GMT
Author: agomes
Date: Sat Oct  7 21:26:54 2017
New Revision: 1811449

URL: http://svn.apache.org/viewvc?rev=1811449&view=rev
Log:
Bug 61593 - Remove Detail, Add, Add from Clipboard, Delete buttons in Function Helper GUI


Modified:
    jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
    jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/images/screenshots/function_helper_dialog.png

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=1811449&r1=1811448&r2=1811449&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 Sat Oct  7 21:26:54
2017
@@ -97,7 +97,11 @@ public class ArgumentsPanel extends Abst
     /** Button to show the detail of an argument*/
     private JButton showDetail;
 
+    /** Enable Up & Down buttons */
     private final boolean enableUpDown;
+    
+    /** Disable buttons :Detail, Add, Add from Clipboard, Delete, Up & Down*/
+    private final boolean disableButtons;
 
     /** Command for adding a row to the table. */
     private static final String ADD = "add"; // $NON-NLS-1$
@@ -152,6 +156,17 @@ public class ArgumentsPanel extends Abst
     public ArgumentsPanel(String label, boolean enableUpDown) {
         this(label, null, enableUpDown, false);
     }
+    
+    /**
+     * Create a new ArgumentsPanel as an embedded component, using the specified
+     * title.
+     * 
+     * @param disableButtons Remove Edit all buttons 
+     * @param label the title for the component.
+     */
+    public ArgumentsPanel(boolean disableButtons, String label) {
+        this(label, null, false, false, null, disableButtons);
+    }
 
     /**
      * Create a new ArgumentsPanel with a border and color background
@@ -170,9 +185,9 @@ public class ArgumentsPanel extends Abst
      * @param standalone is standalone
      */
     public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone)
{
-        this(label, bkg, enableUpDown, standalone, null);
+        this(label, bkg, enableUpDown, standalone, null, false);
     }
-       
+
     /**
      * Create a new ArgumentsPanel with a border and color background
      * @param label text for label
@@ -182,8 +197,22 @@ public class ArgumentsPanel extends Abst
      * @param model the table model to use
      */
     public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone,
ObjectTableModel model) {
+        this(label, bkg, enableUpDown, standalone, model, false);
+    }
+
+    /**
+     * Create a new ArgumentsPanel with a border and color background
+     * @param label text for label
+     * @param bkg background colour
+     * @param enableUpDown Add up/down buttons
+     * @param standalone is standalone
+     * @param model the table model to use
+     * @param disableButtons Remove all buttons 
+     */
+    public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone,
ObjectTableModel model, boolean disableButtons) {
         tableLabel = new JLabel(label);
         this.enableUpDown = enableUpDown;
+        this.disableButtons = disableButtons;
         this.background = bkg;
         this.standalone = standalone;
         this.tableModel = model;
@@ -297,25 +326,27 @@ public class ArgumentsPanel extends Abst
     }    
     
     protected void checkButtonsStatus() {
-        // Disable DELETE if there are no rows in the table to delete.
-        if (tableModel.getRowCount() == 0) {
-            delete.setEnabled(false);
-            showDetail.setEnabled(false);
-        } else {
-            delete.setEnabled(true);
-            showDetail.setEnabled(true);
-        }
-        
-        if(enableUpDown) {
-            if(tableModel.getRowCount()>1) {
-                up.setEnabled(true);
-                down.setEnabled(true);
-            }
-            else {
-                up.setEnabled(false);
-                down.setEnabled(false);
+        if (!disableButtons) {
+            // Disable DELETE if there are no rows in the table to delete.
+            if (tableModel.getRowCount() == 0) {
+                delete.setEnabled(false);
+                showDetail.setEnabled(false);
+            } else {
+                delete.setEnabled(true);
+                showDetail.setEnabled(true);
+            }
+            if(enableUpDown) {
+                if(tableModel.getRowCount()>1) {
+                    up.setEnabled(true);
+                    down.setEnabled(true);
+                }
+                else {
+                    up.setEnabled(false);
+                    down.setEnabled(false);
+                }
             }
         }
+        
     }
 
     @Override
@@ -340,20 +371,23 @@ public class ArgumentsPanel extends Abst
      */
     @Override
     public void actionPerformed(ActionEvent e) {
-        String action = e.getActionCommand();
-        if (action.equals(DELETE)) {
-            deleteArgument();
-        } else if (action.equals(ADD)) {
-            addArgument();
-        } else if (action.equals(ADD_FROM_CLIPBOARD)) {
-            addFromClipboard();
-        } else if (action.equals(UP)) {
-            moveUp();
-        } else if (action.equals(DOWN)) {
-            moveDown();
-        } else if (action.equals(DETAIL)) {
-            showDetail();
+        if (!disableButtons) {
+            String action = e.getActionCommand();
+            if (action.equals(DELETE)) {
+                deleteArgument();
+            } else if (action.equals(ADD)) {
+                addArgument();
+            } else if (action.equals(ADD_FROM_CLIPBOARD)) {
+                addFromClipboard();
+            } else if (action.equals(UP)) {
+                moveUp();
+            } else if (action.equals(DOWN)) {
+                moveDown();
+            } else if (action.equals(DETAIL)) {
+                showDetail();
+            }
         }
+
     }
 
     
@@ -645,14 +679,15 @@ 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);
-        
+
         // A button for adding new arguments to the table from the clipboard
         JButton addFromClipboard = new JButton(JMeterUtils.getResString("add_from_clipboard"));
// $NON-NLS-1$
         addFromClipboard.setActionCommand(ADD_FROM_CLIPBOARD);
@@ -661,10 +696,10 @@ public class ArgumentsPanel extends Abst
         delete = new JButton(JMeterUtils.getResString("delete")); // $NON-NLS-1$
         delete.setActionCommand(DELETE);
 
-        if(enableUpDown) {
+        if (enableUpDown) {
             up = new JButton(JMeterUtils.getResString("up")); // $NON-NLS-1$
             up.setActionCommand(UP);
-    
+
             down = new JButton(JMeterUtils.getResString("down")); // $NON-NLS-1$
             down.setActionCommand(DOWN);
         }
@@ -683,7 +718,7 @@ public class ArgumentsPanel extends Abst
         buttonPanel.add(add);
         buttonPanel.add(addFromClipboard);
         buttonPanel.add(delete);
-        if(enableUpDown) {
+        if (enableUpDown) {
             up.addActionListener(this);
             down.addActionListener(this);
             buttonPanel.add(up);
@@ -711,7 +746,9 @@ public class ArgumentsPanel extends Abst
         p.add(makeMainPanel(), BorderLayout.CENTER);
         // Force a minimum table height of 70 pixels
         p.add(Box.createVerticalStrut(70), BorderLayout.WEST);
-        p.add(makeButtonPanel(), BorderLayout.SOUTH);
+        if (!disableButtons) {
+            p.add(makeButtonPanel(), BorderLayout.SOUTH);
+        }
 
         if (standalone) {
             add(p, BorderLayout.CENTER);

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=1811449&r1=1811448&r2=1811449&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 Oct  7 21:26:54
2017
@@ -102,7 +102,7 @@ public class FunctionHelper extends JDia
     }
 
     private void init() { // WARNING: called from ctor so must not be overridden (i.e. must
be private or final)
-        parameterPanel = new ArgumentsPanel(JMeterUtils.getResString("function_params"),
false); //$NON-NLS-1$
+        parameterPanel = new ArgumentsPanel(true,JMeterUtils.getResString("function_params"));
//$NON-NLS-1$
         initializeFunctionList();
         this.getContentPane().setLayout(new BorderLayout(10, 10));
         JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
@@ -120,7 +120,7 @@ public class FunctionHelper extends JDia
         JButton generateButton = new JButton(JMeterUtils.getResString("generate")); //$NON-NLS-1$
         generateButton.addActionListener(this);
         generatePanel.add(generateButton);
-        resultTextArea = JSyntaxTextArea.getInstance(5,50);
+        resultTextArea = JSyntaxTextArea.getInstance(5,60);
         resultTextArea.setToolTipText(JMeterUtils.getResString("function_helper_dialog_result_warn"));
         displayPanel.add(new JLabel(JMeterUtils.getResString("result_function")));
         displayPanel.add(JTextScrollPane.getInstance(resultTextArea));

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1811449&r1=1811448&r2=1811449&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Oct  7 21:26:54 2017
@@ -101,6 +101,7 @@ Summary
 <h3>Functions</h3>
 <ul>
     <li><bug>61561</bug>Function helper dialog should display exception
in result</li>
+    <li><bug>61593</bug>Remove Detail, Add, Add from Clipboard, Delete
buttons in Function Helper GUI</li>
 </ul>
 
 <h3>I18N</h3>

Modified: jmeter/trunk/xdocs/images/screenshots/function_helper_dialog.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/images/screenshots/function_helper_dialog.png?rev=1811449&r1=1811448&r2=1811449&view=diff
==============================================================================
Binary files - no diff available.



Mime
View raw message