MultiColListEntry.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Jun 2019 09:21:50 +0200
changeset 6078 08c9e2a47dc5
parent 5982 99f5b623447c
child 6102 a8ddd21314c4
permissions -rw-r--r--
#OTHER by cg self class name -> self className
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5928
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
     1
"{ Encoding: utf8 }"
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
     2
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     3
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     4
 COPYRIGHT (c) 1994 by Claus Gittinger
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     5
	      All Rights Reserved
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     6
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     7
 This software is furnished under a license and may be used
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     8
 only in accordance with the terms of that license and with the
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    10
 be provided or otherwise made available to, or used by, any
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    11
 other person.  No title to or ownership of the software is
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    12
 hereby transferred.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    13
"
4766
e2217ad4d57d class: MultiColListEntry
Claus Gittinger <cg@exept.de>
parents: 2925
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    15
4766
e2217ad4d57d class: MultiColListEntry
Claus Gittinger <cg@exept.de>
parents: 2925
diff changeset
    16
"{ NameSpace: Smalltalk }"
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    17
58
claus
parents: 36
diff changeset
    18
ListEntry subclass:#MultiColListEntry
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    19
	instanceVariableNames:'strings tabSpec'
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    20
	classVariableNames:'DefaultTabSpec'
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    21
	poolDictionaries:''
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    22
	category:'Views-Support'
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    23
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    24
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    25
!MultiColListEntry class methodsFor:'documentation'!
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    26
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    27
copyright
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    28
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    29
 COPYRIGHT (c) 1994 by Claus Gittinger
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    30
	      All Rights Reserved
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    31
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    32
 This software is furnished under a license and may be used
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    33
 only in accordance with the terms of that license and with the
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    35
 be provided or otherwise made available to, or used by, any
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    36
 other person.  No title to or ownership of the software is
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    37
 hereby transferred.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    38
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    39
!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    40
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    41
documentation
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    42
"
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    43
    Instances of MultiColListEntry can be used in place of strings
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    44
    as entries of the list in a ListView or SelectionInListView.
34
159147b254e1 *** empty log message ***
claus
parents: 25
diff changeset
    45
    They allow data to be presented in table (or any other) form.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    46
    See example here and in TabulatorSpecs documentation.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    47
    Notice, that each entry can have its own tabulator specification;
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    48
    although, usually all share a single spec.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    49
    Also, notice that each column may align different; making these
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    50
    perfect elements to present table data.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    51
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    52
    MultiColListEntry and TabulatorSpec were originally created to
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    53
    support nice tabular display of file-lists in the FileBrowser
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    54
    (see its long list); you may find many other uses ...
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    55
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    56
    [author:]
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    57
        Claus Gittinger
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    58
"
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    59
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    60
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    61
examples
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    62
"
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    63
     putting multiColListEntries into a ListView (instead of strings)
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    64
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    65
        |v e myList tabs|
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    66
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    67
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    68
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    69
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    70
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    71
        tabs positions:#(0 3 4).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    72
        tabs align:#(left #center #left).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    73
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    74
        e := MultiColListEntry fromString:'left centered left'.
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    75
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    76
        myList add:e.
58
claus
parents: 36
diff changeset
    77
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    78
        e := MultiColListEntry fromString:'| | |'.
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    79
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    80
        myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    81
        myList add:''.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    82
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    83
        e := MultiColListEntry fromString:'hello hallo salut'.
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    84
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    85
        myList add:e.
