TreeItem.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 10:54:35 +0200
changeset 5816 7876c07931a7
parent 5635 4fe9214fa41f
child 6079 c61b633da982
permissions -rw-r--r--
#DOCUMENTATION by cg class: ComboListView class comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     1
"
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     3
              All Rights Reserved
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     4
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    11
"
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
    13
5233
011a234e6095 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
    14
"{ NameSpace: Smalltalk }"
011a234e6095 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
    15
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    16
Object subclass:#TreeItem
795
d36f94d682bf #changed: bug fixed
tz
parents: 786
diff changeset
    17
	instanceVariableNames:'name tree parent children contents hide readChildren'
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    18
	classVariableNames:'UnknownContents'
795
d36f94d682bf #changed: bug fixed
tz
parents: 786
diff changeset
    19
	poolDictionaries:''
d36f94d682bf #changed: bug fixed
tz
parents: 786
diff changeset
    20
	category:'Interface-Support'
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    21
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    22
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    23
!TreeItem class methodsFor:'documentation'!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    24
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    25
copyright
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    26
"
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    27
 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    28
              All Rights Reserved
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    29
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    30
 This software is furnished under a license and may be used
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    35
 hereby transferred.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    36
"
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    37
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    38
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    39
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    40
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    41
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    42
documentation
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    43
"
5458
49d0d417a87b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 5450
diff changeset
    44
    THIS CLASS HAS BEEN OBSOLETED by HierarchicalItem with its corresponding
49d0d417a87b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 5450
diff changeset
    45
    view class HierarchicalListView. Please use these new ones.
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    46
5458
49d0d417a87b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 5450
diff changeset
    47
    Class to build up tree-like structures to represent file-trees, class tress etc.
49d0d417a87b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 5450
diff changeset
    48
    Especially suited for use with (also now obsolete) SelectionInTree and SelectionInTreeView.
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    49
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    50
    [Author:]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    51
        W. Olberding
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    52
        Claus Atzkern
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    53
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    54
    [See also:]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    55
        SelectionInTree
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    56
        SelectionInTreeView
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    57
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    58
"
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    59
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    60
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    61
!TreeItem class methodsFor:'instance creation'!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    62
768
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    63
contents:aContents
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    64
    |node|
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    65
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    66
    node := self new.
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    67
    node contents:aContents.
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    68
  ^ node
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    69
!
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
    70
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    71
name:aName
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    72
    ^ self name:aName contents:nil
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    73
!
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    74
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    75
name:aName contents:aContents
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    76
    |node|
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    77
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    78
    node := self new.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    79
    node name:aName.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    80
    node contents:aContents.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    81
  ^ node
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    82
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    83
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    84
name:aName value:aContents
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    85
    ^ self name:aName contents:aContents
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    86
!
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
    87
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    88
new
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    89
    ^ self basicNew initialize
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    90
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
    91
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    92
!TreeItem class methodsFor:'class initialization'!
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    93
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    94
initialize
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    95
    UnknownContents isNil ifTrue:[
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    96
        UnknownContents := Object new.
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    97
    ]
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    98
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
    99
    "
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   100
     self initialize
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   101
    "
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   102
! !
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   103
786
ca
parents: 784
diff changeset
   104
!TreeItem class methodsFor:'default icons'!
ca
parents: 784
diff changeset
   105
ca
parents: 784
diff changeset
   106
keysAndIcons
ca
parents: 784
diff changeset
   107
    "returns an IdentityDictionary containing a list of images and keys used
ca
parents: 784
diff changeset
   108
     by any file entry; could be redefined by subclass
ca
parents: 784
diff changeset
   109
    "
ca
parents: 784
diff changeset
   110
    ^ nil
ca
parents: 784
diff changeset
   111
ca
parents: 784
diff changeset
   112
! !
ca
parents: 784
diff changeset
   113
2512
c7087ddb4508 category
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   114
!TreeItem class methodsFor:'example-instance creation'!
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   115
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   116
newAsTreeFromNestedList:aListOfElementsOrSublists named:name
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   117
    "create a tree of nodes with fix elements from aListOfElementsOrSublists.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   118
     The tree will contain leafs for any non-collection elements in aListOfElementsOrSublists,
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   119
     and sub-trees for 2-element array-elements.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   120
     Useful to be shown in long selection lists, if some grouping is possible"
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   121
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   122
    |newInst|
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   123
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   124
    newInst := self new.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   125
    newInst name:name.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   126
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   127
    aListOfElementsOrSublists do:[:each |
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   128
        each isArray ifTrue:[
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   129
            newInst add:(self newAsTreeFromNestedList:each second named:each first)
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   130
        ] ifFalse:[    
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   131
            newInst add:(self new name:each)
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   132
        ]
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   133
    ].
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   134
    ^ newInst
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   135
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   136
    "
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   137
      |top model sel root|
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   138
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   139
      root  := TreeItem 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   140
                newAsTreeFromNestedList:
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   141
                    #(
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   142
                        'one-1'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   143
                        'two-1'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   144
                        ('three...' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   145
                            ('three-1'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   146
                             'three-2'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   147
                             'three-3'))
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   148
                        'four-1'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   149
                        ('five...' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   150
                            ('five-1'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   151
                             'five-2'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   152
                             'five-3'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   153
                             'five-4'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   154
                             'five-5'))
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   155
                        ('six...' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   156
                            ('six-1' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   157
                             'six-2' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   158
                             ('six-3...' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   159
                                ('six-3-1' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   160
                                 'six-3-2'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   161
                                 'six-3-3'))
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   162
                             'six-4'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   163
                             ('six-5...'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   164
                                ('six-5-1' 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   165
                                 'five-5-2'))
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   166
                             ) 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   167
                        )    
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   168
                        'seven-1'
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   169
                    ).
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   170
      root expand.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   171
      model := SelectionInTree new root:root.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   172
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   173
      top := StandardSystemView new.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   174
      top extent:300@300.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   175
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   176
      sel := SelectionInTreeView new.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   177
      sel showDirectoryIndicator:true.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   178
      sel showRoot:false.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   179
      sel imageOpened:nil.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   180
      sel imageClosed:nil.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   181
      sel imageItem:nil.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   182
      sel model: model.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   183
      sel action:[:nr | Transcript show:'selected:'; showCR:nr].
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   184
      top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)).
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   185
      top open.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   186
    "
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   187
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   188
    "Created: / 04-02-2017 / 22:48:28 / cg"
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   189
!
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   190
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   191
newAsTreeFromSmalltalkClass:aClass
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   192
    "create a tree of nodes with aClass and all its
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   193
     subclasses as contents. Set the initial level as given."
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   194
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   195
    |newInst clsName|
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   196
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   197
    aClass isNil ifTrue:[
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   198
        "/ nil subclasses requested
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   199
        clsName := 'nil'
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   200
    ] ifFalse:[
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   201
        "/ regular tree requested
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   202
        clsName := aClass name
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   203
    ].
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   204
3907
860a141af427 changed: #newAsTreeFromSmalltalkClass:
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
   205
    newInst := self new.
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   206
    newInst name:clsName.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   207
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   208
    aClass isNil ifTrue:[
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   209
        ((Smalltalk allClasses select:[:cls | cls superclass isNil])
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   210
            asSortedCollection:[:a :b | a name < b name])
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   211
        do:[:aSubClass |
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   212
            newInst add:(self newAsTreeFromSmalltalkClass:aSubClass).
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   213
        ]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   214
    ] ifFalse:[
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   215
        (aClass subclasses asSortedCollection:[:a :b | a name < b name])
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   216
        do:[:aSubClass |
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   217
            newInst add:(self newAsTreeFromSmalltalkClass:aSubClass).
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   218
        ]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   219
    ].
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   220
    ^newInst
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   221
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   222
"
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   223
      |top model sel root|
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   224
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   225
      root  := TreeItem newAsTreeFromSmalltalkClass:ByteArray.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   226
      root expand.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   227
      model := SelectionInTree new root:root.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   228
      top := StandardSystemView new.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   229
      top extent:300@300.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   230
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   231
      sel := SelectionInTreeView new.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   232
      sel model: model.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   233
      sel action:[:nr | Transcript show:'selected:'; showCR:nr].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   234
      top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)).
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   235
      top open.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   236
