author | tz |
Fri, 13 Mar 1998 23:33:15 +0100 | |
changeset 732 | 9320f2f0ae6e |
parent 731 | cd36a0c9ba62 |
child 736 | 6db5efc5df90 |
permissions | -rw-r--r-- |
300 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
||
15 |
||
731 | 16 |
ListSpecEditor subclass:#HierarchicalListEditor |
17 |
instanceVariableNames:'treeView' |
|
18 |
classVariableNames:'' |
|
300 | 19 |
poolDictionaries:'' |
20 |
category:'Interface-UIPainter' |
|
21 |
! |
|
22 |
||
23 |
!HierarchicalListEditor class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
||
39 |
||
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
731 | 44 |
The HierarchicalListEditor allows you to create, modify or just inspect |
45 |
(statical) hierarchical lists for the SelectionInListView. |
|
300 | 46 |
|
47 |
[start with:] |
|
48 |
HierarchicalListEditor open |
|
49 |
||
50 |
[see also:] |
|
51 |
UIPainter |
|
52 |
||
53 |
[author:] |
|
546 | 54 |
Claus Atzkern, eXept Software AG |
731 | 55 |
Thomas Zwick, eXept Software AG |
300 | 56 |
" |
57 |
||
58 |
||
59 |
||
60 |
! ! |
|
61 |
||
731 | 62 |
!HierarchicalListEditor class methodsFor:'instance creation'! |
63 |
||
64 |
openModalOnTreeItem: aTreeItem |
|
65 |
"Open a HierarchicalListEditor modal on aTreeItem" |
|
66 |
"self openModalOnTreeItem: (TreeItem name: 'Label' contents: #Contents)" |
|
67 |
||
68 |
^self new openModalOnTreeItem: aTreeItem |
|
69 |
||
70 |
! ! |
|
71 |
||
72 |
!HierarchicalListEditor class methodsFor:'accessing'! |
|
73 |
||
74 |
resourceType |
|
75 |
"get the type of resource of the method generated by the HierarchicalListEditor" |
|
76 |
||
77 |
^#hierarchicalList |
|
78 |
||
79 |
! ! |
|
80 |
||
551 | 81 |
!HierarchicalListEditor class methodsFor:'help specs'! |
82 |
||
83 |
helpSpec |
|
84 |
"return a dictionary filled with helpKey -> helptext associations. |
|
85 |
These are used by the activeHelp tool." |
|
86 |
||
87 |
" |
|
88 |
UIHelpTool openOnClass:HierarchicalListEditor |
|
89 |
" |
|
90 |
||
91 |
^ super helpSpec addPairsFrom:#( |
|
92 |
||
93 |
#addChild |
|
94 |
'Adds a new child item.' |
|
95 |
||
96 |
#addSister |
|
97 |
'Adds a new sister item.' |
|
98 |
||
581 | 99 |
#contents |
100 |
'Contents of the tree item.' |
|
101 |
||
731 | 102 |
#fileLoad |
103 |
'Opens a dialog for selecting and loading a hierarchical list spec from a class.' |
|
104 |
||
551 | 105 |
#fileNew |
106 |
'Creates a new hierarchical list.' |
|
107 |
||
731 | 108 |
#fileSave |
109 |
'Saves current hierarchical list spec.' |
|
552 | 110 |
|
731 | 111 |
#fileSaveAs |
112 |
'Opens a dialog to save current hierarchical list spec.' |
|
552 | 113 |
|
581 | 114 |
#label |
115 |
'Label of the tree item.' |
|
116 |
||
551 | 117 |
) |
118 |
! ! |
|
119 |
||
731 | 120 |
!HierarchicalListEditor class methodsFor:'image specs'! |
300 | 121 |
|
731 | 122 |
createChildIcon |
123 |
"Generated by the Image Editor" |
|
300 | 124 |
" |
731 | 125 |
ImageEditor openOnClass:self andSelector:#createChildIcon |
300 | 126 |
" |
127 |
||
731 | 128 |
<resource: #image> |
129 |
||
130 |
^Icon |
|
131 |
constantNamed:#'HierarchicalListEditor createChildIcon' |
|
132 |
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A<3L308@A33L33H@A30L33H@A33L33H@A<3L008@A?????8@C*****(@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8') ; yourself); yourself]! |
|
300 | 133 |
|
731 | 134 |
createSisterIcon |
135 |
"Generated by the Image Editor" |
|
136 |
" |
|
137 |
ImageEditor openOnClass:self andSelector:#createSisterIcon |
|
138 |
" |
|
139 |
||
140 |
<resource: #image> |
|
141 |
||
142 |
^Icon |
|
143 |
constantNamed:#'HierarchicalListEditor createSisterIcon' |
|
144 |
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A<L<O?8@A3<3??8@A<<<<C8@A?L?O?8@A0<0??8@A?????8@A0LCC?8@A<<?L?8@A<<CC?8@A<<?L?8@A<<CL?8@A?????8@C*****(@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8') ; yourself); yourself]! ! |
|
145 |
||
146 |
!HierarchicalListEditor class methodsFor:'interface specs'! |
|
300 | 147 |
|
148 |
windowSpec |
|
149 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
150 |
||
151 |
"do not manually edit this - the painter/builder may not be able to |
|
152 |
handle the specification if its corrupted." |
|
153 |
||
154 |
" |
|
155 |
UIPainter new openOnClass:HierarchicalListEditor andSelector:#windowSpec |
|
156 |
HierarchicalListEditor new openInterface:#windowSpec |
|
157 |
" |
|
158 |
"HierarchicalListEditor open" |
|
159 |
||
160 |
<resource: #canvas> |
|
161 |
||
162 |
^ |
|
163 |
||
164 |
#(#FullSpec |
|
731 | 165 |
#window: |
300 | 166 |
#(#WindowSpec |
731 | 167 |
#name: 'Hierarchical List Editor' |
168 |
#layout: #(#LayoutFrame 140 0 249 0 614 0 561 0) |
|
169 |
#label: 'Hierarchical List Editor' |
|
170 |
#min: #(#Point 10 10) |
|
171 |
#max: #(#Point 1160 870) |
|
172 |
#bounds: #(#Rectangle 140 249 615 562) |
|
173 |
#menu: #menu |
|
174 |
#usePreferredExtent: false |
|
300 | 175 |
) |
731 | 176 |
#component: |
300 | 177 |
#(#SpecCollection |
731 | 178 |
#collection: |
300 | 179 |
#( |
180 |
#(#MenuPanelSpec |
|
731 | 181 |
#name: 'menuToolbarView' |
182 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) |
|
183 |
#menu: #menuToolbar |
|
300 | 184 |
) |
185 |
#(#VariableHorizontalPanelSpec |
|
731 | 186 |
#name: 'VariableHorizontalPanel' |
187 |
#layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
|
188 |
#component: |
|
300 | 189 |
#(#SpecCollection |
731 | 190 |
#collection: |
300 | 191 |
#( |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
192 |
#(#ArbitraryComponentSpec |
731 | 193 |
#name: 'TreeView' |
194 |
#menu: #menuEdit |
|
195 |
#hasHorizontalScrollBar: true |
|
196 |
#hasVerticalScrollBar: true |
|
197 |
#miniScrollerHorizontal: true |
|
198 |
#miniScrollerVertical: true |
|
199 |
#component: #treeView |
|
200 |
#hasBorder: false |
|
300 | 201 |
) |
202 |
#(#ViewSpec |
|
731 | 203 |
#name: 'SpecView' |
204 |
#component: |
|
300 | 205 |
#(#SpecCollection |
731 | 206 |
#collection: |
300 | 207 |
#( |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
208 |
#(#LabelSpec |
731 | 209 |
#name: 'nameLabel' |
210 |
#layout: #(#AlignmentOrigin 108 0 26 0 1 0.5) |
|
211 |
#label: 'Label:' |
|
212 |
#resizeForLabel: true |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
213 |
) |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
214 |
#(#InputFieldSpec |
731 | 215 |
#name: 'labelInputField' |
216 |
#layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
217 |
#activeHelpKey: #label |
|
218 |
#tabable: true |
|
219 |
#model: #itemName |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
220 |
) |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
221 |
#(#LabelSpec |
731 | 222 |
#name: 'valueLabel' |
223 |
#layout: #(#AlignmentOrigin 108 0 52 0 1 0.5) |
|
224 |
#activeHelpKey: #contents |
|
225 |
#label: 'Contents:' |
|
226 |
#resizeForLabel: true |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
227 |
) |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
228 |
#(#InputFieldSpec |
731 | 229 |
#name: 'valueInputField' |
230 |
#layout: #(#LayoutFrame 110 0 41 0 -5 1.0 63 0) |
|
231 |
#activeHelpKey: #contents |
|
232 |
#tabable: true |
|
233 |
#model: #itemValue |
|
234 |
#type: #symbolOrNil |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
235 |
) |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
236 |
#(#UISubSpecification |
731 | 237 |
#name: 'SubSpecification' |
238 |
#layout: #(#LayoutFrame 2 0.0 -26 1.0 -2 1.0 -2 1.0) |
|
239 |
#majorKey: #ToolApplicationModel |
|
240 |
#minorKey: #windowSpecForCommit |
|
300 | 241 |
) |
242 |
) |
|
243 |
) |
|
731 | 244 |
#level: -1 |
300 | 245 |
) |
246 |
) |
|
247 |
) |
|
731 | 248 |
#handles: #(#Any 0.368421 1.0) |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
249 |
) |
484 | 250 |
#(#UISubSpecification |
731 | 251 |
#name: 'InfoBarSubSpec' |
252 |
#layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
253 |
#majorKey: #ToolApplicationModel |
|
254 |
#minorKey: #windowSpecForInfoBar |
|
300 | 255 |
) |
256 |
) |
|
257 |
) |
|
258 |
) |
|
259 |
! ! |
|
260 |
||
506 | 261 |
!HierarchicalListEditor class methodsFor:'menu specs'! |
262 |
||
263 |
menu |
|
264 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
265 |
||
266 |
"do not manually edit this - the builder may not be able to |
|
267 |
handle the specification if its corrupted." |
|
268 |
||
269 |
" |
|
270 |
MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menu |
|
271 |
(Menu new fromLiteralArrayEncoding:(HierarchicalListEditor menu)) startUp |
|
272 |
" |
|
273 |
||
274 |
<resource: #menu> |
|
275 |
||
276 |
^ |
|
277 |
||
278 |
#(#Menu |
|
279 |
||
280 |
#( |
|
281 |
#(#MenuItem |
|
731 | 282 |
#label: 'About' |
283 |
#labelImage: #(#ResourceRetriever nil #menuIcon) |
|
284 |
#submenuChannel: #menuAbout |
|
506 | 285 |
) |
286 |
#(#MenuItem |
|
731 | 287 |
#label: 'File' |
288 |
#submenu: |
|
506 | 289 |
#(#Menu |
290 |
||
291 |
#( |
|
292 |
#(#MenuItem |
|
731 | 293 |
#label: 'New' |
294 |
#value: #doNew |
|
295 |
#activeHelpKey: #fileNew |
|
506 | 296 |
) |
297 |
#(#MenuItem |
|
731 | 298 |
#label: '-' |
522 | 299 |
) |
300 |
#(#MenuItem |
|
731 | 301 |
#label: 'Load...' |
302 |
#translateLabel: true |
|
303 |
#value: #doLoad |
|
304 |
#activeHelpKey: #fileLoad |
|
506 | 305 |
) |
306 |
#(#MenuItem |
|
731 | 307 |
#label: '-' |
506 | 308 |
) |
309 |
#(#MenuItem |
|
731 | 310 |
#label: 'Save' |
311 |
#value: #doSave |
|
312 |
#activeHelpKey: #fileSave |
|
506 | 313 |
) |
314 |
#(#MenuItem |
|
731 | 315 |
#label: 'Save As...' |
316 |
#value: #doSaveAs |
|
317 |
#activeHelpKey: #fileSaveAs |
|
506 | 318 |
) |
319 |
#(#MenuItem |
|
731 | 320 |
#label: '-' |
506 | 321 |
) |
322 |
#(#MenuItem |
|
731 | 323 |
#label: 'Browse Class' |
324 |
#value: #doBrowseClass |
|
325 |
#activeHelpKey: #fileBrowseClass |
|
326 |
#enabled: #hasValidClass |
|
581 | 327 |
) |
328 |
#(#MenuItem |
|
731 | 329 |
#label: '-' |
581 | 330 |
) |
331 |
#(#MenuItem |
|
731 | 332 |
#label: 'Exit' |
333 |
#value: #closeRequest |
|
334 |
#activeHelpKey: #fileExit |
|
506 | 335 |
) |
336 |
) nil |
|
337 |
nil |
|
338 |
) |
|
339 |
) |
|
340 |
#(#MenuItem |
|
731 | 341 |
#label: 'Edit' |
342 |
#submenuChannel: #menuEdit |
|
506 | 343 |
) |
344 |
#(#MenuItem |
|
731 | 345 |
#label: 'Add' |
346 |
#submenu: |
|
522 | 347 |
#(#Menu |
348 |
||
349 |
#( |
|
350 |
#(#MenuItem |
|
731 | 351 |
#label: 'Child' |
352 |
#value: #doCreateChild |
|
353 |
#activeHelpKey: #addChild |
|
354 |
#enabled: #canCreateChildChannel |
|
355 |
#labelImage: #(#ResourceRetriever #HierarchicalListEditor #createChildIcon 'Child') |
|
522 | 356 |
) |
357 |
#(#MenuItem |
|
731 | 358 |
#label: 'Sister' |
359 |
#value: #doCreateSister |
|
360 |
#activeHelpKey: #addSister |
|
361 |
#enabled: #canCreateSisterChannel |
|
362 |
#labelImage: #(#ResourceRetriever #HierarchicalListEditor #createSisterIcon 'Sister') |
|
522 | 363 |
) |
364 |
) nil |
|
365 |
nil |
|
366 |
) |
|
367 |
) |
|
368 |
#(#MenuItem |
|
731 | 369 |
#label: 'History' |
370 |
#submenuChannel: #menuHistory |
|
371 |
) |
|
372 |
#(#MenuItem |
|
373 |
#label: 'Help' |
|
374 |
#startGroup: #right |
|
375 |
#submenuChannel: #menuHelp |
|
546 | 376 |
) |
506 | 377 |
) nil |
378 |
nil |
|
379 |
) |
|
380 |
! |
|
381 |
||
382 |
menuEdit |
|
383 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
384 |
||
385 |
"do not manually edit this - the builder may not be able to |
|
386 |
handle the specification if its corrupted." |
|
387 |
||
388 |
" |
|
389 |
MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menuEdit |
|
390 |
(Menu new fromLiteralArrayEncoding:(HierarchicalListEditor menuEdit)) startUp |
|
391 |
" |
|
392 |
||
393 |
<resource: #menu> |
|
394 |
||
395 |
^ |
|
396 |
||
397 |
#(#Menu |
|
398 |
||
399 |
#( |
|
400 |
#(#MenuItem |
|
731 | 401 |
#label: 'Cut' |
402 |
#value: #doCut |
|
403 |
#activeHelpKey: #editCut |
|
404 |
#enabled: #valueOfCanCut |
|
405 |
) |
|
406 |
#(#MenuItem |
|
407 |
#label: 'Copy' |
|
408 |
#value: #doCopy |
|
409 |
#activeHelpKey: #editCopy |
|
410 |
#enabled: #valueOfCanCopy |
|
506 | 411 |
) |
412 |
#(#MenuItem |
|
731 | 413 |
#label: 'Paste' |
414 |
#value: #doPaste |
|
415 |
#activeHelpKey: #editPaste |
|
416 |
#enabled: #valueOfCanPaste |
|
506 | 417 |
) |
418 |
#(#MenuItem |
|
731 | 419 |
#label: 'Delete' |
420 |
#value: #doDelete |
|
421 |
#activeHelpKey: #editPaste |
|
422 |
#enabled: #valueOfCanCut |
|
506 | 423 |
) |
424 |
#(#MenuItem |
|
731 | 425 |
#label: '-' |
506 | 426 |
) |
427 |
#(#MenuItem |
|
731 | 428 |
#label: 'Move Up' |
429 |
#value: #doStepUp |
|
430 |
#activeHelpKey: #editMoveUp |
|
431 |
#enabled: #canStepOverChannel |
|
432 |
#labelImage: #(#ResourceRetriever #ToolApplicationModel #upIcon 'Move Up') |
|
506 | 433 |
) |
434 |
#(#MenuItem |
|
731 | 435 |
#label: 'Move Down' |
436 |
#value: #doStepDown |
|
437 |
#activeHelpKey: #editMoveDown |
|
438 |
#enabled: #canStepOverChannel |
|
439 |
#labelImage: #(#ResourceRetriever #ToolApplicationModel #downIcon 'Move Down') |
|
506 | 440 |
) |
441 |
#(#MenuItem |
|
731 | 442 |
#label: 'Move In' |
443 |
#value: #doStepIn |
|
444 |
#activeHelpKey: #editMoveIn |
|
445 |
#enabled: #canStepInChannel |
|
446 |
#labelImage: #(#ResourceRetriever #ToolApplicationModel #downRightIcon 'Move In') |
|
506 | 447 |
) |
448 |
#(#MenuItem |
|
731 | 449 |
#label: 'Move Out' |
450 |
#value: #doStepOut |
|
451 |
#activeHelpKey: #editMoveOut |
|
452 |
#enabled: #canStepOutChannel |
|
453 |
#labelImage: #(#ResourceRetriever #ToolApplicationModel #leftDownIcon 'Move Out') |
|
506 | 454 |
) |
455 |
) nil |
|
456 |
nil |
|
457 |
) |
|
458 |
! |
|
459 |
||
460 |
menuToolbar |
|
461 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
462 |
||
463 |
"do not manually edit this - the builder may not be able to |
|
464 |
handle the specification if its corrupted." |
|
465 |
||
466 |
" |
|
467 |
MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menuToolbar |
|
468 |
(Menu new fromLiteralArrayEncoding:(HierarchicalListEditor menuToolbar)) startUp |
|
469 |
" |
|
470 |
||
471 |
<resource: #menu> |
|
472 |
||
473 |
^ |
|
474 |
||
475 |
#(#Menu |
|
476 |
||
477 |
#( |
|
478 |
#(#MenuItem |
|
731 | 479 |
#label: 'New' |
480 |
#isButton: true |
|
481 |
#value: #doNew |
|
482 |
#activeHelpKey: #fileNew |
|
483 |
#labelImage: #(#ResourceRetriever nil #newIcon) |
|
506 | 484 |
) |
485 |
#(#MenuItem |
|
731 | 486 |
#label: 'Load' |
487 |
#isButton: true |
|
488 |
#value: #doLoad |
|
489 |
#activeHelpKey: #fileLoad |
|
490 |
#labelImage: #(#ResourceRetriever nil #loadIcon) |
|
491 |
) |
|
492 |
#(#MenuItem |
|
493 |
#label: 'Save' |
|
494 |
#isButton: true |
|
495 |
#value: #doSave |
|
496 |
#activeHelpKey: #fileSave |
|
497 |
#labelImage: #(#ResourceRetriever nil #saveIcon) |
|
506 | 498 |
) |
499 |
#(#MenuItem |
|
731 | 500 |
#label: '' |
501 |
) |
|
502 |
#(#MenuItem |
|
503 |
#label: 'Cut' |
|
504 |
#isButton: true |
|
505 |
#value: #doCut |
|
506 |
#activeHelpKey: #editCut |
|
507 |
#enabled: #valueOfCanCut |
|
508 |
#labelImage: #(#ResourceRetriever nil #cutIcon) |
|
506 | 509 |
) |
510 |
#(#MenuItem |
|
731 | 511 |
#label: 'Copy' |
512 |
#isButton: true |
|
513 |
#value: #doCopy |
|
514 |
#activeHelpKey: #editCopy |
|
515 |
#enabled: #valueOfCanCopy |
|
516 |
#labelImage: #(#ResourceRetriever nil #copyIcon) |
|
506 | 517 |
) |
518 |
#(#MenuItem |
|
731 | 519 |
#label: 'Paste' |
520 |
#isButton: true |
|
521 |
#value: #doPaste |
|
522 |
#activeHelpKey: #editPaste |
|
523 |
#enabled: #valueOfCanPaste |
|
524 |
#labelImage: #(#ResourceRetriever nil #pasteIcon) |
|
506 | 525 |
) |
526 |
#(#MenuItem |
|
731 | 527 |
#label: 'Delete' |
528 |
#isButton: true |
|
529 |
#value: #doDelete |
|
530 |
#activeHelpKey: #editDelete |
|
531 |
#enabled: #valueOfCanCut |
|
532 |
#labelImage: #(#ResourceRetriever nil #deleteIcon) |
|
533 |
) |
|
534 |
#(#MenuItem |
|
535 |
#label: '' |
|
506 | 536 |
) |
537 |
#(#MenuItem |
|
731 | 538 |
#label: 'Add Child' |
539 |
#isButton: true |
|
540 |
#value: #doCreateChild |
|
541 |
#activeHelpKey: #addChild |
|
542 |
#enabled: #canCreateChildChannel |
|
543 |
#labelImage: #(#ResourceRetriever nil #createChildIcon) |
|
544 |
) |
|
545 |
#(#MenuItem |
|
546 |
#label: 'Add Sister' |
|
547 |
#isButton: true |
|
548 |
#value: #doCreateSister |
|
549 |
#activeHelpKey: #addSister |
|
550 |
#enabled: #canCreateSisterChannel |
|
551 |
#labelImage: #(#ResourceRetriever nil #createSisterIcon) |
|
552 |
) |
|
553 |
#(#MenuItem |
|
554 |
#label: '' |
|
506 | 555 |
) |
556 |
#(#MenuItem |
|
731 | 557 |
#label: 'Move Up' |
558 |
#isButton: true |
|
559 |
#value: #doStepUp |
|
560 |
#activeHelpKey: #editMoveUp |
|
561 |
#enabled: #canStepOverChannel |
|
562 |
#labelImage: #(#ResourceRetriever nil #upIcon) |
|
506 | 563 |
) |
564 |
#(#MenuItem |
|
731 | 565 |
#label: 'Move Down' |
566 |
#isButton: true |
|
567 |
#value: #doStepDown |
|
568 |
#activeHelpKey: #editMoveDown |
|
569 |
#enabled: #canStepOverChannel |
|
570 |
#labelImage: #(#ResourceRetriever nil #downIcon) |
|
506 | 571 |
) |
572 |
#(#MenuItem |
|
731 | 573 |
#label: 'Move In' |
574 |
#isButton: true |
|
575 |
#value: #doStepIn |
|
576 |
#activeHelpKey: #editMoveIn |
|
577 |
#enabled: #canStepInChannel |
|
578 |
#labelImage: #(#ResourceRetriever nil #downRightIcon) |
|
579 |
) |
|
580 |
#(#MenuItem |
|
581 |
#label: 'Move Out' |
|
582 |
#isButton: true |
|
583 |
#value: #doStepOut |
|
584 |
#activeHelpKey: #editMoveOut |
|
585 |
#enabled: #canStepOutChannel |
|
586 |
#labelImage: #(#ResourceRetriever nil #leftDownIcon) |
|
506 | 587 |
) |
588 |
) nil |
|
589 |
nil |
|
590 |
) |
|
591 |
! ! |
|
592 |
||
300 | 593 |
!HierarchicalListEditor class methodsFor:'printing'! |
594 |
||
595 |
prettyPrintArray:anArray on:aStream indent:anIndent |
|
596 |
"print a literal array in a nice format |
|
597 |
" |
|
598 |
|arg sol| |
|
599 |
||
600 |
sol := aStream position. |
|
601 |
aStream spaces:anIndent. |
|
602 |
aStream nextPutAll:'#('. |
|
603 |
||
604 |
anArray first isSymbol ifTrue:[ |
|
605 |
arg := anArray first. |
|
606 |
aStream nextPut:$#. |
|
607 |
aStream nextPutAll:anArray first. |
|
608 |
aStream cr. |
|
609 |
anArray size == 2 ifTrue:[ |
|
610 |
self prettyPrintArray:(anArray last) |
|
611 |
on:aStream |
|
612 |
indent:(anIndent + 4). |
|
613 |
]. |
|
614 |
aStream spaces:anIndent. |
|
615 |
aStream nextPut:$). |
|
616 |
^ self |
|
617 |
]. |
|
618 |
||
619 |
aStream nextPut:$'. |
|
620 |
aStream nextPutAll:(anArray at:1). |
|
621 |
aStream nextPut:$'. |
|
622 |
arg := anArray at:2 ifAbsent:nil. |
|
623 |
||
624 |
arg isString ifTrue:[ |
|
625 |
aStream spaces:((50 - (aStream position - sol)) max:4). |
|
626 |
||
627 |
arg isSymbol ifTrue:[ |
|
628 |
aStream nextPut:$#. |
|
629 |
]. |
|
630 |
aStream nextPut:$'. |
|
631 |
aStream nextPutAll:arg. |
|
632 |
aStream nextPut:$'. |
|
633 |
arg := anArray at:3 ifAbsent:nil. |
|
634 |
]. |
|
635 |
arg isArray ifTrue:[ |
|
636 |
aStream nextPutAll:' #('. |
|
637 |
aStream cr. |
|
638 |
arg do:[:e|self prettyPrintArray:e on:aStream indent:(anIndent + 4)]. |
|
639 |
aStream spaces:anIndent. |
|
640 |
aStream nextPut:$). |
|
641 |
]. |
|
642 |
aStream nextPut:$). |
|
643 |
aStream cr. |
|
644 |
! ! |
|
645 |
||
646 |
!HierarchicalListEditor methodsFor:'aspects'! |
|
647 |
||
648 |
canCreateChildChannel |
|
649 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
650 |
^builder booleanValueAspectFor:#canCreateChildChannel |
300 | 651 |
|
652 |
! |
|
653 |
||
654 |
canCreateSisterChannel |
|
655 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
656 |
^builder booleanValueAspectFor:#canCreateSisterChannel |
300 | 657 |
|
658 |
! |
|
659 |
||
660 |
canStepInChannel |
|
661 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
662 |
^builder booleanValueAspectFor:#canStepInChannel |
300 | 663 |
|
664 |
! |
|
665 |
||
666 |
canStepOutChannel |
|
667 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
668 |
^builder booleanValueAspectFor:#canStepOutChannel |
300 | 669 |
|
670 |
! |
|
671 |
||
672 |
canStepOverChannel |
|
673 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
674 |
^builder booleanValueAspectFor:#canStepOverChannel |
300 | 675 |
|
676 |
! |
|
677 |
||
678 |
itemName |
|
679 |
||
680 |
|holder| |
|
681 |
||
682 |
(holder := builder bindingAt:#itemName) isNil ifTrue:[ |
|
683 |
builder aspectAt:#itemName put:(holder := ValueHolder new). |
|
684 |
holder addDependent:self. |
|
685 |
]. |
|
686 |
^ holder |
|
687 |
! |
|
688 |
||
689 |
itemValue |
|
690 |
||
691 |
|holder| |
|
692 |
||
693 |
(holder := builder bindingAt:#itemValue) isNil ifTrue:[ |
|
694 |
builder aspectAt:#itemValue put:(holder := ValueHolder new). |
|
695 |
holder addDependent:self. |
|
696 |
]. |
|
697 |
^ holder |
|
698 |
! |
|
699 |
||
700 |
treeView |
|
701 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
702 |
^treeView |
300 | 703 |
! ! |
704 |
||
731 | 705 |
!HierarchicalListEditor methodsFor:'building'! |
706 |
||
707 |
buildFromClass:aClass andSelector:aSelector |
|
708 |
"rebuild window from a class and selector" |
|
709 |
||
710 |
|cls sel anchor| |
|
300 | 711 |
|
731 | 712 |
cls := self resolveName:aClass. |
713 |
specSelector := nil. |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
714 |
|
731 | 715 |
aSelector size ~~ 0 |
716 |
ifTrue: |
|
717 |
[ |
|
718 |
sel := aSelector asString withoutSeparators. |
|
719 |
sel size ~~ 0 ifTrue:[specSelector := sel asSymbol] |
|
720 |
]. |
|
721 |
treeView selection:nil. |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
722 |
|
731 | 723 |
(specSelector notNil and:[cls notNil]) |
724 |
ifTrue: |
|
725 |
[ |
|
726 |
(cls respondsTo:specSelector) |
|
727 |
ifTrue: |
|
728 |
[ |
|
729 |
anchor := cls perform:specSelector. |
|
730 |
anchor isArray ifTrue:[anchor := anchor decodeAsLiteralArray] |
|
731 |
]. |
|
732 |
]. |
|
733 |
anchor notNil |
|
734 |
ifTrue: [anchor expand. treeView root:anchor] |
|
735 |
ifFalse: [treeView root isNil ifTrue: [self buildRoot]]. |
|
581 | 736 |
|
731 | 737 |
treeView selection: 1. |
581 | 738 |
|
731 | 739 |
self updateHistory. |
740 |
self updateInfoLabel. |
|
741 |
||
742 |
||
743 |
||
744 |
! |
|
745 |
||
746 |
buildFromListSpec: aListSpec |
|
581 | 747 |
|
731 | 748 |
treeView root: aListSpec |
749 |
||
750 |
! |
|
751 |
||
752 |
buildRoot |
|
753 |
"build just a root" |
|
754 |
||
755 |
treeView root:(TreeItem name:'Root' contents:#Anchor). |
|
756 |
treeView selection:1. |
|
581 | 757 |
! ! |
758 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
759 |
!HierarchicalListEditor methodsFor:'private'! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
760 |
|
731 | 761 |
getDepthAndSistersNumberOfNode: aNode onParentNode: aParentNode |
762 |
"return depth of selected node" |
|
763 |
||
764 |
|parent childNode depthAndSistersNumbers str| |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
765 |
|
731 | 766 |
depthAndSistersNumbers := OrderedCollection new. |
767 |
childNode := aNode. |
|
768 |
parent := aParentNode. |
|
769 |
[parent notNil] |
|
770 |
whileTrue: |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
771 |
[ |
731 | 772 |
depthAndSistersNumbers add: (parent children indexOf: childNode). |
773 |
childNode := parent. |
|
774 |
parent := parent parent. |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
775 |
]. |
731 | 776 |
depthAndSistersNumbers removeFirst; addFirst: aParentNode children size. |
777 |
str := ''. |
|
778 |
depthAndSistersNumbers reverseDo: [:n| str := str, n printString, '.']. |
|
779 |
^str copyFrom: 1 to: str size - 1 |
|
506 | 780 |
! |
781 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
782 |
newItem |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
783 |
"creates and returns a new default item" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
784 |
|
558 | 785 |
^TreeItem name: 'Item' contents: nil |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
786 |
! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
787 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
788 |
updateChannels |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
789 |
"update channels" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
790 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
791 |
|node parent chnStepIn chnStepOut chnStepOvr chnChild chnSister| |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
792 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
793 |
chnStepIn := chnStepOut := chnStepOvr := chnChild := chnSister := false. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
794 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
795 |
(node := treeView selectedNode) notNil |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
796 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
797 |
[ |
731 | 798 |
(builder componentAt: #SpecView) beVisible. |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
799 |
chnChild := true. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
800 |
(parent := node parent) notNil |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
801 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
802 |
[ |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
803 |
chnSister := true. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
804 |
chnStepOvr := parent numberOfChildren > 1. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
805 |
chnStepOut := parent parent notNil. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
806 |
chnStepIn := node ~~ parent lastChild |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
807 |
] |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
808 |
] |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
809 |
ifFalse: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
810 |
[ |
731 | 811 |
(builder componentAt: #SpecView) beInvisible |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
812 |
]. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
813 |
self canCreateChildChannel value:chnChild. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
814 |
self canCreateSisterChannel value:chnSister. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
815 |
self canStepOverChannel value:chnStepOvr. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
816 |
self canStepOutChannel value:chnStepOut. |
506 | 817 |
self canStepInChannel value:chnStepIn. |
818 |
||
731 | 819 |
self valueOfCanCut value: (treeView selection notNil |
820 |
ifTrue:[(treeView isInSelection:1) not] |
|
821 |
ifFalse: [false]). |
|
506 | 822 |
|
731 | 823 |
self valueOfCanCopy value: self valueOfCanCut value. |
824 |
||
825 |
self valueOfCanPaste value: (self class clipboard notNil and:[treeView selectedNode notNil]). |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
826 |
! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
827 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
828 |
updateInputFields |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
829 |
"reload item value into input fields" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
830 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
831 |
|node| |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
832 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
833 |
(node := treeView selectedNode) notNil |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
834 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
835 |
[ |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
836 |
self itemName value:node name. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
837 |
self itemValue value:node contents |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
838 |
] |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
839 |
ifFalse: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
840 |
[ |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
841 |
self itemName value:''. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
842 |
self itemValue value:nil |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
843 |
]. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
844 |
self valueOfEnablingCommitButtons value: false |
300 | 845 |
! ! |
846 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
847 |
!HierarchicalListEditor methodsFor:'startup / release'! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
848 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
849 |
initialize |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
850 |
"setup default values" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
851 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
852 |
super initialize. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
853 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
854 |
treeView := SelectionInTreeView new. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
855 |
treeView multipleSelectOk: true. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
856 |
treeView showDirectoryIndicator: true. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
857 |
treeView showDirectoryIndicatorForRoot: false. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
858 |
treeView action:[:aNr| self updateChannels. self updateInputFields]. |
731 | 859 |
treeView selectConditionBlock: [:i|self askForItemModification]. |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
860 |
treeView validateDoubleClickBlock: [:node| node ~~ treeView model list first]. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
861 |
! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
862 |
|
731 | 863 |
openModalOnTreeItem: aTreeItem |
864 |
"build a tree from aTreeItem and open it modal" |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
865 |
|
731 | 866 |
super openModalOnListSpec: aTreeItem |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
867 |
! ! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
868 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
869 |
!HierarchicalListEditor methodsFor:'user actions'! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
870 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
871 |
accept |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
872 |
"invoked by button 'OK'" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
873 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
874 |
|node index| |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
875 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
876 |
(index := treeView selectedIndex) ~~ 0 |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
877 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
878 |
[ |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
879 |
node := treeView nodeAtIndex:index. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
880 |
node name: self itemName value. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
881 |
node contents: self itemValue value. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
882 |
treeView redrawLine:index. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
883 |
]. |
731 | 884 |
modified := true. |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
885 |
self valueOfEnablingCommitButtons value: false |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
886 |
! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
887 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
888 |
cancel |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
889 |
"invoked by button 'Cancel'" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
890 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
891 |
self updateInputFields. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
892 |
|
731 | 893 |
modified := false. |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
894 |
self valueOfEnablingCommitButtons value: false |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
895 |
! |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
896 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
897 |
doCopy |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
898 |
"copy current selected nodes into copy buffer" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
899 |
|
731 | 900 |
self class clipboard: OrderedCollection new. |
901 |
treeView selectedNodesDo:[:aNode| self class clipboard add: aNode copy] |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
902 |
|
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
903 |
! |
300 | 904 |
|
905 |
doCreateChild |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
906 |
"create a child within selected parent" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
907 |
|
558 | 908 |
|node newItem| |
300 | 909 |
|
731 | 910 |
((node := treeView selectedNode) notNil and: [self askForItemModification]) |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
911 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
912 |
[ |
558 | 913 |
treeView model add: (newItem := self newItem) afterIndex: node children size below:node. |
914 |
newItem name: 'Child ', (self getDepthAndSistersNumberOfNode: newItem onParentNode: node). |
|
300 | 915 |
treeView selectedNodeExpand:true. |
558 | 916 |
treeView selectNode: newItem. |
300 | 917 |
self updateChannels. |
731 | 918 |
modified := true |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
919 |
] |
300 | 920 |
! |
921 |
||
922 |
doCreateSister |
|
923 |
"create a sister next to selected item |
|
924 |
" |
|
558 | 925 |
|node newItem| |
300 | 926 |
|
731 | 927 |
((node := treeView selectedNode) notNil and: [self askForItemModification]) |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
928 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
929 |
[ |
558 | 930 |
newItem := self newItem. |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
931 |
node parent notNil |
562 | 932 |
ifTrue: [treeView model add: newItem after:node] |
558 | 933 |
ifFalse:[treeView model add: newItem beforeIndex:1 below:node]. |
562 | 934 |
|
558 | 935 |
newItem name: 'Child ', (self getDepthAndSistersNumberOfNode: newItem onParentNode: node parent). |
936 |
treeView selectNode: newItem. |
|
506 | 937 |
self updateChannels. |
731 | 938 |
modified := true |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
939 |
] |
300 | 940 |
! |
941 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
942 |
doCut |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
943 |
"cut current selected nodes" |
300 | 944 |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
945 |
|selection| |
731 | 946 |
(treeView hasSelection and: [self askForItemModification]) |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
947 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
948 |
[ |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
949 |
self doCopy. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
950 |
selection := treeView selection asSortedCollection. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
951 |
treeView selectedNodesRemove. |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
952 |
treeView selection: selection first - 1. |
506 | 953 |
self updateChannels. |
731 | 954 |
modified := true |
955 |
] |
|
956 |
! |
|
957 |
||
958 |
doDelete |
|
959 |
"delete current selected nodes" |
|
960 |
||
961 |
|selection| |
|
962 |
(treeView hasSelection and: [self askForItemModification]) |
|
963 |
ifTrue: |
|
964 |
[ |
|
965 |
selection := treeView selection asSortedCollection. |
|
966 |
treeView selectedNodesRemove. |
|
967 |
treeView selection: selection first - 1. |
|
968 |
self updateChannels. |
|
969 |
modified := true |
|
300 | 970 |
] |
971 |
! |
|
972 |
||
731 | 973 |
doNew |
974 |
"remove all items; restart" |
|
300 | 975 |
|
731 | 976 |
self askForModification |
977 |
ifTrue: |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
978 |
[ |
731 | 979 |
self isStandAlone ifTrue: [specClass := specSelector := nil]. |
980 |
self buildRoot |
|
300 | 981 |
] |
982 |
||
731 | 983 |
|
984 |
||
300 | 985 |
! |
986 |
||
731 | 987 |
doPaste |
988 |
"paste after current selected item" |
|
989 |
||
990 |
self askForItemModification |
|
991 |
ifTrue: |
|
992 |
[ |
|
993 |
|copiedNode| |
|
994 |
self class clipboard do: |
|
995 |
[:node| |
|
996 |
copiedNode := node copy. |
|
997 |
treeView selectedNodeAdd: copiedNode. |
|
998 |
treeView selectNode: copiedNode. |
|
999 |
]. |
|
1000 |
self updateChannels. |
|
1001 |
modified := true |
|
1002 |
] |
|
1003 |
! |
|
1004 |
||
1005 |
doReload |
|
1006 |
"reload spec from current class and selector" |
|
1007 |
||
1008 |
self buildFrom:specClass andSelector:specSelector |
|
1009 |
||
1010 |
! |
|
1011 |
||
1012 |
doSave |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1013 |
"install code" |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1014 |
|
731 | 1015 |
|cls code spec category mthd stream| |
300 | 1016 |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1017 |
(specClass notNil and:[specSelector notNil]) |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1018 |
ifFalse: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1019 |
[ |
731 | 1020 |
^self doSaveAs |
300 | 1021 |
]. |
1022 |
||
731 | 1023 |
cls := self resolveName: specClass. |
300 | 1024 |
spec := (treeView nodeAtIndex:1) literalArrayEncoding. |
1025 |
stream := WriteStream on:String new. |
|
1026 |
self class prettyPrintArray:spec on:stream indent:4. |
|
1027 |
spec := stream contents. |
|
731 | 1028 |
category := 'list specs'. |
300 | 1029 |
|
731 | 1030 |
(mthd := cls class compiledMethodAt:specSelector) notNil |
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1031 |
ifTrue: |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1032 |
[ |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1033 |
category := mthd category |
300 | 1034 |
]. |
1035 |
||
1036 |
code := Character excla asString |
|
731 | 1037 |
, cls name , ' class methodsFor:' , category storeString |
300 | 1038 |
, Character excla asString , '\\' |
1039 |
||
1040 |
, specSelector , '\' |
|
1041 |
, ' "this window spec was automatically generated by the ST/X HierarchicalListEditor"\\' |
|
1042 |
, ' "do not manually edit this - the builder may not be able to\' |
|
1043 |
, ' handle the specification if its corrupted."\\' |
|
1044 |
, ' "\' |
|
731 | 1045 |
, ' HierarchicalListEditor openOnClass:' , cls name , ' andSelector:#' , specSelector , '\' |
300 | 1046 |
, ' "\'. |
1047 |
||
1048 |
code := code |
|
1049 |
, '\' |
|
1050 |
, ' <resource: #hierarchicalList>\\' |
|
1051 |
, ' ^\' |
|
1052 |
, spec |
|
1053 |
, ' decodeAsLiteralArray\' |
|
1054 |
, Character excla asString |
|
1055 |
, ' ' |
|
1056 |
, Character excla asString |
|
1057 |
, '\\'. |
|
1058 |
||
1059 |
code := code withCRs. |
|
1060 |
(ReadStream on:code) fileIn. |
|
1061 |
||
731 | 1062 |
self updateHistory. |
1063 |
hasSaved := true. |
|
1064 |
modified := false. |
|
300 | 1065 |
! |
1066 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1067 |
doStepDown |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1068 |
"move selected item after next item" |
300 | 1069 |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1070 |
treeView selectedNodeChangeSequenceOrder:1. |
506 | 1071 |
self updateChannels. |
731 | 1072 |
modified := true |
506 | 1073 |
|
300 | 1074 |
! |
1075 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1076 |
doStepIn |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1077 |
"lets become the selected item a child of its next sister" |
300 | 1078 |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1079 |
treeView selectedNodeBecomeChildOfNext. |
506 | 1080 |
self updateChannels. |
731 | 1081 |
modified := true |
506 | 1082 |
|
1083 |
||
1084 |
||
300 | 1085 |
! |
1086 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1087 |
doStepOut |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1088 |
"let selected node become a sister of its current parent" |
300 | 1089 |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1090 |
treeView selectedNodeBecomeSisterOfParent. |
506 | 1091 |
self updateChannels. |
731 | 1092 |
modified := true |
506 | 1093 |
|
1094 |
||
1095 |
||
300 | 1096 |
! |
1097 |
||
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1098 |
doStepUp |
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1099 |
"move selected item before previous item" |
300 | 1100 |
|
423
ea6880a0e024
totally revised version; create icons will be changed next days
tz
parents:
372
diff
changeset
|
1101 |
treeView selectedNodeChangeSequenceOrder:-1. |
506 | 1102 |
self updateChannels. |
731 | 1103 |
modified := true |
506 | 1104 |
|
1105 |
||
1106 |
||
300 | 1107 |
! ! |
1108 |
||
1109 |
!HierarchicalListEditor class methodsFor:'documentation'! |
|
1110 |
||
1111 |
version |
|
1112 |
^ '$Header$' |
|
1113 |
! ! |