HierarchicalListView.st
changeset 2595 1ab5dc7d4796
parent 2554 0df306e11170
child 2606 009fbaa4e199
--- a/HierarchicalListView.st	Thu Dec 18 16:13:09 2003 +0100
+++ b/HierarchicalListView.st	Fri Dec 19 09:41:11 2003 +0100
@@ -341,31 +341,31 @@
     "test whether the list is not a hierarchical item and
      retrieve the showRoot attribute from the list
     "
-    |newList|
-
-    newList := aList.
-
     aList notNil ifTrue:[
         aList isHierarchicalItem ifTrue:[
-            list notNil ifTrue:[
-                list root:aList.
-                ^ self
-            ].
-            newList := HierarchicalList new.
-            newList showRoot:showRoot.
-            newList root:aList.
+            self list root:aList.
             aList expand.
+            ^ self
         ].
-        showRoot := newList showRoot.
+        showRoot := aList showRoot.
     ].
-    super list:newList
+    super list:aList
+!
+
+newDefaultList
+    "creates and returns a new default list class, on default a HierarchicalList
+    "
+    |list|
+
+    list := HierarchicalList new.
+    list showRoot:(showRoot ? true).
+    ^ list
 !
 
 root
     "returns the anchor of the list or nil
     "
-    list notNil ifTrue:[ ^ list root ].
-    ^ nil
+    ^ self list root
 ! !
 
 !HierarchicalListView methodsFor:'accessing-behavior'!
@@ -571,10 +571,7 @@
     "
     showRoot ~~ aBoolean ifTrue:[
         showRoot := aBoolean.
-
-        list notNil ifTrue:[
-            list showRoot:aBoolean.
-        ].
+        self list showRoot:showRoot.
         shown ifTrue:[ self invalidate ]
     ].
 !
@@ -814,7 +811,7 @@
 update:what with:aPara from:chgObj
     "get the status of <showRoot> from the list
     "
-    chgObj == list ifTrue:[
+    chgObj == self list ifTrue:[
         showRoot ~~ chgObj showRoot ifTrue:[
             showRoot := chgObj showRoot.
             self invalidate.
@@ -1077,8 +1074,8 @@
 
     maxLevel := 1.
 
-    list criticalDo:[
-        list do:[:el| maxLevel := maxLevel max:(el level) ].
+    self list criticalDo:[
+        self list do:[:el| maxLevel := maxLevel max:(el level) ].
     ].
 
     needMore        := (width - imageWidth) max:2.
@@ -1595,5 +1592,5 @@
 !HierarchicalListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.86 2003-08-19 08:34:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.87 2003-12-19 08:41:04 ca Exp $'
 ! !