added: #displayOn: (instead of #displaySting)
authorStefan Vogel <sv@exept.de>
Tue, 24 Apr 2012 14:00:50 +0200
changeset 14118 c4375f1867f6
parent 14117 299ac69e8f9d
child 14119 26e51066f338
added: #displayOn: (instead of #displaySting)
Association.st
--- a/Association.st	Tue Apr 24 12:33:39 2012 +0200
+++ b/Association.st	Tue Apr 24 14:00:50 2012 +0200
@@ -130,12 +130,23 @@
 
 !Association methodsFor:'printing & storing'!
 
-displayString
-    "return a string containing a printable representation
-     of the receiver for displaying - redefined to use display string on
-     the components for nicer look"
+displayOn:aGCOrStream
+    "Compatibility
+     append a printed desription on some stream (Dolphin,  Squeak)
+     OR:
+     display the receiver in a graphicsContext at 0@0 (ST80).
+     This method allows for any object to be displayed in some view
+     (although the fallBack is to display its printString ...)"
 
-    ^ key displayString , '->' , value displayString
+    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
+    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
+    (aGCOrStream isStream and:[aGCOrStream ~~ Transcript]) ifFalse:[
+        ^ super displayOn:aGCOrStream
+    ].
+
+    key displayOn:aGCOrStream.
+    aGCOrStream nextPutAll:'->'.
+    value displayOn:aGCOrStream.
 !
 
 printOn:aStream
@@ -173,9 +184,9 @@
 !Association class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Association.st,v 1.23 2009-10-06 15:16:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Association.st,v 1.24 2012-04-24 12:00:50 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Association.st,v 1.23 2009-10-06 15:16:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Association.st,v 1.24 2012-04-24 12:00:50 stefan Exp $'
 ! !