"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   237
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   238
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   239
!TreeItem methodsFor:'accessing'!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   240
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   241
contents
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   242
    "get the contents; 
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   243
     usually, the contents is computed lazily
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   244
     i.e. #retrieveContents is invoked when the contents has not yet been set."
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   245
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   246
    contents == UnknownContents ifTrue:[        
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   247
        self retrieveContents
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   248
    ].
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   249
    ^contents
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   250
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   251
    "Modified (comment): / 04-02-2017 / 20:23:22 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   252
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   253
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   254
contents:something 
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   255
    "set the contents"
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   256
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   257
    contents := something
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   258
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   259
    "Modified (comment): / 04-02-2017 / 20:23:33 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   260
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   261
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   262
editor
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   263
    "returns an editor on the editable value or nil"
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   264
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   265
    ^ nil
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   266
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   267
    "Modified (comment): / 04-02-2017 / 20:23:44 / cg"
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   268
!
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   269
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   270
hide
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   271
   "retrieve the hide flag "    
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   272
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   273
    ^ hide
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   274
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   275
    "Modified (comment): / 04-02-2017 / 20:24:08 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   276
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   277
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   278
hide:aBoolean
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   279
   "set hide flag "    
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   280
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   281
   hide := aBoolean
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   282
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   283
    "Modified (comment): / 04-02-2017 / 20:23:55 / cg"
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   284
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   285
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   286
icon
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   287
    "get the icon"        
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   288
772
9ae43992a603 do not cache icons because TreeItems are models
tz
parents: 768
diff changeset
   289
    ^self retrieveAndEvaluate: #iconAction
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   290
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   291
    "Modified (comment): / 04-02-2017 / 20:24:16 / cg"
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   292
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   293
5629
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   294
label
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   295
    "for protocol compatibility with herarchical item"
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   296
    
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   297
    ^ self name
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   298
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   299
    "Created: / 20-10-2017 / 11:30:15 / cg"
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   300
!
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   301
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   302
labelPath
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   303
    "for protocol compatibility with herarchical item"
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   304
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   305
    ^ ({self} , self allParents) reverse collect:#label
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   306
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   307
    "Created: / 20-10-2017 / 11:30:07 / cg"
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   308
!
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   309
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   310
level
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   311
    "get the nesting level"
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   312
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   313
    |p lvl|
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   314
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   315
    lvl := 1.
786
ca
parents: 784
diff changeset
   316
    p  := self.
ca
parents: 784
diff changeset
   317
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   318
    [ (p := p parent) notNil ] whileTrue:[ lvl := lvl + 1 ].
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   319
    ^ lvl
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   320
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   321
    "Modified (comment): / 04-02-2017 / 20:25:22 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   322
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   323
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   324
middleButtonMenu
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   325
    "returns the middleButtonMenu of the item or nil"
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   326
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   327
    ^ nil
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   328
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
   329
    "Modified (comment): / 04-02-2017 / 20:25:04 / cg"
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   330
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   331
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   332
name
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   333
    "get name
772
9ae43992a603 do not cache icons because TreeItems are models
tz
parents: 768
diff changeset
   334
    "   
786
ca
parents: 784
diff changeset
   335
    name isNil ifTrue:[    
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   336
        self retrieveLabel
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   337
    ].
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   338
    ^name
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   339
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   340
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   341
name:aString
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   342
    name := aString.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   343
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   344
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   345
parent
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   346
    "get parent
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   347
    "
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   348
    ^ parent
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   349
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   350
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   351
parent:something
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   352
    "set parent
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   353
    "
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   354
    parent := something.
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   355
!
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   356
5571
1e6cb883c641 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   357
string
1e6cb883c641 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   358
    ^ self contents asString
1e6cb883c641 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   359
1e6cb883c641 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   360
    "Created: / 03-08-2017 / 16:49:05 / cg"
1e6cb883c641 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   361
!
1e6cb883c641 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5557
diff changeset
   362
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   363
value
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   364
    "get contents
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   365
    "
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   366
    ^ self contents
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   367
!
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   368
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   369
value:something 
5366
64470c9be16e #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 5233
diff changeset
   370
    "allow TreeItem to be used as a model"
64470c9be16e #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 5233
diff changeset
   371
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   372
    self contents:something
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   373
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   374
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
   375
!TreeItem methodsFor:'accessing-children'!
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   376
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   377
basicLastChild
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   378
    "returns the last child without checking for valid sequence
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   379
    "
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   380
    ^ children last
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   381
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   382
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   383
children
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   384
    "get list of children
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   385
    "
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   386
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   387
    "/ readChildren is actually: "MUSTreadChildren" - bad naming
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   388
    (readChildren and:[children isEmpty]) ifTrue:[       
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   389
        self retrieveChildren
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   390
    ].
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   391
    ^children
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   392
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   393
    "Modified (comment): / 04-08-2017 / 14:15:08 / cg"
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   394
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   395
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   396
children:aCollection 
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   397
    "set children
