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