logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r917404 - in /logging/chainsaw/trunk/src/main: java/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/help/
Date Mon, 01 Mar 2010 07:05:33 GMT
Author: sdeboy
Date: Mon Mar  1 07:05:32 2010
New Revision: 917404

URL: http://svn.apache.org/viewvc?rev=917404&view=rev
Log:
New feature: LogPanel context menu now provides 'Show times relative to this row' and 'Hide
relative times' menu items
 - 'Show times relative to this row' will use the timestamp for the current row as time zero,
with other row timestamps displayed in milliseconds relative to this row's time (positive
or negative)
 - 'Hide relative times' will reset the display of timestamps back to their normal non-relative
values
 - also updated release notes

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/EventContainer.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
    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/ChainsawCyclicBufferTableModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java?rev=917404&r1=917403&r2=917404&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
Mon Mar  1 07:05:32 2010
@@ -121,7 +121,7 @@
     return list;
   }
 
-  private void reFilter() {
+  public void reFilter() {
     synchronized (unfilteredList) {
       final int previousSize = filteredList.size();
       try {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/EventContainer.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/EventContainer.java?rev=917404&r1=917403&r2=917404&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/EventContainer.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/EventContainer.java Mon
Mar  1 07:05:32 2010
@@ -153,6 +153,10 @@
   void notifyCountListeners();
 
   /**
+   * Force a re-processing of the table layout
+   */
+  void reFilter();
+  /**
    * Sets the DisplayFilter in operation
    * @param displayRule
    */

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=917404&r1=917403&r2=917404&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 
1 07:05:32 2010
@@ -1407,6 +1407,41 @@
 
     p.add(new JSeparator());
 
+    final JMenuItem menuItemDisplayNormalTimes =
+      new JMenuItem("Hide relative times");
+    menuItemDisplayNormalTimes.addActionListener(
+      new ActionListener() {
+        public void actionPerformed(ActionEvent e) {
+          if (currentPoint != null) {
+            int row = table.rowAtPoint(currentPoint);
+            LoggingEvent event = tableModel.getRow(row);
+            renderer.setUseNormalTimes();
+            tableModel.reFilter();
+            menuItemDisplayNormalTimes.setEnabled(false);
+          }
+        }
+    });
+
+    final JMenuItem menuItemDisplayRelativeTimesToRowUnderCursor =
+      new JMenuItem("Show times relative to this row");
+    menuItemDisplayRelativeTimesToRowUnderCursor.addActionListener(
+      new ActionListener() {
+        public void actionPerformed(ActionEvent e) {
+            if (currentPoint != null) {
+              int row = table.rowAtPoint(currentPoint);
+              LoggingEvent event = tableModel.getRow(row);
+              renderer.setUseRelativeTimes(event.getTimeStamp());
+              tableModel.reFilter();
+              menuItemDisplayNormalTimes.setEnabled(true);
+            }
+        }
+      });
+
+    menuItemDisplayNormalTimes.setEnabled(false);
+    p.add(menuItemDisplayRelativeTimesToRowUnderCursor);
+    p.add(menuItemDisplayNormalTimes);
+    p.add(new JSeparator());
+
     p.add(menuItemToggleDetails);
     p.add(menuItemLoggerTree);
     p.add(menuItemToggleToolTips);

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java?rev=917404&r1=917403&r2=917404&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
Mon Mar  1 07:05:32 2010
@@ -66,8 +66,10 @@
   private boolean toolTipsVisible;
   private String dateFormatTZ;
   private final Icon markerIcon = new ImageIcon(ChainsawIcons.MARKER);
+  private boolean useRelativeTimes = false;
+  private long relativeTimestampBase;
 
-  /**
+    /**
    * Creates a new TableColorizingRenderer object.
    */
   public TableColorizingRenderer(Colorizer colorizer) {
@@ -277,7 +279,13 @@
     if (!(o instanceof Date)) {
       return (o == null ? "" : o);
     }
-    
+
+    //handle date field
+    if (useRelativeTimes)
+    {
+        return "" + (((Date)o).getTime() - relativeTimestampBase);
+    }
+
     return dateFormatInUse.format((Date) o);
   }
 
@@ -306,4 +314,13 @@
       dateFormatInUse.setTimeZone(TimeZone.getDefault());
     }
   }
+
+  public void setUseRelativeTimes(long timeStamp) {
+    useRelativeTimes = true;
+    relativeTimestampBase = timeStamp;
+  }
+
+  public void setUseNormalTimes() {
+    useRelativeTimes = false;
+  }
 }

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=917404&r1=917403&r2=917404&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  1 07:05:32 2010
@@ -9,7 +9,15 @@
 <br>
 <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</h2>
+<h1>1.99.99</h1>
+<h2>28 Feb 2010</h2>
+<ul>
+<li>
+LogPanel context menu now provides 'Show times relative to this row' and 'Hide relative times'
menu items
+ - 'Show times relative to this row' will use the timestamp for the current row as time zero,
with other row timestamps displayed in milliseconds relative to this row's time (positive
or negative)
+ - 'Hide relative times' will reset the display of timestamps back to their normal non-relative
values
+</li>
+</ul>
 <h2>22 Feb 2010</h2>
 <ul>
 <li>Implemented marker support (ability to add notes to rows).  Double click a row
to toggle on or off a default note, or click in a row to define a custom note.  Navigate between
markers with F2/Shift F2.



Mime
View raw message