HierarchyNode.st
author Jan Vrany <jan.vrany@labware.com>
Fri, 02 Sep 2022 11:25:39 +0100
branchjv
changeset 6261 9b7eb7159d29
parent 5309 badbe0ef991c
child 5727 246a1c42ce5e
permissions -rw-r--r--
Fix loong standing bug with some menus not being translated / resolved This has happened with browser "View" menu when sometimes it had the slice resolved and sometimes not. It turned out that it was because the code disabled resources (and therefore slices) resolution when processing shortcuts, so the menu was created and cached unresolved. This fixes the issue. eXept apparently run into the same problem.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by AEG Industry Automation
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
 COPYRIGHT (c) 1994 by Claus Gittinger
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	      All Rights Reserved
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 This software is furnished under a license and may be used
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 only in accordance with the terms of that license and with the
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 inclusion of the above copyright notice.   This software may not
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 be provided or otherwise made available to, or used by, any
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 other person.  No title to or ownership of the software is
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 hereby transferred.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
    13
"{ Package: 'stx:libwidg2' }"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
    14
5309
badbe0ef991c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
    15
"{ NameSpace: Smalltalk }"
badbe0ef991c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
    16
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
Object subclass:#HierarchyNode
435
ca
parents: 359
diff changeset
    18
	instanceVariableNames:'name id parent children contents disabled hide level
ca
parents: 359
diff changeset
    19
		childCollectionClass'
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    20
	classVariableNames:''
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    21
	poolDictionaries:''
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    22
	category:'Interface-Support'
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    25
!HierarchyNode class methodsFor:'documentation'!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
copyright 
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 COPYRIGHT (c) 1994 by AEG Industry Automation
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 COPYRIGHT (c) 1994 by Claus Gittinger
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	      All Rights Reserved
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 This software is furnished under a license and may be used
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 only in accordance with the terms of that license and with the
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 be provided or otherwise made available to, or used by, any
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 other person.  No title to or ownership of the software is
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 hereby transferred.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
documentation
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    class to build up tree like structures to represent
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    file-trees, class tress etc.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    Especially suited for use with SelectionInHierarchy and
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    SelectionInHierarchyView.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    See examples in SelectionInHierarchyView.
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    49
5309
badbe0ef991c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
    50
    Notice: this class (together with SelectionInHierarchy and
1192
6c182c8683ec comment
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    51
           SelectionInHierarchyView) has been obsoleted by
6c182c8683ec comment
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    52
           corresponding SelectionInTree* classes.
6c182c8683ec comment
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    53
           These provide similar (but more) functionality.
6c182c8683ec comment
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    54
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    55
    [Author:]
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    56
        W. Olberding AEG Factory Automation
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    57
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    58
    [See also:]
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    59
        SelectionInHierarchy
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    60
        SelectionInHierarchyView
1192
6c182c8683ec comment
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    61
        SelectionInTree SelectionInTreeView TreeItem
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
"
118
2821a094ba30 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    63
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    65
!HierarchyNode class methodsFor:'instance creation'!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    66
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    67
new
3906
6660807d7832 comment/format in: #new
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
    68
    ^ self basicNew initialize
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
    69
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    71
newAsTreeFromSmalltalkClass:aClass
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    72
    "create a tree of nodes with aClass and all its
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    73
    subclasses as contents."
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    75
    ^ self
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    76
        newAsTreeFromSmalltalkClass:aClass
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    77
        level:(aClass allSuperclasses size).
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    78
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    79
    "Modified: 15.4.1997 / 16:34:23 / cg"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    82
newAsTreeFromSmalltalkClass:aClass level:level
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    83
    "create a tree of nodes with aClass and all its
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    84
     subclasses as contents. Set the initial level as given."
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    85
447
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    86
    |newInst clsName|
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    87
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    88
    aClass isNil ifTrue:[
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    89
        "/ nil subclasses requested
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    90
        clsName := 'nil'
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    91
    ] ifFalse:[
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    92
        "/ regular tree requested
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    93
        clsName := aClass name
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    94
    ].
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    95
3906
6660807d7832 comment/format in: #new
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
    96
    newInst := self new.
447
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
    97
    newInst name:clsName.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    98
    newInst contents:aClass.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    99
    newInst level:level.
438
19f0f3a171f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   100
    newInst childCollectionClass:OrderedCollection.
