logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r930804 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ChainsawCyclicBufferTableModel.java LogPanel.java
Date Mon, 05 Apr 2010 06:08:37 GMT
Author: sdeboy
Date: Mon Apr  5 06:08:37 2010
New Revision: 930804

URL: http://svn.apache.org/viewvc?rev=930804&view=rev
Log:
Updates to refresh detail pane if event (marker) or detail pane layout change

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

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java?rev=930804&r1=930803&r2=930804&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
Mon Apr  5 06:08:37 2010
@@ -332,10 +332,7 @@ class ChainsawCyclicBufferTableModel ext
   }
 
     public void removePropertyFromEvents(String propName) {
-        for (Iterator iter = unfilteredList.iterator();iter.hasNext();) {
-            LoggingEvent event = (LoggingEvent)iter.next();
-            event.removeProperty(propName);
-        }
+        //first remove the event from any displayed events, so we can fire row updated event
         for (int i=0;i<filteredList.size();i++) {
             LoggingEvent event = (LoggingEvent)filteredList.get(i);
             Object result = event.removeProperty(propName);
@@ -343,6 +340,11 @@ class ChainsawCyclicBufferTableModel ext
                 fireRowUpdated(i, false);
             }
         }
+        //now remove the event from all events
+        for (Iterator iter = unfilteredList.iterator();iter.hasNext();) {
+            LoggingEvent event = (LoggingEvent)iter.next();
+            event.removeProperty(propName);
+        }
     }
 
     public void updateEventsWithFindRule(Rule findRule) {

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=930804&r1=930803&r2=930804&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 Mon Apr 
5 06:08:37 2010
@@ -1041,10 +1041,13 @@ public class LogPanel extends DockablePa
         
     tableModel.addTableModelListener(new TableModelListener() {
 		public void tableChanged(TableModelEvent e) {
-			detailPaneUpdater.setSelectedRow(table.getSelectedRow());
+            int currentRow = table.getSelectedRow();
+            if (e.getFirstRow() <= currentRow && e.getLastRow() >= currentRow)
{
+                //current row has changed - update
+                detailPaneUpdater.setAndUpdateSelectedRow(table.getSelectedRow());
+            }
 		}
     });
-    
     addPropertyChangeListener(
       "detailPaneConversionPattern", detailPaneUpdater);
 
@@ -2926,10 +2929,18 @@ public class LogPanel extends DockablePa
       updateDetailPane();
     }
 
+    private void setAndUpdateSelectedRow(int row) {
+        selectedRow = row;
+        updateDetailPane(true);
+    }
+
+    private void updateDetailPane() {
+        updateDetailPane(false);
+    }
     /**
      * Update detail pane
      */
-    private void updateDetailPane() {
+    private void updateDetailPane(boolean force) {
             /*
              * Don't bother doing anything if it's not visible. Note: the isVisible() method
on
              * Component is not really accurate here because when the button to toggle display
of
@@ -2940,7 +2951,7 @@ public class LogPanel extends DockablePa
       }
 
 	      ExtendedLoggingEvent event = null;
-	      if (selectedRow != -1 && (lastRow != selectedRow)) {
+	      if (force || (selectedRow != -1 && (lastRow != selectedRow))) {
 	        event = tableModel.getRow(selectedRow);
 	
 	        if (event != null) {
@@ -2991,7 +3002,7 @@ public class LogPanel extends DockablePa
       SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
-            updateDetailPane();
+            updateDetailPane(true);
           }
         });
     }
@@ -3025,6 +3036,7 @@ public class LogPanel extends DockablePa
             } else {
                 currentEvent.setProperty(ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE,
textField.getText());
             }
+            tableModel.fireRowUpdated(table.getSelectedRow(), true);
             ChangeEvent event = new ChangeEvent(table);
             for (Iterator iter = cellEditorListeners.iterator();iter.hasNext();) {
                 ((CellEditorListener)iter.next()).editingStopped(event);



Mime
View raw message