Tools__ChangeList.st
branchjv
changeset 12214 4b7eedbab2a7
parent 12213 63694f12baba
child 12216 5698c277f043
--- a/Tools__ChangeList.st	Fri Mar 30 14:35:31 2012 +0100
+++ b/Tools__ChangeList.st	Sat Mar 31 01:16:30 2012 +0100
@@ -29,7 +29,7 @@
 
 BrowserListWithFilter subclass:#ChangeList
 	instanceVariableNames:'listHolder showRemovedHolder showSameHolder allowRemoveHolder
-		allowAcceptHolder'
+		allowAcceptHolder scrollToBottom'
 	classVariableNames:'LastSelectionConditionString'
 	poolDictionaries:''
 	category:'Interface-Browsers-ChangeSet'
@@ -360,6 +360,17 @@
     "Created: / 27-12-2011 / 14:18:25 / cg"
 !
 
+scrollToBottom:aBoolean
+    "If set to true, list will automaticallu scroll to bottom
+     ehen the list is updated and clears this flag. 
+
+     This is required as the list is updated asynchronously"
+
+    scrollToBottom := aBoolean.
+
+    "Modified (comment): / 30-03-2012 / 17:05:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 selection
 
     ^self selectionHolder value
@@ -628,6 +639,7 @@
 
     super initialize.
     menuHolder := [self menuFor: #listMenu].
+    scrollToBottom := false.
 
     "Created: / 29-10-2010 / 12:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -859,10 +871,15 @@
     newList := newList collect:[:chg | self listEntryFor:chg ].
     self listHolder value ~= newList ifTrue:[
         self listHolder value: newList.
+        ((newList size ~~ 0) and:[scrollToBottom]) ifTrue:[
+            self selection: { newList last }
+        ].
+        scrollToBottom := false.
+
     ]
 
-    "Modified: / 29-11-2011 / 15:38:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 28-12-2011 / 15:46:15 / cg"
+    "Modified: / 30-03-2012 / 17:04:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ChangeList methodsFor:'queries'!
@@ -1101,7 +1118,7 @@
 !ChangeList class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Tools__ChangeList.st 7960 2012-03-30 13:35:31Z vranyj1 $'
+    ^ '$Id: Tools__ChangeList.st 7961 2012-03-31 00:16:30Z vranyj1 $'
 !
 
 version_CVS
@@ -1109,5 +1126,5 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__ChangeList.st 7960 2012-03-30 13:35:31Z vranyj1 $'
+    ^ '$Id: Tools__ChangeList.st 7961 2012-03-31 00:16:30Z vranyj1 $'
 ! !