You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@logging.apache.org by ps...@apache.org on 2008/09/10 07:55:39 UTC

svn commit: r693710 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java

Author: psmith
Date: Tue Sep  9 22:55:39 2008
New Revision: 693710

URL: http://svn.apache.org/viewvc?rev=693710&view=rev
Log:
Slight optimization.  Found this with Yourkit, but if the Event Detail View is hidden, this logic is still getting fired...

That is, detailPain.isVisible() is true... even though we call setVisible(false) to toggle it.  

Instead, check the Preference model for the state, and exit early if it's not visible.

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=693710&r1=693709&r2=693710&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 Tue Sep  9 22:55:39 2008
@@ -222,7 +222,7 @@
   private final FilterModel filterModel = new FilterModel();
   private final RuleColorizer colorizer = new RuleColorizer();
   private final RuleMediator ruleMediator = new RuleMediator();
-  private EventDetailLayout detailLayout = new EventDetailLayout();
+  private final EventDetailLayout detailLayout = new EventDetailLayout();
   private double lastDetailPanelSplitLocation = DEFAULT_DETAIL_SPLIT_LOCATION;
   private double lastLogTreePanelSplitLocation =
     DEFAULT_LOG_TREE_SPLIT_LOCATION;
@@ -231,7 +231,7 @@
   private Rule findRule;
   private final JPanel findPanel;
   private JTextField findField;
-  private int dividerSize;
+  private final int dividerSize;
   static final String TABLE_COLUMN_ORDER = "table.columns.order";
   static final String TABLE_COLUMN_WIDTHS = "table.columns.widths";
   static final String COLUMNS_EXTENSION = ".columns";
@@ -2107,7 +2107,7 @@
    */
   private void setDetailPaneConversionPattern(String conversionPattern) {
     String oldPattern = getDetailPaneConversionPattern();
-    ((EventDetailLayout) detailLayout).setConversionPattern(conversionPattern);
+    (detailLayout).setConversionPattern(conversionPattern);
     firePropertyChange(
       "detailPaneConversionPattern", oldPattern,
       getDetailPaneConversionPattern());
@@ -2119,7 +2119,7 @@
    * @return conversionPattern layout text
    */
   private String getDetailPaneConversionPattern() {
-    return ((EventDetailLayout) detailLayout).getConversionPattern();
+    return (detailLayout).getConversionPattern();
   }
 
   /**
@@ -2632,10 +2632,12 @@
      * Update detail pane
      */
     private void updateDetailPane() {
-      /*
-       * Don't bother doing anything if it's not visible
-       */
-      if (!detail.isVisible()) {
+            /*
+             * 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
+             * the detail pane is triggered it still appears as 'visible' for some reason.
+             */
+      if (!preferenceModel.isDetailPaneVisible()) {
         return;
       }