Author: sebb
Date: Wed Nov 12 11:11:51 2008
New Revision: 713456

URL: http://svn.apache.org/viewvc?rev=713456&view=rev
Log:
Allow sub-classes to override how the text is generated

Modified:
    
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java?rev=713456&r1=713455&r2=713456&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java
 (original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/HeaderAsPropertyRenderer.java
 Wed Nov 12 11:11:51 2008
@@ -29,12 +29,14 @@
 import org.apache.jmeter.util.JMeterUtils;
 
 /**
- * Renders items in a JTable right-aligned
+ * Renders items in a JTable by converting from resource names.
  */
 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) {
@@ -44,10 +46,25 @@
                 setBackground(header.getBackground());
                 setFont(header.getFont());
             }
-            setText(value == null ? "" : 
JMeterUtils.getResString(value.toString()));
+            setText(getText(value, row, column));
             setBorder(UIManager.getBorder("TableHeader.cellBorder"));
             setHorizontalAlignment(JLabel.CENTER);
         }
         return this;
     }
+
+    /**
+     * Get the text for the value as the translation of the resource name.
+     * 
+     * @param value
+     * @param column 
+     * @param row 
+     * @return
+     */
+    protected String getText(Object value, int row, int column) {
+        if (value == null){
+            return "";
+        }
+        return JMeterUtils.getResString(value.toString());
+    }
 }
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to