author | Claus Gittinger <cg@exept.de> |
Tue, 09 Jul 2019 20:53:39 +0200 | |
changeset 6083 | 7a2c0a30e75c |
parent 6073 | b7d061c67140 |
child 6095 | 42a1a76ba814 |
permissions | -rw-r--r-- |
6009 | 1 |
"{ Encoding: utf8 }" |
2 |
||
4733 | 3 |
" |
4 |
COPYRIGHT (c) 1999/2015 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libwidg2' }" |
|
15 |
||
16 |
"{ NameSpace: Smalltalk }" |
|
17 |
||
18 |
Object subclass:#AbstractHierarchicalItem |
|
19 |
instanceVariableNames:'parent children' |
|
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Views-Support' |
|
23 |
! |
|
24 |
||
25 |
!AbstractHierarchicalItem class methodsFor:'documentation'! |
|
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1999/2015 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
Hierarchical Items are mostly like Models, but the list of |
|
44 |
dependencies are kept by its HierarchicalList. |
|
45 |
The class is used to build up hierarchical trees. |
|
46 |
||
47 |
2015 update: |
|
48 |
the original HierarchicalItem has been refactored into this abstract class, |
|
49 |
which provides all the mechanisms, but leaves the concrete representation |
|
50 |
of some slots open. |
|
51 |
These are: |
|
52 |
- if and how the geometry information (width + height) are cached, |
|
53 |
- if and how the expanded-state is remembered. |
|
54 |
- if and how the underlying model is fetched |
|
55 |
||
56 |
The old class used private slots for the first three (width-height-isExpanded), |
|
57 |
but did not keep a reference to the model. This leads to a very poor performance, |
|
58 |
as many algorithms degenerated to O(n log(n)) or even O(n^2) time behavior, |
|
59 |
as the model was fetched by walking along the parent chain - sometimes for every item |
|
60 |
in a long list. |
|
61 |
||
62 |
The old class is still around and may be used for small trees, |
|
63 |
but we recommend rewriting applications to use the new CompactHierarchicalItem |
|
64 |
class, which behaves the same on the outside, but uses clever tricks to be both more |
|
65 |
space efficient (saving 2 slots) and time efficient (caching the model). |
|
4749
13a7e6db823b
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4746
diff
changeset
|
66 |
For this, make sure that the subclass does not access the instvars isExpanded, width and height |
13a7e6db823b
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4746
diff
changeset
|
67 |
directly, but uses the getters isExpanded, width and height and the setters setExpanded:, width: and height: |
4733 | 68 |
|
69 |
[Instance variables:] |
|
70 |
parent <Item, List or nil> parent or my HierarchicalList. |
|
71 |
children <Collection or nil> list of children |
|
72 |
||
73 |
[author:] |
|
5740 | 74 |
Claus Atzkern |
4733 | 75 |
Claus Gittinger (redesign and refactoring) |
76 |
||
77 |
[see also:] |
|
78 |
HierarchicalItem (the old item class) |
|
79 |
HierarchicalList (typical model) |
|
80 |
HierarchicalListView (typical user of me) |
|
81 |
" |
|
82 |
! ! |
|
83 |
||
84 |
!AbstractHierarchicalItem class methodsFor:'instance creation'! |
|
85 |
||
86 |
new |
|
87 |
^ (self basicNew) initialize |
|
88 |
! |
|
89 |
||
90 |
parent:aParent |
|
91 |
|item| |
|
92 |
||
93 |
item := self new. |
|
94 |
item parent:aParent. |
|
95 |
^ item |
|
96 |
! ! |
|
97 |
||
98 |
!AbstractHierarchicalItem class methodsFor:'protocol'! |
|
99 |
||
100 |
doResetExtentOnChange |
|
101 |
"true: the extent of the item is reset if a change |
|
102 |
notification is raised from the item. the default is true |
|
103 |
" |
|
104 |
^ true |
|
105 |
! ! |
|
106 |
||
5461 | 107 |
!AbstractHierarchicalItem class methodsFor:'queries'! |
108 |
||
109 |
isAbstract |
|
110 |
"Return if this class is an abstract class. |
|
111 |
True is returned here for myself only; false for subclasses. |
|
112 |
Abstract subclasses must redefine this again." |
|
113 |
||
114 |
^ self == AbstractHierarchicalItem. |
|
115 |
! ! |
|
116 |
||
4733 | 117 |
!AbstractHierarchicalItem methodsFor:'accessing'! |
118 |
||
119 |
getChildren |
|
5996 | 120 |
"returns the children as they are present (or not); |
121 |
not going to the model, and especially not creating autocreated children..." |
|
4733 | 122 |
|
123 |
^ children |
|
5996 | 124 |
|
125 |
"Modified (comment): / 12-02-2019 / 17:41:06 / Claus Gittinger" |
|
4733 | 126 |
! |
127 |
||
128 |
level |
|
129 |
"returns the level starting with 0 for the root" |
|
130 |
||
131 |
|item level| |
|
132 |
||
133 |
item := self. |
|
134 |
level := 0. |
|
135 |
||
136 |
[ (item := item parentOrModel) notNil] whileTrue:[ |
|
137 |
level := level + 1. |
|
5739 | 138 |
level > 10000 ifTrue:[ |
139 |
self halt:'possibly recursive item hierarchy'. |
|
140 |
^ self. |
|
4733 | 141 |
]. |
142 |
]. |
|
143 |
^ level |
|
144 |
||
145 |
"Modified: / 09-07-2010 / 08:56:27 / cg" |
|
146 |
! |
|
147 |
||
6000 | 148 |
nextSibling |
149 |
"returns the next child of my parent or nil" |
|
150 |
||
151 |
|siblings myIndex| |
|
152 |
||
153 |
(parent notNil and:[parent isHierarchicalItem]) ifTrue:[ |
|
154 |
siblings := parent getChildren. |
|
155 |
myIndex := siblings identityIndexOf:self. |
|
156 |
myIndex ~~ 0 ifTrue:[ |
|
157 |
^ siblings at:myIndex+1 ifAbsent:nil |
|
158 |
]. |
|
159 |
]. |
|
160 |
^ nil |
|
161 |
||
162 |
"Created: / 13-02-2019 / 15:17:39 / Claus Gittinger" |
|
163 |
! |
|
164 |
||
4733 | 165 |
parent |
166 |
"returns the parent or nil" |
|
167 |
||
5865 | 168 |
|p| |
5870 | 169 |
|
170 |
p := parent. |
|
171 |
^ (p notNil and:[p isHierarchicalItem]) |
|
5865 | 172 |
ifTrue:[p] |
4733 | 173 |
ifFalse:[nil] |
5865 | 174 |
|
5870 | 175 |
"Modified: / 01-08-2018 / 10:18:37 / Claus Gittinger" |
176 |
"Modified: / 01-08-2018 / 16:15:07 / Stefan Vogel" |
|
4733 | 177 |
! |
178 |
||
179 |
parent:aParent |
|
180 |
"set the parent (or the model if the item is the root item)" |
|
181 |
||
182 |
parent := aParent |
|
183 |
! |
|
184 |
||
6000 | 185 |
previousSibling |
186 |
"returns the previous child of my parent or nil" |
|
187 |
||
188 |
|siblings myIndex| |
|
189 |
||
190 |
(parent notNil and:[parent isHierarchicalItem]) ifTrue:[ |
|
191 |
siblings := parent getChildren. |
|
192 |
myIndex := siblings identityIndexOf:self. |
|
193 |
myIndex ~~ 0 ifTrue:[ |
|
194 |
^ siblings at:myIndex-1 ifAbsent:nil |
|
195 |
]. |
|
196 |
]. |
|
197 |
^ nil |
|
198 |
||
199 |
"Created: / 13-02-2019 / 15:17:57 / Claus Gittinger" |
|
200 |
! |
|
201 |
||
4733 | 202 |
rootItem |
203 |
"returns the root item" |
|
204 |
||
205 |
parent isHierarchicalItem ifTrue:[ |
|
206 |
^ parent rootItem |
|
207 |
]. |
|
208 |
^ self |
|
209 |
! ! |
|
210 |
||
211 |
!AbstractHierarchicalItem methodsFor:'accessing-children'! |
|
212 |
||
213 |
at:anIndex |
|
214 |
"return the child at anIndex if valid; |
|
215 |
if the index is invalid, nil is returned" |
|
216 |
||
217 |
^ self at:anIndex ifAbsent:nil |
|
218 |
! |
|
219 |
||
220 |
at:anIndex ifAbsent:exceptionBlock |
|
221 |
"return the child at anIndex if valid; if the index is |
|
222 |
invalid, the result of evaluating the exceptionBlock is returned." |
|
223 |
||
224 |
|list| |
|
225 |
||
226 |
(list := self children) notNil ifTrue:[ |
|
227 |
^ list at:anIndex ifAbsent:exceptionBlock |
|
228 |
]. |
|
229 |
^ exceptionBlock value |
|
230 |
! |
|
231 |
||
232 |
at:anIndex put:anItem |
|
233 |
"replace a child by a new item. return anItem (sigh)" |
|
234 |
||
235 |
|children oldItem visIndex model expFlag| |
|
236 |
||
237 |
anItem isNil ifTrue:[ |
|
238 |
self removeFromIndex:anIndex toIndex:anIndex. |
|
239 |
^ nil |
|
240 |
]. |
|
241 |
anItem parent:self. |
|
242 |
||
243 |
(model := self model) isNil ifTrue:[ |
|
244 |
self children at:anIndex put:anItem. |
|
245 |
^ anItem |
|
246 |
]. |
|
247 |
||
5840 | 248 |
model synchronized:[ |
4733 | 249 |
children := self children. |
250 |
oldItem := children at:anIndex. |
|
251 |
||
252 |
oldItem isExpanded ifTrue:[ |
|
253 |
oldItem collapse |
|
254 |
]. |
|
255 |
visIndex := model identityIndexOf:oldItem. |
|
256 |
expFlag := anItem isExpanded. |
|
257 |
anItem setExpanded:false. |
|
258 |
||
259 |
children at:anIndex put:anItem. |
|
260 |
||
261 |
visIndex ~~ 0 ifTrue:[ |
|
262 |
model at:visIndex put:anItem. |
|
263 |
]. |
|
264 |
self changed:#redraw. |
|
265 |
expFlag ifTrue:[ anItem expand ]. |
|
266 |
]. |
|
267 |
^ anItem |
|
5840 | 268 |
|
269 |
"Modified: / 28-07-2018 / 15:51:06 / Claus Gittinger" |
|
4733 | 270 |
! |
271 |
||
272 |
children:aListOfChildren |
|
273 |
"set a new list of children" |
|
274 |
||
5840 | 275 |
self synchronized:[ |
4733 | 276 |
self removeAll. |
5994 | 277 |
self addAll:aListOfChildren beforeIndex:1. |
4733 | 278 |
]. |
279 |
^ aListOfChildren |
|
5840 | 280 |
|
5994 | 281 |
"Modified: / 06-02-2019 / 15:59:15 / Claus Gittinger" |
4733 | 282 |
! |
283 |
||
284 |
first |
|
285 |
"returns the first child |
|
286 |
" |
|
287 |
^ self at:1 |
|
288 |
! |
|
289 |
||
290 |
last |
|
291 |
"returns the last child" |
|
292 |
||
293 |
^ self at:(self size) |
|
294 |
! |
|
295 |
||
296 |
second |
|
297 |
"returns the second child" |
|
298 |
||
299 |
^ self at:2 |
|
300 |
! ! |
|
301 |
||
302 |
!AbstractHierarchicalItem methodsFor:'accessing-hierarchy'! |
|
303 |
||
304 |
collapse |
|
305 |
"hide all my subitems" |
|
306 |
||
307 |
self canCollapse ifTrue:[ |
|
5840 | 308 |
self synchronized:[ |
5996 | 309 |
|overAllNrOfVisibleChildren nrOfVisibleChildren index| |
310 |
||
311 |
overAllNrOfVisibleChildren := self numberOfVisibleChildren. |
|
312 |
||
313 |
self setExpanded:false. |
|
314 |
||
4733 | 315 |
(index := self listIndex) notNil ifTrue:[ |
5996 | 316 |
"/ do not call self size or self children, |
317 |
"/ as this might autocreate children !!!! |
|
318 |
(nrOfVisibleChildren := children size) ~~ 0 ifTrue:[ |
|
319 |
children do:[:el| |
|
320 |
nrOfVisibleChildren := nrOfVisibleChildren + el numberOfVisibleChildren |
|
4733 | 321 |
]. |
5996 | 322 |
self assert:(nrOfVisibleChildren = overAllNrOfVisibleChildren). |
323 |
self model itemRemoveFromIndex:(index + 1) toIndex:(index + nrOfVisibleChildren). |
|
4733 | 324 |
]. |
325 |
index ~~ 0 ifTrue:[self hierarchyChanged]. |
|
326 |
] |
|
327 |
] |
|
328 |
] |
|
5840 | 329 |
|
5996 | 330 |
"Modified: / 12-02-2019 / 18:53:55 / Claus Gittinger" |
4733 | 331 |
! |
332 |
||
333 |
enforcedExpand |
|
334 |
"expand children - even if there are no children, |
|
335 |
the item is initially expanded (but this might be undone later, |
|
336 |
when we know that no children are there" |
|
337 |
||
338 |
self expand:true |
|
339 |
! |
|
340 |
||
341 |
expand |
|
342 |
"expand children - but only if there are children |
|
343 |
(i.e. this cannot be used before the childInfo is valid; |
|
344 |
aka not before the updateTask came along this item)" |
|
345 |
||
346 |
self expand:false |
|
347 |
! |
|
348 |
||
349 |
expand:enforced |
|
350 |
"expand children" |
|
351 |
||
352 |
"/ test whether the item already is expanded; #canExpand could be redefined |
|
353 |
"/ without checking whether the node is expanded (happens already) !! |
|
354 |
||
355 |
self isExpanded ifTrue:[ ^ self ]. |
|
356 |
(enforced not and:[self canExpand not]) ifTrue:[ ^ self ]. |
|
357 |
||
5840 | 358 |
self synchronized:[ |
5720 | 359 |
|index list| |
360 |
||
6010 | 361 |
self isExpanded ifFalse:[ |
362 |
(index := self listIndex) notNil ifTrue:[ |
|
363 |
"/ must set expand-flag to false, otherwise change notifications |
|
364 |
"/ are raised during lazy auto creation (to the list). |
|
365 |
self setExpanded:false. |
|
366 |
list := self children. |
|
367 |
list notEmptyOrNil ifTrue:[ |
|
368 |
self setExpanded:true. |
|
369 |
list := OrderedCollection new. |
|
370 |
self addVisibleChildrenTo:list. |
|
371 |
self model itemAddAll:list beforeIndex:(index + 1). |
|
372 |
]. |
|
373 |
index ~~ 0 ifTrue:[self hierarchyChanged]. |
|
374 |
] ifFalse:[ |
|
375 |
self setExpanded:true |
|
376 |
] |
|
377 |
]. |
|
4733 | 378 |
]. |
5720 | 379 |
|
380 |
"Modified: / 08-03-2018 / 21:06:13 / stefan" |
|
6010 | 381 |
"Modified: / 20-02-2019 / 00:23:49 / Claus Gittinger" |
4733 | 382 |
! |
383 |
||
5728 | 384 |
expandLevels:numLevels |
385 |
"expand children numLevels down" |
|
386 |
||
387 |
numLevels == 0 ifTrue:[^ self]. |
|
388 |
self children do:[:each | |
|
389 |
each expand. |
|
390 |
each expandLevels:(numLevels - 1). |
|
391 |
]. |
|
392 |
! |
|
393 |
||
394 |
expandLevels:numLevels max:maxNumExpandedHolder |
|
395 |
"expand children numLevels down" |
|
396 |
||
5998 | 397 |
|childrenToExpand| |
398 |
||
5728 | 399 |
numLevels == 0 ifTrue:[^ self]. |
400 |
maxNumExpandedHolder value <= 0 ifTrue:[^ self]. |
|
401 |
||
5998 | 402 |
childrenToExpand := self children. |
403 |
childrenToExpand do:[:each | |
|
5728 | 404 |
each expand. |
405 |
]. |
|
406 |
||
5998 | 407 |
maxNumExpandedHolder value:(maxNumExpandedHolder value - childrenToExpand size). |
408 |
childrenToExpand do:[:each | |
|
5728 | 409 |
each expandLevels:(numLevels - 1) max:maxNumExpandedHolder. |
410 |
]. |
|
5998 | 411 |
|
412 |
"Modified: / 13-02-2019 / 12:33:40 / Claus Gittinger" |
|
5728 | 413 |
! |
414 |
||
5992 | 415 |
expandWithoutUpdate |
416 |
"in case expand is redefined to do any update |
|
417 |
(as in guiBrowser's applicationTreeItem), |
|
418 |
this can be used to expand without updating" |
|
419 |
||
420 |
self expand |
|
421 |
||
422 |
"Created: / 02-02-2019 / 19:59:55 / Claus Gittinger" |
|
423 |
"Modified (comment): / 03-02-2019 / 01:28:33 / Claus Gittinger" |
|
424 |
! |
|
425 |
||
5623 | 426 |
labelPath |
427 |
"return my label-path as an ordered collection of individual labels" |
|
428 |
||
429 |
^ ({self} , self allParents) reverse collect:#label |
|
430 |
||
431 |
"Created: / 16-10-2017 / 13:09:10 / cg" |
|
432 |
"Modified: / 16-10-2017 / 14:16:46 / cg" |
|
433 |
! |
|
434 |
||
4733 | 435 |
makeVisible |
436 |
"expand all my parents" |
|
437 |
||
438 |
(parent notNil and:[parent isHierarchicalItem]) ifTrue:[ |
|
5840 | 439 |
self synchronized:[ |
4733 | 440 |
parent makeVisible. |
441 |
parent expand. |
|
442 |
] |
|
443 |
]. |
|
5840 | 444 |
|
445 |
"Modified: / 28-07-2018 / 15:47:52 / Claus Gittinger" |
|
4733 | 446 |
! |
447 |
||
448 |
recursiveCollapse |
|
5998 | 449 |
"collapse item and recursively all sub items" |
450 |
||
451 |
self canCollapse ifFalse:[^ self]. |
|
5999 | 452 |
|
453 |
"/ self checkConsistency. |
|
5840 | 454 |
self synchronized:[ |
5996 | 455 |
|nrOfVisibleChildren index| |
5840 | 456 |
|
457 |
self canCollapse ifTrue:[ |
|
4733 | 458 |
(index := self listIndex) notNil ifTrue:[ |
5996 | 459 |
"/ do not call self size or self children here; |
460 |
"/ otherwise, lazy children would be autocreated !!!! |
|
5998 | 461 |
nrOfVisibleChildren := self numberOfVisibleChildren. |
5996 | 462 |
self recursiveSetCollapsedHelper. |
463 |
||
464 |
nrOfVisibleChildren ~~ 0 ifTrue:[ |
|
5998 | 465 |
self model removeFromIndex:(index + 1) toIndex:(index + nrOfVisibleChildren) |
4733 | 466 |
]. |
467 |
index ~~ 0 ifTrue:[ |
|
468 |
self hierarchyChanged |
|
469 |
] |
|
470 |
] ifFalse:[ |
|
5998 | 471 |
"/ not visible |
5996 | 472 |
self recursiveSetCollapsedHelper |
4733 | 473 |
] |
474 |
] |
|
5998 | 475 |
]. |
5999 | 476 |
"/ self checkConsistency. |
477 |
||
478 |
"Modified: / 13-02-2019 / 12:59:40 / Claus Gittinger" |
|
4733 | 479 |
! |
480 |
||
481 |
recursiveExpand |
|
5998 | 482 |
"expand children and sub-children; |
483 |
WARNING: refetches children. |
|
5870 | 484 |
Precondition: must be collapsed" |
485 |
||
5998 | 486 |
|index todo toExpand wasExpanded myList prevChildren childrenOfToExpand| |
487 |
||
5999 | 488 |
"/ self checkConsistency. |
5998 | 489 |
self synchronized:[ |
5996 | 490 |
myList := self model. |
491 |
todo := OrderedCollection with:self. |
|
492 |
[todo notEmpty] whileTrue:[ |
|
493 |
toExpand := todo removeFirst. |
|
494 |
||
495 |
"/ test whether the item already is expanded; #canExpand could be redefined |
|
5998 | 496 |
"/ without checking whether the node is already expanded (happens actually) !! |
497 |
wasExpanded := toExpand isExpanded. |
|
498 |
(wasExpanded or:[toExpand canExpand]) ifTrue:[ |
|
5996 | 499 |
toExpand setExpanded:true. |
6009 | 500 |
prevChildren := toExpand getChildren ? #(). |
5996 | 501 |
childrenOfToExpand := toExpand children. |
502 |
||
503 |
index := toExpand listIndex. "/ get the visible list index |
|
504 |
index isNil ifTrue:[ |
|
505 |
"/ not visible |
|
506 |
childrenOfToExpand do:[:eachChild | |
|
507 |
(eachChild isExpanded not and:[eachChild canExpand]) ifTrue:[ |
|
508 |
eachChild setExpanded:true |
|
509 |
]. |
|
510 |
]. |
|
511 |
] ifFalse:[ |
|
512 |
"/ visible |
|
5998 | 513 |
wasExpanded ifTrue:[ |
514 |
prevChildren = childrenOfToExpand ifTrue:[ |
|
515 |
childrenOfToExpand do:[:eachChild | |
|
516 |
(eachChild isExpanded not and:[eachChild canExpand]) ifTrue:[ |
|
517 |
todo add:eachChild |
|
518 |
]. |
|
519 |
]. |
|
520 |
] ifFalse:[ |
|
521 |
"/ remove the previous children |
|
522 |
prevChildren do:[:each | each recursiveCollapse]. |
|
523 |
"/ add the new children |
|
524 |
myList itemAddAll:childrenOfToExpand afterIndex:index. |
|
525 |
]. |
|
526 |
] ifFalse:[ |
|
527 |
"/ add the new children |
|
528 |
myList itemAddAll:childrenOfToExpand afterIndex:index. |
|
529 |
]. |
|
5996 | 530 |
childrenOfToExpand do:[:eachChild | |
5998 | 531 |
(eachChild isExpanded not and:[eachChild canExpand]) ifTrue:[ |
532 |
todo add:eachChild |
|
5996 | 533 |
]. |
5998 | 534 |
]. |
4733 | 535 |
]. |
536 |
] |
|
537 |
] |
|
538 |
]. |
|
5999 | 539 |
"/ self checkConsistency. |
5840 | 540 |
|
5870 | 541 |
"Modified (comment): / 02-08-2018 / 16:16:17 / Stefan Vogel" |
6009 | 542 |
"Modified: / 18-02-2019 / 18:37:36 / Claus Gittinger" |
4733 | 543 |
! |
544 |
||
545 |
recursiveToggleExpand |
|
546 |
"if the item is collapsed, the item and all its sub-items |
|
547 |
are expanded otherwise collapsed" |
|
548 |
||
549 |
self isExpanded ifTrue:[ |
|
550 |
self recursiveCollapse |
|
551 |
] ifFalse:[ |
|
552 |
self recursiveExpand |
|
553 |
] |
|
554 |
! |
|
555 |
||
556 |
toggleExpand |
|
557 |
"if the item is collapsed, the item is expanded otherwise collapsed" |
|
558 |
||
559 |
self isExpanded ifTrue:[ |
|
560 |
self collapse |
|
561 |
] ifFalse:[ |
|
562 |
self expand |
|
563 |
]. |
|
564 |
! ! |
|
565 |
||
566 |
!AbstractHierarchicalItem methodsFor:'accessing-mvc'! |
|
567 |
||
568 |
application |
|
569 |
"returns the responsible application or nil" |
|
570 |
||
571 |
|model| |
|
572 |
||
573 |
(model := self model) notNil ifTrue:[ |
|
574 |
^ model application |
|
575 |
]. |
|
576 |
^ nil |
|
577 |
! |
|
578 |
||
579 |
applicationsDo:aOneArgBlock |
|
580 |
"evaluate the block for each dependent application" |
|
581 |
||
582 |
|model| |
|
583 |
||
584 |
(model := self model) notNil ifTrue:[ |
|
585 |
model applicationsDo:aOneArgBlock |
|
586 |
] |
|
587 |
! |
|
588 |
||
5840 | 589 |
fetchModel |
4733 | 590 |
"returns the hierachicalList model or nil. |
591 |
This is a stupid implementation here, in that the top-item's parent is assumed to |
|
592 |
be the model of the tree, and that is returned. |
|
593 |
This saves a slot in every node, but makes some algorithms O(n*log n) or even O(n^2). |
|
594 |
So be aware of the performance penalty" |
|
595 |
||
596 |
|item next| |
|
597 |
||
598 |
item := self. |
|
599 |
[ (next := item parentOrModel) notNil ] whileTrue:[ |
|
600 |
item := next. |
|
601 |
]. |
|
602 |
||
603 |
item isHierarchicalItem ifFalse:[^ item]. |
|
604 |
^ nil |
|
5840 | 605 |
! |
606 |
||
607 |
model |
|
608 |
"returns the hierachicalList model or nil. |
|
609 |
This uses fetchModel, which has a stupid implementation here, |
|
610 |
in that the top-item's parent is assumed to be the model of the tree, and that is returned. |
|
611 |
This saves a slot in every node, but makes some algorithms O(n*log n) or even O(n^2). |
|
612 |
So be aware of the performance penalty or redefined fetchModel" |
|
613 |
||
614 |
^ self fetchModel |
|
615 |
||
616 |
"Modified (comment): / 28-07-2018 / 13:30:24 / Claus Gittinger" |
|
4733 | 617 |
! ! |
618 |
||
619 |
!AbstractHierarchicalItem methodsFor:'adding & removing'! |
|
620 |
||
621 |
add:aChildItem |
|
622 |
"add a child at end" |
|
623 |
||
5857 | 624 |
^ self synchronized:[ |
5840 | 625 |
self add:aChildItem beforeIndex:(self children size + 1). |
626 |
]. |
|
627 |
||
628 |
"Modified: / 28-07-2018 / 13:35:08 / Claus Gittinger" |
|
5857 | 629 |
"Modified: / 29-07-2018 / 20:23:01 / Stefan Vogel" |
4733 | 630 |
! |
631 |
||
632 |
add:aChildItem after:aChild |
|
633 |
"add an item after an existing item" |
|
634 |
||
5857 | 635 |
^ self synchronized:[ |
636 |
|index| |
|
637 |
||
5840 | 638 |
index := self identityIndexOf:aChild. |
639 |
index == 0 ifTrue:[ self subscriptBoundsError:index ]. |
|
640 |
||
641 |
self add:aChildItem beforeIndex:(index + 1). |
|
642 |
]. |
|
643 |
||
644 |
"Modified: / 28-07-2018 / 13:35:18 / Claus Gittinger" |
|
5857 | 645 |
"Modified: / 29-07-2018 / 20:23:26 / Stefan Vogel" |
4733 | 646 |
! |
647 |
||
648 |
add:aChildItem afterIndex:anIndex |
|
649 |
"add an item after an index" |
|
650 |
||
5857 | 651 |
^ self add:aChildItem beforeIndex:(anIndex + 1). |
5840 | 652 |
|
653 |
"Modified: / 28-07-2018 / 13:37:32 / Claus Gittinger" |
|
5857 | 654 |
"Modified: / 29-07-2018 / 20:23:39 / Stefan Vogel" |
4733 | 655 |
! |
656 |
||
657 |
add:aChildItem before:aChild |
|
658 |
"add an item before an existing item" |
|
659 |
||
5857 | 660 |
^ self synchronized:[ |
5840 | 661 |
|index| |
662 |
||
663 |
index := self identityIndexOf:aChild. |
|
664 |
index == 0 ifTrue:[ self subscriptBoundsError:index ]. |
|
665 |
||
666 |
self add:aChildItem beforeIndex:index. |
|
667 |
]. |
|
668 |
||
669 |
"Modified: / 28-07-2018 / 13:35:47 / Claus Gittinger" |
|
5857 | 670 |
"Modified: / 29-07-2018 / 20:22:28 / Stefan Vogel" |
4733 | 671 |
! |
672 |
||
673 |
add:aChildItem beforeIndex:anIndex |
|
674 |
"add an item before an index" |
|
675 |
||
676 |
aChildItem notNil ifTrue:[ |
|
677 |
self addAll:(Array with:aChildItem) beforeIndex:anIndex |
|
678 |
]. |
|
5857 | 679 |
^ aChildItem. |
5840 | 680 |
|
681 |
"Modified: / 28-07-2018 / 13:35:01 / Claus Gittinger" |
|
5857 | 682 |
"Modified: / 29-07-2018 / 20:24:07 / Stefan Vogel" |
4733 | 683 |
! |
684 |
||
685 |
add:aChild sortBlock:aBlock |
|
686 |
"add a child sorted" |
|
687 |
||
5857 | 688 |
^ self synchronized:[ |
4733 | 689 |
self basicAdd:aChild sortBlock:aBlock |
690 |
]. |
|
5840 | 691 |
|
692 |
"Modified: / 28-07-2018 / 13:37:12 / Claus Gittinger" |
|
5857 | 693 |
"Modified: / 29-07-2018 / 20:24:31 / Stefan Vogel" |
4733 | 694 |
! |
695 |
||
696 |
addAll:aList |
|
697 |
"add children at the end" |
|
698 |
||
5857 | 699 |
^ self synchronized:[ |
5840 | 700 |
self addAll:aList beforeIndex:(self children size + 1) |
701 |
] |
|
702 |
||
703 |
"Modified: / 28-07-2018 / 13:37:25 / Claus Gittinger" |
|
5857 | 704 |
"Modified: / 29-07-2018 / 20:25:09 / Stefan Vogel" |
4733 | 705 |
! |
706 |
||
707 |
addAll:aList before:aChild |
|
708 |
"add an item before an existing item" |
|
709 |
||
5857 | 710 |
^ self synchronized:[ |
5840 | 711 |
|index| |
712 |
||
713 |
index := self identityIndexOf:aChild. |
|
714 |
index == 0 ifTrue:[ self subscriptBoundsError:index ]. |
|
715 |
||
716 |
self addAll:aList beforeIndex:index |
|
717 |
]. |
|
718 |
||
719 |
"Modified: / 28-07-2018 / 13:37:53 / Claus Gittinger" |
|
5857 | 720 |
"Modified: / 29-07-2018 / 20:25:18 / Stefan Vogel" |
4733 | 721 |
! |
722 |
||
723 |
addAll:aList beforeIndex:anIndex |
|
724 |
"add children before an index" |
|
725 |
||
5857 | 726 |
aList notEmptyOrNil ifTrue:[ |
5840 | 727 |
self synchronized:[ |
4733 | 728 |
self basicAddAll:aList beforeIndex:anIndex |
729 |
] |
|
730 |
]. |
|
731 |
^ aList |
|
5840 | 732 |
|
733 |
"Modified: / 28-07-2018 / 13:38:02 / Claus Gittinger" |
|
5857 | 734 |
"Modified: / 29-07-2018 / 20:25:38 / Stefan Vogel" |
4733 | 735 |
! |
736 |
||
737 |
addAll:aList sortBlock:aBlock |
|
738 |
"add children sorted" |
|
739 |
||
5857 | 740 |
aList notEmptyOrNil ifTrue:[ ^ aList ]. |
4733 | 741 |
|
742 |
aBlock isNil ifTrue:[ |
|
743 |
self addAll:aList. |
|
744 |
] ifFalse:[ |
|
5840 | 745 |
self synchronized:[ |
4733 | 746 |
aList do:[:el| self basicAdd:el sortBlock:aBlock ] |
747 |
] |
|
748 |
]. |
|
5857 | 749 |
^ aList |
5840 | 750 |
|
751 |
"Modified: / 28-07-2018 / 13:38:14 / Claus Gittinger" |
|
5857 | 752 |
"Modified: / 29-07-2018 / 20:26:24 / Stefan Vogel" |
4733 | 753 |
! |
754 |
||
755 |
addAllFirst:aCollectionOfItems |
|
756 |
"add children at the beginning" |
|
757 |
||
5857 | 758 |
^ self addAll:aCollectionOfItems beforeIndex:1 |
5840 | 759 |
|
760 |
"Modified: / 28-07-2018 / 13:38:24 / Claus Gittinger" |
|
5857 | 761 |
"Modified: / 29-07-2018 / 20:26:47 / Stefan Vogel" |
4733 | 762 |
! |
763 |
||
764 |
addAllLast:aCollectionOfItems |
|
765 |
"add children at the end" |
|
766 |
||
5857 | 767 |
^ self addAll:aCollectionOfItems |
5840 | 768 |
|
769 |
"Modified: / 28-07-2018 / 13:38:32 / Claus Gittinger" |
|
5857 | 770 |
"Modified: / 29-07-2018 / 20:26:55 / Stefan Vogel" |
4733 | 771 |
! |
772 |
||
773 |
addFirst:aChildItem |
|
774 |
"add a child at the beginning" |
|
775 |
||
5857 | 776 |
^ self add:aChildItem beforeIndex:1. |
5840 | 777 |
|
778 |
"Modified: / 28-07-2018 / 13:38:47 / Claus Gittinger" |
|
5857 | 779 |
"Modified: / 29-07-2018 / 20:27:01 / Stefan Vogel" |
4733 | 780 |
! |
781 |
||
782 |
addLast:anItem |
|
783 |
"add a child at the end" |
|
784 |
||
5857 | 785 |
^ self add:anItem |
5840 | 786 |
|
787 |
"Modified: / 28-07-2018 / 13:38:52 / Claus Gittinger" |
|
5857 | 788 |
"Modified: / 29-07-2018 / 20:27:09 / Stefan Vogel" |
4733 | 789 |
! |
790 |
||
791 |
remove |
|
792 |
"remove the item" |
|
793 |
||
794 |
parent notNil ifTrue:[ "check whether parent exists" |
|
795 |
parent isHierarchicalItem ifTrue:[parent remove:self] "parent is HierarchicalItem" |
|
796 |
ifFalse:[parent root:nil] "parent is HierarchicalList" |
|
797 |
]. |
|
5857 | 798 |
|
799 |
"Modified: / 29-07-2018 / 20:31:18 / Stefan Vogel" |
|
4733 | 800 |
! |
801 |
||
802 |
remove:aChild |
|
803 |
"remove a child" |
|
804 |
||
5840 | 805 |
self synchronized:[ |
806 |
self removeIndex:(self identityIndexOf:aChild) |
|
807 |
]. |
|
808 |
||
809 |
"Modified: / 28-07-2018 / 13:39:47 / Claus Gittinger" |
|
5857 | 810 |
"Modified: / 29-07-2018 / 20:40:47 / Stefan Vogel" |
4733 | 811 |
! |
812 |
||
813 |
removeAll |
|
5840 | 814 |
"remove all children. |
815 |
Returns the receiver." |
|
816 |
||
817 |
self synchronized:[ |
|
818 |
|size| |
|
819 |
||
820 |
(size := children size) ~~ 0 ifTrue:[ |
|
821 |
self removeFromIndex:1 toIndex:size |
|
822 |
] |
|
4733 | 823 |
] |
5840 | 824 |
|
825 |
"Modified (comment): / 28-07-2018 / 13:44:24 / Claus Gittinger" |
|
4733 | 826 |
! |
827 |
||
828 |
removeAll:aList |
|
5840 | 829 |
"remove all children in the collection. |
830 |
Returns the receiver." |
|
4733 | 831 |
|
832 |
aList size ~~ 0 ifTrue:[ |
|
5840 | 833 |
self synchronized:[ |
4733 | 834 |
aList do:[:el| |
5840 | 835 |
|index| |
836 |
||
4733 | 837 |
(index := self identityIndexOf:el) ~~ 0 ifTrue:[ |
838 |
self removeIndex:index |
|
839 |
] |
|
840 |
] |
|
841 |
] |
|
842 |
]. |
|
5840 | 843 |
|
844 |
"Modified (format): / 28-07-2018 / 13:44:51 / Claus Gittinger" |
|
5857 | 845 |
"Modified: / 29-07-2018 / 20:39:01 / Stefan Vogel" |
4733 | 846 |
! |
847 |
||
848 |
removeAllIdentical:aList |
|
849 |
"remove all children in the collection" |
|
850 |
||
5840 | 851 |
^ self removeAll:aList. |
4733 | 852 |
|
853 |
"Created: / 20-09-2010 / 09:43:06 / sr" |
|
5840 | 854 |
"Modified: / 28-07-2018 / 13:41:48 / Claus Gittinger" |
4733 | 855 |
! |
856 |
||
857 |
removeFromIndex:startIndex |
|
5840 | 858 |
"remove the children from startIndex up to end of children. |
859 |
Returns the receiver." |
|
860 |
||
861 |
self synchronized:[ |
|
862 |
self removeFromIndex:startIndex toIndex:(children size) |
|
863 |
]. |
|
864 |
||
865 |
"Modified: / 28-07-2018 / 13:44:07 / Claus Gittinger" |
|
4733 | 866 |
! |
867 |
||
868 |
removeFromIndex:startIndex toIndex:stopIndex |
|
869 |
"remove the children from startIndex up to and including |
|
870 |
the child under stopIndex. |
|
871 |
Returns the receiver." |
|
872 |
||
5840 | 873 |
self synchronized:[ |
5870 | 874 |
|nrOfChildren| |
5840 | 875 |
|
876 |
nrOfChildren := children size. |
|
877 |
||
878 |
(startIndex <= stopIndex and:[startIndex <= nrOfChildren]) ifTrue:[ |
|
5870 | 879 |
self basicRemoveFromIndex:startIndex toIndex:(stopIndex min:nrOfChildren) |
5840 | 880 |
]. |
5870 | 881 |
(children isEmptyOrNil and:[self clearExpandedWhenLastChildWasRemoved]) ifTrue:[ |
882 |
self setExpanded:false. |
|
5840 | 883 |
]. |
4733 | 884 |
]. |
885 |
||
5840 | 886 |
"Modified: / 28-07-2018 / 13:45:07 / Claus Gittinger" |
5870 | 887 |
"Modified: / 02-08-2018 / 15:51:19 / Stefan Vogel" |
4733 | 888 |
! |
889 |
||
890 |
removeIndex:anIndex |
|
6073 | 891 |
"remove the child at an index. |
892 |
Returns the receiver" |
|
4733 | 893 |
|
894 |
anIndex > 0 ifTrue:[ |
|
895 |
self removeFromIndex:anIndex toIndex:anIndex |
|
896 |
] |
|
6073 | 897 |
|
898 |
"Modified (comment): / 24-06-2019 / 12:47:27 / Claus Gittinger" |
|
4733 | 899 |
! ! |
900 |
||
901 |
!AbstractHierarchicalItem methodsFor:'basic adding & removing'! |
|
902 |
||
5870 | 903 |
basicAdd:aChild sortBlock:aBlockOrNil |
5840 | 904 |
"add a child sorted. |
905 |
Not synchronized - should only be called internally |
|
906 |
within a synchronized region." |
|
4733 | 907 |
|
908 |
|size list| |
|
909 |
||
910 |
size := children size. |
|
911 |
list := Array with:aChild. |
|
912 |
||
5870 | 913 |
(aBlockOrNil notNil and:[size ~~ 0]) ifTrue:[ |
4733 | 914 |
children keysAndValuesDo:[:i :el| |
5870 | 915 |
(aBlockOrNil value:aChild value:el) ifTrue:[ |
4733 | 916 |
self basicAddAll:list beforeIndex:i. |
917 |
^ aChild |
|
918 |
] |
|
919 |
] |
|
920 |
]. |
|
5870 | 921 |
|
922 |
"insert at the end" |
|
4733 | 923 |
self basicAddAll:list beforeIndex:(size + 1). |
924 |
^ aChild. |
|
5840 | 925 |
|
926 |
"Modified (comment): / 28-07-2018 / 13:46:12 / Claus Gittinger" |
|
5870 | 927 |
"Modified (comment): / 01-08-2018 / 16:07:16 / Stefan Vogel" |
4733 | 928 |
! |
929 |
||
930 |
basicAddAll:aList beforeIndex:anIndex |
|
5840 | 931 |
"add children before an index. |
932 |
Not synchronized - should only be called internally |
|
933 |
within a synchronized region." |
|
4733 | 934 |
|
5994 | 935 |
|coll model notify index oldSize| |
936 |
||
937 |
oldSize := children size. |
|
4733 | 938 |
|
939 |
anIndex == 1 ifTrue:[ |
|
940 |
notify := self |
|
941 |
] ifFalse:[ |
|
5994 | 942 |
anIndex > oldSize ifTrue:[ |
943 |
anIndex > (1 + oldSize) ifTrue:[ |
|
4733 | 944 |
^ self subscriptBoundsError:index |
945 |
]. |
|
5994 | 946 |
notify := self at:oldSize |
4733 | 947 |
] ifFalse:[ |
948 |
notify := nil |
|
949 |
] |
|
950 |
]. |
|
5870 | 951 |
|
952 |
aList do:[:eachItem| eachItem parent:self ]. |
|
953 |
||
5994 | 954 |
oldSize == 0 ifTrue:[ |
5993 | 955 |
self setChildren:(OrderedCollection withAll:aList). |
4795
eead012852f9
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4758
diff
changeset
|
956 |
] ifFalse:[ |
5870 | 957 |
children isArray ifTrue:[ |
5993 | 958 |
self setChildren:(children asOrderedCollection) |
4795
eead012852f9
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4758
diff
changeset
|
959 |
]. |
5870 | 960 |
children addAll:aList beforeIndex:anIndex. |
4733 | 961 |
]. |
5993 | 962 |
|
4733 | 963 |
(model := self model) isNil ifTrue:[ |
964 |
^ aList |
|
965 |
]. |
|
966 |
||
967 |
self isExpanded ifFalse:[ |
|
968 |
notify notNil ifTrue:[ |
|
969 |
notify changed |
|
970 |
]. |
|
971 |
^ aList |
|
972 |
]. |
|
973 |
(index := self listIndex) isNil ifTrue:[ |
|
974 |
^ aList |
|
975 |
]. |
|
976 |
||
977 |
children from:1 to:(anIndex - 1) do:[:anItem| |
|
978 |
index := 1 + index + anItem numberOfVisibleChildren |
|
979 |
]. |
|
5857 | 980 |
|
4733 | 981 |
coll := OrderedCollection new. |
982 |
aList do:[:anItem| |
|
983 |
coll add:anItem. |
|
984 |
anItem addVisibleChildrenTo:coll. |
|
985 |
]. |
|
986 |
model itemAddAll:coll beforeIndex:(index + 1). |
|
987 |
||
988 |
notify notNil ifTrue:[ |
|
989 |
notify changed |
|
990 |
]. |
|
991 |
^ aList |
|
5840 | 992 |
|
5870 | 993 |
"Modified: / 01-08-2018 / 15:31:54 / Stefan Vogel" |
994 |
"Modified (format): / 02-08-2018 / 15:52:16 / Stefan Vogel" |
|
5993 | 995 |
"Modified: / 03-02-2019 / 19:32:25 / Claus Gittinger" |
5994 | 996 |
"Modified (format): / 06-02-2019 / 15:58:41 / Claus Gittinger" |
4733 | 997 |
! |
998 |
||
999 |
basicRemoveFromIndex:startIndex toIndex:stopIndex |
|
1000 |
"remove the children from startIndex up to and including |
|
5840 | 1001 |
the child under stopIndex. |
1002 |
Not synchronized - should only be called internally |
|
1003 |
within a synchronized region." |
|
4733 | 1004 |
|
1005 |
|model notify |
|
1006 |
index "{ Class:SmallInteger }" |
|
1007 |
start "{ Class:SmallInteger }" |
|
1008 |
stop "{ Class:SmallInteger }" |
|
1009 |
size "{ Class:SmallInteger }" |
|
1010 |
| |
|
1011 |
size := self children size. |
|
1012 |
stop := stopIndex. |
|
1013 |
start := startIndex. |
|
1014 |
||
1015 |
(stop <= size and:[start between:1 and:stop]) ifFalse:[ |
|
1016 |
^ self subscriptBoundsError:index |
|
1017 |
]. |
|
1018 |
start == 1 ifTrue:[ |
|
1019 |
notify := self |
|
1020 |
] ifFalse:[ |
|
1021 |
stop == size ifTrue:[ |
|
1022 |
notify := self at:(start - 1) |
|
1023 |
] ifFalse:[ |
|
1024 |
notify := nil |
|
1025 |
] |
|
1026 |
]. |
|
1027 |
||
1028 |
(model := self model) notNil ifTrue:[ |
|
1029 |
index := model identityIndexOf:(children at:start). |
|
1030 |
size := stop - start + 1. |
|
1031 |
] ifFalse:[ |
|
1032 |
index := 0 |
|
1033 |
]. |
|
1034 |
||
1035 |
children from:start to:stop do:[:aChild| |
|
1036 |
index ~~ 0 ifTrue:[ |
|
1037 |
size := size + aChild numberOfVisibleChildren |
|
1038 |
]. |
|
1039 |
aChild parent:nil |
|
1040 |
]. |
|
1041 |
children removeFromIndex:start toIndex:stop. |
|
1042 |
||
1043 |
index ~~ 0 ifTrue:[ |
|
1044 |
model itemRemoveFromIndex:index toIndex:(index + size - 1) |
|
1045 |
]. |
|
1046 |
notify notNil ifTrue:[ |
|
1047 |
notify changed |
|
1048 |
]. |
|
5840 | 1049 |
|
1050 |
"Modified (format): / 28-07-2018 / 13:46:41 / Claus Gittinger" |
|
4733 | 1051 |
! ! |
1052 |
||
1053 |
!AbstractHierarchicalItem methodsFor:'change & update'! |
|
1054 |
||
1055 |
changed:what with:anArgument |
|
1056 |
"the item changed; raise change notification |
|
1057 |
#icon icon is modified; height and width are unchanged |
|
1058 |
#hierarchy collapsed/expanded; height and width are unchanged |
|
1059 |
#redraw redraw but height and width are unchanged |
|
1060 |
....... all others: the height and width are reset |
|
1061 |
" |
|
5886 | 1062 |
|
4733 | 1063 |
|model| |
1064 |
||
5860 | 1065 |
(what ~~ #redraw |
1066 |
and:[what ~~ #hierarchy |
|
1067 |
and:[what ~~ #icon |
|
1068 |
and:[self class doResetExtentOnChange]]]) ifTrue:[ |
|
1069 |
self makeWidthAndHeightUnknown |
|
1070 |
]. |
|
1071 |
||
5886 | 1072 |
(model := self model) notNil ifTrue:[ |
1073 |
self synchronized:[ |
|
5860 | 1074 |
model itemChanged:what with:anArgument from:self. |
4733 | 1075 |
]. |
1076 |
]. |
|
1077 |
super changed:what with:anArgument |
|
1078 |
||
1079 |
"Modified: / 24-11-2010 / 17:21:20 / cg" |
|
5861 | 1080 |
"Modified: / 30-07-2018 / 15:58:18 / Stefan Vogel" |
5886 | 1081 |
"Modified (format): / 15-08-2018 / 12:37:03 / Claus Gittinger" |
4733 | 1082 |
! |
1083 |
||
1084 |
childrenOrderChanged |
|
1085 |
"called if the order of the children changed by a user |
|
1086 |
operation. Update the model and raise a change notification for |
|
1087 |
each item which has changed its position |
|
1088 |
triggered by the user operation !!" |
|
1089 |
||
1090 |
|model visStart list| |
|
1091 |
||
1092 |
self isExpanded ifFalse:[ ^ self ]. "/ not expanded |
|
1093 |
children size > 1 ifFalse:[ ^ self ]. |
|
1094 |
||
1095 |
model := self model. |
|
1096 |
model isNil ifTrue:[^ self]. "/ no model |
|
1097 |
||
1098 |
visStart := model identityIndexOf:self. |
|
1099 |
visStart == 0 ifTrue:[ |
|
1100 |
model root ~~ self ifTrue:[ ^ self ]. |
|
5840 | 1101 |
"/ I'am the root but switched of by setting #showRoot to false |
4733 | 1102 |
]. |
1103 |
||
5840 | 1104 |
self synchronized:[ |
4733 | 1105 |
list := OrderedCollection new. |
1106 |
self addVisibleChildrenTo:list. |
|
1107 |
||
1108 |
list do:[:el| |
|
1109 |
visStart := visStart + 1. |
|
1110 |
||
1111 |
(model at:visStart ifAbsent:el) ~~ el ifTrue:[ |
|
1112 |
model at:visStart put:el |
|
1113 |
]. |
|
1114 |
] |
|
1115 |
]. |
|
5840 | 1116 |
|
1117 |
"Modified (format): / 28-07-2018 / 13:47:27 / Claus Gittinger" |
|
4733 | 1118 |
! |
1119 |
||
1120 |
fontChanged |
|
1121 |
"called if the font has changed. |
|
1122 |
Clear the precomputed width and height" |
|
1123 |
||
1124 |
self makeWidthAndHeightUnknown. |
|
1125 |
||
5870 | 1126 |
children notNil ifTrue:[ |
4733 | 1127 |
children do:[:el| el fontChanged]. |
1128 |
]. |
|
5870 | 1129 |
|
1130 |
"Modified: / 02-08-2018 / 15:53:52 / Stefan Vogel" |
|
4733 | 1131 |
! |
1132 |
||
1133 |
hierarchyChanged |
|
1134 |
"hierarchy changed; optimize redrawing" |
|
1135 |
||
1136 |
self changed:#hierarchy with:nil |
|
1137 |
! |
|
1138 |
||
1139 |
iconChanged |
|
1140 |
"icon changed; optimize redrawing" |
|
1141 |
||
1142 |
self changed:#icon with:nil |
|
1143 |
! |
|
1144 |
||
5886 | 1145 |
invalidate |
1146 |
"force redrawing of me" |
|
1147 |
||
1148 |
self changed:#redraw with:nil |
|
1149 |
||
1150 |
"Created: / 15-08-2018 / 12:38:48 / Claus Gittinger" |
|
1151 |
! |
|
1152 |
||
4733 | 1153 |
labelChanged |
1154 |
"called if the label has changed. |
|
5887 | 1155 |
Clear the precomputed width and height, and invalidate" |
4733 | 1156 |
|
1157 |
self makeWidthAndHeightUnknown. |
|
5887 | 1158 |
self invalidate |
4733 | 1159 |
|
1160 |
"Created: / 17-01-2011 / 17:43:42 / cg" |
|
5887 | 1161 |
"Modified: / 15-08-2018 / 12:43:20 / Claus Gittinger" |
4733 | 1162 |
! ! |
1163 |
||
1164 |
!AbstractHierarchicalItem methodsFor:'enumerating'! |
|
1165 |
||
5623 | 1166 |
allExpandedItemsDo:aBlock |
1167 |
"recursively enumerate all expanded nodes |
|
1168 |
(depth first; parent before children)" |
|
1169 |
||
1170 |
self recursiveDo:[:each | |
|
1171 |
each isExpanded ifTrue:[ |
|
1172 |
aBlock value:each. |
|
1173 |
]. |
|
1174 |
]. |
|
1175 |
||
1176 |
"Created: / 16-10-2017 / 14:19:00 / cg" |
|
1177 |
! |
|
1178 |
||
4733 | 1179 |
collect:aBlock |
5363 | 1180 |
"for each child in the receiver (non recursive), evaluate the argument, aBlock |
4733 | 1181 |
and return a new collection with the results" |
1182 |
||
1183 |
|coll| |
|
1184 |
||
1185 |
coll := OrderedCollection new. |
|
1186 |
self do:[:el| coll add:(aBlock value:el) ]. |
|
1187 |
^ coll |
|
5363 | 1188 |
|
1189 |
"Modified (comment): / 25-11-2016 / 08:42:19 / cg" |
|
4733 | 1190 |
! |
1191 |
||
1192 |
contains:aBlock |
|
5363 | 1193 |
"evaluate aOneArgBlock for each of the receiver's children (non recursive). |
4733 | 1194 |
Return true and skip remaining elements, if aBlock ever returns true, |
1195 |
otherwise return false" |
|
1196 |
||
1197 |
self do:[:el | (aBlock value:el) ifTrue:[^ true] ]. |
|
1198 |
^ false |
|
5362 | 1199 |
|
5363 | 1200 |
"Modified (comment): / 25-11-2016 / 08:43:31 / cg" |
4733 | 1201 |
! |
1202 |
||
1203 |
do:aOneArgBlock |
|
5363 | 1204 |
"evaluate a block for each child (non recursive)" |
4733 | 1205 |
|
1206 |
self from:1 to:nil do:aOneArgBlock |
|
5363 | 1207 |
|
1208 |
"Modified (comment): / 25-11-2016 / 08:43:36 / cg" |
|
4733 | 1209 |
! |
1210 |
||
1211 |
from:startIndex do:aOneArgBlock |
|
1212 |
"evaluate a block on each child starting with the |
|
5362 | 1213 |
child at startIndex to the end." |
1214 |
||
4733 | 1215 |
self from:startIndex to:nil do:aOneArgBlock |
5362 | 1216 |
|
1217 |
"Modified (comment): / 25-11-2016 / 07:45:55 / cg" |
|
4733 | 1218 |
! |
1219 |
||
1220 |
from:startIndex reverseDo:aOneArgBlock |
|
5363 | 1221 |
"evaluate a block on each child (non recursive) starting at end to the startIndex" |
5362 | 1222 |
|
4733 | 1223 |
self from:startIndex to:nil reverseDo:aOneArgBlock |
5362 | 1224 |
|
5363 | 1225 |
"Modified (comment): / 25-11-2016 / 08:43:42 / cg" |
4733 | 1226 |
! |
1227 |
||
1228 |
from:startIndex to:endIndex do:aOneArgBlock |
|
5996 | 1229 |
"WARNING: may fetch lazy children |
1230 |
evaluate a block on each child (non recursive), |
|
5870 | 1231 |
starting with the child at startIndex to the endIndex (last index if nil). |
1232 |
Answer the value of the block executed on the last element." |
|
1233 |
||
1234 |
^ self synchronized:[ |
|
1235 |
self nonCriticalFrom:startIndex to:endIndex do:aOneArgBlock |
|
4733 | 1236 |
]. |
5363 | 1237 |
|
1238 |
"Modified (comment): / 25-11-2016 / 08:43:51 / cg" |
|
5840 | 1239 |
"Modified: / 28-07-2018 / 13:48:49 / Claus Gittinger" |
5870 | 1240 |
"Modified: / 02-08-2018 / 16:04:04 / Stefan Vogel" |
5996 | 1241 |
"Modified (comment): / 12-02-2019 / 18:49:58 / Claus Gittinger" |
4733 | 1242 |
! |
1243 |
||
1244 |
from:startIndex to:endIndex reverseDo:aOneArgBlock |
|
5996 | 1245 |
"WARNING: may fetch lazy children |
1246 |
evaluate a block on each child (non recursive), |
|
5363 | 1247 |
starting with the child at endIndex to the startIndex." |
4733 | 1248 |
|
5840 | 1249 |
self synchronized:[ |
1250 |
self size >= startIndex ifTrue:[ |
|
1251 |
self nonCriticalFrom:startIndex to:endIndex reverseDo:aOneArgBlock |
|
1252 |
]. |
|
4733 | 1253 |
]. |
5363 | 1254 |
|
1255 |
"Modified (comment): / 25-11-2016 / 08:43:58 / cg" |
|
5840 | 1256 |
"Modified: / 28-07-2018 / 13:49:17 / Claus Gittinger" |
5996 | 1257 |
"Modified (comment): / 12-02-2019 / 18:50:04 / Claus Gittinger" |
4733 | 1258 |
! |
1259 |
||
1260 |
keysAndValuesDo:aTwoArgBlock |
|
5363 | 1261 |
"evaluate the argument, aBlock for every child (non recursive), |
4733 | 1262 |
passing both index and element as arguments." |
1263 |
||
5840 | 1264 |
|key| |
4733 | 1265 |
|
1266 |
key := 1. |
|
1267 |
||
1268 |
self do:[:el| |
|
5840 | 1269 |
el value:key value:el. |
4733 | 1270 |
key := key + 1. |
1271 |
]. |
|
5363 | 1272 |
|
1273 |
"Modified (comment): / 25-11-2016 / 08:44:03 / cg" |
|
5840 | 1274 |
"Modified: / 28-07-2018 / 13:49:35 / Claus Gittinger" |
4733 | 1275 |
! |
1276 |
||
1277 |
keysAndValuesReverseDo:aTwoArgBlock |
|
5996 | 1278 |
"WARNING: may fetch lazy children |
1279 |
evaluate the argument, aBlock in reverse order for every child (non recursive), |
|
5362 | 1280 |
passing both index and element as arguments." |
4733 | 1281 |
|
5840 | 1282 |
self synchronized:[ |
1283 |
self size == 0 ifFalse:[ |
|
1284 |
self nonCriticalKeysAndValuesReverseDo:aTwoArgBlock |
|
1285 |
]. |
|
4733 | 1286 |
]. |
5362 | 1287 |
|
5363 | 1288 |
"Modified (comment): / 25-11-2016 / 08:44:06 / cg" |
5840 | 1289 |
"Modified: / 28-07-2018 / 13:50:14 / Claus Gittinger" |
5996 | 1290 |
"Modified (comment): / 12-02-2019 / 18:50:08 / Claus Gittinger" |
4733 | 1291 |
! |
1292 |
||
1293 |
recursiveCollect:aBlock |
|
1294 |
"for each child in the receiver, evaluate the argument, aBlock |
|
5363 | 1295 |
and return a new collection with the results. |
1296 |
Warning: this only enumerates already visible child elements |
|
1297 |
i.e. any collapsed items are not visited." |
|
4733 | 1298 |
|
1299 |
|coll| |
|
1300 |
||
1301 |
coll := OrderedCollection new. |
|
1302 |
self recursiveDo:[:el| coll add:(aBlock value:el) ]. |
|
1303 |
^ coll |
|
5363 | 1304 |
|
1305 |
"Modified (comment): / 25-11-2016 / 08:43:20 / cg" |
|
4733 | 1306 |
! |
1307 |
||
1308 |
recursiveDo:aOneArgBlock |
|
5996 | 1309 |
"WARNING: may fetch lazy children |
1310 |
evaluate a block on each item and all the sub-items. |
|
5363 | 1311 |
Warning: this only enumerates already visible child elements |
1312 |
i.e. any collapsed items are not visited." |
|
4733 | 1313 |
|
5840 | 1314 |
self do:[:aChild| "/ notice: do does it synchronized |
4733 | 1315 |
aOneArgBlock value:aChild. |
1316 |
aChild nonCriticalRecursiveDo:aOneArgBlock |
|
1317 |
]. |
|
5363 | 1318 |
|
1319 |
"Modified (comment): / 25-11-2016 / 08:43:04 / cg" |
|
5996 | 1320 |
"Modified (comment): / 12-02-2019 / 18:51:21 / Claus Gittinger" |
4733 | 1321 |
! |
1322 |
||
6047 | 1323 |
recursiveDo:aOneArgBlock skipIf:elementCheck skipChildrenIf:childrenCheck |
1324 |
"WARNING: may fetch lazy children |
|
1325 |
evaluate a block on each item and all the sub-items. |
|
1326 |
Warning: this only enumerates already visible child elements |
|
1327 |
i.e. any collapsed items are not visited." |
|
1328 |
||
1329 |
self do:[:aChild| "/ notice: do does it synchronized |
|
1330 |
(elementCheck value:aChild) ifFalse:[ |
|
1331 |
aOneArgBlock value:aChild. |
|
1332 |
]. |
|
1333 |
(childrenCheck value:aChild) ifFalse:[ |
|
1334 |
aChild nonCriticalRecursiveDo:aOneArgBlock |
|
1335 |
]. |
|
1336 |
]. |
|
1337 |
||
1338 |
"Created: / 07-05-2019 / 13:12:53 / Claus Gittinger" |
|
1339 |
! |
|
1340 |
||
4733 | 1341 |
recursiveReverseDo:aOneArgBlock |
5996 | 1342 |
"WARNING: may fetch lazy children |
1343 |
evaluate a block on each item and all the sub-items; |
|
5363 | 1344 |
proccesing children in reverse direction. |
1345 |
Warning: this only enumerates already visible child elements |
|
1346 |
i.e. any collapsed items are not visited." |
|
4733 | 1347 |
|
5840 | 1348 |
self reverseDo:[:aChild| "/ notice: reverseDo does it synchronized |
4733 | 1349 |
aChild nonCriticalRecursiveReverseDo:aOneArgBlock. |
1350 |
aOneArgBlock value:aChild. |
|
1351 |
]. |
|
5363 | 1352 |
|
1353 |
"Modified (comment): / 25-11-2016 / 08:43:09 / cg" |
|
5996 | 1354 |
"Modified (comment): / 12-02-2019 / 18:51:09 / Claus Gittinger" |
4733 | 1355 |
! |
1356 |
||
1357 |
recursiveSelect:aBlock |
|
5362 | 1358 |
"return a new collection with all children and subChildren from the receiver, |
5363 | 1359 |
for which the argument aBlock evaluates to true. |
1360 |
Warning: this only enumerates already visible child elements |
|
1361 |
i.e. any collapsed items are not visited." |
|
4733 | 1362 |
|
1363 |
|coll| |
|
1364 |
||
1365 |
coll := OrderedCollection new. |
|
1366 |
self recursiveDo:[:el| (aBlock value:el) ifTrue:[coll add:el] ]. |
|
1367 |
^ coll |
|
5362 | 1368 |
|
5363 | 1369 |
"Modified (comment): / 25-11-2016 / 08:43:12 / cg" |
4733 | 1370 |
! |
1371 |
||
1372 |
reverseDo:aOneArgBlock |
|
5363 | 1373 |
"evaluate a block on each child (non recursive) in reverse direction" |
4733 | 1374 |
|
1375 |
self from:1 reverseDo:aOneArgBlock |
|
5363 | 1376 |
|
1377 |
"Modified (comment): / 25-11-2016 / 08:44:12 / cg" |
|
4733 | 1378 |
! |
1379 |
||
1380 |
select:aBlock |
|
5363 | 1381 |
"return a new collection with all items from the receiver (non recursive), |
1382 |
for which the argument aBlock evaluates to true." |
|
4733 | 1383 |
|
1384 |
|coll| |
|
1385 |
||
1386 |
coll := OrderedCollection new. |
|
1387 |
self do:[:el| (aBlock value:el) ifTrue:[coll add:el] ]. |
|
1388 |
^ coll |
|
5363 | 1389 |
|
1390 |
"Modified (comment): / 25-11-2016 / 08:44:20 / cg" |
|
4733 | 1391 |
! |
1392 |
||
1393 |
withAllDo:aOneArgBlock |
|
5996 | 1394 |
"WARNING: may fetch lazy children |
1395 |
recursively evaluate aOneArgBlock on each item and subitem including self" |
|
4733 | 1396 |
|
1397 |
aOneArgBlock value:self. |
|
1398 |
||
5840 | 1399 |
self do:[:el| "/ do does it synchronized |
4733 | 1400 |
aOneArgBlock value:el. |
1401 |
el nonCriticalRecursiveDo:aOneArgBlock. |
|
1402 |
]. |
|
5363 | 1403 |
|
1404 |
"Modified (comment): / 25-11-2016 / 08:44:49 / cg" |
|
5996 | 1405 |
"Modified (comment): / 12-02-2019 / 18:50:40 / Claus Gittinger" |
4733 | 1406 |
! ! |
1407 |
||
1408 |
!AbstractHierarchicalItem methodsFor:'enumerating parents'! |
|
1409 |
||
5623 | 1410 |
allParents |
5925 | 1411 |
"return a collection of all parents (bottom to top, ie. in parent, grandparent, ... order)" |
5623 | 1412 |
|
1413 |
|parents| |
|
1414 |
||
1415 |
parents := OrderedCollection new. |
|
1416 |
self parentsDo:[:p | parents add:p]. |
|
1417 |
^ parents. |
|
1418 |
||
1419 |
"Created: / 16-10-2017 / 13:08:45 / cg" |
|
1420 |
! |
|
1421 |
||
4733 | 1422 |
parentsDetect:aBlock |
5925 | 1423 |
"find the first parent (bottom to top), for which evaluation of the block returns |
4733 | 1424 |
true; if none does so, report an error" |
1425 |
||
1426 |
^ self parentsDetect:aBlock ifNone:[self errorNotFound] |
|
1427 |
! |
|
1428 |
||
1429 |
parentsDetect:aBlock ifNone:anExceptionBlock |
|
5925 | 1430 |
"find the first parent (bottom to top), for which evaluation of the block returns |
4733 | 1431 |
true; if none does so, return the evaluation of anExceptionBlock" |
1432 |
||
5925 | 1433 |
self parentsDo:[:prnt | |
1434 |
(aBlock value:prnt) ifTrue:[^ prnt] |
|
4733 | 1435 |
]. |
1436 |
^ anExceptionBlock value |
|
5840 | 1437 |
|
1438 |
"Modified: / 28-07-2018 / 13:51:06 / Claus Gittinger" |
|
4733 | 1439 |
! |
1440 |
||
1441 |
parentsDo:aBlock |
|
5925 | 1442 |
"evaluate a block for each parent (bottom to top)" |
4733 | 1443 |
|
1444 |
|prnt| |
|
1445 |
||
1446 |
prnt := self. |
|
1447 |
||
5840 | 1448 |
self synchronized:[ |
4733 | 1449 |
[(prnt := prnt parent) notNil and:[prnt isHierarchicalItem]] whileTrue:[ |
1450 |
aBlock value:prnt |
|
1451 |
] |
|
1452 |
]. |
|
5840 | 1453 |
|
1454 |
"Modified: / 28-07-2018 / 13:51:22 / Claus Gittinger" |
|
4733 | 1455 |
! ! |
1456 |
||
1457 |
!AbstractHierarchicalItem methodsFor:'initialization'! |
|
1458 |
||
1459 |
initialize |
|
1460 |
self setExpanded:false |
|
1461 |
! ! |
|
1462 |
||
1463 |
!AbstractHierarchicalItem methodsFor:'private'! |
|
1464 |
||
1465 |
addVisibleChildrenTo:aList |
|
1466 |
"add all visible children and sub-children to the list" |
|
1467 |
||
1468 |
self isExpanded ifFalse:[^ self]. |
|
1469 |
||
5840 | 1470 |
self from:1 to:nil do:[:el| |
4733 | 1471 |
aList add:el. |
5996 | 1472 |
el isExpanded ifTrue:[ |
1473 |
el addVisibleChildrenTo:aList. |
|
1474 |
]. |
|
4733 | 1475 |
]. |
5840 | 1476 |
|
5996 | 1477 |
"Modified: / 12-02-2019 / 19:00:25 / Claus Gittinger" |
4733 | 1478 |
! |
1479 |
||
5998 | 1480 |
checkConsistency |
1481 |
|allChildrenDo idx expectedIndex| |
|
1482 |
||
1483 |
allChildrenDo := |
|
1484 |
[:item :action | |
|
1485 |
action value:item. |
|
1486 |
(item getChildren ? #()) do:[:subItem | |
|
1487 |
allChildrenDo value:subItem value:action |
|
1488 |
]. |
|
1489 |
]. |
|
1490 |
||
1491 |
idx := self listIndex. |
|
1492 |
self isExpanded ifFalse:[ |
|
1493 |
(self getChildren ? #()) do:[:eachChild | |
|
1494 |
allChildrenDo value:eachChild value:[:subItem | |
|
1495 |
self assert:(subItem listIndex isNil). |
|
1496 |
]. |
|
1497 |
]. |
|
1498 |
^ self. |
|
1499 |
]. |
|
1500 |
||
1501 |
expectedIndex := idx+1. |
|
1502 |
self getChildren do:[:eachChild | |
|
1503 |
self assert:(eachChild listIndex == expectedIndex). |
|
1504 |
expectedIndex := expectedIndex + 1 + eachChild numberOfVisibleChildren. |
|
1505 |
]. |
|
1506 |
||
1507 |
"Created: / 13-02-2019 / 12:31:24 / Claus Gittinger" |
|
1508 |
! |
|
1509 |
||
4733 | 1510 |
clearExpandedWhenLastChildWasRemoved |
5712 | 1511 |
"https://expeccoalm.exept.de/D227397 |
1512 |
Do not set #isExpanded to false just because #children is empty (may children appear 'again' later). |
|
1513 |
Do modify #isExpanded ONLY when a user presses the expand/collapse toggle, otherwise #isExpanded should be persistent. |
|
1514 |
||
1515 |
The user's preference if the item is expanded or collapsed should be kept, |
|
1516 |
regardless if there are chilren or not (even regardless anything else). |
|
1517 |
All other related things, like the drawing in case for #isExpanded is true and children is empty, |
|
1518 |
has to be solved within the drawing (or within any feature requesting this information)" |
|
1519 |
||
1520 |
^ false |
|
4733 | 1521 |
! |
1522 |
||
1523 |
criticalDo:aBlock |
|
5996 | 1524 |
<resource: #obsolete> |
5840 | 1525 |
self synchronized:aBlock |
5834 | 1526 |
|
1527 |
"Modified: / 23-07-2018 / 13:25:11 / Stefan Vogel" |
|
5840 | 1528 |
"Modified: / 28-07-2018 / 15:51:23 / Claus Gittinger" |
4733 | 1529 |
! |
1530 |
||
1531 |
listIndex |
|
5998 | 1532 |
"returns the index in the full list or nil; |
1533 |
for a non-visible root, 0 is returned" |
|
4733 | 1534 |
|
1535 |
|index model| |
|
1536 |
||
1537 |
(model := self model) notNil ifTrue:[ |
|
1538 |
index := model identityIndexOf:self. |
|
1539 |
||
1540 |
(index ~~ 0 or:[parent == model]) ifTrue:[ |
|
1541 |
^ index |
|
1542 |
] |
|
1543 |
]. |
|
1544 |
^ nil |
|
5998 | 1545 |
|
1546 |
"Modified (comment): / 13-02-2019 / 11:34:56 / Claus Gittinger" |
|
4733 | 1547 |
! |
1548 |
||
1549 |
numberOfVisibleChildren |
|
5996 | 1550 |
"returns the number of all visible children including subchildren, |
5998 | 1551 |
but excluding myself. |
1552 |
PseudoRecursive to avoid recursionError for very deep hierarchies." |
|
1553 |
||
1554 |
|count todo toCount itsChildren| |
|
4733 | 1555 |
|
1556 |
self isExpanded ifFalse:[^ 0]. |
|
5840 | 1557 |
|
1558 |
count := 0. |
|
5996 | 1559 |
todo := OrderedCollection with:self. |
1560 |
[todo notEmpty] whileTrue:[ |
|
1561 |
toCount := todo removeFirst. |
|
5998 | 1562 |
|
1563 |
itsChildren := toCount getChildren. |
|
6008 | 1564 |
itsChildren notNil ifTrue:[ |
1565 |
count := count + itsChildren size. |
|
1566 |
itsChildren do:[:each | |
|
1567 |
each isExpanded ifTrue:[ |
|
1568 |
todo add:each |
|
1569 |
]. |
|
5996 | 1570 |
]. |
6008 | 1571 |
]. |
4733 | 1572 |
]. |
5840 | 1573 |
^ count |
1574 |
||
6008 | 1575 |
"Modified: / 18-02-2019 / 18:36:17 / Claus Gittinger" |
4733 | 1576 |
! |
1577 |
||
1578 |
parentOrModel |
|
1579 |
"returns the parent without checking for item or model" |
|
1580 |
||
1581 |
^ parent |
|
5840 | 1582 |
! |
1583 |
||
5993 | 1584 |
setChildren:aCollectionOfChildrenOrNil |
5994 | 1585 |
children := aCollectionOfChildrenOrNil. |
1586 |
||
1587 |
Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ |
|
1588 |
children notNil ifTrue:[ |
|
1589 |
self assert:(children conform:[:each | each parent == self]). |
|
1590 |
]. |
|
1591 |
]. |
|
5993 | 1592 |
|
1593 |
"Created: / 03-02-2019 / 19:22:26 / Claus Gittinger" |
|
5994 | 1594 |
"Modified: / 06-02-2019 / 16:00:51 / Claus Gittinger" |
5993 | 1595 |
! |
1596 |
||
5840 | 1597 |
synchronized:aBlock |
6064 | 1598 |
"evaluate aBlock synchronized, i.e. use a monitor for this object; |
1599 |
return the value from aBlock" |
|
1600 |
||
5840 | 1601 |
|model| |
1602 |
||
1603 |
(model := self model) notNil ifTrue:[ |
|
5857 | 1604 |
^ model synchronized:aBlock |
5840 | 1605 |
] ifFalse:[ |
5977 | 1606 |
"/ self breakPoint:#cg. "/ should not happen |
5857 | 1607 |
^ aBlock value |
5840 | 1608 |
] |
1609 |
||
1610 |
"Created: / 28-07-2018 / 13:58:54 / Claus Gittinger" |
|
5857 | 1611 |
"Modified: / 29-07-2018 / 21:02:22 / Stefan Vogel" |
5977 | 1612 |
"Modified: / 21-12-2018 / 20:01:54 / Claus Gittinger" |
6064 | 1613 |
"Modified (comment): / 07-06-2019 / 13:51:36 / Claus Gittinger" |
4733 | 1614 |
! ! |
1615 |
||
1616 |
!AbstractHierarchicalItem methodsFor:'private-displaying'! |
|
1617 |
||
1618 |
displayLabel:aLabel h:lH on:aGC x:x y:y h:h |
|
1619 |
<resource: #obsolete> |
|
1620 |
||
1621 |
"display the label at x@y" |
|
1622 |
||
1623 |
"/ obsolete - left in for backward compatibility |
|
1624 |
self displayLabel:aLabel h:lH on:aGC x:x y:y h:h isHighlightedAsSelected:false |
|
1625 |
! |
|
1626 |
||
1627 |
displayLabel:aLabel h:lH on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected |
|
1628 |
"display the label at x@y" |
|
1629 |
||
4758
1095f8fdf167
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
1630 |
|y0| |
4733 | 1631 |
|
1632 |
lH ~~ 0 ifTrue:[ |
|
1633 |
y0 := y - ((lH + 1 - h) // 2). |
|
1634 |
y0 := y0 + (aLabel ascentOn:aGC). |
|
1635 |
||
1636 |
(aLabel isString not |
|
5821 | 1637 |
or:[(aLabel includes:(Character cr)) not]) ifTrue:[ |
4758
1095f8fdf167
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
1638 |
|labelShown| |
1095f8fdf167
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
1639 |
|
4733 | 1640 |
labelShown := aLabel. |
1641 |
isHighlightedAsSelected ifTrue:[ |
|
1642 |
(aLabel isText and:[aLabel hasChangeOfEmphasis]) ifTrue:[ |
|
1643 |
labelShown := Text string:aLabel string emphasisCollection:aLabel emphasis asArray. |
|
1644 |
labelShown emphasisAllRemove:#color. |
|
1645 |
]. |
|
1646 |
]. |
|
5821 | 1647 |
labelShown displayOn:aGC x:x y:y0. |
1648 |
^ self. |
|
4733 | 1649 |
]. |
1650 |
||
4758
1095f8fdf167
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
1651 |
aLabel asCollectionOfLines do:[:el| |
1095f8fdf167
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
1652 |
|labelShown| |
1095f8fdf167
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
1653 |
|
4733 | 1654 |
labelShown := el. |
1655 |
isHighlightedAsSelected ifTrue:[ |
|
1656 |
(el isText and:[el hasChangeOfEmphasis]) ifTrue:[ |
|
1657 |
labelShown := Text string:el string emphasisCollection:el emphasis asArray. |
|
1658 |
labelShown emphasisAllRemove:#color. |
|
1659 |
]. |
|
1660 |
]. |
|
1661 |
labelShown displayOn:aGC x:x y:y0. |
|
1662 |
y0 := y0 + (el heightOn:aGC) |
|
1663 |
] |
|
1664 |
]. |
|
1665 |
! |
|
1666 |
||
1667 |
heightOf:aLabel on:aGC |
|
1668 |
"returns the height of the label or 0" |
|
1669 |
||
1670 |
|h| |
|
1671 |
||
1672 |
aLabel isSequenceable ifFalse:[ |
|
1673 |
^ aLabel notNil ifTrue:[aLabel heightOn:aGC] ifFalse:[0] |
|
1674 |
]. |
|
1675 |
||
1676 |
aLabel isString ifFalse:[ |
|
1677 |
h := 0. |
|
1678 |
aLabel do:[:el|h := h max:(self heightOf:el on:aGC)]. |
|
4746
25341fd92e38
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4733
diff
changeset
|
1679 |
^ h |
4733 | 1680 |
]. |
1681 |
||
1682 |
h := 1 + (aLabel occurrencesOf:(Character cr)). |
|
1683 |
^ h * (aGC font height) |
|
1684 |
! |
|
1685 |
||
1686 |
widthOf:aLabel on:aGC |
|
1687 |
"returns the height of the label or 0" |
|
1688 |
||
1689 |
|w| |
|
1690 |
||
1691 |
aLabel isSequenceable ifFalse:[ |
|
1692 |
^ aLabel notNil ifTrue:[aLabel widthOn:aGC] ifFalse:[0] |
|
1693 |
]. |
|
1694 |
||
1695 |
aLabel isString ifFalse:[ |
|
1696 |
w := -5. |
|
1697 |
aLabel do:[:el|w := w + 5 + (self widthOf:el on:aGC)]. |
|
1698 |
^ w |
|
1699 |
]. |
|
1700 |
||
1701 |
(aLabel indexOf:(Character cr)) == 0 ifTrue:[ |
|
1702 |
^ aLabel widthOn:aGC |
|
1703 |
]. |
|
1704 |
||
1705 |
w := 0. |
|
1706 |
aLabel asCollectionOfLines do:[:el|w := w max:(el widthOn:aGC)]. |
|
1707 |
^ w |
|
1708 |
! ! |
|
1709 |
||
1710 |
!AbstractHierarchicalItem methodsFor:'private-enumerating'! |
|
1711 |
||
1712 |
nonCriticalDo:aOneArgBlock |
|
6026 | 1713 |
"WARNING: may fetch lazy children (i.e. calls #children) |
5996 | 1714 |
evaluate a block noncritical for each child. |
5840 | 1715 |
Not synchronized - should only be called internally |
1716 |
within a synchronized region." |
|
4733 | 1717 |
|
1718 |
^ self nonCriticalFrom:1 to:nil do:aOneArgBlock |
|
5840 | 1719 |
|
6026 | 1720 |
"Modified (comment): / 05-03-2019 / 09:37:32 / Claus Gittinger" |
4733 | 1721 |
! |
1722 |
||
1723 |
nonCriticalFrom:startIndex to:endIndex do:aOneArgBlock |
|
6026 | 1724 |
"WARNING: may fetch lazy children (i.e. calls #children) |
5996 | 1725 |
evaluate a block noncritical for each child starting with the |
6026 | 1726 |
child at startIndex to the endIndex (if nil: to end of list). |
1727 |
Returns the value of the last block's evaluation. |
|
5840 | 1728 |
Not synchronized - should only be called internally |
5870 | 1729 |
within a synchronized region. |
1730 |
Answer the value of the block executed on the last element." |
|
4733 | 1731 |
|
1732 |
|list size resp| |
|
1733 |
||
1734 |
list := self children. |
|
1735 |
size := list size. |
|
1736 |
||
1737 |
startIndex > size ifTrue:[^ nil]. |
|
1738 |
resp := nil. |
|
1739 |
||
1740 |
endIndex notNil ifTrue:[ |
|
1741 |
size := size min:endIndex |
|
1742 |
]. |
|
1743 |
startIndex to:size do:[:i| |
|
1744 |
|item| |
|
1745 |
||
1746 |
item := list at:i ifAbsent:nil. |
|
5996 | 1747 |
item isNil ifTrue:[self halt:'oops - lost child item?'. ^ resp]. |
4733 | 1748 |
resp := aOneArgBlock value:item. |
1749 |
]. |
|
1750 |
^ resp |
|
5840 | 1751 |
|
5870 | 1752 |
"Modified (comment): / 02-08-2018 / 16:02:13 / Stefan Vogel" |
5996 | 1753 |
"Modified: / 12-02-2019 / 16:55:20 / Claus Gittinger" |
6026 | 1754 |
"Modified (comment): / 05-03-2019 / 09:37:28 / Claus Gittinger" |
4733 | 1755 |
! |
1756 |
||
6026 | 1757 |
nonCriticalFrom:startIndex to:endIndexArg reverseDo:aOneArgBlock |
1758 |
"WARNING: may fetch lazy children (i.e. calls #children) |
|
5996 | 1759 |
evaluate a block non critical for each child starting with the |
6026 | 1760 |
child at endIndex (if nil: from the end of list) down to to startIndex. |
1761 |
Returns the value of the last block's evaluation. |
|
5840 | 1762 |
Not synchronized - should only be called internally |
1763 |
within a synchronized region." |
|
4733 | 1764 |
|
6026 | 1765 |
|list endIndex resp| |
4733 | 1766 |
|
1767 |
list := self children. |
|
6026 | 1768 |
endIndex := list size. |
4733 | 1769 |
resp := nil. |
1770 |
||
6026 | 1771 |
endIndexArg notNil ifTrue:[ |
1772 |
endIndex := endIndex min:endIndexArg |
|
4733 | 1773 |
]. |
6026 | 1774 |
endIndex to:startIndex by:-1 do:[:i| |
4733 | 1775 |
|item| |
1776 |
||
1777 |
item := list at:i ifAbsent:nil. |
|
1778 |
item isNil ifTrue:[^ resp]. |
|
1779 |
resp := aOneArgBlock value:item. |
|
1780 |
]. |
|
1781 |
^ resp |
|
5840 | 1782 |
|
6026 | 1783 |
"Modified (comment): / 05-03-2019 / 09:40:33 / Claus Gittinger" |
4733 | 1784 |
! |
1785 |
||
1786 |
nonCriticalKeysAndValuesReverseDo:aOneArgBlock |
|
6026 | 1787 |
"WARNING: may fetch lazy children (i.e. calls #children) |
5996 | 1788 |
evaluate the argument, aBlock in reverse order for every |
5840 | 1789 |
child, passing both index and element as arguments. |
1790 |
Not synchronized - should only be called internally |
|
1791 |
within a synchronized region." |
|
4733 | 1792 |
|
1793 |
|list size resp| |
|
1794 |
||
1795 |
list := self children. |
|
1796 |
size := list size. |
|
1797 |
resp := nil. |
|
1798 |
||
1799 |
size to:1 by:-1 do:[:i| |
|
1800 |
|item| |
|
1801 |
||
1802 |
item := list at:i ifAbsent:nil. |
|
1803 |
item isNil ifTrue:[^ resp]. |
|
1804 |
resp := aOneArgBlock value:i value:item. |
|
1805 |
]. |
|
1806 |
^ resp |
|
5840 | 1807 |
|
6026 | 1808 |
"Modified (comment): / 05-03-2019 / 09:37:35 / Claus Gittinger" |
4733 | 1809 |
! |
1810 |
||
1811 |
nonCriticalRecursiveDo:aOneArgBlock |
|
6026 | 1812 |
"WARNING: may fetch lazy children (i.e. calls #children) |
5996 | 1813 |
evaluate the block non critical for each item and all the sub-items. |
5840 | 1814 |
Not synchronized - should only be called internally |
1815 |
within a synchronized region." |
|
4733 | 1816 |
|
1817 |
self nonCriticalFrom:1 to:nil do:[:eachChild| |
|
1818 |
aOneArgBlock value:eachChild. |
|
1819 |
eachChild nonCriticalRecursiveDo:aOneArgBlock |
|
1820 |
]. |
|
5840 | 1821 |
|
6026 | 1822 |
"Modified (comment): / 05-03-2019 / 09:37:48 / Claus Gittinger" |
4733 | 1823 |
! |
1824 |
||
1825 |
nonCriticalRecursiveReverseDo:aOneArgBlock |
|
6026 | 1826 |
"WARNING: may fetch lazy children (i.e. calls #children) |
5996 | 1827 |
evaluate the block non critical for each item and all the sub-items; |
5840 | 1828 |
proccesing children in reverse direction. |
1829 |
Not synchronized - should only be called internally |
|
1830 |
within a synchronized region." |
|
4733 | 1831 |
|
1832 |
self nonCriticalFrom:1 to:nil reverseDo:[:eachChild| |
|
1833 |
eachChild nonCriticalRecursiveReverseDo:aOneArgBlock. |
|
1834 |
aOneArgBlock value:eachChild. |
|
1835 |
]. |
|
5840 | 1836 |
|
6026 | 1837 |
"Modified (comment): / 05-03-2019 / 09:37:52 / Claus Gittinger" |
4733 | 1838 |
! |
1839 |
||
1840 |
nonCriticalRecursiveSort:aSortBlock |
|
6026 | 1841 |
"recursively sort children using aSortBlock. |
1842 |
Does NOT fetch children (via #children), but sort the ones which are already present. |
|
5840 | 1843 |
Not synchronized - should only be called internally |
1844 |
within a synchronized region." |
|
4733 | 1845 |
|
1846 |
|unsorted sorted| |
|
1847 |
||
1848 |
unsorted := children. |
|
1849 |
||
1850 |
unsorted size ~~ 0 ifTrue:[ |
|
1851 |
sorted := unsorted sort:aSortBlock. |
|
1852 |
sorted do:[:el| el nonCriticalRecursiveSort:aSortBlock ]. |
|
5993 | 1853 |
self setChildren:sorted. |
4733 | 1854 |
]. |
5840 | 1855 |
|
5993 | 1856 |
"Modified: / 03-02-2019 / 19:24:03 / Claus Gittinger" |
6026 | 1857 |
"Modified (comment): / 05-03-2019 / 09:39:57 / Claus Gittinger" |
4733 | 1858 |
! ! |
1859 |
||
1860 |
!AbstractHierarchicalItem methodsFor:'private-hierarchy'! |
|
1861 |
||
1862 |
recursiveSetCollapsed |
|
5996 | 1863 |
<resource: #obsolete> |
4733 | 1864 |
"collapse all children and sub-children without notifications" |
1865 |
||
5840 | 1866 |
self synchronized:[ |
4733 | 1867 |
self recursiveSetCollapsedHelper |
1868 |
] |
|
5840 | 1869 |
|
1870 |
"Modified: / 28-07-2018 / 13:56:58 / Claus Gittinger" |
|
4733 | 1871 |
! |
1872 |
||
1873 |
recursiveSetCollapsedHelper |
|
1874 |
"private helper. |
|
1875 |
collapse all children and sub-children without notifications. |
|
5840 | 1876 |
Helper; not synchronized - should only be called internally |
5998 | 1877 |
within a synchronized region. |
1878 |
PseudoRecursive to avoid recursionError with deep hierarchies." |
|
4733 | 1879 |
|
5996 | 1880 |
|todo toCollapse| |
5998 | 1881 |
|
1882 |
self canRecursiveCollapse ifFalse:[^ self]. |
|
5996 | 1883 |
|
1884 |
todo := OrderedCollection with:self. |
|
1885 |
[todo notEmpty] whileTrue:[ |
|
1886 |
"/ do not call self size or self children; |
|
1887 |
"/ otherwise, children might will be autocreated !!!! |
|
1888 |
toCollapse := todo removeFirst. |
|
5998 | 1889 |
|
5996 | 1890 |
toCollapse setExpanded:false. |
6009 | 1891 |
(toCollapse getChildren ? #()) do:[:eachChild | |
5996 | 1892 |
eachChild canRecursiveCollapse ifTrue:[ |
1893 |
todo add:eachChild |
|
1894 |
]. |
|
5870 | 1895 |
] |
1896 |
]. |
|
5840 | 1897 |
|
5870 | 1898 |
"Modified: / 02-08-2018 / 16:07:35 / Stefan Vogel" |
6009 | 1899 |
"Modified: / 18-02-2019 / 18:37:49 / Claus Gittinger" |
4733 | 1900 |
! |
1901 |
||
1902 |
recursiveSetExpandedAndAddToList:aList |
|
5996 | 1903 |
<resource: #obsolete> |
4733 | 1904 |
"expand all children and sub-children without notifications; |
1905 |
add children to list" |
|
1906 |
||
5840 | 1907 |
self synchronized:[ |
4733 | 1908 |
self recursiveSetExpandedAndAddToListHelper:aList |
1909 |
]. |
|
5840 | 1910 |
|
1911 |
"Modified: / 28-07-2018 / 13:59:52 / Claus Gittinger" |
|
4733 | 1912 |
! |
1913 |
||
1914 |
recursiveSetExpandedAndAddToListHelper:aList |
|
1915 |
"private helper. |
|
1916 |
expand all children and sub-children without notifications; adds children to aList |
|
5840 | 1917 |
Helper; not synchronized - should only be called internally |
1918 |
within a synchronized region." |
|
4733 | 1919 |
|
5996 | 1920 |
|toDo work toExpand indexToAddAfter| |
1921 |
||
1922 |
toDo := OrderedCollection with:(self -> aList size). |
|
5925 | 1923 |
[ toDo notEmpty ] whileTrue:[ |
5996 | 1924 |
work := toDo removeFirst. |
1925 |
toExpand := work key. |
|
1926 |
indexToAddAfter := work value. |
|
5925 | 1927 |
toExpand setExpanded:true. |
5996 | 1928 |
(children := toExpand children) size > 0 ifTrue:[ |
1929 |
aList addAll:children afterIndex:indexToAddAfter. |
|
1930 |
children doWithIndex:[:eachChild :index | |
|
1931 |
eachChild canRecursiveExpand ifTrue:[ |
|
1932 |
toDo add:(eachChild -> (indexToAddAfter+index)) |
|
1933 |
]. |
|
5925 | 1934 |
]. |
4733 | 1935 |
]. |
1936 |
]. |
|
5840 | 1937 |
|
5996 | 1938 |
"Modified: / 12-02-2019 / 17:08:48 / Claus Gittinger" |
4733 | 1939 |
! ! |
1940 |
||
1941 |
!AbstractHierarchicalItem methodsFor:'private-to be redefined'! |
|
1942 |
||
4751
a1b6112d33ca
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4749
diff
changeset
|
1943 |
fetchChildren |
6019 | 1944 |
"should return the list of children via the model. |
1945 |
The default here is to return nil (no children). |
|
1946 |
*** redefine in subClass" |
|
1947 |
||
4751
a1b6112d33ca
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4749
diff
changeset
|
1948 |
^ nil |
6019 | 1949 |
|
1950 |
"Modified (comment): / 01-03-2019 / 19:53:38 / Claus Gittinger" |
|
4751
a1b6112d33ca
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4749
diff
changeset
|
1951 |
! |
a1b6112d33ca
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4749
diff
changeset
|
1952 |
|
4733 | 1953 |
heightOn:aGC |
1954 |
"return the height of the receiver, if it is to be displayed on aGC" |
|
1955 |
||
1956 |
self subclassResponsibility. |
|
1957 |
||
1958 |
"/ could in theory compute it for every draw operation; |
|
1959 |
"/ in practice, this is not a good idea, as it could make drawing very slow |
|
1960 |
"/ (unless that info can be easily computed) |
|
1961 |
||
1962 |
"/ so we force programmers to think about that issue and redefine this method |
|
1963 |
"/ as required. If compuation is really cheap, it can be redefined as: |
|
1964 |
"/ ^ self heightOf:(self label) on:aGC |
|
1965 |
! |
|
1966 |
||
1967 |
isExpanded |
|
1968 |
"returns true if the item is expanded" |
|
1969 |
||
1970 |
self subclassResponsibility |
|
1971 |
! |
|
1972 |
||
1973 |
makeWidthAndHeightUnknown |
|
1974 |
"invalidate any cached with/height information" |
|
1975 |
||
1976 |
"see comments in widthOn/heightOn" |
|
1977 |
self subclassResponsibility |
|
1978 |
! |
|
1979 |
||
1980 |
setExpanded:aBoolean |
|
1981 |
"set expanded flag without any computation or notification. |
|
1982 |
It is left to the subclasses responsibility, where this expanded state is stored; |
|
1983 |
could be in the model (as a list of expanded items), in the item itself (as boolean flag), |
|
1984 |
or somewhere else. |
|
1985 |
For huge trees, it may make sense to not store the expanded flag in a slot |
|
1986 |
(in order to save space). See CompactHierarchicalItem as a clever example of how it can be |
|
1987 |
stored without ANY additional space requirements." |
|
1988 |
||
1989 |
self subclassResponsibility |
|
1990 |
! |
|
1991 |
||
1992 |
widthOn:aGC |
|
1993 |
"return the width of the receiver, if it is to be displayed on aGC" |
|
1994 |
||
1995 |
self subclassResponsibility. |
|
1996 |
||
1997 |
"/ could in theory compute it for every draw operation; |
|
1998 |
"/ in practice, this is not a good idea, as it could make drawing very slow |
|
1999 |
"/ (unless that info can be easily computed) |
|
2000 |
||
2001 |
"/ so we force programmers to think about that issue and redefine this method |
|
2002 |
"/ as required. If compuation is really cheap, it can be redefined as: |
|
2003 |
"/ ^ self widthOf:(self label) on:aGC |
|
2004 |
! ! |
|
2005 |
||
2006 |
!AbstractHierarchicalItem methodsFor:'protocol-accessing'! |
|
2007 |
||
2008 |
children |
|
2009 |
"returns a list of children. When first asked, the list is fetched, if it was |
|
5116 | 2010 |
built lazily. |
4733 | 2011 |
*** to optimize: either redefine this or fetchChildren by subClass" |
2012 |
||
2013 |
children isNil ifTrue:[ |
|
5993 | 2014 |
self setChildren:(self fetchChildren) |
4733 | 2015 |
]. |
2016 |
^ children |
|
5993 | 2017 |
|
2018 |
"Modified: / 03-02-2019 / 19:23:55 / Claus Gittinger" |
|
4733 | 2019 |
! |
2020 |
||
2021 |
icon |
|
2022 |
"returns the icon or nil; |
|
2023 |
*** to optimize:redefine by subClass" |
|
2024 |
||
2025 |
|model| |
|
2026 |
||
2027 |
(model := self model) notNil ifTrue:[ |
|
2028 |
^ model iconFor:self |
|
2029 |
]. |
|
2030 |
^ nil |
|
2031 |
! |
|
2032 |
||
2033 |
label |
|
2034 |
"returns the label displayed on aGC; |
|
2035 |
*** to optimize:redefine by subClass" |
|
2036 |
||
2037 |
|model| |
|
2038 |
||
2039 |
(model := self model) notNil ifTrue:[ |
|
2040 |
^ model labelFor:self |
|
2041 |
]. |
|
2042 |
^ nil |
|
2043 |
! |
|
2044 |
||
2045 |
middleButtonMenu |
|
2046 |
"returns the items middleButtonMenu or nil if no menu is defined. |
|
2047 |
If nil is returned, the view is asked for a menu." |
|
2048 |
||
2049 |
<resource: #programMenu> |
|
2050 |
||
2051 |
|model| |
|
2052 |
||
2053 |
(model := self model) notNil ifTrue:[ |
|
2054 |
^ model middleButtonMenuFor:self |
|
2055 |
]. |
|
2056 |
^ nil |
|
2057 |
! |
|
2058 |
||
2059 |
recursiveSortChildren:aSortBlock |
|
5840 | 2060 |
self synchronized:[ |
2061 |
|children| |
|
2062 |
||
2063 |
(children := self children) notEmptyOrNil ifTrue:[ |
|
4733 | 2064 |
children sort:aSortBlock. |
2065 |
children do:[:aChild| aChild recursiveSortChildren:aSortBlock ] |
|
2066 |
] |
|
2067 |
]. |
|
5840 | 2068 |
|
2069 |
"Modified: / 28-07-2018 / 14:01:15 / Claus Gittinger" |
|
4733 | 2070 |
! |
2071 |
||
2072 |
sortChildren:aSortBlock |
|
2073 |
"sort the children inplace using the 2-arg block sortBlock for comparison" |
|
2074 |
||
2075 |
<resource: #obsolete> |
|
2076 |
self obsoleteMethodWarning:'use #sort:'. |
|
2077 |
self sort:aSortBlock. |
|
2078 |
! ! |
|
2079 |
||
2080 |
!AbstractHierarchicalItem methodsFor:'protocol-displaying'! |
|
2081 |
||
2082 |
displayIcon:anIcon atX:x y:y on:aGC |
|
2083 |
"called to draw the icon - can be redefined to manipulate the icon" |
|
2084 |
||
2085 |
anIcon displayOn:aGC x:x y:y. |
|
2086 |
! |
|
2087 |
||
2088 |
displayOn:aGC x:x y:y h:h |
|
2089 |
<resource: #obsolete> |
|
2090 |
"draw the receiver in the graphicsContext, aGC" |
|
2091 |
||
2092 |
"/ obsolete - left here for backward compatibility |
|
2093 |
self displayOn:aGC x:x y:y h:h isHighlightedAsSelected:false |
|
2094 |
! |
|
2095 |
||
2096 |
displayOn:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected |
|
2097 |
"draw the receiver in the graphicsContext, aGC" |
|
2098 |
||
2099 |
|label |
|
2100 |
x0 "{ Class:SmallInteger }"| |
|
2101 |
||
2102 |
label := self label. |
|
2103 |
label isNil ifTrue:[^ self]. |
|
2104 |
||
5325 | 2105 |
label isNonByteCollection ifFalse:[ |
4733 | 2106 |
^ self displayLabel:label h:(self heightOn:aGC) on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected |
2107 |
]. |
|
2108 |
||
2109 |
x0 := x. |
|
2110 |
label do:[:el| |
|
2111 |
el notNil ifTrue:[ |
|
2112 |
self displayLabel:el h:(self heightOf:el on:aGC) on:aGC x:x0 y:y h:h isHighlightedAsSelected:isHighlightedAsSelected. |
|
2113 |
x0 := x0 + 5 + (el widthOn:aGC). |
|
2114 |
]. |
|
2115 |
] |
|
2116 |
! ! |
|
2117 |
||
2118 |
!AbstractHierarchicalItem methodsFor:'protocol-event processing'! |
|
2119 |
||
2120 |
processButtonPress:button visibleX:visX visibleY: visY on: view |
|
2121 |
"A mouse button was pressed on myself. The visX/visY coordinates |
|
2122 |
are relative to the viewOrigin. |
|
2123 |
||
2124 |
If this method returns TRUE, the other method |
|
2125 |
#processButtonPress:x:y:on: IS NOT CALLED !!!!!! |
|
2126 |
" |
|
2127 |
||
2128 |
^false |
|
2129 |
||
2130 |
"Created: / 18-04-2013 / 09:56:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2131 |
"Modified (comment): / 18-04-2013 / 11:04:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2132 |
! |
|
2133 |
||
2134 |
processButtonPress:button x:x y:y |
|
2135 |
"a mouse button was pressed in my label. |
|
2136 |
Return true, if the event is eaten (ignored by the gc). |
|
2137 |
By default, false is returned (should be handled by the gc)." |
|
2138 |
||
2139 |
^ false |
|
2140 |
! |
|
2141 |
||
2142 |
processButtonPress:button x:x y:y on:aGC |
|
2143 |
"a mouse button was pressed in my label. |
|
2144 |
Return true, if the event is eaten (ignored by the gc). |
|
2145 |
By default, false is returned (should be handled by the gc)." |
|
2146 |
||
2147 |
^ self processButtonPress:button x:x y:y |
|
2148 |
! |
|
2149 |
||
2150 |
processButtonPressOnIcon:button on:aGC |
|
2151 |
"a mouse button was pressed in my icon. |
|
2152 |
Return true, if the event is eaten (ignored by the gc). |
|
2153 |
By default, false is returned (should be handled by the gc)." |
|
2154 |
||
2155 |
^ false |
|
2156 |
! ! |
|
2157 |
||
2158 |
!AbstractHierarchicalItem methodsFor:'protocol-monitoring'! |
|
2159 |
||
2160 |
monitoringCycle |
|
2161 |
"called every 'n' seconds by the model, if the monitoring |
|
2162 |
cycle is enabled. The item can perform some checks, .. |
|
2163 |
**** can be redefined by subclass to perform some actions |
|
2164 |
" |
|
2165 |
! ! |
|
2166 |
||
2167 |
!AbstractHierarchicalItem methodsFor:'protocol-queries'! |
|
2168 |
||
2169 |
canCollapse |
|
2170 |
"called before collapsing the item; can be redefined |
|
2171 |
by subclass to omit the collapse operation" |
|
2172 |
||
2173 |
^ self isExpanded |
|
2174 |
! |
|
2175 |
||
2176 |
canExpand |
|
2177 |
"called before expanding the item; can be redefined |
|
2178 |
by subclass to omit the expand operation" |
|
2179 |
||
2180 |
^ self hasChildren |
|
2181 |
! |
|
2182 |
||
2183 |
canRecursiveCollapse |
|
2184 |
"called before collapsing the item; can be redefined |
|
5998 | 2185 |
by subclass to omit the collapse operation. |
2186 |
Q: why is there an extra canRecursiveCollapse (i.e. not always using canCollapse)?" |
|
4733 | 2187 |
|
2188 |
^ self canCollapse |
|
5998 | 2189 |
|
2190 |
"Modified (comment): / 13-02-2019 / 12:14:03 / Claus Gittinger" |
|
4733 | 2191 |
! |
2192 |
||
2193 |
canRecursiveExpand |
|
6056 | 2194 |
"called before recursive expanding the item; |
2195 |
can be redefined by subclass to omit the expand operation" |
|
4733 | 2196 |
|
2197 |
^ self canExpand |
|
6056 | 2198 |
|
2199 |
"Modified (comment): / 27-05-2019 / 18:27:01 / Claus Gittinger" |
|
4733 | 2200 |
! |
2201 |
||
2202 |
drawHorizontalLineUpToText |
|
5802 | 2203 |
"draw the horizontal line for the selected item up to the text |
2204 |
or (by default) to the start of the vertical line; |
|
2205 |
only used by the hierarchical view |
|
4733 | 2206 |
" |
2207 |
^ false |
|
5802 | 2208 |
|
2209 |
"Modified (comment): / 12-06-2018 / 10:41:54 / Claus Gittinger" |
|
4733 | 2210 |
! |
2211 |
||
2212 |
hasChildren |
|
5991 | 2213 |
"checks whether the item has children; |
2214 |
here the children are fetched, and thus this may take some time. |
|
2215 |
*** to optimize: redefine in subClass (example: FileDirectory)" |
|
4733 | 2216 |
|
5720 | 2217 |
^ self children notEmptyOrNil |
2218 |
||
2219 |
"Modified: / 08-03-2018 / 19:37:45 / stefan" |
|
5991 | 2220 |
"Modified (comment): / 02-02-2019 / 14:51:59 / Claus Gittinger" |
4733 | 2221 |
! |
2222 |
||
2223 |
hasIndicator |
|
2224 |
"on default the indicator is drawn if the item has children" |
|
2225 |
||
2226 |
^ self hasChildren |
|
2227 |
! |
|
2228 |
||
2229 |
isSelectable |
|
2230 |
"returns true if the item is selectable. Can be redefined in subclasses" |
|
2231 |
||
2232 |
^ true |
|
2233 |
! |
|
2234 |
||
2235 |
string |
|
2236 |
"access the printable string used for stepping through a list |
|
2237 |
searching for an entry starting with a character. |
|
2238 |
*** to optimize:redefine by subClass" |
|
2239 |
||
2240 |
|label| |
|
2241 |
||
2242 |
(label := self label) notNil ifTrue:[ |
|
2243 |
label isString ifTrue:[ ^ label string ]. |
|
2244 |
label isImageOrForm ifTrue:[ ^ nil ]. |
|
2245 |
||
2246 |
label isSequenceable ifFalse:[ |
|
2247 |
^ label perform:#string ifNotUnderstood:nil |
|
2248 |
]. |
|
2249 |
||
2250 |
label do:[:el||s| |
|
2251 |
(el notNil and:[el isImageOrForm not]) ifTrue:[ |
|
2252 |
s := el perform:#string ifNotUnderstood:nil. |
|
2253 |
s notNil ifTrue:[^ s]. |
|
2254 |
] |
|
2255 |
] |
|
2256 |
]. |
|
2257 |
^ nil |
|
2258 |
! ! |
|
2259 |
||
2260 |
!AbstractHierarchicalItem methodsFor:'queries'! |
|
2261 |
||
2262 |
isChildOf:anItem |
|
5884 | 2263 |
"returns true if the item is a child (or grandchild or ...) of anItem" |
4733 | 2264 |
|
5840 | 2265 |
self synchronized:[ |
2266 |
|item| |
|
2267 |
||
2268 |
item := self. |
|
2269 |
||
2270 |
[anItem ~~ item] whileTrue:[ |
|
2271 |
((item := item parent) notNil and:[item isHierarchicalItem]) ifFalse:[ |
|
2272 |
^ false |
|
2273 |
] |
|
2274 |
]. |
|
4733 | 2275 |
]. |
2276 |
^ true |
|
5840 | 2277 |
|
2278 |
"Modified: / 28-07-2018 / 14:02:32 / Claus Gittinger" |
|
5884 | 2279 |
"Modified (comment): / 12-08-2018 / 12:49:16 / Claus Gittinger" |
4733 | 2280 |
! |
2281 |
||
2282 |
isCollapsed |
|
2283 |
"returns true if the item is collapsed" |
|
2284 |
||
2285 |
^ self isExpanded not |
|
2286 |
! |
|
2287 |
||
2288 |
isDirectoryItem |
|
2289 |
^ false |
|
2290 |
||
2291 |
"Created: / 23-06-2006 / 12:47:05 / fm" |
|
2292 |
"Modified: / 23-02-2007 / 12:04:23 / User" |
|
2293 |
! |
|
2294 |
||
2295 |
isHierarchicalItem |
|
2296 |
"used to decide if the parent is a hierarchical item or the model" |
|
2297 |
||
2298 |
^ true |
|
2299 |
! |
|
2300 |
||
2301 |
isRealChildOf:anItem |
|
2302 |
"returns true if the item is a child of anItem" |
|
2303 |
||
5840 | 2304 |
self synchronized:[ |
2305 |
|item| |
|
2306 |
item := self parent. |
|
2307 |
||
2308 |
[item notNil] whileTrue:[ |
|
2309 |
item == anItem ifTrue:[^ true]. |
|
2310 |
item := item parent. |
|
2311 |
]. |
|
4733 | 2312 |
]. |
2313 |
^ false |
|
5840 | 2314 |
|
2315 |
"Modified: / 28-07-2018 / 14:03:22 / Claus Gittinger" |
|
4733 | 2316 |
! |
2317 |
||
2318 |
isRootItem |
|
2319 |
"returns true if the item is the root item" |
|
2320 |
||
2321 |
^ parent isHierarchicalItem not |
|
2322 |
! |
|
2323 |
||
2324 |
size |
|
2325 |
"return the number of children" |
|
2326 |
||
2327 |
^ self children size |
|
2328 |
! ! |
|
2329 |
||
2330 |
!AbstractHierarchicalItem methodsFor:'searching'! |
|
2331 |
||
2332 |
detect:aOneArgBlock |
|
5363 | 2333 |
"find the first child (not recursive), for which evaluation of the block returns |
4733 | 2334 |
true; if none does so, report an error" |
2335 |
||
2336 |
^ self detect:aOneArgBlock ifNone:[self errorNotFound] |
|
5363 | 2337 |
|
2338 |
"Modified (comment): / 25-11-2016 / 08:40:16 / cg" |
|
4733 | 2339 |
! |
2340 |
||
2341 |
detect:aOneArgBlock ifNone:exceptionValue |
|
5363 | 2342 |
"find the first child (not recursive), for which evaluation of the block returns |
4733 | 2343 |
true; if none does so, return the value of anExceptionValue" |
2344 |
||
2345 |
self do:[:el| |
|
2346 |
(aOneArgBlock value:el) ifTrue:[^ el] |
|
2347 |
]. |
|
2348 |
^ exceptionValue value |
|
5363 | 2349 |
|
2350 |
"Modified (comment): / 25-11-2016 / 08:40:18 / cg" |
|
4733 | 2351 |
! |
2352 |
||
2353 |
detectLast:aOneArgBlock |
|
5363 | 2354 |
"find the last child (not recursive), for which evaluation of the block returns |
4733 | 2355 |
true; if none does so, an exception is raised" |
2356 |
||
2357 |
^ self detectLast:aOneArgBlock ifNone:[self errorNotFound] |
|
5363 | 2358 |
|
2359 |
"Modified (comment): / 25-11-2016 / 08:40:21 / cg" |
|
4733 | 2360 |
! |
2361 |
||
2362 |
detectLast:aOneArgBlock ifNone:anExceptionValue |
|
5363 | 2363 |
"find the last child (not recursive), for which evaluation of the block returns |
4733 | 2364 |
true; if none does so, return the value of anExceptionValue" |
2365 |
||
2366 |
self reverseDo:[:el| (aOneArgBlock value:el) ifTrue:[^ el] ]. |
|
2367 |
^ anExceptionValue value |
|
5363 | 2368 |
|
2369 |
"Modified (comment): / 25-11-2016 / 08:40:23 / cg" |
|
4733 | 2370 |
! |
2371 |
||
5624 | 2372 |
findChildByLabelPath:aLabelPath |
2373 |
"recursivly find the child by its label path. |
|
2374 |
A label path is an ordered collection (or array) of strings, |
|
2375 |
which are the labels of items (i.e. as retrived by labelPath)." |
|
2376 |
||
2377 |
|restPath searchedLabel childSearched| |
|
2378 |
||
2379 |
childSearched := self. |
|
2380 |
restPath := aLabelPath. |
|
2381 |
||
2382 |
[ |
|
2383 |
|subChild| |
|
2384 |
||
2385 |
restPath isEmptyOrNil ifTrue:[^ childSearched]. |
|
2386 |
||
2387 |
searchedLabel := restPath first string. |
|
2388 |
||
2389 |
subChild := childSearched detect:[:eachSubChild | eachSubChild label string = searchedLabel] ifNone:nil. |
|
2390 |
subChild isNil ifTrue:[^ nil]. |
|
2391 |
||
2392 |
childSearched := subChild. |
|
2393 |
restPath := restPath from:2. |
|
2394 |
] loop. |
|
2395 |
||
2396 |
"Created: / 16-10-2017 / 14:30:11 / cg" |
|
2397 |
! |
|
2398 |
||
4733 | 2399 |
findFirst:aOneArgBlock |
5363 | 2400 |
"find the first child (not recursive), for which evaluation of the argument, aOneArgBlock |
4733 | 2401 |
returns true; return its index or 0 if none detected." |
2402 |
||
2403 |
||
2404 |
self keysAndValuesDo:[:i :el| (aOneArgBlock value:el) ifTrue:[^ i] ]. |
|
2405 |
^ 0 |
|
5363 | 2406 |
|
2407 |
"Modified (comment): / 25-11-2016 / 08:40:25 / cg" |
|
4733 | 2408 |
! |
2409 |
||
5363 | 2410 |
findLast:aOneArgBlock |
2411 |
"find the last child (not recursive), for which evaluation of the argument, aOneArgBlock |
|
4733 | 2412 |
returns true; return its index or 0 if none detected." |
2413 |
||
5363 | 2414 |
self keysAndValuesReverseDo:[:i :el| (aOneArgBlock value:el) ifTrue:[^ i] ]. |
4733 | 2415 |
^ 0 |
5363 | 2416 |
|
2417 |
"Modified (format): / 25-11-2016 / 08:40:33 / cg" |
|
4733 | 2418 |
! |
2419 |
||
5864 | 2420 |
findNextInTreeForWhich:aBlock |
2421 |
"does a breadth-first search in the tree starting at the receiver |
|
2422 |
i.e. first goes down recursively, then up to the next child of the parent |
|
2423 |
(doing a recursive search there), |
|
2424 |
up until all of the top item's children have been visited. |
|
2425 |
Returns the found item or nil." |
|
2426 |
||
2427 |
|item nextItem itemsParent| |
|
2428 |
||
2429 |
item := self. |
|
2430 |
[item notNil] whileTrue:[ |
|
2431 |
item recursiveDo:[:eachChild | |
|
2432 |
(aBlock value:eachChild) ifTrue:[ |
|
2433 |
^ eachChild. |
|
2434 |
]. |
|
2435 |
]. |
|
2436 |
||
2437 |
itemsParent := item parent. |
|
2438 |
nextItem := nil. |
|
2439 |
||
2440 |
[ |
|
2441 |
|idx siblings| |
|
2442 |
||
2443 |
itemsParent isNil ifTrue:[ |
|
2444 |
^ nil |
|
2445 |
]. |
|
2446 |
siblings := itemsParent children. |
|
2447 |
idx := siblings identityIndexOf:item. |
|
2448 |
nextItem := siblings at:idx+1 ifAbsent:nil. |
|
2449 |
nextItem isNil ifTrue:[ |
|
2450 |
item := itemsParent. |
|
2451 |
itemsParent := itemsParent parent. |
|
2452 |
]. |
|
2453 |
] doWhile:[ nextItem isNil ]. |
|
2454 |
||
2455 |
item := nextItem. |
|
2456 |
(aBlock value:item) ifTrue:[ |
|
2457 |
^ item. |
|
2458 |
]. |
|
2459 |
]. |
|
2460 |
^ nil |
|
2461 |
||
2462 |
"Created: / 31-07-2018 / 09:01:11 / Claus Gittinger" |
|
2463 |
! |
|
2464 |
||
5885 | 2465 |
findPreviousInTreeForWhich:aBlock |
2466 |
"does a breadth-first search in the tree starting at the receiver |
|
2467 |
i.e. first goes down recursively, then up to the next child of the parent |
|
2468 |
(doing a recursive search there), |
|
2469 |
up until all of the top item's children have been visited. |
|
2470 |
Returns the found item or nil." |
|
2471 |
||
2472 |
|item itemsParent idx siblings prevItem| |
|
2473 |
||
2474 |
item := self. |
|
2475 |
[item notNil] whileTrue:[ |
|
2476 |
"/ previous sibling |
|
2477 |
itemsParent := item parent. |
|
2478 |
itemsParent isNil ifTrue:[ |
|
2479 |
^ nil |
|
2480 |
]. |
|
2481 |
siblings := itemsParent children. |
|
2482 |
idx := siblings identityIndexOf:item. |
|
2483 |
idx <= 1 ifTrue:[ |
|
2484 |
"/ continue in parent |
|
2485 |
item := itemsParent. |
|
2486 |
] ifFalse:[ |
|
2487 |
prevItem := siblings at:idx-1 ifAbsent:nil. |
|
2488 |
"/ continue in prev sibling's last child |
|
2489 |
item := prevItem. |
|
2490 |
[item children notEmptyOrNil] whileTrue:[ |
|
2491 |
item := item children last. |
|
2492 |
] |
|
2493 |
]. |
|
2494 |
item isNil ifTrue:[^ nil]. |
|
2495 |
item isRootItem ifTrue:[^ nil]. |
|
2496 |
||
2497 |
(aBlock value:item) ifTrue:[ |
|
2498 |
^ item. |
|
2499 |
]. |
|
2500 |
]. |
|
2501 |
^ nil |
|
2502 |
||
2503 |
"Created: / 13-08-2018 / 10:59:12 / Claus Gittinger" |
|
2504 |
! |
|
2505 |
||
4733 | 2506 |
identityIndexOf:aChild |
2507 |
"return the index of aChild or 0 if not found. Compare using ==" |
|
2508 |
||
2509 |
^ self identityIndexOf:aChild startingAt:1 |
|
2510 |
! |
|
2511 |
||
2512 |
identityIndexOf:aChild startingAt:startIndex |
|
2513 |
"return the index of aChild, starting search at startIndex. |
|
2514 |
Compare using ==; return 0 if not found" |
|
2515 |
||
2516 |
|index| |
|
2517 |
||
2518 |
index := startIndex. |
|
2519 |
||
2520 |
self from:startIndex do:[:el| |
|
2521 |
el == aChild ifTrue:[^ index ]. |
|
2522 |
index := index + 1. |
|
2523 |
]. |
|
2524 |
^ 0 |
|
2525 |
! |
|
2526 |
||
2527 |
recursiveDetect:aOneArgBlock |
|
2528 |
"recursive find the first child, for which evaluation |
|
2529 |
of the block returns true; if none, nil is returned. |
|
2530 |
Warning: this only searches in already visible child elements |
|
2531 |
i.e. any collapsed items are not searched." |
|
2532 |
||
2533 |
self recursiveDo:[:aChild| |
|
2534 |
(aOneArgBlock value:aChild) ifTrue:[^ aChild] |
|
2535 |
]. |
|
2536 |
^ nil |
|
2537 |
! |
|
2538 |
||
6048 | 2539 |
recursiveDetect:aOneArgBlock skipIf:elementCheck skipChildrenIf:childrenCheck |
2540 |
"recursive find the first child, for which evaluation |
|
2541 |
of the block returns true; if none, nil is returned. |
|
2542 |
Warning: this only searches in already visible child elements |
|
2543 |
i.e. any collapsed items are not searched." |
|
2544 |
||
2545 |
self |
|
2546 |
recursiveDo:[:aChild| |
|
2547 |
(aOneArgBlock value:aChild) ifTrue:[^ aChild] |
|
2548 |
] |
|
2549 |
skipIf:elementCheck skipChildrenIf:childrenCheck. |
|
2550 |
^ nil |
|
2551 |
||
2552 |
"Created: / 07-05-2019 / 13:14:03 / Claus Gittinger" |
|
2553 |
! |
|
2554 |
||
4733 | 2555 |
recursiveDetectLast:aBlock |
5363 | 2556 |
"recursive find the last child, for which evaluation of the block returns true; |
2557 |
if none does so, nil is returned. |
|
2558 |
Warning: this only searches in already visible child elements |
|
2559 |
i.e. any collapsed items are not searched." |
|
4733 | 2560 |
|
2561 |
self recursiveReverseDo:[:aChild| |
|
2562 |
(aBlock value:aChild) ifTrue:[^ aChild]. |
|
2563 |
]. |
|
2564 |
^ nil |
|
5363 | 2565 |
|
2566 |
"Modified (comment): / 25-11-2016 / 08:41:42 / cg" |
|
4733 | 2567 |
! |
2568 |
||
2569 |
withAllDetect:aOneArgBlock |
|
5363 | 2570 |
"recursive find the first item including self, |
2571 |
for which evaluation of the block returns true; if none nil is returned. |
|
2572 |
Warning: this only searches in already visible child elements |
|
2573 |
i.e. any collapsed items are not searched." |
|
4733 | 2574 |
|
2575 |
(aOneArgBlock value:self) ifTrue:[^ self]. |
|
2576 |
||
2577 |
^ self recursiveDetect:aOneArgBlock |
|
5363 | 2578 |
|
2579 |
"Modified (comment): / 25-11-2016 / 08:41:53 / cg" |
|
4733 | 2580 |
! ! |
2581 |
||
2582 |
!AbstractHierarchicalItem methodsFor:'sorting & reordering'! |
|
2583 |
||
2584 |
recursiveSort:aSortBlock |
|
2585 |
"recursive sort the children inplace using the 2-arg block sortBlock for comparison" |
|
2586 |
||
5840 | 2587 |
children notEmptyOrNil ifTrue:[ |
2588 |
self synchronized:[ |
|
2589 |
"/ check again (asynchronous update was possible before) |
|
2590 |
children notEmptyOrNil ifTrue:[ |
|
2591 |
self nonCriticalRecursiveSort:aSortBlock. |
|
2592 |
self childrenOrderChanged. |
|
2593 |
] |
|
4733 | 2594 |
] |
2595 |
]. |
|
5840 | 2596 |
|
2597 |
"Modified (format): / 28-07-2018 / 15:46:06 / Claus Gittinger" |
|
4733 | 2598 |
! |
2599 |
||
2600 |
sort:aSortBlock |
|
2601 |
"sort the children inplace using the 2-arg block sortBlock for comparison" |
|
2602 |
||
2603 |
children notEmptyOrNil ifTrue: [ |
|
5840 | 2604 |
self synchronized:[ |
4733 | 2605 |
"/ check again (asynchronous update was possible before) |
2606 |
children notEmptyOrNil ifTrue: [ |
|
5993 | 2607 |
self setChildren:(children sort:aSortBlock). |
4733 | 2608 |
self childrenOrderChanged. |
2609 |
] |
|
2610 |
]. |
|
2611 |
] |
|
5840 | 2612 |
|
5993 | 2613 |
"Modified: / 03-02-2019 / 19:24:20 / Claus Gittinger" |
4733 | 2614 |
! ! |
2615 |
||
2616 |
!AbstractHierarchicalItem class methodsFor:'documentation'! |
|
2617 |
||
2618 |
version |
|
4795
eead012852f9
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4758
diff
changeset
|
2619 |
^ '$Header$' |
4733 | 2620 |
! |
2621 |
||
2622 |
version_CVS |
|
4795
eead012852f9
class: AbstractHierarchicalItem
Claus Gittinger <cg@exept.de>
parents:
4758
diff
changeset
|
2623 |
^ '$Header$' |
4733 | 2624 |
! ! |
2625 |