View | Details | Raw Unified | Return to bug 60705
Collapse All | Expand All

(-)src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (-2 / +2 lines)
Lines 343-349 Link Here
343
     * @return ObjectTableModel
343
     * @return ObjectTableModel
344
     */
344
     */
345
    static ObjectTableModel createObjectTableModel() {
345
    static ObjectTableModel createObjectTableModel() {
346
        return new ObjectTableModel(COLUMNS,
346
        return new ObjectTableModel(getLabels(COLUMNS),
347
                SamplingStatCalculator.class,
347
                SamplingStatCalculator.class,
348
                new Functor[] {
348
                new Functor[] {
349
                new Functor("getLabel"),                    //$NON-NLS-1$
349
                new Functor("getLabel"),                    //$NON-NLS-1$
Lines 513-519 Link Here
513
        myJTable.setRowSorter(new ObjectTableSorter(model).fixLastRow());
513
        myJTable.setRowSorter(new ObjectTableSorter(model).fixLastRow());
514
        JMeterUtils.applyHiDPI(myJTable);
514
        JMeterUtils.applyHiDPI(myJTable);
515
        // Fix centering of titles
515
        // Fix centering of titles
516
        HeaderAsPropertyRendererWrapper.setupDefaultRenderer(myJTable, getColumnsMsgParameters());
516
        HeaderAsPropertyRendererWrapper.setupDefaultRenderer(myJTable);
517
        myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
517
        myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
518
        RendererUtils.applyRenderers(myJTable, getRenderers());
518
        RendererUtils.applyRenderers(myJTable, getRenderers());
519
        myScrollPane = new JScrollPane(myJTable);
519
        myScrollPane = new JScrollPane(myJTable);
(-)src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java (-12 / +10 lines)
Lines 19-25 Link Here
19
package org.apache.jmeter.gui.util;
19
package org.apache.jmeter.gui.util;
20
20
21
import java.awt.Component;
21
import java.awt.Component;
22
import java.text.MessageFormat;
23
22
24
import javax.swing.JTable;
23
import javax.swing.JTable;
25
import javax.swing.SwingConstants;
24
import javax.swing.SwingConstants;
Lines 34-41 Link Here
34
 */
33
 */
35
public class HeaderAsPropertyRenderer extends DefaultTableCellRenderer {
34
public class HeaderAsPropertyRenderer extends DefaultTableCellRenderer {
36
35
37
    private static final long serialVersionUID = 240L;
36
    private static final long serialVersionUID = 241L;
38
    private Object[][] columnsMsgParameters;
39
37
40
    /**
38
    /**
41
     * 
39
     * 
Lines 45-55 Link Here
45
    }
43
    }
46
    
44
    
47
    /**
45
    /**
48
     * @param columnsMsgParameters Optional parameters of i18n keys
46
     * @param columnsMsgParameters ignored
47
     * @deprecated don't use {@code columnsMgsParameters} as they are
48
     * not moved around when rows of the corresponding table object model
49
     * are moved.
49
     */
50
     */
51
    @Deprecated
50
    public HeaderAsPropertyRenderer(Object[][] columnsMsgParameters) {
52
    public HeaderAsPropertyRenderer(Object[][] columnsMsgParameters) {
51
        super();
53
        super();
52
        this.columnsMsgParameters = columnsMsgParameters;
53
    }
54
    }
54
55
55
    @Override
56
    @Override
Lines 78-84 Link Here
78
     * @return the text
79
     * @return the text
79
     */
80
     */
80
    protected String getText(Object value, int row, int column) {
81
    protected String getText(Object value, int row, int column) {
81
        return getText(value, row, column, columnsMsgParameters);
82
        return getText(value, row, column, null);
82
    }
83
    }
83
    
84
    
84
    /**
85
    /**
Lines 87-93 Link Here
87
     * @param value value for which to get the translation
88
     * @param value value for which to get the translation
88
     * @param column index which column message parameters should be used
89
     * @param column index which column message parameters should be used
89
     * @param row not used
90
     * @param row not used
90
     * @param columnsMsgParameters
91
     * @param columnsMsgParameters ignored
91
     * @return the text
92
     * @return the text
92
     */
93
     */
93
    static String getText(Object value, int row, int column, Object[][] columnsMsgParameters) {
94
    static String getText(Object value, int row, int column, Object[][] columnsMsgParameters) {
Lines 94-103 Link Here
94
        if (value == null){
95
        if (value == null){
95
            return "";
96
            return "";
96
        }
97
        }
97
        if(columnsMsgParameters != null && columnsMsgParameters[column] != null) {
98
        String label = value.toString();
98
            return MessageFormat.format(JMeterUtils.getResString(value.toString()), columnsMsgParameters[column]);
99
        return JMeterUtils.getResString(label, label);
99
        } else {
100
            return JMeterUtils.getResString(value.toString());
101
        }
102
    }
100
    }
103
}
101
}
(-)src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRendererWrapper.java (-10 / +18 lines)
Lines 33-49 Link Here
33
 */
33
 */
34
public class HeaderAsPropertyRendererWrapper implements TableCellRenderer {
34
public class HeaderAsPropertyRendererWrapper implements TableCellRenderer {
35
35
36
    private Object[][] columnsMsgParameters;
37
38
    private TableCellRenderer delegate;
36
    private TableCellRenderer delegate;
39
37
40
    /**
38
    /**
41
     * @param renderer {@link TableCellRenderer} to delegate to
39
     * @param renderer {@link TableCellRenderer} to delegate to
42
     * @param columnsMsgParameters Optional parameters of i18n keys
40
     * @param columnsMsgParameters ignored
41
     * @deprecated don't use {@code columnsMsgParameters} as they are not moved, when
42
     * the corresponding columns in the tables object model are moved
43
     */
43
     */
44
    @Deprecated
44
    public HeaderAsPropertyRendererWrapper(TableCellRenderer renderer, Object[][] columnsMsgParameters) {
45
    public HeaderAsPropertyRendererWrapper(TableCellRenderer renderer, Object[][] columnsMsgParameters) {
46
        this(renderer);
47
        
48
    }
49
    
50
    public HeaderAsPropertyRendererWrapper(TableCellRenderer renderer) {
45
        this.delegate = renderer;
51
        this.delegate = renderer;
46
        this.columnsMsgParameters = columnsMsgParameters;
47
    }
52
    }
48
53
49
    @Override
54
    @Override
Lines 63-69 Link Here
63
            tr.setHorizontalAlignment(SwingConstants.CENTER);
68
            tr.setHorizontalAlignment(SwingConstants.CENTER);
64
        }
69
        }
65
        return delegate.getTableCellRendererComponent(table, 
70
        return delegate.getTableCellRendererComponent(table, 
66
                HeaderAsPropertyRenderer.getText(value, row, column, columnsMsgParameters), 
71
                HeaderAsPropertyRenderer.getText(value, row, column, null), 
67
                isSelected, hasFocus, row, column);
72
                isSelected, hasFocus, row, column);
68
    }
73
    }
69
    
74
    
Lines 72-88 Link Here
72
     * @param table {@link JTable}
77
     * @param table {@link JTable}
73
     */
78
     */
74
    public static void setupDefaultRenderer(JTable table) {
79
    public static void setupDefaultRenderer(JTable table) {
75
        setupDefaultRenderer(table, null);
80
        TableCellRenderer defaultRenderer = table.getTableHeader().getDefaultRenderer();
81
        HeaderAsPropertyRendererWrapper newRenderer = new HeaderAsPropertyRendererWrapper(defaultRenderer);
82
        table.getTableHeader().setDefaultRenderer(newRenderer);
76
    }
83
    }
77
84
78
    /**
85
    /**
79
     * @param table  {@link JTable}
86
     * @param table  {@link JTable}
80
     * @param columnsMsgParameters Double dimension array of column message parameters
87
     * @param columnsMsgParameters ignored
88
     * @deprecated don't use {@columnsMsgParameters} as they are not moved when the columns
89
     * of the corresponding tables object model are moved
81
     */
90
     */
91
    @Deprecated
82
    public static void setupDefaultRenderer(JTable table, Object[][] columnsMsgParameters) {
92
    public static void setupDefaultRenderer(JTable table, Object[][] columnsMsgParameters) {
83
        TableCellRenderer defaultRenderer = table.getTableHeader().getDefaultRenderer();
93
        setupDefaultRenderer(table);
84
        HeaderAsPropertyRendererWrapper newRenderer = new HeaderAsPropertyRendererWrapper(defaultRenderer, columnsMsgParameters);
85
        table.getTableHeader().setDefaultRenderer(newRenderer);
86
    }
94
    }
87
95
88
}
96
}

Return to bug 60705