logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r950370 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
Date Wed, 02 Jun 2010 04:47:01 GMT
Author: sdeboy
Date: Wed Jun  2 04:47:01 2010
New Revision: 950370

URL: http://svn.apache.org/viewvc?rev=950370&view=rev
Log:
Reusing JTextPane table cell renderer component to improve performance

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java?rev=950370&r1=950369&r2=950370&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
Wed Jun  2 04:47:01 2010
@@ -104,6 +104,7 @@ public class TableColorizingRenderer ext
   private final JPanel generalPanel = new JPanel();
   private final JPanel levelPanel = new JPanel();
   private ApplicationPreferenceModel applicationPreferenceModel;
+  private JTextPane multiLineTextPane;
 
     /**
    * Creates a new TableColorizingRenderer object.
@@ -127,6 +128,11 @@ public class TableColorizingRenderer ext
     levelPanel.add(levelLabel);
 
     this.colorizer = colorizer;
+    multiLineTextPane = new JTextPane();
+    multiLineTextPane.setEditorKit(new HTMLEditorKit());
+    multiLineTextPane.setMargin(null);
+    multiLineTextPane.setEditable(false);
+    multiLineTextPane.setFont(levelLabel.getFont());
   }
 
   public void setToolTipsVisible(boolean toolTipsVisible) {
@@ -139,8 +145,6 @@ public class TableColorizingRenderer ext
     value = formatField(value);
     TableColumn tableColumn = table.getColumnModel().getColumn(col);
 
-    //null unless needed
-    JTextPane multiLineTextPane = null;
     JLabel label = (JLabel)super.getTableCellRendererComponent(table, value,
         isSelected, hasFocus, row, col);
     //chainsawcolumns uses one-based indexing
@@ -233,11 +237,6 @@ public class TableColorizingRenderer ext
             thisString = buildHighlightString(matches.get(LoggingEventFieldResolver.MSG_FIELD),
value.toString().trim());
         }
         int tableRowHeight = table.getRowHeight(row);
-        multiLineTextPane = new JTextPane();
-        multiLineTextPane.setEditorKit(new HTMLEditorKit());
-        multiLineTextPane.setMargin(null);
-        multiLineTextPane.setEditable(false);
-        multiLineTextPane.setFont(label.getFont());
         setText(thisString);
         multiLinePanel.removeAll();
         multiLinePanel.add(multiLineTextPane);



Mime
View raw message