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