447
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   101
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   102
    aClass isNil ifTrue:[
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   103
        ((Smalltalk allClasses select:[:cls | cls superclass isNil])
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   104
            asSortedCollection:[:a :b | a name < b name])
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   105
        do:[:aSubClass |
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   106
            newInst addChild:(self newAsTreeFromSmalltalkClass:aSubClass level:level+1).
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   107
        ]
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   108
    ] ifFalse:[
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   109
        (aClass subclasses asSortedCollection:[:a :b | a name < b name])
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   110
        do:[:aSubClass |
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   111
            newInst addChild:(self newAsTreeFromSmalltalkClass:aSubClass level:level+1).
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   112
        ]
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   113
    ].
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   114
    ^newInst
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   116
    "Created: 15.4.1997 / 16:33:52 / cg"
447
705b618eb324 changed #newAsTreeFromSmalltalk to handle nil-superclass tree
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   117
    "Modified: 3.7.1997 / 12:25:03 / cg"
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   118
!
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   119
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   120
newWithName:aString
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   121
    "create a new node with a name"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   122
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   123
    |newInst|
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   124
3906
6660807d7832 comment/format in: #new
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
   125
    newInst := self new.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   126
    newInst name: aString.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   127
    ^newInst
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   128
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   129
    "Modified: 15.4.1997 / 16:32:06 / cg"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
newWithName: aString andId: anId
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   133
    "create a new node with a name and id"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   135
    |newInst|
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   136
3906
6660807d7832 comment/format in: #new
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
   137
    newInst := self new.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   138
    newInst name: aString.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   139
    newInst id:   anId.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   140
    ^newInst
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   141
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   142
    "Modified: 15.4.1997 / 16:32:22 / cg"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
! !
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
!HierarchyNode methodsFor:'accessing'!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
435
ca
parents: 359
diff changeset
   147
childCollectionClass:aCollectionClass
ca
parents: 359
diff changeset
   148
    "set the class of the child-collection.
ca
parents: 359
diff changeset
   149
     Default is Set."
ca
parents: 359
diff changeset
   150
ca
parents: 359
diff changeset
   151
     childCollectionClass := aCollectionClass.
ca
parents: 359
diff changeset
   152
     children := aCollectionClass withAll:children.
ca
parents: 359
diff changeset
   153
!
ca
parents: 359
diff changeset
   154
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   155
children
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   156
    "Answer my immediate children."
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   157
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   158
    ^ children
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   159
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   160
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   161
!
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   162
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   163
children:aCollectionWithElementsOfMyKind 
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   164
    "set my children"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   165
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   166
    aCollectionWithElementsOfMyKind do:[:child | 
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   167
         child parent: self.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   168
         child level: level + 1.
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   169
    ].
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   170
    children := aCollectionWithElementsOfMyKind.
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   171
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   172
    "Modified: 10.10.1994 / 16:13:33 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   173
    "Modified: 15.4.1997 / 16:48:38 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   174
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   175
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
contents
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    "Answer the contents of me (e.g. a set of items)"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    ^contents
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   181
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   182
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
contents: anObject 
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    "Set the contents of me to any object (e.g. a set of items)"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
4480
879db1acef5a class: HierarchyNode
Claus Gittinger <cg@exept.de>
parents: 3906
diff changeset
   187
    contents:= anObject
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
4480
879db1acef5a class: HierarchyNode
Claus Gittinger <cg@exept.de>
parents: 3906
diff changeset
   189
        "Modified: 10.10.94 / 16:13:33 / W.Olberding"
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   190
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   192
disabled
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   193
    "return disabled"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   194
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   195
    ^ disabled
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   196
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   197
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   198
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   199
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   200
disabled: aBool 
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   201
    "set disabled"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   202
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   203
    disabled := aBool.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   204
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   205
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   206
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   207
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
hide: aBoolean
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
   "Set hide to aBoolean"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
   hide:= aBoolean
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   214
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   215
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
hideToFalseForPath
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
    "set the hide-flag to false"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
      hide:= false.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
      parent isNil ifTrue: [^self].
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
      parent hideToFalseForPath
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   224
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   225
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
id
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    "return id"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    ^ id
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   232
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   233
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
id:something
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    "set id"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    id := something.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   240
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   241
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   243
level
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   244
    "answer the level in hierarchy (0=root)"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   245
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   246
    ^level
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   248
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   249
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   250
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   251
level: anInteger 
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   252
    "set the level in hierarchy (0=root)"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   254
    level := anInteger.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   256
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   257
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   259
name
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   260
    "return name"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   262
    ^ name
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   264
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   265
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   267
name: aString 
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   268
    "set the name that identifys me within my parent's context."
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   269
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   270
    name :=   aString.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   272
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   273
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   274
435
ca
parents: 359
diff changeset
   275
