HierarchicalItem.st
changeset 2193 41d5d33c9f78
parent 2117 61d68e3e5bdc
child 2201 aa74fa6137a5
--- a/HierarchicalItem.st	Wed Sep 18 16:32:06 2002 +0200
+++ b/HierarchicalItem.st	Wed Sep 18 17:27:40 2002 +0200
@@ -755,6 +755,37 @@
     super changed:why with:anArgument
 !
 
+childrenOrderChanged
+    "called if the order of the children changed by a user
+     operation. Update the model and raise a change notification for
+     each item which has changed its position
+     triggered by the user operation !!
+    "
+    |model visStart list|
+
+    self isExpanded   ifFalse:[ ^ self ].       "/ not expanded
+    children size ~~ 0 ifTrue:[ ^ self ].       "/ no children
+
+    model := self model.
+    model ifNil:[^ self].                       "/ no model
+
+    visStart := model identityIndexOf:self.
+    visStart == 0 ifTrue:[^ self].              "/ not visible in the model
+
+    self criticalDo:[
+        list := OrderedCollection new.
+        self addVisibleChildrenTo:list.
+
+        list do:[:el|
+            visStart := visStart + 1.
+
+            (model at:visStart ifAbsent:el) ~~ el ifTrue:[
+                model at:visStart put:el
+            ].
+        ]
+    ].
+!
+
 fontChanged
     "called if the font has changed
     "
@@ -1722,5 +1753,5 @@
 !HierarchicalItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalItem.st,v 1.38 2002-07-05 15:39:51 tm Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalItem.st,v 1.39 2002-09-18 15:27:40 ca Exp $'
 ! !