sdeboy 2004/06/24 23:25:07
Modified: src/java/org/apache/log4j/chainsaw LogPanel.java
src/java/org/apache/log4j/chainsaw/help release-notes.html
Log:
Minor change to 'scroll to bottom' behavior to ensure context menu always matched
expected behavior (scroll to bottom wouldn't stay selected in some cases).
Revision Changes Path
1.79 +12 -8 logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
Index: LogPanel.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- LogPanel.java 22 Jun 2004 07:00:43 -0000 1.78
+++ LogPanel.java 25 Jun 2004 06:25:06 -0000 1.79
@@ -712,17 +712,21 @@
return;
}
boolean lastIndexOnLastRow = (evt.getLastIndex() == (table.getRowCount()
- 1));
- boolean firstIndexOnLastRow = (evt.getFirstIndex() ==
(table.getRowCount() - 1));
boolean lastIndexSame = (previousLastIndex == evt.getLastIndex());
/*
- to bypass the scroll-to-bottom feature when the user selects a row other
than the bottom row,
- one of two conditions must be met:
- 1: neither the 'firstindex' nor the 'lastindex' are on the last row, or
- 2: the last index value didn't change and the 'lastindex' is on the last
row, and the last index and first index aren't the same
- */
- boolean bypassScrollSelection = (!(lastIndexOnLastRow ||
firstIndexOnLastRow)) || (lastIndexSame && lastIndexOnLastRow && (evt.getFirstIndex()
!= evt.getLastIndex()));
- if (bypassScrollSelection && scroll && table.getRowCount() > -1) {
+ * when scroll-to-bottom is active, here is what events look like:
+ * rowcount-1: 227, last: 227, previous last: 191..first: 191
+ *
+ * when the user has unselected the bottom row, here is what the events
look like:
+ * rowcount-1: 227, last: 227, previous last: 227..first: 222
+ *
+ * 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());
+
+ boolean bypassScrollSelection = (lastIndexOnLastRow && lastIndexSame &&
previousLastIndex != evt.getFirstIndex());
+ if (bypassScrollSelection && scroll && table.getRowCount() > 0) {
preferenceModel.setScrollToBottom(false);
}
previousLastIndex = evt.getLastIndex();
1.25 +5 -0
logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html
Index: release-notes.html
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- release-notes.html 22 Jun 2004 07:00:44 -0000 1.24
+++ release-notes.html 25 Jun 2004 06:25:07 -0000 1.25
@@ -9,6 +9,11 @@
<h1>1.99.99</h2>
+<h2>24 June 2004</h2>
+<ul>
+ <li>Minor change to 'scroll to bottom' behavior to ensure context menu always
matched expected behavior (scroll to bottom wouldn't stay selected in some cases).</li>
+</ul>
+
<h2>21 June 2004</h2>
<ul>
<li>Modified 'scroll to bottom' behavior: Selecting the 'scroll to bottom'
context menu now selects the bottom row. Select any row other than the bottom row to
deactivate scroll to bottom.</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]