ordered:aBoolean
ca
parents: 359
diff changeset
   276
    "set/clear the children-are-ordered flag.
ca
parents: 359
diff changeset
   277
     If unordered (the default), children are kept in a set;
ca
parents: 359
diff changeset
   278
     if ordered, they are kept in an orderedCollection."
ca
parents: 359
diff changeset
   279
ca
parents: 359
diff changeset
   280
     aBoolean ifTrue:[
ca
parents: 359
diff changeset
   281
        children := children asOrderedCollection
ca
parents: 359
diff changeset
   282
     ] ifFalse:[
ca
parents: 359
diff changeset
   283
        children := children asSet
ca
parents: 359
diff changeset
   284
     ].
ca
parents: 359
diff changeset
   285
!
ca
parents: 359
diff changeset
   286
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   287
parent:something
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   288
    "set parent"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   289
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   290
    parent := something.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   292
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   293
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
pathName
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
    "return a full path name to me"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   298
    |n|
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   300
    n := self delimiterString , name.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   301
    parent isNil ifTrue: [^ n].
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   302
    ^ parent pathName , n.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   303
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   304
    "Modified: 10.10.1994 / 16:13:33 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   305
    "Modified: 15.4.1997 / 16:52:02 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   306
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   308
!HierarchyNode methodsFor:'constants'!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   310
delimiter
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   311
	"Answer the delimiter character"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   313
	^$/
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   315
	"Modified: 10.10.94 / 16:13:35 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   316
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   318
delimiterString
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   319
	"Answer the delimiter character asString"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   321
	^self delimiter asString
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   323
	"Modified: 10.10.94 / 16:13:35 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   324
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   326
!HierarchyNode methodsFor:'copying'!
439
08c889635dfd create:
ca
parents: 438
diff changeset
   327
08c889635dfd create:
ca
parents: 438
diff changeset
   328
copyWithParent:aParent
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   329
    |node|
439
08c889635dfd create:
ca
parents: 438
diff changeset
   330
08c889635dfd create:
ca
parents: 438
diff changeset
   331
    node := self copy.
08c889635dfd create:
ca
parents: 438
diff changeset
   332
    node parent:aParent.
08c889635dfd create:
ca
parents: 438
diff changeset
   333
    node level:((aParent level) + 1).
08c889635dfd create:
ca
parents: 438
diff changeset
   334
    node children:(children collect:[:aChild| aChild copyWithParent:self]).
08c889635dfd create:
ca
parents: 438
diff changeset
   335
  ^ node
08c889635dfd create:
ca
parents: 438
diff changeset
   336
