bug fixes:
authorca
Wed, 29 Oct 1997 09:25:29 +0100
changeset 585 5a0ed2305998
parent 584 1426fe34f4e8
child 586 0679203515d2
bug fixes: support of reused model
SelInTree.st
SelTreeV.st
SelectionInTree.st
SelectionInTreeView.st
--- a/SelInTree.st	Wed Oct 29 08:42:29 1997 +0100
+++ b/SelInTree.st	Wed Oct 29 09:25:29 1997 +0100
@@ -253,13 +253,6 @@
 recomputeList
     "Travers the tree and build a new list."
 
-    self updateList.
-    self changed:#list.
-!
-
-updateList
-    "Travers the tree and build a new list.; no notification raised"
-
     list := OrderedCollection new.
 
     root notNil ifTrue:[
@@ -268,6 +261,7 @@
         ].
         root recomputeList:list
     ].
+    self changed:#list.
 ! !
 
 !SelectionInTree methodsFor:'selection'!
@@ -299,7 +293,7 @@
     self setSelectionIndex:indexesOrNil.
 
     oldSel = selection ifFalse:[
-        self changed:#selection
+        self changed:#selectionIndex
     ]
 !
 
@@ -328,5 +322,5 @@
 !SelectionInTree class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/SelInTree.st,v 1.6 1997-09-04 12:17:32 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/SelInTree.st,v 1.7 1997-10-29 08:25:29 ca Exp $'
 ! !
--- a/SelTreeV.st	Wed Oct 29 08:42:29 1997 +0100
+++ b/SelTreeV.st	Wed Oct 29 09:25:29 1997 +0100
@@ -384,6 +384,11 @@
         ^ self selectionFromModel
     ].
 
+    aModel == aModel ifTrue:[
+        something == #list ifTrue:[
+            ^ self getListFromModel
+        ]
+    ].
     ^ super update:something with:aParameter from:aModel.
 
 
@@ -816,12 +821,12 @@
     "
     |root|
 
-    root := rootHolder value.
+    root := rootHolder root.
 
     self root == root ifFalse:[
         self selection:nil.
         self root:root.
-    ]
+    ].
 !
 
 selectionFromModel
@@ -885,6 +890,9 @@
 !SelectionInTreeView methodsFor:'private'!
 
 list:aList keepSelection:keepSelection
+    "setup new list; keep selection dependent on the boolean state
+     keepSelection
+    "
     |list|
 
     list := aList.
@@ -902,6 +910,9 @@
 !
 
 nodeAt:anIndex expand:doExpand
+    "expand or collapse the node at an index, anIndex dependent on the boolean state
+     of doExpand
+    "
     |node|
 
     node := listOfNodes at:anIndex.
@@ -920,7 +931,9 @@
             self redrawLine:anIndex.
         ] ifFalse:[
             "/ with children; update list and redraw to end.
-            model updateList.
+            model removeDependent:self.
+            model recomputeList.
+            model addDependent:self.
             list := self listFromModel.
             self redrawFromLine:anIndex.
             self contentsChanged.
@@ -1121,7 +1134,9 @@
     ].
 
     rdwNd notNil ifTrue:[
-        model updateList.
+        model removeDependent:self.
+        model recomputeList.
+        model addDependent:self.
         list := self listFromModel.
         self redrawFromLine:(self indexOfNode:rdwNd).
         self contentsChanged.
@@ -1285,7 +1300,9 @@
                 self redrawLine:index.
             ] ifFalse:[
                 "/ with children; update list and redraw to end.
-                model updateList.
+                model removeDependent:self.
+                model recomputeList.
+                model addDependent:self.
                 list := self listFromModel.
                 self redrawFromLine:index.
                 self contentsChanged.
@@ -1305,5 +1322,5 @@
 !SelectionInTreeView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/SelTreeV.st,v 1.28 1997-10-22 13:25:22 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/SelTreeV.st,v 1.29 1997-10-29 08:25:02 ca Exp $'
 ! !
--- a/SelectionInTree.st	Wed Oct 29 08:42:29 1997 +0100
+++ b/SelectionInTree.st	Wed Oct 29 09:25:29 1997 +0100
@@ -253,13 +253,6 @@
 recomputeList
     "Travers the tree and build a new list."
 
-    self updateList.
-    self changed:#list.
-!
-
-updateList
-    "Travers the tree and build a new list.; no notification raised"
-
     list := OrderedCollection new.
 
     root notNil ifTrue:[
@@ -268,6 +261,7 @@
         ].
         root recomputeList:list
     ].
+    self changed:#list.
 ! !
 
 !SelectionInTree methodsFor:'selection'!
@@ -299,7 +293,7 @@
     self setSelectionIndex:indexesOrNil.
 
     oldSel = selection ifFalse:[
-        self changed:#selection
+        self changed:#selectionIndex
     ]
 !
 
@@ -328,5 +322,5 @@
 !SelectionInTree class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTree.st,v 1.6 1997-09-04 12:17:32 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTree.st,v 1.7 1997-10-29 08:25:29 ca Exp $'
 ! !
--- a/SelectionInTreeView.st	Wed Oct 29 08:42:29 1997 +0100
+++ b/SelectionInTreeView.st	Wed Oct 29 09:25:29 1997 +0100
@@ -384,6 +384,11 @@
         ^ self selectionFromModel
     ].
 
+    aModel == aModel ifTrue:[
+        something == #list ifTrue:[
+            ^ self getListFromModel
+        ]
+    ].
     ^ super update:something with:aParameter from:aModel.
 
 
@@ -816,12 +821,12 @@
     "
     |root|
 
-    root := rootHolder value.
+    root := rootHolder root.
 
     self root == root ifFalse:[
         self selection:nil.
         self root:root.
-    ]
+    ].
 !
 
 selectionFromModel
@@ -885,6 +890,9 @@
 !SelectionInTreeView methodsFor:'private'!
 
 list:aList keepSelection:keepSelection
+    "setup new list; keep selection dependent on the boolean state
+     keepSelection
+    "
     |list|
 
     list := aList.
@@ -902,6 +910,9 @@
 !
 
 nodeAt:anIndex expand:doExpand
+    "expand or collapse the node at an index, anIndex dependent on the boolean state
+     of doExpand
+    "
     |node|
 
     node := listOfNodes at:anIndex.
@@ -920,7 +931,9 @@
             self redrawLine:anIndex.
         ] ifFalse:[
             "/ with children; update list and redraw to end.
-            model updateList.
+            model removeDependent:self.
+            model recomputeList.
+            model addDependent:self.
             list := self listFromModel.
             self redrawFromLine:anIndex.
             self contentsChanged.
@@ -1121,7 +1134,9 @@
     ].
 
     rdwNd notNil ifTrue:[
-        model updateList.
+        model removeDependent:self.
+        model recomputeList.
+        model addDependent:self.
         list := self listFromModel.
         self redrawFromLine:(self indexOfNode:rdwNd).
         self contentsChanged.
@@ -1285,7 +1300,9 @@
                 self redrawLine:index.
             ] ifFalse:[
                 "/ with children; update list and redraw to end.
-                model updateList.
+                model removeDependent:self.
+                model recomputeList.
+                model addDependent:self.
                 list := self listFromModel.
                 self redrawFromLine:index.
                 self contentsChanged.
@@ -1305,5 +1322,5 @@
 !SelectionInTreeView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.28 1997-10-22 13:25:22 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.29 1997-10-29 08:25:02 ca Exp $'
 ! !