logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r941121 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ChainsawStatusBar.java ChainsawToolBarAndMenus.java LogPanel.java LogUI.java
Date Wed, 05 May 2010 00:29:50 GMT
Author: sdeboy
Date: Wed May  5 00:29:50 2010
New Revision: 941121

URL: http://svn.apache.org/viewvc?rev=941121&view=rev
Log:
Only display active tab's state in status bar

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

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java?rev=941121&r1=941120&r2=941121&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawStatusBar.java
Wed May  5 00:29:50 2010
@@ -62,10 +62,11 @@ public class ChainsawStatusBar extends J
   private final NumberFormat nf = NumberFormat.getNumberInstance();
   private final Border statusBarComponentBorder =
     BorderFactory.createLineBorder(statusMsg.getBackground().darker());
+  private final LogUI logUI;
 
-  public ChainsawStatusBar() {
+    public ChainsawStatusBar(LogUI logUI) {
     setLayout(new GridBagLayout());
-
+    this.logUI = logUI;
     nf.setMaximumFractionDigits(0);
     nf.setMinimumFractionDigits(0);
     nf.setGroupingUsed(false);
@@ -237,37 +238,43 @@ public class ChainsawStatusBar extends J
   /**
    * Called when the paused state of the LogPanel has been updated
    * @param isPaused
+   * @param tabName
    */
-  void setPaused(final boolean isPaused) {
-    Runnable runnable =
-      new Runnable() {
-        public void run() {
-          pausedLabel.setIcon(isPaused ? pausedIcon : null);
-          pausedLabel.setToolTipText(
-            isPaused ? "This Log panel is currently paused"
-                     : "This Log panel is not paused");
-        }
+  void setPaused(final boolean isPaused, String tabName) {
+    if (tabName.equals(logUI.getActiveTabName())) {
+      Runnable runnable =
+        new Runnable() {
+          public void run() {
+              pausedLabel.setIcon(isPaused ? pausedIcon : null);
+              pausedLabel.setToolTipText(
+                isPaused ? "This Log panel is currently paused"
+                         : "This Log panel is not paused");
+          }
       };
-
-    SwingUtilities.invokeLater(runnable);
+      SwingUtilities.invokeLater(runnable);
+    }
   }
 
   void setSelectedLine(
-    final int selectedLine, final int lineCount, final int total) {
-    SwingUtilities.invokeLater(
-      new Runnable() {
-        public void run() {
-          lineSelectionLabel.setText(selectedLine+"");
-	      eventCountLabel.setText("Filtered/Total: " + lineCount + ":" + total);
-        }
-      });
+          final int selectedLine, final int lineCount, final int total, String tabName) {
+    if (tabName.equals(logUI.getActiveTabName())) {
+        SwingUtilities.invokeLater(
+          new Runnable() {
+            public void run() {
+              lineSelectionLabel.setText(selectedLine+"");
+              eventCountLabel.setText("Filtered/Total: " + lineCount + ":" + total);
+            }
+          });
+    }
   }
 
-  void setSearchMatchCount(int searchMatchCount) {
-      if (searchMatchCount == 0) {
-        searchMatchLabel.setText("");
-      } else {
-        searchMatchLabel.setText("Search matches: " + searchMatchCount);
+  void setSearchMatchCount(int searchMatchCount, String tabName) {
+      if (tabName.equals(logUI.getActiveTabName())) {
+          if (searchMatchCount == 0) {
+            searchMatchLabel.setText("");
+          } else {
+            searchMatchLabel.setText("Search matches: " + searchMatchCount);
+          }
       }
   }
 

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java?rev=941121&r1=941120&r2=941121&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
Wed May  5 00:29:50 2010
@@ -936,7 +936,7 @@ class ChainsawToolBarAndMenus implements
 
       pauseButton.getModel().setSelected(logPanel.isPaused());
       toggleCyclicButton.setSelected(logPanel.isCyclic());
-      logui.getStatusBar().setPaused(logPanel.isPaused());
+      logui.getStatusBar().setPaused(logPanel.isPaused(), logPanel.getIdentifier());
       toggleCyclicMenuItem.setSelected(logPanel.isCyclic());
       detailPaneButton.getModel().setSelected(logPanel.isDetailVisible());
       toggleLogTreeMenuItem.setSelected(logPanel.isLogTreeVisible());

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=941121&r1=941120&r2=941121&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 Wed May 
5 00:29:50 2010
@@ -250,6 +250,7 @@ public class LogPanel extends DockablePa
   private TableCellEditor markerCellEditor;
   private AutoFilterComboBox filterCombo;
   private JScrollPane eventsPane;
+  private int currentSearchMatchCount;
 
     /**
    * Creates a new LogPanel object.  If a LogPanel with this identifier has
@@ -610,7 +611,7 @@ public class LogPanel extends DockablePa
         public void eventCountChanged(int currentCount, int totalCount) {
           if (LogPanel.this.isVisible()) {
             statusBar.setSelectedLine(
-              table.getSelectedRow() + 1, currentCount, totalCount);
+              table.getSelectedRow() + 1, currentCount, totalCount, getIdentifier());
           }
         }
       });
@@ -2015,7 +2016,8 @@ public class LogPanel extends DockablePa
       findField.setBackground(UIManager.getColor("TextField.background"));
       findField.setToolTipText(
         "Enter expression - right click or ctrl-space for menu");
-      statusBar.setSearchMatchCount(0);
+      currentSearchMatchCount = 0;
+      statusBar.setSearchMatchCount(currentSearchMatchCount, getIdentifier());
     } else {
       //only turn off scrolltobottom when finding something (find not empty)
       preferenceModel.setScrollToBottom(false);
@@ -2028,17 +2030,18 @@ public class LogPanel extends DockablePa
         findField.setToolTipText(
           "Enter expression - right click or ctrl-space for menu");
         findRule = ExpressionRule.getRule(ruleText);
-        int matchCount = tableModel.updateEventsWithFindRule(findRule);
+        currentSearchMatchCount = tableModel.updateEventsWithFindRule(findRule);
         colorizer.setFindRule(findRule);
         //valid expression, reset background color in case we were previously an invalid
expression
         findField.setBackground(UIManager.getColor("TextField.background"));
-        statusBar.setSearchMatchCount(matchCount);
+        statusBar.setSearchMatchCount(currentSearchMatchCount, getIdentifier());
       } catch (IllegalArgumentException re) {
         findField.setToolTipText(re.getMessage());
         findField.setBackground(INVALID_EXPRESSION_BACKGROUND);
         colorizer.setFindRule(null);
         tableModel.updateEventsWithFindRule(null);
-        statusBar.setSearchMatchCount(0);
+        currentSearchMatchCount = 0;
+        statusBar.setSearchMatchCount(currentSearchMatchCount, getIdentifier());
       }
     }
   }
@@ -2336,13 +2339,14 @@ public class LogPanel extends DockablePa
   /**
    * Update the status bar with current selected row and row count
    */
-  private void updateStatusBar() {
+  protected void updateStatusBar() {
     SwingHelper.invokeOnEDT(
       new Runnable() {
         public void run() {
           statusBar.setSelectedLine(
             table.getSelectedRow() + 1, tableModel.getRowCount(),
-            tableModel.size());
+            tableModel.size(), getIdentifier());
+          statusBar.setSearchMatchCount(currentSearchMatchCount, getIdentifier());
         }
       });
   }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=941121&r1=941120&r2=941121&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Wed May  5 00:29:50
2010
@@ -497,7 +497,7 @@ public class LogUI extends JFrame implem
   private void initGUI() {
 
     setupHelpSystem();
-    statusBar = new ChainsawStatusBar();
+    statusBar = new ChainsawStatusBar(this);
     setupReceiverPanel();
 
     setToolBarAndMenus(new ChainsawToolBarAndMenus(this));
@@ -773,6 +773,17 @@ public class LogUI extends JFrame implem
     getContentPane().setLayout(new BorderLayout());
 
     getTabbedPane().addChangeListener(getToolBarAndMenus());
+    getTabbedPane().addChangeListener(new ChangeListener()
+    {
+        public void stateChanged(ChangeEvent e)
+        {
+            LogPanel thisLogPanel = getCurrentLogPanel();
+            if (thisLogPanel != null)
+            {
+                thisLogPanel.updateStatusBar();
+            }
+        }
+    });
 
     KeyStroke ksRight =
       KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK);



Mime
View raw message