jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1834634 - in /jmeter/trunk: src/components/org/apache/jmeter/visualizers/ src/core/org/apache/jmeter/gui/util/ xdocs/
Date Thu, 28 Jun 2018 19:13:00 GMT
Author: fschumacher
Date: Thu Jun 28 19:13:00 2018
New Revision: 1834634

URL: http://svn.apache.org/viewvc?rev=1834634&view=rev
Log:
Fix headers of Aggregate Reports and friends when columns are moved around.

Bugzilla Id: 60705

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRendererWrapper.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java?rev=1834634&r1=1834633&r2=1834634&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java Thu
Jun 28 19:13:00 2018
@@ -343,7 +343,7 @@ public class StatGraphVisualizer extends
      * @return ObjectTableModel
      */
     static ObjectTableModel createObjectTableModel() {
-        return new ObjectTableModel(COLUMNS,
+        return new ObjectTableModel(getLabels(COLUMNS),
                 SamplingStatCalculator.class,
                 new Functor[] {
                 new Functor("getLabel"),                    //$NON-NLS-1$
@@ -513,7 +513,7 @@ public class StatGraphVisualizer extends
         myJTable.setRowSorter(new ObjectTableSorter(model).fixLastRow());
         JMeterUtils.applyHiDPI(myJTable);
         // Fix centering of titles
-        HeaderAsPropertyRendererWrapper.setupDefaultRenderer(myJTable, getColumnsMsgParameters());
+        HeaderAsPropertyRendererWrapper.setupDefaultRenderer(myJTable);
         myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
         RendererUtils.applyRenderers(myJTable, getRenderers());
         myScrollPane = new JScrollPane(myJTable);

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java?rev=1834634&r1=1834633&r2=1834634&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java Thu Jun
28 19:13:00 2018
@@ -19,7 +19,6 @@
 package org.apache.jmeter.gui.util;
 
 import java.awt.Component;
-import java.text.MessageFormat;
 
 import javax.swing.JTable;
 import javax.swing.SwingConstants;
@@ -34,8 +33,7 @@ import org.apache.jmeter.util.JMeterUtil
  */
 public class HeaderAsPropertyRenderer extends DefaultTableCellRenderer {
 
-    private static final long serialVersionUID = 240L;
-    private Object[][] columnsMsgParameters;
+    private static final long serialVersionUID = 241L;
 
     /**
      * 
@@ -45,11 +43,14 @@ public class HeaderAsPropertyRenderer ex
     }
     
     /**
-     * @param columnsMsgParameters Optional parameters of i18n keys
+     * @param columnsMsgParameters ignored
+     * @deprecated don't use {@code columnsMgsParameters} as they are
+     * not moved around when rows of the corresponding table object model
+     * are moved.
      */
+    @Deprecated
     public HeaderAsPropertyRenderer(Object[][] columnsMsgParameters) {
         super();
-        this.columnsMsgParameters = columnsMsgParameters;
     }
 
     @Override
@@ -78,7 +79,7 @@ public class HeaderAsPropertyRenderer ex
      * @return the text
      */
     protected String getText(Object value, int row, int column) {
-        return getText(value, row, column, columnsMsgParameters);
+        return getText(value, row, column, null);
     }
     
     /**
@@ -87,17 +88,14 @@ public class HeaderAsPropertyRenderer ex
      * @param value value for which to get the translation
      * @param column index which column message parameters should be used
      * @param row not used
-     * @param columnsMsgParameters
+     * @param columnsMsgParameters ignored
      * @return the text
      */
     static String getText(Object value, int row, int column, Object[][] columnsMsgParameters)
{
         if (value == null){
             return "";
         }
-        if(columnsMsgParameters != null && columnsMsgParameters[column] != null)
{
-            return MessageFormat.format(JMeterUtils.getResString(value.toString()), columnsMsgParameters[column]);
-        } else {
-            return JMeterUtils.getResString(value.toString());
-        }
+        String label = value.toString();
+        return JMeterUtils.getResString(label, label);
     }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRendererWrapper.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRendererWrapper.java?rev=1834634&r1=1834633&r2=1834634&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRendererWrapper.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRendererWrapper.java
Thu Jun 28 19:13:00 2018
@@ -33,17 +33,21 @@ import javax.swing.table.TableCellRender
  */
 public class HeaderAsPropertyRendererWrapper implements TableCellRenderer {
 
-    private Object[][] columnsMsgParameters;
-
     private TableCellRenderer delegate;
 
     /**
      * @param renderer {@link TableCellRenderer} to delegate to
-     * @param columnsMsgParameters Optional parameters of i18n keys
+     * @param columnsMsgParameters ignored
+     * @deprecated don't use {@code columnsMsgParameters} as they are not moved, when
+     * the corresponding columns in the tables object model are moved
      */
+    @Deprecated
     public HeaderAsPropertyRendererWrapper(TableCellRenderer renderer, Object[][] columnsMsgParameters)
{
+        this(renderer);
+    }
+
+    public HeaderAsPropertyRendererWrapper(TableCellRenderer renderer) {
         this.delegate = renderer;
-        this.columnsMsgParameters = columnsMsgParameters;
     }
 
     @Override
@@ -63,7 +67,7 @@ public class HeaderAsPropertyRendererWra
             tr.setHorizontalAlignment(SwingConstants.CENTER);
         }
         return delegate.getTableCellRendererComponent(table, 
-                HeaderAsPropertyRenderer.getText(value, row, column, columnsMsgParameters),

+                HeaderAsPropertyRenderer.getText(value, row, column, null), 
                 isSelected, hasFocus, row, column);
     }
     
@@ -72,17 +76,20 @@ public class HeaderAsPropertyRendererWra
      * @param table {@link JTable}
      */
     public static void setupDefaultRenderer(JTable table) {
-        setupDefaultRenderer(table, null);
+        TableCellRenderer defaultRenderer = table.getTableHeader().getDefaultRenderer();
+        HeaderAsPropertyRendererWrapper newRenderer = new HeaderAsPropertyRendererWrapper(defaultRenderer);
+        table.getTableHeader().setDefaultRenderer(newRenderer);
     }
 
     /**
      * @param table  {@link JTable}
-     * @param columnsMsgParameters Double dimension array of column message parameters
+     * @param columnsMsgParameters ignored
+     * @deprecated don't use {@columnsMsgParameters} as they are not moved when the columns
+     * of the corresponding tables object model are moved
      */
+    @Deprecated
     public static void setupDefaultRenderer(JTable table, Object[][] columnsMsgParameters)
{
-        TableCellRenderer defaultRenderer = table.getTableHeader().getDefaultRenderer();
-        HeaderAsPropertyRendererWrapper newRenderer = new HeaderAsPropertyRendererWrapper(defaultRenderer,
columnsMsgParameters);
-        table.getTableHeader().setDefaultRenderer(newRenderer);
+        setupDefaultRenderer(table);
     }
 
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1834634&r1=1834633&r2=1834634&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Jun 28 19:13:00 2018
@@ -196,6 +196,7 @@ this behaviour, set <code>httpclient.res
   <li><bug>62097</bug>Update JTable in Aggregate Report only when new data
has arrived. That way selections of rows will be kept longer around.</li>
   <li><bug>62203</bug>Influxdb BackendListener client: store user tags
to annotation and internal transaction. Contributed by Sergey Batalin (sergey_batalin at mail.ru)</li>
   <li><bug>62251</bug>TextGraphiteMetricsSender does not invalidate lost
connections in case of network errors </li>
+  <li><bug>60705</bug>Fix headers of Aggregate Reports and friends when
columns are moved around.</li>
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>



Mime
View raw message