logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r923056 - in /logging/chainsaw/trunk/src/main: java/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/help/
Date Mon, 15 Mar 2010 05:14:04 GMT
Author: sdeboy
Date: Mon Mar 15 05:14:04 2010
New Revision: 923056

URL: http://svn.apache.org/viewvc?rev=923056&view=rev
Log:
Adding 'scroll to top' capability to logpanel, accessible via menus and Ctrl-A accelerator

Modified:
    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/resources/org/apache/log4j/chainsaw/WelcomePanel.html
    logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html

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=923056&r1=923055&r2=923056&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
Mon Mar 15 05:14:04 2010
@@ -85,6 +85,7 @@ class ChainsawToolBarAndMenus implements
   private final Action showReceiversAction;
   private final Action toggleLogTreeAction;
   private final Action toggleScrollToBottomAction;
+  private final Action scrollToTopAction;
   private final Action toggleDetailPaneAction;
   private final Action toggleToolbarAction;
   private final Action undockAction;
@@ -138,6 +139,7 @@ class ChainsawToolBarAndMenus implements
     toggleToolbarAction = createToggleToolbarAction();
     toggleLogTreeAction = createToggleLogTreeAction();
     toggleScrollToBottomAction = createScrollToBottomAction();
+    scrollToTopAction = createScrollToTopAction();
     pauseAction = createPauseAction();
     clearAction = createClearAction();
     undockAction = createUndockAction();
@@ -164,7 +166,7 @@ class ChainsawToolBarAndMenus implements
     logPanelSpecificActions =
       new Action[] {
         pauseAction, findNextAction, findPreviousAction, findNextMarkerAction, findPreviousMarkerAction,
-        toggleMarkerAction, clearAllMarkersAction, clearAction,
+        toggleMarkerAction, clearAllMarkersAction, scrollToTopAction, clearAction,
         fileMenu.getFileSaveAction(), toggleDetailPaneAction,
         showPreferencesAction, showColorPanelAction, undockAction,
         toggleLogTreeAction, toggleScrollToBottomAction, changeModelAction,
@@ -259,6 +261,24 @@ class ChainsawToolBarAndMenus implements
      return action;
    }
 
+    private Action createScrollToTopAction() {
+      Action action =
+        new AbstractAction("Scroll to top") {
+          public void actionPerformed(ActionEvent e) {
+            if (logui.getCurrentLogPanel() != null) {
+              logui.getCurrentLogPanel().scrollToTop();;
+            }
+          }
+        };
+
+      action.putValue(Action.SHORT_DESCRIPTION, "Scroll to top");
+      action.putValue("enabled", Boolean.TRUE);
+      action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_T));
+      action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A,  InputEvent.CTRL_MASK));
+
+      return action;
+    }
+
      private Action createFindNextMarkerAction() {
        Action action =
          new AbstractAction("Find next marker") {
@@ -501,6 +521,7 @@ class ChainsawToolBarAndMenus implements
     activeTabMenu.add(new JMenuItem(clearAllMarkersAction));
 
     activeTabMenu.addSeparator();
+    activeTabMenu.add(new JMenuItem(scrollToTopAction));
     activeTabMenu.add(toggleScrollToBottomMenuItem);
     activeTabMenu.add(menuItemUseRightMouse);
 

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=923056&r1=923055&r2=923056&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 Mar 15
05:14:04 2010
@@ -384,6 +384,14 @@ public class LogPanel extends DockablePa
       });
     menuItemLoggerTree.setIcon(new ImageIcon(ChainsawIcons.WINDOW_ICON));
 
+    final JMenuItem menuItemScrollToTop = new JMenuItem("Scroll to top");
+    menuItemScrollToTop.addActionListener(
+      new ActionListener() {
+          public void actionPerformed(ActionEvent evt)
+          {
+              scrollToTop();
+          }
+      });
     final JCheckBoxMenuItem menuItemScrollBottom =
       new JCheckBoxMenuItem("Scroll to bottom");
     menuItemScrollBottom.addActionListener(
@@ -573,6 +581,9 @@ public class LogPanel extends DockablePa
     table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_F2,
InputEvent.CTRL_MASK), "none");
     table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_F2,
InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK), "none");
 
+    //we're also mapping ctrl-a to scroll-to-top, unmap from the table
+    table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_A,
InputEvent.CTRL_MASK), "none");
+        
     //add a listener to update the 'refine focus'
     tableModel.addNewKeyListener(new NewKeyListener() {
 		public void newKeyAdded(NewKeyEvent e) {
@@ -1448,8 +1459,8 @@ public class LogPanel extends DockablePa
 
     p.add(new JSeparator());
 
+    p.add(menuItemScrollToTop);
     p.add(menuItemScrollBottom);
-
     p.add(new JSeparator());
 
     p.add(menuItemToggleDock);
@@ -1487,6 +1498,13 @@ public class LogPanel extends DockablePa
     table.scrollToRow(tableModel.getRowCount() - 1);
   }
 
+  public void scrollToTop()
+  {
+    if (tableModel.getRowCount() > 1) {
+        table.scrollToRow(0);
+    }
+  }
+
   /**
    * Accessor
    *

Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html?rev=923056&r1=923055&r2=923056&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html
(original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html
Mon Mar 15 05:14:04 2010
@@ -35,6 +35,14 @@
 	<td>Hide/Show Welcome Panel/Help page</td>
 
 </tr>
+<tr valign="top">
+    <td nowrap class="HotKey">CTRL-A</td>
+    <td width="50" align="center">-</td>
+    <td>Scroll to top</td>
+    <td nowrap class="HotKey">CTRL-B</td>
+    <td width="50" align="center">-</td>
+    <td>Scroll to bottom</td>
+</tr>
 <tr valign="top" bgcolor="#EEEEEE">
 	<td nowrap class="HotKey">CTRL-RIGHT</td>
 	<td width="50" align="center">-</td>

Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html?rev=923056&r1=923055&r2=923056&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
(original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
Mon Mar 15 05:14:04 2010
@@ -10,6 +10,12 @@
 <b>NOTE:</b> The mechanism and format used to persist settings in Chainsaw is
subject to change.  If you are experiencing problems displaying events in Chainsaw, please
delete everything in the $user.dir/.chainsaw directory and restart Chainsaw.
 <br>
 <h1>1.99.99</h1>
+<h2>14 Mar 2010</h2>
+<ul>
+<li>
+Added 'scroll to top' LogPanel feature, available via Ctrl-A, context menu or regular menu,
and added Ctrl A (and Ctrl B/scroll to bottom) keyboard shortcuts to 'welcome panel' screen
+</li>
+</ul>
 <h2>28 Feb 2010</h2>
 <ul>
 <li>



Mime
View raw message