#UI_ENHANCEMENT by stefan
authorStefan Vogel <sv@exept.de>
Fri, 29 Mar 2019 12:27:51 +0100
changeset 24027 e7dee6e7966c
parent 24026 1d8362c3d5ea
child 24028 cda4ff7bb993
#UI_ENHANCEMENT by stefan class: Collection added: #displayElement:on: comment/format in: #printElementsOn: #printOn: changed: #displayOn: Omit '#' in front of symbols and sub-arrays in Array print/store/displayString
Collection.st
--- a/Collection.st	Fri Mar 29 12:27:32 2019 +0100
+++ b/Collection.st	Fri Mar 29 12:27:51 2019 +0100
@@ -4658,6 +4658,15 @@
 
 !Collection methodsFor:'printing & storing'!
 
+displayElement:element on:aStream 
+   "print a representation of element on aStream.
+    Subclasses may redefine this."
+
+   element displayOn:aStream.
+
+    "Created: / 29-03-2019 / 11:04:32 / stefan"
+!
+
 displayOn:aGCOrStream
     "print a representation of the receiver on aGCOrStream for display in inspectors etc."
 
@@ -4681,31 +4690,33 @@
     total := 0.
     limit := self maxPrint.
 
-    self printElementsDo: [:element |
+    self printElementsDo:[:element |
         noneYet ifTrue:[
             noneYet := false.
         ] ifFalse:[
             aGCOrStream space
         ].
-        element displayOn:aGCOrStream.
+        self displayElement:element on:aGCOrStream.
         total := total + 1.
         (total > limit) ifTrue:[
             aGCOrStream nextPutAll:'... )'.
             ^ self
         ]
     ].
-    aGCOrStream nextPutAll:')'.
-
-    "
-     #(1 2 3 'hello' $a) asOrderedCollection displayString
+    aGCOrStream nextPut:$).
+
+    "
+     #(1 2 3 'hello' $a String) asOrderedCollection displayString
+     #(1 2 3 'hello' $a String) displayString
 
      (Dictionary new at:#hello put:'world';
                      at:#foo put:'bar'; yourself) displayString
     "
 
-    "Modified: / 20-01-1998 / 14:11:03 / stefan"
     "Modified: / 02-02-1999 / 22:39:44 / cg"
     "Modified (format): / 22-02-2017 / 16:46:32 / cg"
+    "Modified: / 29-03-2019 / 11:04:41 / stefan"
+    "Modified (format): / 29-03-2019 / 12:08:10 / stefan"
 !
 
 displayStringName
@@ -4736,8 +4747,7 @@
 printElementsOn:aStream
     "append a user readable representation of the receiver to aStream.
      The text appended is not meant to be read back for reconstruction of
-     the receiver. Also, this method limits the size of generated string.
-    "
+     the receiver. Also, this method limits the size of generated string."
 
     |limit firstOne s|
 
@@ -4798,15 +4808,15 @@
      a printOn:Transcript
     "
 
-    "Modified: / 28.1.1997 / 00:39:17 / cg"
-    "Modified: / 20.1.1998 / 14:11:03 / stefan"
+    "Modified: / 28-01-1997 / 00:39:17 / cg"
+    "Modified: / 20-01-1998 / 14:11:03 / stefan"
+    "Modified (comment): / 29-03-2019 / 11:46:31 / stefan"
 !
 
 printOn:aStream
     "append a user readable representation of the receiver to aStream.
      The text appended is not meant to be read back for reconstruction of
-     the receiver. Also, this method limits the size of generated string.
-    "
+     the receiver. Also, this method limits the size of generated string."
 
     thisContext isRecursive ifTrue:[
         'Collection [error]: printOn: of self referencing collection.' errorPrintCR.
@@ -4832,8 +4842,9 @@
      a printOn:Transcript
     "
 
-    "Modified: / 28.1.1997 / 00:39:17 / cg"
-    "Modified: / 20.1.1998 / 14:11:03 / stefan"
+    "Modified: / 28-01-1997 / 00:39:17 / cg"
+    "Modified: / 20-01-1998 / 14:11:03 / stefan"
+    "Modified (comment): / 29-03-2019 / 11:46:56 / stefan"
 !
 
 storeOn:aStream