logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r569153 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
Date Thu, 23 Aug 2007 21:33:09 GMT
Author: sdeboy
Date: Thu Aug 23 14:33:08 2007
New Revision: 569153

URL: http://svn.apache.org/viewvc?rev=569153&view=rev
Log:
fix scroll to bottom
 - 'find' no longer bypasses - find now deactivates scroll to bottom.
     To re-activate, press ctrl-b or click the scroll to bottom button
 - button state/default scroll state didn't match preference model

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=569153&r1=569152&r2=569153&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 23
14:33:08 2007
@@ -75,6 +75,7 @@
 import javax.swing.BoxLayout;
 import javax.swing.ButtonGroup;
 import javax.swing.ImageIcon;
+import javax.swing.JButton;
 import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JComboBox;
 import javax.swing.JComponent;
@@ -90,7 +91,6 @@
 import javax.swing.JSeparator;
 import javax.swing.JSplitPane;
 import javax.swing.JTable;
-import javax.swing.JButton;
 import javax.swing.JTextArea;
 import javax.swing.JTextField;
 import javax.swing.JToolBar;
@@ -223,9 +223,7 @@
   private double lastDetailPanelSplitLocation = DEFAULT_DETAIL_SPLIT_LOCATION;
   private double lastLogTreePanelSplitLocation =
     DEFAULT_LOG_TREE_SPLIT_LOCATION;
-  private boolean bypassScrollFind;
   private Point currentPoint;
-  private boolean scroll;
   private boolean paused = false;
   private Rule findRule;
   private final JPanel findPanel;
@@ -254,8 +252,6 @@
     logger.debug("creating logpanel for " + identifier);
 
     setLayout(new BorderLayout());
-    scroll = true;
-
     findPanel = new JPanel();
 
     final Map columnNameKeywordMap = new HashMap();
@@ -298,7 +294,7 @@
 
     setDetailPaneConversionPattern(
       DefaultLayoutFactory.getDefaultPatternLayout());
-    ((EventDetailLayout) detailLayout).setConversionPattern(
+      detailLayout.setConversionPattern(
       DefaultLayoutFactory.getDefaultPatternLayout());
 
     undockedFrame = new JFrame(identifier);
@@ -385,6 +381,7 @@
           preferenceModel.setScrollToBottom(menuItemScrollBottom.isSelected());
         }
       });
+    menuItemScrollBottom.setSelected(isScrollToBottom());
 
     menuItemScrollBottom.setIcon(
       new ImageIcon(ChainsawIcons.SCROLL_TO_BOTTOM));
@@ -535,8 +532,7 @@
         public void propertyChange(PropertyChangeEvent evt) {
           boolean value = ((Boolean) evt.getNewValue()).booleanValue();
           menuItemScrollBottom.setSelected(value);
-          scroll = value;
-          if (scroll) {
+          if (value) {
           	table.scrollToBottom(table.columnAtPoint(table.getVisibleRect().getLocation()));
           }
         }
@@ -714,10 +710,10 @@
            * 
            * note: previouslast is set after it is evaluated in the bypass scroll check
           */
-          //System.out.println("rowcount: " + (table.getRowCount() - 1) + ", last: " + evt.getLastIndex()
+", previous last: " + previousLastIndex + "..first: " + evt.getFirstIndex());
+         //System.out.println("rowcount: " + (table.getRowCount() - 1) + ", last: " + evt.getLastIndex()
+", previous last: " + previousLastIndex + "..first: " + evt.getFirstIndex() + ", isadjusting:
" + evt.getValueIsAdjusting());
           
-          boolean bypassScrollSelection = (lastIndexOnLastRow && lastIndexSame &&
previousLastIndex != evt.getFirstIndex());
-          if (bypassScrollSelection && scroll && table.getRowCount() >
0) {
+          boolean disableScrollToBottom = (lastIndexOnLastRow && lastIndexSame &&
previousLastIndex != evt.getFirstIndex());
+          if (disableScrollToBottom && isScrollToBottom() && table.getRowCount()
> 0) {
           	preferenceModel.setScrollToBottom(false);
           }
           previousLastIndex = evt.getLastIndex();
@@ -1415,7 +1411,7 @@
       tableModel.fireTableEvent(
         first, tableModel.getLastAdded(), events.size());
 
-      if (scroll && !bypassScrollFind) {
+      if (isScrollToBottom()) {
         table.scrollToBottom(
           table.columnAtPoint(table.getVisibleRect().getLocation()));
       }
@@ -1749,17 +1745,15 @@
   }
 
   public boolean updateRule(String ruleText) {
-    if ((ruleText == null) || ((ruleText != null) && ruleText.equals(""))) {
+    if ((ruleText == null) || (ruleText.equals(""))) {
       findRule = null;
       colorizer.setFindRule(null);
-      bypassScrollFind = false;
       findField.setToolTipText(
         "Enter expression - right click or ctrl-space for menu");
-
       return false;
     } else {
-      bypassScrollFind = true;
-
+      //only turn off scroltobottom when finding something (find not empty)
+      preferenceModel.setScrollToBottom(false);
       try {
         findField.setToolTipText(
           "Enter expression - right click or ctrl-space for menu");
@@ -1950,7 +1944,7 @@
         new SmallToggleButton(dockToggleScrollToBottomAction);
       preferenceModel.addPropertyChangeListener("scrollToBottom", new PropertyChangeListener()
{
       	public void propertyChange(PropertyChangeEvent evt) {
-      	    toggleScrollToBottomButton.setSelected(preferenceModel.isScrollToBottom());  
 		
+      	    toggleScrollToBottomButton.setSelected(isScrollToBottom());    		
       	}
       });
 



Mime
View raw message