1208
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   398
    "
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   399
    aCollection isNil ifTrue:[
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   400
        children removeAll
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   401
    ] ifFalse:[
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   402
        aCollection notNil ifTrue:[
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   403
            aCollection do:[:child| child parent:self ].
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   404
            "/ readChildren is actually: "MUSTreadChildren" - bad naming
1208
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   405
            readChildren := false
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   406
        ].
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   407
        children := aCollection
2f9d74cead2f children:
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   408
    ]
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   409
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   410
    "Modified (comment): / 04-08-2017 / 14:15:13 / cg"
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   411
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   412
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   413
firstChild
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   414
    "returns first child in sequence
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   415
    "
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   416
    self children notEmpty ifTrue:[
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   417
        ^ children at:1
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   418
    ].
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   419
    ^ nil
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   420
        
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   421
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   422
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   423
lastChild
3699
4ec92c9e6b29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3361
diff changeset
   424
    "returns the last child in sequence"
4ec92c9e6b29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3361
diff changeset
   425
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   426
    self children notEmpty ifTrue:[
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   427
        ^ children last
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   428
    ].
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   429
    ^ nil
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   430
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   431
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   432
readChildren:aBoolean
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   433
   "set MUSTread children flag
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   434
   "    
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   435
    "/ readChildren is actually: "MUSTreadChildren" - bad naming
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   436
   readChildren:= aBoolean
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   437
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   438
    "Modified (comment): / 04-08-2017 / 14:15:25 / cg"
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   439
! !
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   440
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
   441
!TreeItem methodsFor:'accessing-dimensions'!
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   442
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   443
childrenWidthOn:aDevice
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   444
    "returns the maximum name length of my children
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   445
    "
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   446
    |max name|
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   447
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   448
    max := 0.
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   449
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   450
    children do:[:aChild|
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   451
        (name := aChild name) notNil ifTrue:[
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   452
            max := max max:(name widthOn:aDevice)
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   453
        ]
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   454
    ].
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   455
    ^ max
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   456
! !
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   457
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
   458
!TreeItem methodsFor:'accessing-hierarchy'!
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   459
5629
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   460
allParents
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   461
    "return a collection of all parents (in parent, grandparent, ... order)"
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   462
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   463
    |parents|
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   464
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   465
    parents := OrderedCollection new.
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   466
    self parentsDo:[:p | parents add:p].
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   467
    ^ parents.
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   468
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   469
    "Created: / 20-10-2017 / 11:31:06 / cg"
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   470
!
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   471
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   472
collapse 
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   473
    "hide all my children
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   474
    "
772
9ae43992a603 do not cache icons because TreeItems are models
tz
parents: 768
diff changeset
   475
    hide := true
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   476
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   477
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   478
collapseAll 
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   479
    "hide all my children and sub children
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   480
    "
841
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   481
    hide := true.
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   482
841
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   483
    children notEmpty ifTrue:[
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   484
        children do:[:aChild| aChild collapseAll]
834
8729c234f95d add new queries
ca
parents: 795
diff changeset
   485
    ]
8729c234f95d add new queries
ca
parents: 795
diff changeset
   486
!
8729c234f95d add new queries
ca
parents: 795
diff changeset
   487
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   488
expand
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   489
    "show all my children
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   490
    "
772
9ae43992a603 do not cache icons because TreeItems are models
tz
parents: 768
diff changeset
   491
    hide := false
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   492
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   493
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   494
expandAll 
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   495
    "show all my children and sub children
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   496
    "
841
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   497
    hide := false.
834
8729c234f95d add new queries
ca
parents: 795
diff changeset
   498
841
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   499
    self children notEmpty ifTrue:[
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   500
        children do:[:aChild| aChild expandAll ]
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   501
    ]
5629
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   502
!
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   503
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   504
parentsDo:aBlock
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   505
    "evaluate a block for each parent"
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   506
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   507
    |prnt|
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   508
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   509
    prnt := self.
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   510
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   511
    [(prnt := prnt parent) notNil] whileTrue:[
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   512
        aBlock value:prnt
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   513
    ].
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   514
afcdc42d662f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5628
diff changeset
   515
    "Created: / 20-10-2017 / 11:31:41 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   516
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   517
2404
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   518
!TreeItem methodsFor:'accessing-mvc'!
786
ca
parents: 784
diff changeset
   519
ca
parents: 784
diff changeset
   520
model
ca
parents: 784
diff changeset
   521
    "get my model (an instance of selection in tree) or nil
ca
parents: 784
diff changeset
   522
    "    
5577
1b413325b088 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5576
diff changeset
   523
    ^ parent notNil 
1b413325b088 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5576
diff changeset
   524
        ifTrue:[parent model] 
1b413325b088 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5576
diff changeset
   525
        ifFalse:[tree]
1b413325b088 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5576
diff changeset
   526
1b413325b088 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5576
diff changeset
   527
    "Modified (format): / 16-08-2017 / 19:13:49 / cg"
786
ca
parents: 784
diff changeset
   528
!
ca
parents: 784
diff changeset
   529
ca
parents: 784
diff changeset
   530
model:aSelectionInTree
ca
parents: 784
diff changeset
   531
    "set my model (an instance of selection in tree) or nil
ca
parents: 784
diff changeset
   532
    "    
ca
parents: 784
diff changeset
   533
    tree:= aSelectionInTree
ca
parents: 784
diff changeset
   534
!
ca
parents: 784
diff changeset
   535
ca
parents: 784
diff changeset
   536
tree
ca
parents: 784
diff changeset
   537
    "get my model (an instance of selection in tree) or nil
ca
parents: 784
diff changeset
   538
    "    
ca
parents: 784
diff changeset
   539
    ^ self model
ca
parents: 784
diff changeset
   540
!
ca
parents: 784
diff changeset
   541
ca
parents: 784
diff changeset
   542
tree:aSelectionInTree
ca
parents: 784
diff changeset
   543
    "set my model (an instance of selection in tree) or nil
ca
parents: 784
diff changeset
   544
    "    
ca
parents: 784
diff changeset
   545
    self model:aSelectionInTree
ca
parents: 784
diff changeset
   546
