logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r982459 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: JSortTable.java LogPanel.java
Date Thu, 05 Aug 2010 03:43:27 GMT
Author: sdeboy
Date: Thu Aug  5 03:43:26 2010
New Revision: 982459

URL: http://svn.apache.org/viewvc?rev=982459&view=rev
Log:
Minor scrollToRow update - now synchronous if called from the EDT

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

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java?rev=982459&r1=982458&r2=982459&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/JSortTable.java Thu Aug
 5 03:43:26 2010
@@ -93,6 +93,7 @@ public class JSortTable extends JTable i
     getTableHeader().resizeAndRepaint();
   }
 
+  //Allow synchronous updates if already on the EDT
   public void scrollTo(final int row, final int col) {
     SwingHelper.invokeOnEDT(new Runnable() {
       public void run() {

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=982459&r1=982458&r2=982459&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 Thu Aug 
5 03:43:26 2010
@@ -990,6 +990,7 @@ public class LogPanel extends DockablePa
     //if the table is refiltered, try to reselect the last selected row
     //refilter with a newValue of TRUE means refiltering is about to begin
     //refilter with a newValue of FALSE means refiltering is complete
+    //assuming notification is called on the EDT so we can in the current EDT call update
the scroll & selection
     tableModel.addPropertyChangeListener("refilter", new PropertyChangeListener() {
         private LoggingEvent currentEvent;
         public void propertyChange(PropertyChangeEvent evt) {
@@ -998,27 +999,9 @@ public class LogPanel extends DockablePa
             if (evt.getNewValue().equals(Boolean.TRUE)) {
                 currentEvent = tableModel.getRow(table.getSelectedRow());
             } else {
-                //events are still coming in..wait until all events are added before resetting
current row
-                new Thread(new Runnable() {
-                    public void run() {
-                        try
-                        {
-                            Thread.sleep(500);
-                        }
-                        catch (InterruptedException e)
-                        {
-                            e.printStackTrace();
-                        }
-                        EventQueue.invokeLater(new Runnable() {
-                            public void run() {
-                                //refilter is about to begin...get current selected row
-                                if (currentEvent != null) {
-                                    table.scrollToRow(tableModel.getRowIndex(currentEvent));
-                                }
-                            }
-                        });
-                    }
-                }).start();
+                if (currentEvent != null) {
+                    table.scrollToRow(tableModel.getRowIndex(currentEvent));
+                }
             }
         }
     });



Mime
View raw message