/*
 * 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.gui.util;

import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;

import org.apache.jmeter.util.JMeterUtils;

/**
 * Renders items in a JTable right-aligned
 */
public class HeaderAsPropertyRenderer extends DefaultTableCellRenderer {
    public HeaderAsPropertyRenderer() {
        super();
    }
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        if (table != null) {
            JTableHeader header = table.getTableHeader();
            if (header != null){
                setForeground(header.getForeground());
                setBackground(header.getBackground());
                setFont(header.getFont());
            }
            setText(value == null ? "" : JMeterUtils.getResString(value.toString()));
            setBorder(UIManager.getBorder("TableHeader.cellBorder"));
            setHorizontalAlignment(JLabel.CENTER);
        }
        return this;
    }
}
@@ -1118,21 +1118,42 @@
 ble 
-right-aligned
+by converting from resource names.
 %0A */
@@ -1226,16 +1226,21 @@
 derer %7B%0A
+    %0A
     publ
@@ -1290,24 +1290,29 @@
 er();%0A    %7D%0A
+    %0A
     public C
@@ -1762,70 +1762,34 @@
 ext(
-value == null ? %22%22 : JMeterUtils.getResString(value.toString()
+getText(value, row, column
 ));%0A
@@ -1911,32 +1911,32 @@
 TER);%0A        %7D%0A
-
         return t
@@ -1945,10 +1945,378 @@
 s;%0A    %7D
+%0A%0A    /**%0A     * Get the text for the value as the translation of the resource name.%0A     * %0A     * @param value%0A     * @param column %0A     * @param row %0A     * @return%0A     */%0A    protected String getText(Object value, int row, int column) %7B%0A        if (value == null)%7B%0A            return %22%22;%0A        %7D%0A        return JMeterUtils.getResString(value.toString());%0A    %7D
 %0A%7D

Allow sub-classes to override how the text is generated