! !
ca
parents: 784
diff changeset
   547
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   548
!TreeItem methodsFor:'adding & removing'!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   549
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   550
add:something
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   551
    "add a child or collection of children add end
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   552
    "
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   553
    self add:something beforeIndex:(self children size + 1)
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   554
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   555
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   556
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   557
add:something after:aChild
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   558
    "add a child or collection of children add end
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   559
    "
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   560
    self add:something afterIndex:(self indexOfChild:aChild)
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   561
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   562
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   563
add:something afterIndex:anIndex
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   564
    "add a child or collection after an index
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   565
    "
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   566
    self add:something beforeIndex:(anIndex + 1)
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   567
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   568
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   569
add:something before:aChild
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   570
    "add a child or collection of children add end
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   571
    "
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   572
    self add:something beforeIndex:(self indexOfChild:aChild)
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   573
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   574
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   575
add:something beforeIndex:anIndex
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   576
    "add a child or collection before an index
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   577
    "
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   578
    |idx children|
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   579
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   580
    children := self children.
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   581
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   582
    (idx := anIndex) > children size ifTrue:[
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   583
        idx := children size + 1
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   584
    ] ifFalse:[
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   585
        idx == 0 ifTrue:[idx := 1]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   586
    ].
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   587
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   588
    self each:something do:[:el|
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   589
        children add:el beforeIndex:idx.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   590
        el parent:self.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   591
        el allWithParentAndChildrenDo:[:aParent :aChild| aChild parent:aParent ].
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   592
        idx := idx + 1.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   593
    ]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   594
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   595
909
b2930fedcbe8 checkin from browser
tz
parents: 858
diff changeset
   596
addFirst: something
b2930fedcbe8 checkin from browser
tz
parents: 858
diff changeset
   597
    "add a child at the beginning
b2930fedcbe8 checkin from browser
tz
parents: 858
diff changeset
   598
    "
b2930fedcbe8 checkin from browser
tz
parents: 858
diff changeset
   599
    self add:something beforeIndex:1
b2930fedcbe8 checkin from browser
tz
parents: 858
diff changeset
   600
!
b2930fedcbe8 checkin from browser
tz
parents: 858
diff changeset
   601
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   602
remove:something 
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   603
    "remove a child or collection of children
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   604
    "
858
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   605
    self each:something do:[:aChild| self removeChild:aChild ].
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   606
  ^ something
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   607
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   608
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   609
removeAll
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   610
    "remove all children
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   611
    "
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   612
    self childrenDo:[:aChild| aChild parent:nil ].
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   613
    self children removeAll.
858
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   614
!
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   615
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   616
removeChild:aChild
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   617
    "remove a aChild
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   618
    "
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   619
    |item|
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   620
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   621
    (item := self children remove:aChild ifAbsent:nil) notNil ifTrue:[
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   622
        item parent:nil
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   623
    ].
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   624
    ^ item
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   625
!
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   626
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   627
removeIndex:anIndex
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   628
    "remove child at index
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   629
    "
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   630
    ^ self removeChild:(self childAt:anIndex)
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   631
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   632
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   633
!TreeItem methodsFor:'change & update'!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   634
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   635
changed
786
ca
parents: 784
diff changeset
   636
    "node changed; raise notification to model
ca
parents: 784
diff changeset
   637
    "
ca
parents: 784
diff changeset
   638
    self changed:#value
784
f521b359ec84 #changed: mechanism extented
tz
parents: 777
diff changeset
   639
!
f521b359ec84 #changed: mechanism extented
tz
parents: 777
diff changeset
   640
786
ca
parents: 784
diff changeset
   641
changed:what
ca
parents: 784
diff changeset
   642
    "node changed; raise notification to model
ca
parents: 784
diff changeset
   643
    "
ca
parents: 784
diff changeset
   644
    |model|
784
f521b359ec84 #changed: mechanism extented
tz
parents: 777
diff changeset
   645
795
d36f94d682bf #changed: bug fixed
tz
parents: 786
diff changeset
   646
    what == #value 
982
d94684e7fe9f sending #changed to a tree item should not invoke retrieving children
tz
parents: 909
diff changeset
   647
        ifTrue:  [self retrieveLabel]
5557
8b713ce203d2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5495
diff changeset
   648
        ifFalse: [
8b713ce203d2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5495
diff changeset
   649
            what == #children ifTrue: [
8b713ce203d2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5495
diff changeset
   650
                self retrieveChildren
8b713ce203d2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5495
diff changeset
   651
            ]
8b713ce203d2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5495
diff changeset
   652
        ].
786
ca
parents: 784
diff changeset
   653
ca
parents: 784
diff changeset
   654
    (model := self model) notNil ifTrue:[
795
d36f94d682bf #changed: bug fixed
tz
parents: 786
diff changeset
   655
        model update:what with:nil from:self
786
ca
parents: 784
diff changeset
   656
    ]
5557
8b713ce203d2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5495
diff changeset
   657
8b713ce203d2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5495
diff changeset
   658
    "Modified (format): / 21-07-2017 / 09:14:30 / cg"
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   659
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   660
2038
81b3b590c9d8 *** empty log message ***
ca
parents: 1825
diff changeset
   661
changedSelected
81b3b590c9d8 *** empty log message ***
ca
parents: 1825
diff changeset
   662
    "called if the node is selected
81b3b590c9d8 *** empty log message ***
ca
parents: 1825
diff changeset
   663
    "
81b3b590c9d8 *** empty log message ***
ca
parents: 1825
diff changeset
   664
!
81b3b590c9d8 *** empty log message ***
ca
parents: 1825
diff changeset
   665
786
ca
parents: 784
diff changeset
   666
update:something with:aParameter from:anItem
ca
parents: 784
diff changeset
   667
    "raise change notification to my model
ca
parents: 784
diff changeset
   668
    "
ca
parents: 784
diff changeset
   669
    |m|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   670
786
ca
parents: 784
diff changeset
   671
    (m := self model) notNil ifTrue:[
ca
parents: 784
diff changeset
   672
        m update:something with:aParameter from:anItem
ca
parents: 784
diff changeset
   673
    ]
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   674
! !
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   675
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   676
!TreeItem methodsFor:'converting'!
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   677
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   678
fromLiteralArrayEncoding:aLiteralEncodedArray
786
ca
parents: 784
diff changeset
   679
    "read my contents from a aLiteralEncodedArray.
