logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r996435 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: LogPanel.java LogPanelPreferenceModel.java LogUI.java
Date Mon, 13 Sep 2010 06:46:53 GMT
Author: sdeboy
Date: Mon Sep 13 06:46:53 2010
New Revision: 996435

URL: http://svn.apache.org/viewvc?rev=996435&view=rev
Log:
Fix issues setting detail panel size when persistent tab settings are reloaded.  Also set
logpanelpref detailpanevisible default to match actual defaults in default.properties

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.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=996435&r1=996434&r2=996435&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 Sep 13
06:46:53 2010
@@ -256,6 +256,7 @@ public class LogPanel extends DockablePa
   private int currentSearchMatchCount;
   private ApplicationPreferenceModel applicationPreferenceModel;
   private Rule clearTableExpressionRule;
+  private int lowerPanelDividerLocation;
 
     /**
    * Creates a new LogPanel object.  If a LogPanel with this identifier has
@@ -1188,12 +1189,6 @@ public class LogPanel extends DockablePa
     lowerPanel.setBorder(null);
     lowerPanel.setContinuousLayout(true);
 
-    if (preferenceModel.isDetailPaneVisible()) {
-      showDetailPane();
-    } else {
-      hideDetailPane();
-    }
-    
     /*
      * Detail panel layout editor
      */
@@ -1877,7 +1872,7 @@ public class LogPanel extends DockablePa
             FileReader r = new FileReader(xmlFile);
             in = stream.createObjectInputStream(r);
             LogPanelPreferenceModel storedPrefs = (LogPanelPreferenceModel)in.readObject();
-            int lowerPanelDividerLocation = in.readInt();
+            lowerPanelDividerLocation = in.readInt();
             int treeDividerLocation = in.readInt();
             String conversionPattern = in.readObject().toString();
             Point p = (Point)in.readObject();
@@ -1997,7 +1992,12 @@ public class LogPanel extends DockablePa
     	FileWriter w = new FileWriter(xmlFile);
     	s = stream.createObjectOutputStream(w);
     	s.writeObject(preferenceModel);
-        s.writeInt(lowerPanel.getDividerLocation());
+        if (lowerPanelDividerLocation == 0) {
+            //pick a reasonable default
+            s.writeInt((int) (lowerPanel.getSize().height * DEFAULT_DETAIL_SPLIT_LOCATION));
+        } else {
+            s.writeInt(lowerPanelDividerLocation);
+        }
     	s.writeInt(nameTreeAndMainPanelSplit.getDividerLocation());
     	s.writeObject(detailLayout.getConversionPattern());
     	s.writeObject(undockedFrame.getLocation());
@@ -2279,8 +2279,12 @@ public class LogPanel extends DockablePa
    */
   private void showDetailPane() {
     lowerPanel.setDividerSize(dividerSize);
-    lowerPanel.setDividerLocation(lastDetailPanelSplitLocation);
-    detailPanel.setVisible(true);
+      if (lowerPanelDividerLocation != 0) {
+          lowerPanel.setDividerLocation(lowerPanelDividerLocation);
+      } else {
+          lowerPanel.setDividerLocation(lastDetailPanelSplitLocation);
+      }
+      detailPanel.setVisible(true);
     lowerPanel.repaint();
   }
 
@@ -2294,6 +2298,9 @@ public class LogPanel extends DockablePa
       lastDetailPanelSplitLocation =
         (double) lowerPanel.getDividerLocation() / currentSize;
      }
+     if (lowerPanel.getDividerLocation() > 0) {
+        lowerPanelDividerLocation = lowerPanel.getDividerLocation();
+     }
 
     lowerPanel.setDividerSize(0);
     detailPanel.setVisible(false);
@@ -2910,6 +2917,15 @@ public class LogPanel extends DockablePa
         }
     }
 
+    public void layoutComponents()
+    {
+        if (preferenceModel.isDetailPaneVisible()) {
+          showDetailPane();
+         } else {
+          hideDetailPane();
+        }
+    }
+
     /**
    * This class receives notification when the Refine focus text field is
    * updated, where a backgrounh thread periodically wakes up and checks if

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java?rev=996435&r1=996434&r2=996435&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferenceModel.java
Mon Sep 13 06:46:53 2010
@@ -72,7 +72,8 @@ public class LogPanelPreferenceModel imp
   private List allColumns = new ArrayList();
   private List visibleColumns = new ArrayList();
   private List visibleColumnOrder = new ArrayList();
-  private boolean detailPaneVisible;
+  //set to true to match default 'detailPaneVisible' setting
+  private boolean detailPaneVisible = true;
   private boolean toolTips;
   //default thumbnail bar tooltips to true
   private boolean thumbnailBarToolTips = true;

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=996435&r1=996434&r2=996435&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 Mon Sep 13 06:46:53
2010
@@ -2045,6 +2045,7 @@ public class LogUI extends JFrame implem
           public void run() {
             getTabbedPane().addANewTab(
               ident, thisPanel, new ImageIcon(ChainsawIcons.ANIM_RADIO_TOWER));
+              thisPanel.layoutComponents();
             thisPanel.receiveEventBatch(ident, events);
             if(!getTabbedPane().tabSetting.isChainsawLog()){
               displayPanel("chainsaw-log", false);



Mime
View raw message