MultiColListEntry.st
changeset 5982 99f5b623447c
parent 5928 eb91807871fa
child 6102 a8ddd21314c4
--- a/MultiColListEntry.st	Thu Dec 27 16:33:47 2018 +0100
+++ b/MultiColListEntry.st	Thu Dec 27 22:27:01 2018 +0100
@@ -406,23 +406,27 @@
     |idx e|
 
     e := self new.
-    idx := 1.
-    aCollectionOfStrings do:[:sub |
-        e colAt:idx put:sub.
-        idx := idx + 1.
-    ].
+    e strings:aCollectionOfStrings.
+"/    idx := 1.
+"/    aCollectionOfStrings do:[:sub |
+"/        e colAt:idx put:sub.
+"/        idx := idx + 1.
+"/    ].
     ^ e
 
     "
      self fromStrings:#('hello' 'world')
     "
+
+    "Modified: / 27-12-2018 / 22:26:46 / Claus Gittinger"
 !
 
 fromStrings:aCollectionOfStrings tabulatorSpecification:aTabSpec
     "create and return a new listEntry with columns taken
      from the given aStrings."
 
-    ^ (self fromStrings:aCollectionOfStrings) tabulatorSpecification:aTabSpec
+    ^ (self fromStrings:aCollectionOfStrings) 
+        tabulatorSpecification:aTabSpec
 
     "
      |tabSpec|
@@ -434,6 +438,8 @@
 
      self fromStrings:#('hello' 'world') tabulatorSpecification:tabSpec
     "
+
+    "Modified (format): / 27-12-2018 / 22:26:56 / Claus Gittinger"
 !
 
 new:numberOfColumns
@@ -442,12 +448,22 @@
     |e|
 
     e := self new.
-    1 to:numberOfColumns do:[:i |
-        e colAt:i put:''.
-    ].
+    e strings:(Array new:numberOfColumns withAll:'').
+"/    1 to:numberOfColumns do:[:i |
+"/        e colAt:i put:''.
+"/    ].
     ^ e
 
-    "Modified: 30.8.1995 / 16:33:53 / claus"
+    "
+     |e|
+
+     e := self new:10.
+     e colAt:11 put:'abc'.
+     e
+    "
+
+    "Modified: / 30-08-1995 / 16:33:53 / claus"
+    "Modified: / 27-12-2018 / 22:28:24 / Claus Gittinger"
 !
 
 new:numberOfColumns tabulatorSpecification:aTabSpec
@@ -472,10 +488,16 @@
     "replace the substring at column index"
 
     strings isNil ifTrue:[
-        strings := OrderedCollection new:index
-    ].
-    strings ensureSizeAtLeast:index.
+        strings := OrderedCollection newWithSize:index
+    ] ifFalse:[
+        strings size < index ifTrue:[
+            strings := strings asOrderedCollection.
+            strings ensureSizeAtLeast:index.
+        ].
+    ].        
     strings at:index put:aString
+
+    "Modified: / 27-12-2018 / 22:17:13 / Claus Gittinger"
 !
 
 strings