ca
parents: 784
diff changeset
   680
    "
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   681
    |narg|
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   682
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   683
    (     (aLiteralEncodedArray size > 0)
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   684
     and:[(name := aLiteralEncodedArray at:1) isString]) ifFalse:[
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   685
        ^ nil
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   686
    ].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   687
    narg := aLiteralEncodedArray at:2 ifAbsent:nil.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   688
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   689
    name isSymbol ifTrue:[
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   690
        (narg isArray and:[aLiteralEncodedArray size == 2]) ifTrue:[
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   691
            ^ self fromLiteralArrayEncoding:narg
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   692
        ].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   693
        ^ nil
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   694
    ].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   695
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   696
    narg isArray ifFalse:[
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   697
        contents := narg.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   698
        narg := aLiteralEncodedArray at:3 ifAbsent:nil.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   699
    ].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   700
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   701
    narg isArray ifTrue:[
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   702
        children := OrderedCollection new.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   703
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   704
        narg do:[:aSubArray||aChild|
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   705
            children add:(aChild := TreeItem new).
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   706
            aChild fromLiteralArrayEncoding:aSubArray.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   707
            aChild parent:self.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   708
        ]
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   709
    ]
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   710
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   711
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   712
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   713
!
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   714
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   715
literalArrayEncoding
786
ca
parents: 784
diff changeset
   716
    "return myself encoded as a literal array
ca
parents: 784
diff changeset
   717
    "
5635
4fe9214fa41f #REFACTORING by mawalch
mawalch
parents: 5629
diff changeset
   718
    |array children size noChld|
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   719
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   720
    contents isString ifTrue:[size := 2]
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   721
                     ifFalse:[size := 1].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   722
786
ca
parents: 784
diff changeset
   723
    noChld := self numberOfChildren.
ca
parents: 784
diff changeset
   724
ca
parents: 784
diff changeset
   725
    noChld == 0 ifTrue:[
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   726
        array := Array new:size
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   727
    ] ifFalse:[
786
ca
parents: 784
diff changeset
   728
        array  := Array new:size + 1.
5635
4fe9214fa41f #REFACTORING by mawalch
mawalch
parents: 5629
diff changeset
   729
        children := Array new:noChld.
4fe9214fa41f #REFACTORING by mawalch
mawalch
parents: 5629
diff changeset
   730
        array at:(size + 1) put:children.
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   731
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   732
        self children keysAndValuesDo:[:i :aChild|
5635
4fe9214fa41f #REFACTORING by mawalch
mawalch
parents: 5629
diff changeset
   733
            children at:i put:(aChild literalArrayEncoding)
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   734
        ]
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   735
    ].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   736
    array at:1 put:(name ? '').
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   737
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   738
    contents isString ifTrue:[
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   739
        array at:2 put:contents
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   740
    ].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   741
    parent isNil ifTrue:[
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   742
        array := Array with:#TreeItem with:array.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   743
    ].
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   744
    ^ array
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   745
! !
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   746
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   747
!TreeItem methodsFor:'copying'!
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   748
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   749
copy
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   750
    |node newContents|
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   751
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   752
    node := self species new.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   753
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   754
    contents ~~ UnknownContents ifTrue:[
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   755
        newContents := contents copy.
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   756
    ] ifFalse:[
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   757
        newContents := UnknownContents
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   758
    ].
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   759
    node name:name copy.
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   760
    node contents:newContents.
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   761
    node children:(self children collect:[:c| c copy]).
786
ca
parents: 784
diff changeset
   762
    node readChildren:readChildren.
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   763
    ^ node
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   764
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   765
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   766
!TreeItem methodsFor:'enumerating'!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   767
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   768
allChildrenDo:aOneArgBlock
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   769
    "recursively enumerate children
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   770
     and evaluate a block on each child and subchildren"
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   771
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   772
    self children do:[:aChild|
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   773
        aOneArgBlock value:aChild.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   774
        aChild allChildrenDo:aOneArgBlock
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   775
    ]
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   776
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   777
    "Modified (comment): / 20-10-2017 / 11:26:36 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   778
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   779
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   780
allWithParentAndChildrenDo:aTwoArgBlock
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   781
    self childrenDo:[:aChild|
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   782
        aTwoArgBlock value:self value:aChild.
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   783
        aChild allWithParentAndChildrenDo:aTwoArgBlock
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   784
    ]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   785
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   786
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   787
childrenDo:aOneArgBlock
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   788
    "evaluate a block on each child (excluding sub-children)"
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   789
837
5d437be03bcf optimize evaluation of block
ca
parents: 834
diff changeset
   790
    self children do:aOneArgBlock
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   791
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   792
    "Modified (comment): / 20-10-2017 / 11:27:02 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   793
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   794
1241
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   795
detectParent:aBlock
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   796
    "evaluate aBlock for my parent-chain; 
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   797
     return the parent for which it returns true"
1241
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   798
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   799
    |p|
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   800
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   801
    p := parent.
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   802
    [p notNil] whileTrue:[
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   803
        (aBlock value:p) ifTrue:[^ p].
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   804
        p := p parent
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   805
    ].
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   806
    ^ nil
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   807
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   808
    "Modified (comment): / 20-10-2017 / 11:27:09 / cg"
1241
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   809
!
11749610046e added #detectParent:
tm
parents: 1208
diff changeset
   810
5627
1036554d1cec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5577
diff changeset
   811
each:itemOrCollectionOfItems do:aOneArgBlock
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   812
    "evaluate a block for something or in case of a collection for each
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   813
     element in the collection"
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   814
5627
1036554d1cec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5577
diff changeset
   815
    itemOrCollectionOfItems notNil ifTrue:[
1036554d1cec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5577
diff changeset
   816
        itemOrCollectionOfItems isCollection ifTrue:[
1036554d1cec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5577
diff changeset
   817
            itemOrCollectionOfItems do:aOneArgBlock
1036554d1cec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5577
diff changeset
   818
        ] ifFalse:[
1036554d1cec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5577
diff changeset
   819
            aOneArgBlock value:itemOrCollectionOfItems
1036554d1cec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5577
diff changeset
   820
        ]
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   821
    ]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   822
5628
afbbddcc2951 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
   823
    "Modified (comment): / 20-10-2017 / 11:27:16 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   824
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   825
2501
832cbac295b8 method category rename
Claus Gittinger <cg@exept.de>
parents: 2498
diff changeset
   826
!TreeItem methodsFor:'initialization & release'!
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   827
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   828
initialize
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   829
    "setup defaults
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   830
    "
506
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   831
    super initialize.
6a56843fb354 encodeing decoding
ca
parents: 479
diff changeset
   832
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   833
    children := OrderedCollection new.
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   834
    "/ readChildren is actually: "MUSTreadChildren" - bad naming
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   835
    readChildren := hide := true.
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   836
    contents := UnknownContents.
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   837
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   838
    "Modified (comment): / 04-08-2017 / 14:15:31 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   839
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   840
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
   841
