icon not set to nil anymore
authorpenk
Thu, 10 Oct 2002 11:25:12 +0200
changeset 2270 59eb4948cdec
parent 2269 e250e3adfc56
child 2271 0dff1c3fa414
icon not set to nil anymore
HierarchicalFileList.st
--- a/HierarchicalFileList.st	Thu Oct 10 09:46:27 2002 +0200
+++ b/HierarchicalFileList.st	Thu Oct 10 11:25:12 2002 +0200
@@ -305,6 +305,7 @@
 !
 
 validateIcon:anIcon for:anItem
+
     ^ anIcon
 ! !
 
@@ -452,6 +453,13 @@
 "/    ^ baseName
 !
 
+changed:aParameter
+    "the item changed; raise change notification
+    "
+    aParameter == #icon ifTrue:[ icon := nil ].
+    super changed:aParameter.
+!
+
 fileName
     "returns the fileName
     "
@@ -625,6 +633,15 @@
     ^ super printString, ' for: ', self fileName asString
 ! !
 
+!HierarchicalFileList::HierarchicalFileItem methodsFor:'protocol'!
+
+flushChildren
+    "flush the children because node not visible ....
+     canbe redefined by subclass
+    "
+    children := nil.
+! !
+
 !HierarchicalFileList::HierarchicalFileItem methodsFor:'queries'!
 
 fileSize
@@ -714,6 +731,18 @@
     ^ children
 !
 
+flushChildren
+    "flush the children because node not visible ....
+    "
+    children ifNotNil:[
+        "keep hasChildren information
+        "
+        children size ~~ 0 ifTrue:[ fetchOperation := #hasChildren ]
+                          ifFalse:[ fetchOperation := #hasNoChildren ].
+        children := nil.
+    ].
+!
+
 readChildren
     "reads the list of children
     "
@@ -752,20 +781,24 @@
 !HierarchicalFileList::Directory methodsFor:'accessing-hierarchy'!
 
 collapse
-    icon := nil.
+
     super collapse.
+
+    children notNil ifTrue:[
+        children do:[:el| el flushChildren ]
+    ].
 !
 
 expand
     "expand children; must redefine to raise a notification
      if children are not yet initialized and after initialization empty.
     "
-    icon := nil.
+
     super expand.
 !
 
 recursiveCollapse
-    icon := nil.
+
     super recursiveCollapse.
 !
 
@@ -869,71 +902,6 @@
 
 !HierarchicalFileList::Directory methodsFor:'validation'!
 
-XXmonitoringCycle
-    "run monitoring cycle
-        !!!! called by the HierarchicalList only !!!!
-    "
-    |list existingNames size name modifyTime model shownNames|
-
-    modifyTime := fileName modificationTime.
-    modifyTime isNil ifTrue:[
-        ^ self    
-    ].
-
-    children ifNotNil:[
-        (modificationTime notNil and:[modifyTime <= modificationTime]) ifTrue:[
-            ^ self
-        ].
-    ].
-    icon := nil.
-    modificationTime := modifyTime.
-
-    isExpanded ifFalse:[
-        "/ collapsed; only indicator must be updated
-        fetchOperation := children := nil.
-        self changed:#redraw.
-      ^ self
-    ].
-    model := self model.
-    children ifNil:[ children := #() ].         "/ disable update during merge
-
-    size := children size.
-    fetchOperation := nil.
-
-    list := model childrenFor:self.
-
-    list size == 0 ifTrue:[
-        self removeAll.
-      ^ self
-    ].
-
-    size == 0 ifTrue:[
-        self addAll:list.
-      ^ self
-    ].
-
-
-
-
-
-    existingNames := Set new:list size.
-    list do:[:l| existingNames add:l baseName].
-    size to:1 by:-1 do:[:anIndex|                   "/ remove invisible items from tail
-        name := (children at:anIndex) baseName.
-        (existingNames includes:name) ifFalse:[
-            self removeIndex:anIndex
-        ]
-    ].
-
-    shownNames := Set new:children size.
-    children do:[:l| shownNames add:l baseName].
-    list keysAndValuesDo:[:anIndex :anItem|         "/ add new visible items
-        (shownNames includes:anItem baseName) ifFalse:[
-            self add:anItem beforeIndex:anIndex
-        ]
-    ].
-!
-
 invalidateRepairNow:doRepair
     "invalidate contents
     "
@@ -986,7 +954,6 @@
             ^ self
         ].
     ].
-    icon := nil.
 
     isExpanded ifFalse:[
         timeChanged ifTrue:[
@@ -1070,5 +1037,5 @@
 !HierarchicalFileList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.25 2002-10-10 07:33:05 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.26 2002-10-10 09:25:12 penk Exp $'
 ! !