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