!TreeItem methodsFor:'printing & storing'!
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   842
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   843
asString
3361
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   844
    "sometimes used by the SelectionInListView to get the name"
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   845
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   846
    ^ self name
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   847
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   848
4140
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   849
displayOn:aGCOrStream
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   850
    "Compatibility
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   851
     append a printed desription on some stream (Dolphin,  Squeak)
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   852
     OR:
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   853
     display the receiver in a graphicsContext at 0@0 (ST80).
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   854
     This method allows for any object to be displayed in some view
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   855
     (although the fallBack is to display its printString ...)"
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   856
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   857
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
5495
9a12192a4f0e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5458
diff changeset
   858
    "/ old ST80 means: draw-yourself on a GC.
4140
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   859
    aGCOrStream isStream ifFalse:[
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   860
        ^ super displayOn:aGCOrStream.
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   861
    ].
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   862
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   863
    aGCOrStream 
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   864
        nextPutAll:self class name;
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   865
        nextPut:$(.
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   866
    self printOn:aGCOrStream. 
267c46c27c2a Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 3907
diff changeset
   867
    aGCOrStream nextPut:$)
5495
9a12192a4f0e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5458
diff changeset
   868
9a12192a4f0e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5458
diff changeset
   869
    "Modified (comment): / 22-02-2017 / 16:48:13 / cg"
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   870
!
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   871
3361
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   872
printOn:aStream
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   873
    "sometimes used by the SelectionInListView to get the name"
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   874
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   875
    aStream nextPutAll:self name
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   876
!
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   877
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   878
printString
3361
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   879
    "sometimes used by the SelectionInListView to get the name"
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   880
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   881
    ^ self name
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   882
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   883
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   884
printableEditValue
3361
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   885
    "returns the printable edit value or nil"
5b0ba50df077 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3123
diff changeset
   886
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   887
    ^ nil
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   888
! !
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   889
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   890
!TreeItem methodsFor:'queries'!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   891
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   892
canEdit
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   893
    "returns true if field is editable
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   894
    "
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   895
    ^ false
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   896
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
   897
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   898
hasChildren
786
ca
parents: 784
diff changeset
   899
    "returns true if any child exists
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   900
    "
786
ca
parents: 784
diff changeset
   901
    ^ self children notEmpty
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   902
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   903
834
8729c234f95d add new queries
ca
parents: 795
diff changeset
   904
hasChildrenWithSubChildren
2930
6c5b7065dd15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   905
    "returns true if any child exists and has children too"
834
8729c234f95d add new queries
ca
parents: 795
diff changeset
   906
2930
6c5b7065dd15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   907
    self children contains:[:aChild| aChild hasChildren]
834
8729c234f95d add new queries
ca
parents: 795
diff changeset
   908
!
8729c234f95d add new queries
ca
parents: 795
diff changeset
   909
8729c234f95d add new queries
ca
parents: 795
diff changeset
   910
hasExpandedChildren
8729c234f95d add new queries
ca
parents: 795
diff changeset
   911
    "returns true if any of my children is expanded
8729c234f95d add new queries
ca
parents: 795
diff changeset
   912
    "
3123
8912a9a3bc01 code cleanup: use #contains instead of explicit loop
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
   913
    ^ children contains:[:aChild | aChild hidden not].
8912a9a3bc01 code cleanup: use #contains instead of explicit loop
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
   914
8912a9a3bc01 code cleanup: use #contains instead of explicit loop
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
   915
    "Modified: / 13-10-2006 / 13:00:05 / cg"
834
8729c234f95d add new queries
ca
parents: 795
diff changeset
   916
!
8729c234f95d add new queries
ca
parents: 795
diff changeset
   917
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   918
hidden
786
ca
parents: 784
diff changeset
   919
    "returns true if node is not visible
ca
parents: 784
diff changeset
   920
    "
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   921
    ^ hide
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   922
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   923
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   924
isCollapsable
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   925
    "is collabsable; children existing and shown
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   926
    "
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   927
    ^ (self hasChildren and:[hide == false])
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   928
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   929
569
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   930
isContainedByParent:aParent
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   931
    "returns true if contained in subtree of a parent
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   932
    "
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   933
    |p|
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   934
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   935
    p := parent.
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   936
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   937
    [p notNil] whileTrue:[
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   938
        p == aParent ifTrue:[^ true ].
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   939
        p := p parent
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   940
    ].
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   941
    ^ false
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   942
!
2a1014d6697c checkin from browser
ca
parents: 545
diff changeset
   943
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   944
isExpandable
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   945
    "is expandable; children existing and hidden
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   946
    "
469
d3537bee9988 accessing children through message
ca
parents: 457
diff changeset
   947
    ^ (self hasChildren and:[hide == true])
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   948
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   949
!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   950
1205
98175b161f98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   951
isExpanded
98175b161f98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   952
    "return true if I am expanded"
98175b161f98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   953
    ^ hide not
98175b161f98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   954
98175b161f98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   955
!
98175b161f98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   956
472
ca
parents: 469
diff changeset
   957
numberOfChildren
786
ca
parents: 784
diff changeset
   958
    "returns number of children
ca
parents: 784
diff changeset
   959
    "
472
ca
parents: 469
diff changeset
   960
    ^ self children size
ca
parents: 469
diff changeset
   961
!
ca
parents: 469
diff changeset
   962
841
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   963
showIndicator
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   964
    "returns true if children exists
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   965
    "
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   966
    ^ self hasChildren
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   967
!
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   968
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   969
shown
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   970
    "returns true if node is visible
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   971
    "
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   972
    ^ hide not
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   973
! !
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   974
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   975
!TreeItem methodsFor:'recomputation'!
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   976
858
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   977
addVisibleChildrenTo:aList
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   978
    "add all visible children and sub-children to the list
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
   979
    "  
838
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   980
    |item
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   981
     size "{ Class: SmallInteger }"
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   982
     idx  "{ Class: SmallInteger }"
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   983
    |
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   984
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   985
    hide ifFalse:[
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
   986
        "/ readChildren is actually: "MUSTreadChildren" - bad naming
841
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   987
        readChildren ifTrue:[
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   988
            self children
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   989
        ].
849
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
   990
        (size := children size) ~~ 0 ifTrue:[
838
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   991
            idx := 1.
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   992
            size timesRepeat:[
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   993
                aList add:(item := children at:idx).
858
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
   994
                item addVisibleChildrenTo:aList.
838
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   995
                idx := idx + 1.
d15daece0c54 optimize algorithm to get list from model and to
ca
parents: 837
diff changeset
   996
            ]
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   997
        ]
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
   998
    ]
