From general-return-1498-apmail-logging-general-archive=logging.apache.org@logging.apache.org Mon Jun 14 14:31:30 2010 Return-Path: Delivered-To: apmail-logging-general-archive@www.apache.org Received: (qmail 8320 invoked from network); 14 Jun 2010 05:23:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Jun 2010 05:23:41 -0000 Received: (qmail 32823 invoked by uid 500); 14 Jun 2010 05:23:41 -0000 Delivered-To: apmail-logging-general-archive@logging.apache.org Received: (qmail 32667 invoked by uid 500); 14 Jun 2010 05:23:38 -0000 Mailing-List: contact general-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Logging General" List-Id: Delivered-To: mailing list general@logging.apache.org Received: (qmail 32656 invoked by uid 99); 14 Jun 2010 05:23:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jun 2010 05:23:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jun 2010 05:23:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 76A4123889B6; Mon, 14 Jun 2010 05:22:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r954366 - in /logging/chainsaw/trunk/src/main: java/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/help/ Date: Mon, 14 Jun 2010 05:22:50 -0000 To: general@logging.apache.org From: sdeboy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100614052250.76A4123889B6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sdeboy Date: Mon Jun 14 05:22:50 2010 New Revision: 954366 URL: http://svn.apache.org/viewvc?rev=954366&view=rev Log: New feature: When mouse is moved into the thumbnail bar, event details for the closest event is displayed as a tooltip (enabled by default, configurable via Tab Preferences dialog, Visuals section). 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/LogPanelPreferencePanel.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/LogPanel.java URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=954366&r1=954365&r2=954366&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 Jun 14 05:22:50 2010 @@ -1321,8 +1321,6 @@ public class LogPanel extends DockablePa * Logger tree splitpane definition */ nameTreeAndMainPanelSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, logTreePanel, lowerPanel); - - nameTreeAndMainPanelSplit.setToolTipText("Still under development...."); nameTreeAndMainPanelSplit.setDividerLocation(-1); add(nameTreeAndMainPanelSplit, BorderLayout.CENTER); @@ -2699,6 +2697,12 @@ public class LogPanel extends DockablePa return longestWidth + 5; } + private String getToolTipTextForEvent(ExtendedLoggingEvent event) { + StringBuffer buf = new StringBuffer(); + buf.append(detailLayout.getHeader()).append(detailLayout.format(event)).append(detailLayout.getFooter()); + return buf.toString(); + } + /** * ensures the Entry map of all the unque logger names etc, that is used for * the Filter panel is updated with any new information from the event @@ -2936,11 +2940,8 @@ public class LogPanel extends DockablePa ExtendedLoggingEvent event = tableModel.getRow(currentRow); if (event != null) { - StringBuffer buf = new StringBuffer(); - buf.append(detailLayout.getHeader()) - .append(detailLayout.format(event)).append( - detailLayout.getFooter()); - table.setToolTipText(buf.toString()); + String toolTipText = getToolTipTextForEvent(event); + table.setToolTipText(toolTipText); } } else { table.setToolTipText(null); @@ -3191,33 +3192,24 @@ public class LogPanel extends DockablePa configureColors(); } }); + + addMouseMotionListener(new MouseAdapter() { + public void mouseMoved(MouseEvent e) { + if (preferenceModel.isThumbnailBarToolTips()) { + int yPosition = e.getPoint().y; + EventWrapper event = getEventWrapperAtPosition(yPosition); + setToolTipText(getToolTipTextForEvent(event.loggingEvent)); + } else { + setToolTipText(null); + } + } + }); + addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { - int rowCount = table.getRowCount(); - - Point offsets = getScrollBarOffsets(); - int topOffset = offsets.x; - int bottomOffset = offsets.y; - - //'effective' height of this component is scrollpane height - top/bottom offsets - int height = eventsPane.getHeight() - topOffset - bottomOffset; - - int clickLocation = e.getPoint().y; - - //remove top offset from click location but avoid going negative - clickLocation = Math.max(clickLocation - topOffset, 0); - - //don't let clicklocation exceed height - if (clickLocation >= height) { - clickLocation = height; - } - -// System.out.println("clicked y pos: " + e.getPoint().y + ", relative: " + clickLocation); - float ratio = (float)clickLocation / height; - int rowToSelect = Math.round(rowCount * ratio); -// System.out.println("rowCount: " + rowCount + ", height: " + height + ", clickLocation: " + clickLocation + ", ratio: " + ratio + ", rowToSelect: " + rowToSelect); - EventWrapper event = getClosestRow(rowToSelect); + int yPosition = e.getPoint().y; + EventWrapper event = getEventWrapperAtPosition(yPosition); // System.out.println("rowToSelect: " + rowToSelect + ", closestRow: " + event.loggingEvent.getProperty("log4jid")); if (event != null) { int id = new Integer(event.loggingEvent.getProperty("log4jid")).intValue(); @@ -3322,6 +3314,33 @@ public class LogPanel extends DockablePa }); } + private EventWrapper getEventWrapperAtPosition(int yPosition) + { + int rowCount = table.getRowCount(); + + Point offsets = getScrollBarOffsets(); + int topOffset = offsets.x; + int bottomOffset = offsets.y; + + //'effective' height of this component is scrollpane height - top/bottom offsets + int height = eventsPane.getHeight() - topOffset - bottomOffset; + + //remove top offset from click location but avoid going negative + yPosition = Math.max(yPosition - topOffset, 0); + + //don't let clicklocation exceed height + if (yPosition >= height) { + yPosition = height; + } + +// System.out.println("clicked y pos: " + e.getPoint().y + ", relative: " + clickLocation); + float ratio = (float) yPosition / height; + int rowToSelect = Math.round(rowCount * ratio); +// System.out.println("rowCount: " + rowCount + ", height: " + height + ", clickLocation: " + clickLocation + ", ratio: " + ratio + ", rowToSelect: " + rowToSelect); + EventWrapper event = getClosestRow(rowToSelect); + return event; + } + private EventWrapper getClosestRow(int rowToSelect) { EventWrapper closestRow = null; int rowDelta = Integer.MAX_VALUE; 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=954366&r1=954365&r2=954366&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 Jun 14 05:22:50 2010 @@ -74,6 +74,8 @@ public class LogPanelPreferenceModel imp private List visibleColumnOrder = new ArrayList(); private boolean detailPaneVisible; private boolean toolTips; + //default thumbnail bar tooltips to true + private boolean thumbnailBarToolTips = true; private boolean scrollToBottom; private boolean logTreePanelVisible; private String loggerPrecision = ""; @@ -224,6 +226,7 @@ public class LogPanelPreferenceModel imp setHighlightSearchMatchText(model.isHighlightSearchMatchText()); setTimeZone(model.getTimeZone()); setToolTips(model.isToolTips()); + setThumbnailBarToolTips((model.isThumbnailBarToolTips())); setScrollToBottom(model.isScrollToBottom()); setDetailPaneVisible(model.isDetailPaneVisible()); setLogTreePanelVisible(model.isLogTreePanelVisible()); @@ -379,6 +382,16 @@ public class LogPanelPreferenceModel imp "scrollToBottom", oldValue, this.scrollToBottom); } + public final void setThumbnailBarToolTips(boolean thumbnailBarToolTips) { + boolean oldValue = this.thumbnailBarToolTips; + this.thumbnailBarToolTips = thumbnailBarToolTips; + propertySupport.firePropertyChange("thumbnailBarToolTips", oldValue, this.thumbnailBarToolTips); + } + + public final boolean isThumbnailBarToolTips() { + return thumbnailBarToolTips; + } + /** * @return tool tips enabled flag */ Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java?rev=954366&r1=954365&r2=954366&view=diff ============================================================================== --- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java (original) +++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java Mon Jun 14 05:22:50 2010 @@ -584,6 +584,8 @@ public class LogPanelPreferencePanel ext new JCheckBox("Scroll to bottom (view tracks with new events)"); private final JCheckBox toolTips = new JCheckBox("Show Event Detail Tooltips"); + private final JCheckBox thumbnailBarToolTips = + new JCheckBox("Show Thumbnail Bar Tooltips"); //~ Constructors ========================================================== @@ -607,11 +609,13 @@ public class LogPanelPreferencePanel ext setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(toolTips); + add(thumbnailBarToolTips); add(detailPanelVisible); add(loggerTreePanel); add(scrollToBottom); toolTips.setSelected(preferenceModel.isToolTips()); + thumbnailBarToolTips.setSelected(preferenceModel.isThumbnailBarToolTips()); detailPanelVisible.setSelected(preferenceModel.isDetailPaneVisible()); loggerTreePanel.setSelected(preferenceModel.isLogTreePanelVisible()); } @@ -628,6 +632,13 @@ public class LogPanelPreferencePanel ext preferenceModel.setToolTips(toolTips.isSelected()); } }); + + thumbnailBarToolTips.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + preferenceModel.setThumbnailBarToolTips(thumbnailBarToolTips.isSelected()); + } + }); + preferenceModel.addPropertyChangeListener( "toolTips", new PropertyChangeListener() { @@ -638,6 +649,16 @@ public class LogPanelPreferencePanel ext } }); + preferenceModel.addPropertyChangeListener( + "thumbnailBarToolTips", new PropertyChangeListener() + { + public void propertyChange(PropertyChangeEvent evt) + { + boolean value = ((Boolean) evt.getNewValue()).booleanValue(); + thumbnailBarToolTips.setSelected(value); + } + }); + detailPanelVisible.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) 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=954366&r1=954365&r2=954366&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 Jun 14 05:22:50 2010 @@ -10,6 +10,10 @@ NOTE: 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.

2.1

+

13 Jun 2010

+
    +
  • When mouse is moved into the thumbnail bar, event details for the closest event is displayed as a tooltip (enabled by default, configurable via Tab Preferences dialog, Visuals section).
  • +

11 Jun 2010

  • Updated Chainsaw Maven version to 2.1.