58
claus
parents: 36
diff changeset
    86
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    87
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    88
                 fromString:'good morning,guten Morgen,bon jour'
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    89
                 separatedBy:$,.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    90
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    91
        myList add:e.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    92
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    93
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    94
        e colAt:1 put:'good bye'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    95
        e colAt:2 put:'auf Wiedersehen'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    96
        e colAt:3 put:'au revoir '.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    97
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    98
        myList add:e.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    99
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   100
        v := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   101
        v setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   102
        v extent:500@100.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   103
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   104
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   105
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   106
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   107
58
claus
parents: 36
diff changeset
   108
     many multiColListEntries in a scrollable ListView
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   109
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   110
        |v l e myList tabs|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   111
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   112
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   113
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   114
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   115
        tabs unit:#cm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   116
        tabs positions:#(1 3 5).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   117
        tabs align:#(#right #center #left).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   118
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   119
        1 to:100 do:[:i|
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   120
            e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   121
            e colAt:1 put:i printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   122
            e colAt:2 put:i squared printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   123
            e colAt:3 put:i sqrt  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   124
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   125
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   126
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   127
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   128
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   129
        v := ScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   130
        v extent:300@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   131
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   132
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   133
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   134
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   135
58
claus
parents: 36
diff changeset
   136
     like above, but uses nicer decimal alignments
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   137
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   138
        |v l e myList tabs|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   139
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   140
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   141
        
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   142
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   143
        tabs unit:#cm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   144
        tabs positions:#(1 3 6 9 12).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   145
        tabs align:#(#right #decimal #decimal #decimal #decimal).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   146
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   147
        1 to:100 do:[:i|
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   148
            e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   149
            e colAt:1 put:i printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   150
            e colAt:2 put:i log printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   151
            e colAt:3 put:i sqrt  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   152
            e colAt:4 put:i sin  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   153
            e colAt:5 put:i cos  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   154
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   155
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   156
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   157
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   158
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   159
        v := ScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   160
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   161
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   162
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   163
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   164
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   165
58
claus
parents: 36
diff changeset
   166
     specifying tabs in inches
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   167
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   168
        |v l e myList tabs|
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   169
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   170
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   171
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   172
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   173
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   174
        tabs positions:#(0 2 3.5 4 6 8 10 12).
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   175
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   176
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   177
        e colAt:1 put:'2'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   178
        e colAt:2 put:'3.5'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   179
        e colAt:3 put:'4'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   180
        e colAt:4 put:'6'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   181
        e colAt:5 put:'8'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   182
        e colAt:6 put:'10'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   183
        e colAt:7 put:'12'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   184
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   185
        myList add:e.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   186
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   187
        myList add:((MultiColListEntry fromString:'| | | | | | |')
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   188
                         tabulatorSpecification:tabs).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   189
        myList add:((MultiColListEntry fromString:'xxx xxx xxx xxx xxx xxx xxx')
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   190
                         tabulatorSpecification:tabs).
58
claus
parents: 36
diff changeset
   191
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   192
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   193
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   194
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   195
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   196
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   197
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   198
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   199
58
claus
parents: 36
diff changeset
   200
     if you have the columns available as a collection, 
claus
parents: 36
diff changeset
   201
     setup can be done easier
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   202
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   203
        |v l e myList tabs|
58
claus
parents: 36
diff changeset
   204
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   205
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   206
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   207
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   208
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   209
        tabs positions:#(0 2 3.5 4 6 8 10 12).
58
claus
parents: 36
diff changeset
   210
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   211
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   212
        e strings:#('2' '3.5' '4' '6' '8' '10' '12').
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   213
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   214
        myList add:e.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   215
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   216
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   217
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   218
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   219
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   220
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   221
                                                                        [exEnd]
58
claus
parents: 36
diff changeset
   222
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   223
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   224
     using icons instead of strings:
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   225
                                                                        [exBegin]
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   226
        |v l e myList tabs i1 i2 i3|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   227
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   228
        myList := OrderedCollection new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   229
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   230
        tabs := TabulatorSpecification new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   231
        tabs unit:#cm.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   232
        tabs positions:#(1 3 5).
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   233
        tabs align:#(#left #left #left).
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   234
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   235
        i1 := Image fromFile:'bitmaps/xpmBitmaps/document_images/small_dir.xpm'.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   236
        i2 := Image fromFile:'bitmaps/xpmBitmaps/document_images/small_file.xpm'.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   237
        i3 := Image fromFile:'bitmaps/xpmBitmaps/document_images/small_file_binary.xpm'.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   238
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   239
        1 to:100 do:[:i|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   240
            e := MultiColListEntry new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   241
            i odd ifTrue:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   242
                e colAt:1 put:i1.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   243
            ] ifFalse:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   244
                e colAt:1 put:i2
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   245
            ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   246
            e colAt:2 put:i printString.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   247
            e colAt:3 put:i3.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   248
            e tabulatorSpecification:tabs.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   249
            myList add:e.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   250
        ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   251
        l := SelectionInListView new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   252
        l setList:myList expandTabs:false.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   253
        v := ScrollableView forView:l.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   254
        v extent:300@200.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   255
        v open
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   256
                                                                        [exEnd]
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   257
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   258
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   259
58
claus
parents: 36
diff changeset
   260
    concrete example, show /etc/passwd in a table:
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   261
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   262
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   263
        |v l s myList line e htabs tabs fingerEntry|
58
claus
parents: 36
diff changeset
   264
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   265
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   266
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   267
        tabs positions:#(0    2      3.5  4.5   5    8    11).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   268
        tabs align:    #(left left right right left left left).
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   269
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   270
        htabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   271
        htabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   272
        htabs positions:#(0    2      3.5      4.5    5    8    11).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   273
        htabs align:    #(left center center center left left left).
58
claus
parents: 36
diff changeset
   274
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   275
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   276
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   277
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   278
                    fromString:'login-name:password:uid:gid:finger-entry:home-dir:shell' 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   279
                    separatedBy:$:.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   280
        e tabulatorSpecification:htabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   281
        myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   282
        myList add:''.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   283
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   284
        s := '/etc/passwd' asFilename readStream.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   285
        [s atEnd] whileFalse:[
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   286
            line := s nextLine.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   287
            e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   288
                        fromString:line
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   289
                        separatedBy:$:.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   290
            fingerEntry := e colAt:5.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   291
            e colAt:5 put:(fingerEntry asCollectionOfSubstringsSeparatedBy:$,) first.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   292
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   293
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   294
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   295
        s close.
58
claus
parents: 36
diff changeset
   296
        
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   297
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   298
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   299
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   300
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   301
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   302
                                                                        [exEnd]
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   303
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   304
    a (dynamic) menu with aligned columns:
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   305
                                                                        [exBegin]
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   306
    |menu item l tabSpec n1 n2 n3 n4|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   307
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   308
    menu := Menu new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   309
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   310
    tabSpec := TabulatorSpecification new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   311
    tabSpec unit:#inch.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   312
    tabSpec positions:#(0     1.5     ).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   313
    tabSpec align:    #(#left #right).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   314
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   315
    n1 := 123456.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   316
    n2 := 123.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   317
    n3 := 11111.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   318
    n4 := 9876.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   319
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   320
    l := MultiColListEntry fromStrings:#('N1:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   321
    l colAt:2 put:n1 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   322
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   323
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   324
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   325
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   326
    l := MultiColListEntry fromStrings:#('N2:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   327
    l colAt:2 put:n2 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   328
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   329
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   330
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   331
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   332
    l := MultiColListEntry fromStrings:#('N3:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   333
    l colAt:2 put:n3 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   334
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   335
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   336
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   337
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   338
    l := MultiColListEntry fromStrings:#('N4:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   339
    l colAt:2 put:n4 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   340
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   341
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   342
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   343
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   344
    menu showAtPointer.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   345
                                                                        [exEnd]
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   346
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   347
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   348
! !
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   349
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   350
!MultiColListEntry class methodsFor:'instance creation'!
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   351
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   352
fromString:aString
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   353
    "create and return a new listEntry with columns taken
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   354
     from the words of aString. Assumes that columns are
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   355
     separated by spaces in the string"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   356
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   357
    ^ self fromString:aString separatedBy:(Character space)
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   358
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   359
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   360
     self fromString:'hello world a b' 
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   361
    "
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   362
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   363
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   364
fromString:aString separatedBy:separatorCharacter
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   365
    "create and return a new listEntry with columns taken
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   366
     from the words of aString. Assumes that columns are
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   367
     separated by separatorCharacter in the string"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   368
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   369
    |subStrings|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   370
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   371
    subStrings := aString asCollectionOfSubstringsSeparatedBy:separatorCharacter.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   372
    ^ self fromStrings:subStrings
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   373
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   374
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   375
     self fromString:'hello:world:a:b' separatedBy:$:
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   376
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   377
!
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   378
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   379
fromString:aString separatedBy:separatorCharacter tabulatorSpecification:aTabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   380
    "create and return a new listEntry with columns taken
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   381
     from the words of aString. Assumes that columns are
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   382
     separated by separatorCharacter in the string"
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   383
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   384
    |e|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   385
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   386
    e := self fromString:aString separatedBy:separatorCharacter.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   387
    e tabulatorSpecification:aTabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   388
    ^ e
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   389
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   390
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   391
     |tabSpec|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   392
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   393
     tabSpec := TabulatorSpecification new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   394
     tabSpec unit:#inch.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   395
     tabSpec positions:#(0     1.5     ).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   396
     tabSpec align:    #(#left #right).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   397
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   398
     self fromString:'hello world a b' separatedBy:(Character space) tabulatorSpecification:tabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   399
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   400
!
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   401
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   402
fromStrings:aCollectionOfStrings
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   403
    "create and return a new listEntry with columns taken
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   404
     from the given aStrings."
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   405
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   406
    |idx e|
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   407
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   408
    e := self new.
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   409
    e strings:aCollectionOfStrings.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   410
"/    idx := 1.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   411
"/    aCollectionOfStrings do:[:sub |
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   412
"/        e colAt:idx put:sub.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   413
"/        idx := idx + 1.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   414
"/    ].
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   415
    ^ e
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   416
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   417
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   418
     self fromStrings:#('hello' 'world')
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   419
    "
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   420
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   421
    "Modified: / 27-12-2018 / 22:26:46 / Claus Gittinger"
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   422
!
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   423
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   424
fromStrings:aCollectionOfStrings tabulatorSpecification:aTabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   425
    "create and return a new listEntry with columns taken
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   426
     from the given aStrings."
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   427
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   428
    ^ (self fromStrings:aCollectionOfStrings) 
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   429
        tabulatorSpecification:aTabSpec
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   430
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   431
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   432
     |tabSpec|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   433
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   434
     tabSpec := TabulatorSpecification new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   435
     tabSpec unit:#inch.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   436
     tabSpec positions:#(0     1.5     ).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   437
     tabSpec align:    #(#left #right).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   438
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   439
     self fromStrings:#('hello' 'world') tabulatorSpecification:tabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   440
    "
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   441
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   442
    "Modified (format): / 27-12-2018 / 22:26:56 / Claus Gittinger"
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   443
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   444
70
claus
parents: 62
diff changeset
   445
new:numberOfColumns
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   446
    "create and return a new listEntry with numberOfColumns empty columns"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   447
70
claus
parents: 62
diff changeset
   448
    |e|
claus
parents: 62
diff changeset
   449
claus
parents: 62
diff changeset
   450
    e := self new.
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   451
    e strings:(Array new:numberOfColumns withAll:'').
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   452
"/    1 to:numberOfColumns do:[:i |
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   453
"/        e colAt:i put:''.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   454
"/    ].
70
claus
parents: 62
diff changeset
   455
    ^ e
claus
parents: 62
diff changeset
   456
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   457
    "
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   458
     |e|
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   459
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   460
     e := self new:10.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   461
     e colAt:11 put:'abc'.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   462
     e
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   463
    "
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   464
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   465
    "Modified: / 30-08-1995 / 16:33:53 / claus"
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   466
    "Modified: / 27-12-2018 / 22:28:24 / Claus Gittinger"
70
claus
parents: 62
diff changeset
   467
!
claus
parents: 62
diff changeset
   468
claus
parents: 62
diff changeset
   469
new:numberOfColumns tabulatorSpecification:aTabSpec
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   470
    "create and return a new listEntry with numberOfColumns empty columns
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   471
     and the given tab-specification"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   472
70
claus
parents: 62
diff changeset
   473
    ^ (self new:numberOfColumns) tabulatorSpecification:aTabSpec
claus
parents: 62
diff changeset
   474
claus
parents: 62
diff changeset
   475
    "Modified: 30.8.1995 / 16:34:23 / claus"
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   476
! !
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   477
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   478
!MultiColListEntry methodsFor:'accessing'!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   479
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   480
colAt:index
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   481
    "return the substring at column index"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   482
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   483
    index > strings size ifTrue:[^ nil].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   484
    ^ strings at:index
70
claus
parents: 62
diff changeset
   485
!
claus
parents: 62
diff changeset
   486
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   487
colAt:index put:aString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   488
    "replace the substring at column index"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   489
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   490
    strings isNil ifTrue:[
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   491
        strings := OrderedCollection newWithSize:index
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   492
    ] ifFalse:[
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   493
        strings size < index ifTrue:[
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   494
            strings := strings asOrderedCollection.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   495
            strings ensureSizeAtLeast:index.
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   496
        ].
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   497
    ].        
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   498
    strings at:index put:aString
5982
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   499
99f5b623447c #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
   500
    "Modified: / 27-12-2018 / 22:17:13 / Claus Gittinger"
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   501
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   502
5928
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   503
strings
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   504
    "return all substrings"
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   505
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   506
    ^ strings
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   507
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   508
    "Created: / 27-10-2018 / 10:06:29 / Claus Gittinger"
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   509
!
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   510
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   511
strings:aCollectionOfStrings
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   512
    "replace all substrings"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   513
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   514
    strings := OrderedCollection withAll:aCollectionOfStrings. 
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   515
!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   516
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   517
tabulatorSpecification:aTabSpec
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   518
    "set the tabulator spec"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   519
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   520
    tabSpec := aTabSpec
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   521
! !
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   522
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   523
!MultiColListEntry methodsFor:'converting'!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   524
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   525
asString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   526
    "return the receiver as a string with embedded tabs"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   527
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   528
    |s sub tab 
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   529
     nSub "{ Class: SmallInteger }"|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   530
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   531
    s := ''.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   532
    tab := Character tab asString.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   533
    nSub := strings size.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   534
    1 to:nSub do:[:subStringIndex |
363
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   535
        sub := strings at:subStringIndex.
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   536
        sub notNil ifTrue:[
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   537
            sub isString ifTrue:[
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   538
                s := s , sub.
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   539
            ]
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   540
        ].
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   541
        subStringIndex == nSub ifFalse:[
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   542
            s := s , tab
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   543
        ]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   544
    ].
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   545
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   546
    ^ s
103
f950776fd4e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   547
f950776fd4e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   548
    "Created: 24.11.1995 / 18:54:27 / cg"
363
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   549
    "Modified: 17.4.1997 / 03:21:13 / cg"
5928
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   550
!
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   551
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   552
withoutAnyColorEmphasis
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   553
    ^ self shallowCopy strings:(strings collect:[:each | each withoutAnyColorEmphasis]).
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   554
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   555
    "Created: / 27-10-2018 / 10:10:16 / Claus Gittinger"
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   556
! !
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   557
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   558
!MultiColListEntry methodsFor:'defaults'!
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   559
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   560
defaultTabSpec
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   561
    "the default tabulators are 1 inch apart"
2925
359505806538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   562
    
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   563
    |spec|
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   564
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   565
    spec := DefaultTabSpec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   566
    spec isNil ifTrue:[
2925
359505806538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   567
        spec := TabulatorSpecification new.
359505806538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   568
        spec unit:#inch.
359505806538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   569
        spec positions:(0 to:20).
359505806538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   570
        spec align:#left.
359505806538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   571
        DefaultTabSpec := spec.
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   572
    ].
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   573
    ^ spec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   574
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   575
    "Created: 17.11.1995 / 12:23:29 / cg"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   576
    "Modified: 17.11.1995 / 12:24:20 / cg"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   577
! !
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   578
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   579
!MultiColListEntry methodsFor:'drawing'!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   580
108
b228b94be590 displayOpaque fixes
Claus Gittinger <cg@exept.de>
parents: 103
diff changeset
   581
displayOn:aGC x:x y:y opaque:opaque
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   582
    "display the receiver on a GC"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   583
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   584
    |xPos spec tabPos prevString y0|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   585
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   586
    spec := tabSpec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   587
    spec isNil ifTrue:[
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   588
        spec := self defaultTabSpec
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   589
    ].
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   590
    xPos := x.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   591
    prevString := ''.
364
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   592
5207
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   593
    aGC font:aGC deviceFont.
366
34e1870524f1 fetch device font before querying
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   594
34e1870524f1 fetch device font before querying
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   595
    y0 := y - aGC font ascent.
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   596
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   597
    strings keysAndValuesDo:[:index :subString |
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   598
        |item|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   599
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   600
        subString notNil ifTrue:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   601
            "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   602
             find next tab
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   603
            "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   604
            tabPos := spec positionOfTab:index forString:subString on:aGC.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   605
            tabPos isNil ifTrue:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   606
                "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   607
                 no tab - just continue where we are ...
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   608
                "
2098
d59707230877 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   609
                xPos := xPos + (prevString widthOn:aGC). "/ not: (aGC font widthOf:prevString) -- could be text or image
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   610
            ] ifFalse:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   611
                xPos := tabPos + x.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   612
            ].
5207
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   613
            subString isString ifTrue:[
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   614
                opaque ifTrue:[    
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   615
                    aGC displayOpaqueString:subString x:xPos y:y.
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   616
                ] ifFalse:[    
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   617
                    aGC displayString:subString x:xPos y:y.
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   618
                ].    
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   619
            ] ifFalse:[
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   620
                item := subString.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   621
                item isImage ifTrue:[
2098
d59707230877 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   622
                    strings at:index put:(item := item onDevice:aGC device)
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   623
                ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   624
                item displayOn:aGC x:xPos y:y0
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   625
            ].
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   626
            prevString := subString.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   627
        ]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   628
    ].
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   629
366
34e1870524f1 fetch device font before querying
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   630
    "Modified: 19.4.1997 / 09:54:56 / cg"
58
claus
parents: 36
diff changeset
   631
! !
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   632
58
claus
parents: 36
diff changeset
   633
!MultiColListEntry methodsFor:'queries'!
claus
parents: 36
diff changeset
   634
5928
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   635
hasChangeOfEmphasis
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   636
    "return true, if the receiver contains non-empty emphasis information
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   637
     i.e. any non-normal (=emphasized) characters"
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   638
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   639
    ^ strings contains:#hasChangeOfEmphasis
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   640
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   641
    "Created: / 27-10-2018 / 09:52:51 / Claus Gittinger"
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   642
!
eb91807871fa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
   643
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   644
heightOn:aGC
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   645
    "return the height of the receiver when displayed in aGC"
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   646
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   647
    |hMax|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   648
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   649
    hMax := 0.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   650
    strings keysAndValuesDo:[:index :subString |
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   651
        |h|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   652
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   653
        subString notNil ifTrue:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   654
            h := subString heightOn:aGC.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   655
            hMax := hMax max:h.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   656
        ]
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   657
    ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   658
    ^ hMax
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   659
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   660
    "Created: 15.4.1997 / 09:39:07 / cg"
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   661
!
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   662
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   663
widthOn:aGC
58
claus
parents: 36
diff changeset
   664
    "return the width of the receiver when displayed in aGC"
claus
parents: 36
diff changeset
   665
62
claus
parents: 58
diff changeset
   666
    |xPos xMax tabPos prevLen|
58
claus
parents: 36
diff changeset
   667
claus
parents: 36
diff changeset
   668
    "just to make certain:
claus
parents: 36
diff changeset
   669
     do not assume, that the last col is the rightmost one ...
claus
parents: 36
diff changeset
   670
    "
claus
parents: 36
diff changeset
   671
    xPos := 0.
claus
parents: 36
diff changeset
   672
    xMax := 0.
claus
parents: 36
diff changeset
   673
    prevLen := 0.
claus
parents: 36
diff changeset
   674
    strings keysAndValuesDo:[:index :subString |
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   675
        |w|
62
claus
parents: 58
diff changeset
   676
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   677
        subString notNil ifTrue:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   678
            "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   679
             find next tab
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   680
            "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   681
            tabPos := tabSpec positionOfTab:index forString:subString on:aGC.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   682
            tabPos isNil ifTrue:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   683
                "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   684
                 no tab - just continue where we are ...
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   685
                "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   686
                xPos := xPos + prevLen.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   687
            ] ifFalse:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   688
                xPos := tabPos.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   689
            ].
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   690
            w := prevLen := subString widthOn:aGC. "/ aGC font widthOf:subString.
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   691
            xMax := xMax max:(xPos + w).
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   692
        ]
58
claus
parents: 36
diff changeset
   693
    ].
364
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   694
    xMax isInteger ifFalse:[
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   695
        ^ xMax truncated + 1
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   696
    ].
58
claus
parents: 36
diff changeset
   697
    ^ xMax
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   698
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   699
    "Created: 12.5.1996 / 20:38:38 / cg"
364
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   700
    "Modified: 17.4.1997 / 12:52:00 / cg"
58
claus
parents: 36
diff changeset
   701
! !
claus
parents: 36
diff changeset
   702
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   703
!MultiColListEntry class methodsFor:'documentation'!
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   704
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   705
version
5207
3979ce45f940 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4766
diff changeset
   706
    ^ '$Header$'
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   707
! !
4766
e2217ad4d57d class: MultiColListEntry
Claus Gittinger <cg@exept.de>
parents: 2925
diff changeset
   708