Tools__ViewTreeItem.st
changeset 2452 7892f26996b7
parent 2405 ec54aeed9a42
child 2456 3d8a5dd293ba
--- a/Tools__ViewTreeItem.st	Wed Jan 21 13:36:56 2009 +0100
+++ b/Tools__ViewTreeItem.st	Wed Jan 21 13:37:04 2009 +0100
@@ -3,7 +3,7 @@
 "{ NameSpace: Tools }"
 
 HierarchicalItem subclass:#ViewTreeItem
-	instanceVariableNames:'widget isDrawnShown exists xOffsetApplClass'
+	instanceVariableNames:'widget isDrawnShown exists xOffsetAdditionalName'
 	classVariableNames:'HandleExtent'
 	poolDictionaries:''
 	category:'A-Views-Support'
@@ -230,8 +230,17 @@
 
 !ViewTreeItem methodsFor:'displaying'!
 
+additionalLabelForItem:anItem
+    "answer an additional item for an Item or nil"
+
+    parent notNil ifTrue:[
+        ^ parent additionalLabelForItem:anItem
+    ].
+    ^ nil
+!
+
 displayOn:aGC x:x y:y h:h
-    |labelHeight paint applName|
+    |labelHeight paint additionalName|
 
     widget id isNil ifTrue:[
         isDrawnShown := false.
@@ -246,48 +255,46 @@
     labelHeight := self heightOn:aGC.
     self displayLabel:(self label) h:labelHeight on:aGC x:x y:y h:h.
 
-    xOffsetApplClass notNil ifTrue:[
-        applName := self labelOfApplicationClass.
-        applName notNil ifTrue:[
-            self displayLabel:applName
+    xOffsetAdditionalName notNil ifTrue:[
+        additionalName := self additionalLabelForItem:self.
+
+        additionalName notNil ifTrue:[
+            self displayLabel:additionalName
                             h:labelHeight on:aGC
-                            x:(x + xOffsetApplClass)
+                            x:(x + xOffsetAdditionalName)
                             y:y
                             h:h.
+        ] ifFalse:[
+            xOffsetAdditionalName := nil.
         ].
     ].
 !
 
-labelOfApplicationClass
-    "answer the name of the underlaying application or nil"
-    |applClass|
-
-    self isApplicationClass ifTrue:[
-        applClass := self applicationClass.
+recursiveAdditionalNameBehaviourChanged
+    width := xOffsetAdditionalName := nil.
 
-        applClass notNil ifTrue:[
-            ^ ('[ ', applClass name, ' ]')
-        ].
+    children notNil ifTrue:[
+        children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
     ].
-    xOffsetApplClass := nil.
-    ^ nil
 !
 
 widthOn:aGC
     "return the width of the receiver, if it is to be displayed on aGC
     "
-    |applName|
+    |additionalName|
 
     width isNil ifTrue:[
         width := self widthOf:(self label) on:aGC.
         width := width + 2.
 
-        applName := self labelOfApplicationClass.
+        additionalName := self additionalLabelForItem:self.
 
-        applName notNil ifTrue:[
-            xOffsetApplClass := width + 10.
-            width := xOffsetApplClass + (self widthOf:applName on:aGC).
+        additionalName notNil ifTrue:[
+            xOffsetAdditionalName := width + 10.
+            width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
             width := width + 2.
+        ] ifFalse:[
+            xOffsetAdditionalName := nil.
         ].
     ].
     ^ width