logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r1023198 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
Date Sat, 16 Oct 2010 07:06:20 GMT
Author: sdeboy
Date: Sat Oct 16 07:06:20 2010
New Revision: 1023198

URL: http://svn.apache.org/viewvc?rev=1023198&view=rev
Log:
Ensure colors in both search table and primary table are updated based on color rules

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

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=1023198&r1=1023197&r2=1023198&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Sat Oct 16
07:06:20 2010
@@ -260,7 +260,7 @@ public class LogPanel extends DockablePa
   private Rule clearTableExpressionRule;
   private int lowerPanelDividerLocation;
   private EventContainer searchModel;
-  private JSortTable searchTable;
+  private final JSortTable searchTable;
   private TableColorizingRenderer searchRenderer;
   private ToggleToolTips mainToggleToolTips;
   private ToggleToolTips searchToggleToolTips;
@@ -270,6 +270,7 @@ public class LogPanel extends DockablePa
   private TableCellEditor markerCellEditor;
   private JToolBar detailToolbar;
   private boolean searchResultsDisplayed;
+  private ColorizedEventAndSearchMatchThumbnail colorizedEventAndSearchMatchThumbnail;
 
   /**
    * Creates a new LogPanel object.  If a LogPanel with this identifier has
@@ -841,12 +842,23 @@ public class LogPanel extends DockablePa
       "colorrule",
       new PropertyChangeListener() {
         public void propertyChange(PropertyChangeEvent evt) {
-          if (table != null) {
-            table.repaint();
-          }
-          if (searchTable != null) {
-            searchTable.repaint();
+          for (Iterator iter = tableModel.getAllEvents().iterator();iter.hasNext();) {
+            LoggingEventWrapper loggingEventWrapper = (LoggingEventWrapper)iter.next();
+            loggingEventWrapper.updateColorRuleColors(colorizer.getBackgroundColor(loggingEventWrapper.getLoggingEvent()),
colorizer.getForegroundColor(loggingEventWrapper.getLoggingEvent()));
           }
+
+          for (Iterator iter = searchModel.getAllEvents().iterator();iter.hasNext();) {
+             LoggingEventWrapper loggingEventWrapper = (LoggingEventWrapper)iter.next();
+             loggingEventWrapper.updateColorRuleColors(colorizer.getBackgroundColor(loggingEventWrapper.getLoggingEvent()),
colorizer.getForegroundColor(loggingEventWrapper.getLoggingEvent()));
+           }
+          colorizedEventAndSearchMatchThumbnail.configureColors();
+          lowerPanel.invalidate();
+          lowerPanel.revalidate();
+          lowerPanel.repaint();
+
+          searchTable.invalidate();
+          searchTable.revalidate();
+          searchTable.repaint();
         }
       });
 
@@ -1222,7 +1234,8 @@ public class LogPanel extends DockablePa
     JPanel rightThumbNailPanel = new JPanel();
     rightThumbNailPanel.setLayout(new BoxLayout(rightThumbNailPanel, BoxLayout.Y_AXIS));
     rightThumbNailPanel.add(Box.createVerticalStrut(scrollBarWidth.intValue()));
-    rightThumbNailPanel.add(new ColorizedEventAndSearchMatchThumbnail());
+    colorizedEventAndSearchMatchThumbnail = new ColorizedEventAndSearchMatchThumbnail();
+    rightThumbNailPanel.add(colorizedEventAndSearchMatchThumbnail);
     rightThumbNailPanel.add(Box.createVerticalStrut(scrollBarWidth.intValue()));
     rightPanel.add(rightThumbNailPanel);
     //set thumbnail width to be a bit narrower than scrollbar width
@@ -3775,15 +3788,11 @@ public class LogPanel extends DockablePa
         }
     }
 
+  //a listener receiving color updates needs to call configureColors on this class
     private class ColorizedEventAndSearchMatchThumbnail extends AbstractEventMatchThumbnail
{
         public ColorizedEventAndSearchMatchThumbnail() {
             super();
             configureColors();
-            colorizer.addPropertyChangeListener(new PropertyChangeListener() {
-                public void propertyChange(PropertyChangeEvent evt) {
-                    configureColors();
-                }
-            });
         }
 
         boolean primaryMatches(ThumbnailLoggingEventWrapper wrapper) {
@@ -3801,7 +3810,6 @@ public class LogPanel extends DockablePa
             int i=0;
             for (Iterator iter = tableModel.getFilteredEvents().iterator();iter.hasNext();)
{
                 LoggingEventWrapper loggingEventWrapper = (LoggingEventWrapper) iter.next();
-                loggingEventWrapper.updateColorRuleColors(colorizer.getBackgroundColor(loggingEventWrapper.getLoggingEvent()),
colorizer.getForegroundColor(loggingEventWrapper.getLoggingEvent()));
                 ThumbnailLoggingEventWrapper wrapper = new ThumbnailLoggingEventWrapper(i,
loggingEventWrapper);
                 if (secondaryMatches(wrapper)) {
                     secondaryList.add(wrapper);



Mime
View raw message