841
163dc6648f02 add more functionality
ca
parents: 838
diff changeset
   999
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
  1000
    "Modified (format): / 04-08-2017 / 14:15:42 / cg"
858
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1001
!
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1002
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1003
numberOfAllVisibleChildren
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1004
    "returns number of all visible children including all the children of children
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1005
    "
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1006
    |total "{ Class: SmallInteger }"|
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1007
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1008
    hide ifTrue:[
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1009
        ^ 0
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1010
    ].
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
  1011
    "/ readChildren is actually: "MUSTreadChildren" - bad naming
858
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1012
    readChildren ifTrue:[ self children ].
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1013
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1014
    (total := children size) ~~ 0 ifTrue:[
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1015
        children do:[:aChild| total := total + aChild numberOfAllVisibleChildren ].
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1016
    ].
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1017
    ^ total
0bfbe5be0541 add more functionality
ca
parents: 849
diff changeset
  1018
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
  1019
    "Modified (comment): / 04-08-2017 / 14:15:49 / cg"
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
  1020
! !
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
  1021
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1022
!TreeItem methodsFor:'retrieving'!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1023
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1024
childrenAction
786
ca
parents: 784
diff changeset
  1025
    "get children action block
ca
parents: 784
diff changeset
  1026
    "
ca
parents: 784
diff changeset
  1027
    |m|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1028
786
ca
parents: 784
diff changeset
  1029
    ^ (m := self model) notNil ifTrue:[m childrenAction] ifFalse:[nil]
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1030
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1031
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1032
contentsAction
786
ca
parents: 784
diff changeset
  1033
    "get contents action block
ca
parents: 784
diff changeset
  1034
    "
ca
parents: 784
diff changeset
  1035
    |m|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1036
786
ca
parents: 784
diff changeset
  1037
    ^ (m := self model) notNil ifTrue:[m contentsAction] ifFalse:[nil]
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1038
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1039
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1040
iconAction
786
ca
parents: 784
diff changeset
  1041
    "get icon action block
ca
parents: 784
diff changeset
  1042
    "
ca
parents: 784
diff changeset
  1043
    |m|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1044
786
ca
parents: 784
diff changeset
  1045
    ^ (m := self model) notNil ifTrue:[m iconAction] ifFalse:[nil]
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1046
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1047
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1048
labelAction
3699
4ec92c9e6b29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3361
diff changeset
  1049
    "get label action block "
4ec92c9e6b29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3361
diff changeset
  1050
786
ca
parents: 784
diff changeset
  1051
    |m|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1052
786
ca
parents: 784
diff changeset
  1053
    ^ (m := self model) notNil ifTrue:[m labelAction] ifFalse:[nil]
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1054
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1055
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1056
retrieveAll
786
ca
parents: 784
diff changeset
  1057
    "retrieve all values from model
ca
parents: 784
diff changeset
  1058
    "
784
f521b359ec84 #changed: mechanism extented
tz
parents: 777
diff changeset
  1059
    self "retrieveContents;" retrieveLabel; retrieveChildren
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1060
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1061
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1062
retrieveAndEvaluate: selectorToReturnABlockOrValueHolder
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1063
    "retrieve a specific value from the model; 
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1064
     if no model exists, nil is returned.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1065
     
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1066
     The model mist return a block or valueHolder,
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1067
     which is evaluate with self as optopal argument.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1068
     So the model can compute icons, labels, etc. dynamically.
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1069
     
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1070
     Typical selectors are:
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1071
        #iconAction
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1072
        #childrenAction
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1073
        #contentsAction
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1074
        #labelAction
786
ca
parents: 784
diff changeset
  1075
    "
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1076
2071
7c58c73eff49 use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2038
diff changeset
  1077
    |arg model|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1078
786
ca
parents: 784
diff changeset
  1079
    (model := self model) isNil ifTrue:[
ca
parents: 784
diff changeset
  1080
        ^ nil
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1081
    ].
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1082
    arg := model perform:selectorToReturnABlockOrValueHolder.
786
ca
parents: 784
diff changeset
  1083
ca
parents: 784
diff changeset
  1084
    arg isBlock ifFalse:[
ca
parents: 784
diff changeset
  1085
        ^ arg value
ca
parents: 784
diff changeset
  1086
    ].
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1087
    ^ arg valueWithOptionalArgument:self
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1088
5450
e15db166b618 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5366
diff changeset
  1089
    "Modified (comment): / 04-02-2017 / 19:30:44 / cg"
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1090
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1091
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1092
retrieveChildren
786
ca
parents: 784
diff changeset
  1093
    "retrieve children from model
ca
parents: 784
diff changeset
  1094
    "
ca
parents: 784
diff changeset
  1095
    |retChildren cls|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1096
786
ca
parents: 784
diff changeset
  1097
    retChildren := self retrieveAndEvaluate:#childrenAction.
ca
parents: 784
diff changeset
  1098
ca
parents: 784
diff changeset
  1099
    retChildren notNil ifTrue:[
ca
parents: 784
diff changeset
  1100
        retChildren isCollection ifFalse: [retChildren := OrderedCollection with:retChildren].
ca
parents: 784
diff changeset
  1101
        cls := self class.
ca
parents: 784
diff changeset
  1102
5576
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1103
        self children: 
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1104
            (retChildren collect: 
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1105
                [:obj |      
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1106
                    (obj isKindOf:cls) 
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1107
                        ifTrue:[obj]
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1108
                        ifFalse:[cls new contents:obj]       
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1109
                ]). 
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
  1110
        "/ readChildren is actually: "MUSTreadChildren" - bad naming
768
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
  1111
        readChildren := false.
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
  1112
    ].     
5fa51db3bdb5 set read children flag to false only if retrieving succeeded
tz
parents: 766
diff changeset
  1113
786
ca
parents: 784
diff changeset
  1114
    ^ children
5572
196cd43bf045 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5571
diff changeset
  1115
5576
a8dd627924f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5572
diff changeset
  1116
    "Modified (format): / 16-08-2017 / 17:18:58 / cg"
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1117
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1118
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1119
retrieveContents
786
ca
parents: 784
diff changeset
  1120
    "retrieve contents value from model;
ca
parents: 784
diff changeset
  1121
    "
