HierarchicalFileList.st
changeset 2104 327f2f77ec12
parent 2095 46120b1fd644
child 2127 effea319e46b
--- a/HierarchicalFileList.st	Thu May 16 17:40:07 2002 +0200
+++ b/HierarchicalFileList.st	Fri May 17 07:04:08 2002 +0200
@@ -155,6 +155,29 @@
 
 ! !
 
+!HierarchicalFileList methodsFor:'private monitoring task'!
+
+monitoringCycle
+    "the block evaluated by the monitoring task; test whether directory is expanded
+     otherwise we have not to evaluate the directory contents.
+     think about remote file-systems
+    "
+    |index item|
+
+    item  := root.
+    index := showRoot ifTrue:[1] ifFalse:[0].
+
+    [item notNil] whileTrue:[
+        (item isDirectory and:[item getChildren notNil]) ifTrue:[
+            "/ children already initialized; thus we can update the contents
+            item monitoringCycle
+        ].
+        Processor yield.
+        index := index + 1.
+        item  := self at:index ifAbsent:nil.
+    ].
+! !
+
 !HierarchicalFileList methodsFor:'protocol'!
 
 childrenFor:anItem
@@ -470,6 +493,26 @@
     ^ super icon
 ! !
 
+!HierarchicalFileList::File::Directory methodsFor:'accessing-hierarchy'!
+
+expand
+    "expand children; must redefine to raise a notification
+     if children are not yet initialized and after initialization empty.
+    "
+    |notInit|
+
+    notInit := children isNil.
+    super expand.
+
+    notInit ifTrue:[
+        (children notNil and:[children isEmpty]) ifTrue:[
+            "/ no children exists
+            "/ indicator +/- has changed to unexistant
+            self changed:#redraw
+        ]
+    ].
+! !
+
 !HierarchicalFileList::File::Directory methodsFor:'queries'!
 
 hasChildren
@@ -584,5 +627,5 @@
 !HierarchicalFileList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.11 2002-04-24 11:35:01 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.12 2002-05-17 05:04:08 ca Exp $'
 ! !