! !
08c889635dfd create:
ca
parents: 438
diff changeset
   337
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
!HierarchyNode methodsFor:'hierarchy operations'!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   340
addChild:anObjectOfMyKind 
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   341
    "add anObjectOfMyKind to my children"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   342
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   343
    anObjectOfMyKind parent: self.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   344
    anObjectOfMyKind level: level +1.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   345
    self children add:anObjectOfMyKind.
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   346
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   347
    "Modified: 10.10.1994 / 16:13:34 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   348
    "Modified: 15.4.1997 / 16:49:17 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   349
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   351
addChildren: aCollectionWithElementsOfMyKind 
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   352
    "add aCollectionWithElementsOfMyKind to my children"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   353
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   354
    aCollectionWithElementsOfMyKind do:[:child | 
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   355
         child parent: self.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   356
         child level: level +1.
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   357
    ].
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   358
    self children addAll:aCollectionWithElementsOfMyKind.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   360
    "Modified: 10.10.1994 / 16:13:34 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   361
    "Modified: 15.4.1997 / 16:49:03 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   362
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
allChildren
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    "Answer my immediate children plus all my grandchildren
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
      -- in hierachical order and alphabeticaly sorted by name within one level."
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
     | kids |
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
     kids := OrderedCollection new.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
     self addAllChildrenTo: kids.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
     ^kids.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   373
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   374
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   376
allParents 
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   377
    "return all my parents (next first - root last)"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   378
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   379
    parent isNil ifTrue:  [ ^OrderedCollection new: 0  ]
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   380
		 ifFalse: [ ^parent, parent allParents ].
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   381
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   382
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   383
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   384
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   385
collapse 
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   386
      "Hide my children in hierachical printouts."
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   387
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   388
	 hide := true
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   389
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   390
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   391
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   392
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   393
collapseAll 
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   394
    "Hide my children and all my grandchildren in hierachical printouts."
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   395
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   396
    hide := true.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   397
    self children do: [:kid | kid collapseAll ].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   399
    "Modified: 10.10.1994 / 16:13:34 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   400
    "Modified: 15.4.1997 / 16:49:34 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   401
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
expand 
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
      "Show my immediate children in hierachical printouts."
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
	 hide := false.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   408
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   409
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   411
expandAll 
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   412
    "Show my children and all grand children in hierachical printouts."
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   413
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   414
    hide := false.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   415
    self children do: [:kid | kid expandAll ].
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   416
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   417
    "Modified: 10.10.1994 / 16:13:34 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   418
    "Modified: 15.4.1997 / 16:49:48 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   419
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   420
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   421
parent
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   422
    "return parent"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   424
    ^ parent
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   425
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   426
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   427
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   428
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   429
removeAllChildren
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   430
    "Remove all children of me from the tree, i.e. let them
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   431
     forget myself as parent."
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   432
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   433
    | kids |
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   435
    kids := self allChildren.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   436
    kids do: [:kid | kid parent: nil ].
435
ca
parents: 359
diff changeset
   437
    children := childCollectionClass new.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   438
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   439
    "Modified: 10.10.1994 / 16:13:34 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   440
    "Modified: 15.4.1997 / 16:50:01 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   441
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
removeChild: anObjectOfMyKind 
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   444
    "remove anObjectOfMyKind from my children"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
    anObjectOfMyKind parent: nil.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   447
    children remove: anObjectOfMyKind.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   449
    "Modified: 10.10.1994 / 16:13:34 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   450
    "Modified: 15.4.1997 / 16:50:23 / cg"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
removeYourself
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
    "remove me and all my children"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
    parent isNil ifTrue: [^nil].
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
    parent removeChild: self.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   459
    "Modified: 10.10.1994 / 16:13:34 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   460
    "Modified: 15.4.1997 / 16:52:33 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   461
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
withAllChildren
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
    "Answer me, my immediate children and all my grandchildren
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
      -- in hierachical order and alphabeticaly sorted by name within one level."
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
     | kids |
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
     kids := OrderedCollection with: self .
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
     self addAllChildrenTo: kids.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
     ^kids.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   472
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   473
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   475
withAllShownChildren
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   476
    "Answer me, my immediate children and all my grandchildren which are
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   477
     currently not hidden.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   478
      -- in hierachical order and alphabeticaly sorted by name within one level."
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
     | kids |
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   481
     kids := OrderedCollection with: self .
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   482
     self addAllShownChildrenTo: kids.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   483
     ^kids.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   485
	"Modified: 10.10.94 / 16:13:34 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   486
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
442
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   488
!HierarchyNode methodsFor:'hierarchy sequencable operations'!
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   489
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   490
addChildAndSubChildren:aHierarchyNode after:aChild
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   491
    "add aHierarchyNode to my children after an existing child or at end"
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   492
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   493
    |node index|
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   494
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   495
    node := aHierarchyNode copyWithParent:self.
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   496
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   497
    (index := self indexOfChild:aChild) == 0 ifTrue:[
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   498
        self children add:node
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   499
    ] ifFalse:[
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   500
        self children add:node afterIndex:index
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   501
    ].
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   502
!
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   503
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   504
addChildAndSubChildren:aHierarchyNode at:anIndex
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   505
    "add aHierarchyNode to my children at an index or at end"
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   506
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   507
    |node cseq|
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   508
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   509
    node := aHierarchyNode copyWithParent:self.
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   510
    cseq := self children.
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   511
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   512
    (cseq isSequenceable and:[cseq size >= anIndex]) ifTrue:[
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   513
        cseq add:node beforeIndex:anIndex
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   514
    ] ifFalse:[
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   515
        cseq add:node
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   516
    ]
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   517
!
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   518
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   519
indexOfChild:aChild
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   520
    |seq|
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   521
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   522
    aChild notNil ifTrue:[
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   523
        seq := self children.
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   524
        seq isSequenceable ifTrue:[
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   525
            ^ seq findFirst:[:c| c == aChild ]
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   526
        ]
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   527
    ].
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   528
  ^ 0
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   529
! !
930fe1485dc2 add new features
ca
parents: 439
diff changeset
   530