ca
parents: 784
diff changeset
  1122
    |cont|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1123
786
ca
parents: 784
diff changeset
  1124
    (cont := self retrieveAndEvaluate: #contentsAction) isNil ifTrue:[
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1125
        contents == UnknownContents ifTrue:[
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1126
            cont := ''
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1127
        ]
786
ca
parents: 784
diff changeset
  1128
    ].
ca
parents: 784
diff changeset
  1129
    ^ contents := cont
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1130
!
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1131
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1132
retrieveLabel
786
ca
parents: 784
diff changeset
  1133
    "retrieve label from model
ca
parents: 784
diff changeset
  1134
    "
ca
parents: 784
diff changeset
  1135
    |n|
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1136
786
ca
parents: 784
diff changeset
  1137
    (n := self retrieveAndEvaluate:#labelAction) isNil ifTrue:[
ca
parents: 784
diff changeset
  1138
        n := name ? ''
ca
parents: 784
diff changeset
  1139
    ].
ca
parents: 784
diff changeset
  1140
    ^ name := n
761
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1141
! !
d0cf8f76f1b6 supports dynamic read behavior for contents, label, children, and icon
tz
parents: 569
diff changeset
  1142
479
ca
parents: 472
diff changeset
  1143
!TreeItem methodsFor:'searching'!
ca
parents: 472
diff changeset
  1144
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
  1145
childAt:anIndex
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1146
    "get child at an index or nil"
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1147
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1148
    ^ self children at:anIndex ifAbsent:nil
1172
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
  1149
!
ab035d2357b3 add editable value and menu
ca
parents: 983
diff changeset
  1150
479
ca
parents: 472
diff changeset
  1151
detectChild:aOneArgBlock
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1152
    "evaluate the block on each child; 
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1153
     returns the child's node or nil.
5233
011a234e6095 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  1154
     This searches my direct children only - not walking down sublevels.
479
ca
parents: 472
diff changeset
  1155
    "
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1156
479
ca
parents: 472
diff changeset
  1157
    ^ self children detect:aOneArgBlock ifNone:nil
ca
parents: 472
diff changeset
  1158
!
ca
parents: 472
diff changeset
  1159
849
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1160
detectChild:aTwoArgBlock arguments:args
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1161
    "detect a child the evaluation of the block returns true. The
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1162
     first argument to the block is the item, the second argument
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1163
     the value derived from the argument list at node-level ...
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1164
     I.e. for each sublevel, a different block arg can be specified.
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1165
     The number of arguments also defines the search level.
1552
e3ad6557a3c3 comments
Claus Gittinger <cg@exept.de>
parents: 1551
diff changeset
  1166
     i.e. if you pass (1 to:10) as args, the block will get the sub-level
e3ad6557a3c3 comments
Claus Gittinger <cg@exept.de>
parents: 1551
diff changeset
  1167
     as second argument and stop the search after 10 levels.
849
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1168
    "
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1169
849
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1170
    ^ self detectChild:aTwoArgBlock arguments:args index:1
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1171
!
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1172
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1173
detectFirstChild:anOneArgBlock
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1174
    "detect the first child which evaluation of anOneArgBlock returns true.
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1175
     Recursively walks down the node-tree.
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1176
    "
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1177
    |node children|
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1178
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1179
    (anOneArgBlock value:self) ifTrue:[
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1180
        ^ self.
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1181
    ].
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1182
    (children := self children) notEmpty ifTrue:[
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1183
        children do:[:aChild |
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1184
            (node := aChild detectFirstChild:anOneArgBlock) notNil ifTrue:[
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1185
                ^ node
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1186
            ]
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1187
        ]
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1188
    ].  
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1189
    ^ nil
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1190
!
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1191
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1192
indexOfChild:aChild
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1193
    "get index of a child or 0
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1194
    "
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1195
    ^ aChild notNil ifTrue:[self children identityIndexOf:aChild]
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1196
                   ifFalse:[0]
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1197
! !
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1198
2498
4b4f91e57dd0 method category rename
Claus Gittinger <cg@exept.de>
parents: 2452
diff changeset
  1199
!TreeItem methodsFor:'searching-private'!
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1200
849
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1201
detectChild:aTwoArgBlock arguments:args index:idxArgs
1552
e3ad6557a3c3 comments
Claus Gittinger <cg@exept.de>
parents: 1551
diff changeset
  1202
    "helper for limited search.
e3ad6557a3c3 comments
Claus Gittinger <cg@exept.de>
parents: 1551
diff changeset
  1203
     detect a child the evaluation of the block returns true. The
849
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1204
     first argument to the block is the item, the second argument
1551
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1205
     the value derived from the argument list at an index.
2163ee51cb72 comments
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1206
     This one recursively walks down the tree searching for a node.
849
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1207
    "
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1208
    |num node|
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1209
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1210
    (num := args size) >= idxArgs ifTrue:[
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1211
        (aTwoArgBlock value:self value:(args at:idxArgs)) ifFalse:[
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1212
            ^ nil
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1213
        ].
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1214
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1215
        idxArgs == num ifTrue:[
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1216
            ^ self
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1217
        ].
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1218
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1219
        self children notEmpty ifTrue:[
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1220
            num := idxArgs + 1.
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1221
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1222
            children do:[:aChild|
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1223
                node := aChild detectChild:aTwoArgBlock arguments:args index:num.
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1224
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1225
                node notNil ifTrue:[
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1226
                    ^ node
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1227
                ]
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1228
            ]
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1229
        ]
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1230
    ].
f7d8363fc24f support more detectItem mechanisms
ca
parents: 845
diff changeset
  1231
    ^ nil
479
ca
parents: 472
diff changeset
  1232
! !
ca
parents: 472
diff changeset
  1233
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
  1234
!TreeItem class methodsFor:'documentation'!
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
  1235
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
  1236
version
5233
011a234e6095 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  1237
    ^ '$Header$'
3907
860a141af427 changed: #newAsTreeFromSmalltalkClass:
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  1238
!
860a141af427 changed: #newAsTreeFromSmalltalkClass:
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  1239
860a141af427 changed: #newAsTreeFromSmalltalkClass:
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  1240
version_CVS
5233
011a234e6095 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  1241
    ^ '$Header$'
457
c0f108c6d05f intitial checkin
ca
parents:
diff changeset
  1242
! !
2404
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1243
5233
011a234e6095 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4140
diff changeset
  1244
1196
8f9a3c273eff use UnknownContents special object instead of nil.
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1245
TreeItem initialize!