2499
a2b676b9292c method category rename
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   531
!HierarchyNode methodsFor:'initialization & release'!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
initialize
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   534
        "init some defaults"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
     "  name 
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   537
        id 
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   538
        parent --"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   539
435
ca
parents: 359
diff changeset
   540
    childCollectionClass := Set.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   541
    children := Set new.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   542
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
       " contents    := Set new."
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   545
    disabled := false.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   546
    hide     := false.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   547
    level    := 0. "=root"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   548
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   549
    "Modified: 10.10.1994 / 16:13:35 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   550
    "Modified: 15.4.1997 / 16:50:44 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   551
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   553
!HierarchyNode methodsFor:'private'!
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   554
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   555
addAllChildrenTo:aCollection
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   556
    "Add all my children in hierachical and alphabetical order
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   557
     to aCollection."
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   558
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   559
    |myChildren|
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
435
ca
parents: 359
diff changeset
   561
    "/ myChildren := children asSortedCollection:[:x :y | x name < y name ].
ca
parents: 359
diff changeset
   562
    myChildren := self children.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   563
    myChildren do:[:aChild |
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   564
        aCollection addLast: aChild.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   565
        aChild addAllChildrenTo:aCollection.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   566
    ].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   568
    "Modified: 10.10.1994 / 16:13:35 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   569
    "Modified: 15.4.1997 / 16:47:53 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   570
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   572
addAllShownChildrenTo: aCollection
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   573
    "Add all my children in hierachical and alphabetical order
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   574
     if they are not hidden."
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   575
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   576
    |myChildren|
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   578
    hide ifTrue: [^self].
435
ca
parents: 359
diff changeset
   579
"/    myChildren := self children asSortedCollection:[:x :y | x name < y name ].
ca
parents: 359
diff changeset
   580
    myChildren := self children.
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   581
    myChildren do: [:aChild |
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   582
        aCollection addLast: aChild.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   583
        aChild addAllShownChildrenTo: aCollection.
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   584
    ].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   586
    "Modified: 10.10.1994 / 16:13:35 / W.Olberding"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   587
    "Modified: 15.4.1997 / 16:53:08 / cg"
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   588
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   590
!HierarchyNode methodsFor:'queries'!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   592
childrenHidden
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   593
      "Answer true if my children shall be hidden
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   594
       in hierachical printouts etc."
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   595
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   596
      ^hide.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   597
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   598
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   599
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   600
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   601
childrenShown
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   602
      "Answer true if my children shall be shown
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   603
       in hierachical printouts etc."
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   604
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   605
      ^hide not.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   606
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   607
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   608
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   609
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   610
hasChildren
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   611
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   612
	^children size > 0.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   613
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   614
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   615
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   616
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   617
isCollapsable
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   618
	"Answer true if I have shown children"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   619
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   620
	self hasChildren ifTrue: [ ^hide == false ].
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   621
	^false.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   622
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   623
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   624
!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   625
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   626
isExpandable
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   627
	"Answer true if I have hidden children"
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   628
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   629
	self hasChildren ifTrue: [ ^hide == true ].
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   630
	^false.
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   631
2102
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   632
	"Modified: 10.10.94 / 16:13:33 / W.Olberding"
aa58c7d922fe category change
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
   633
! !
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   634
359
a4f931c5a7d9 comments
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   635
!HierarchyNode class methodsFor:'documentation'!
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   636
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   637
version
5309
badbe0ef991c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   638
    ^ '$Header$'
3906
6660807d7832 comment/format in: #new
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
   639
!
6660807d7832 comment/format in: #new
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
   640
6660807d7832 comment/format in: #new
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
   641
version_CVS
5309
badbe0ef991c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4480
diff changeset
   642
    ^ '$Header$'
253
01498f4ffcca comment
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   643
! !
4480
879db1acef5a class: HierarchyNode
Claus Gittinger <cg@exept.de>
parents: 3906
diff changeset
   644