author | Claus Gittinger <cg@exept.de> |
Sat, 18 Jan 2020 15:37:54 +0100 | |
changeset 6209 | 76d74a400d6b |
parent 6197 | 4f1de496aade |
permissions | -rw-r--r-- |
6197 | 1 |
" |
2 |
COPYRIGHT (c) 2018 by eXept Software AG |
|
3 |
All Rights Reserved |
|
5764 | 4 |
|
6197 | 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 |
" |
|
3796 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
5056 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
3812 | 16 |
ToolApplicationModel subclass:#AssistantApplication |
3796 | 17 |
instanceVariableNames:'currentPageSpecHolder backButtonEnabled forwardButtonEnabled |
18 |
backButtonVisible forwardButtonVisible finishButtonVisible |
|
3805 | 19 |
finishButtonEnabled currentPageInfoHTMLHolder |
3796 | 20 |
currentPageIndexHolder backButtonLabelHolder |
4142 | 21 |
nextButtonLabelHolder pageLabelsInList pageInfoHolder infoHolder |
22 |
cancelButtonVisible' |
|
3796 | 23 |
classVariableNames:'' |
24 |
poolDictionaries:'' |
|
25 |
category:'Views-DialogBoxes' |
|
26 |
! |
|
27 |
||
28 |
!AssistantApplication class methodsFor:'documentation'! |
|
29 |
||
6197 | 30 |
copyright |
31 |
" |
|
32 |
COPYRIGHT (c) 2018 by eXept Software AG |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
||
42 |
" |
|
43 |
! |
|
44 |
||
3813 | 45 |
documentation |
46 |
" |
|
47 |
an easy to use framework for assistant-dialog applications. |
|
48 |
These are multipage applications, in which the user is able to navigate |
|
49 |
along achain of pages as specified in the AssistantSpec |
|
50 |
||
51 |
see stx:doc/coding:DemoAssistant for a demo example. |
|
52 |
see ProjectBuilderAssistantApplication for a concrete example. |
|
3814 | 53 |
|
4100 | 54 |
caveat: should have called this WizardApplication |
4099 | 55 |
|
3814 | 56 |
[author:] |
57 |
Claus Gittinger |
|
3813 | 58 |
" |
3796 | 59 |
! ! |
60 |
||
3815 | 61 |
!AssistantApplication class methodsFor:'defaults'! |
62 |
||
63 |
windowLabelTemplate |
|
5477 | 64 |
^ 'Assistant: %1' |
65 |
||
66 |
"Modified: / 14-02-2017 / 11:50:53 / cg" |
|
3815 | 67 |
! ! |
68 |
||
3809 | 69 |
!AssistantApplication class methodsFor:'help'! |
70 |
||
5676 | 71 |
helpSpec |
3813 | 72 |
<resource: #help> |
73 |
||
5676 | 74 |
^ super helpSpec addPairsFrom:#( |
3813 | 75 |
|
76 |
#backButton |
|
77 |
'Navigate to the previous page %(previousPageInfo)' |
|
78 |
||
79 |
#nextButton |
|
80 |
'Navigate to the next page %(nextPageInfo)' |
|
81 |
||
82 |
) |
|
3809 | 83 |
! ! |
84 |
||
3805 | 85 |
!AssistantApplication class methodsFor:'image specs'! |
86 |
||
3813 | 87 |
bulletIcon |
88 |
"This resource specification was automatically generated |
|
89 |
by the ImageEditor of ST/X." |
|
90 |
||
91 |
"Do not manually edit this!! If it is corrupted, |
|
92 |
the ImageEditor may not be able to read the specification." |
|
93 |
||
94 |
" |
|
95 |
self bulletIcon inspect |
|
96 |
ImageEditor openOnClass:self andSelector:#bulletIcon |
|
97 |
Icon flushCachedIcons |
|
98 |
" |
|
99 |
||
100 |
<resource: #image> |
|
101 |
||
102 |
^Icon |
|
103 |
constantNamed:'AssistantApplication class bulletIcon' |
|
4586
9cc3c58352c4
Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents:
4470
diff
changeset
|
104 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@% @@BPA @@P@D@@ @@ @D@@D@A@@A@@ @@ @A@@P@@$@X@@@% @@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 84 84 84 170 170 170 255 255 255]; mask:((ImageMask new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@<@O<@?0G? _>A?8G? O<@?0@<@@@@@@@@@b') ; yourself); yourself] |
3805 | 105 |
! |
106 |
||
3813 | 107 |
leftArrowIcon |
108 |
"This resource specification was automatically generated |
|
109 |
by the ImageEditor of ST/X." |
|
110 |
||
111 |
"Do not manually edit this!! If it is corrupted, |
|
112 |
the ImageEditor may not be able to read the specification." |
|
113 |
||
114 |
" |
|
115 |
self leftArrowIcon inspect |
|
116 |
ImageEditor openOnClass:self andSelector:#leftArrowIcon |
|
117 |
Icon flushCachedIcons |
|
118 |
" |
|
119 |
||
120 |
<resource: #image> |
|
121 |
||
122 |
^Icon |
|
123 |
constantNamed:'AssistantApplication class leftArrowIcon' |
|
4586
9cc3c58352c4
Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents:
4470
diff
changeset
|
124 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@D@@@@G@@@@G??<@A???@@G@@@@@P@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 84 84 84 170 170 170 255 255 255]; mask:((ImageMask new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@A@@L@A0@O@A?>O?9??''?>O?8_? <@A0@C@@D@@@@b') ; yourself); yourself] |
3805 | 125 |
! |
126 |
||
3813 | 127 |
rightArrowIcon |
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 |
||
134 |
" |
|
135 |
self rightArrowIcon inspect |
|
136 |
ImageEditor openOnClass:self andSelector:#rightArrowIcon |
|
137 |
Icon flushCachedIcons |
|
138 |
" |
|
139 |
||
140 |
<resource: #image> |
|
141 |
||
142 |
^Icon |
|
143 |
constantNamed:'AssistantApplication class rightArrowIcon' |
|
4586
9cc3c58352c4
Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents:
4470
diff
changeset
|
144 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@P@@@@M@@O??4@C??=@@@@M@@@@A@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 84 84 84 170 170 170 255 255 255]; mask:((ImageMask new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@ @C@@N@@<G?8_?1??''?>_?1?>@C0@N@@0@B@@@@b') ; yourself); yourself] |
3805 | 145 |
! ! |
146 |
||
3796 | 147 |
!AssistantApplication class methodsFor:'interface specs'! |
148 |
||
149 |
windowSpec |
|
150 |
"This resource specification was automatically generated |
|
151 |
by the UIPainter of ST/X." |
|
152 |
||
153 |
"Do not manually edit this!! If it is corrupted, |
|
154 |
the UIPainter may not be able to read the specification." |
|
155 |
||
156 |
" |
|
157 |
UIPainter new openOnClass:AssistantApplication andSelector:#windowSpec |
|
158 |
AssistantApplication new openInterface:#windowSpec |
|
159 |
AssistantApplication open |
|
160 |
" |
|
161 |
||
162 |
<resource: #canvas> |
|
163 |
||
164 |
^ |
|
4470 | 165 |
#(FullSpec |
166 |
name: windowSpec |
|
167 |
window: |
|
168 |
(WindowSpec |
|
169 |
label: 'Assistant' |
|
170 |
name: 'Assistant' |
|
171 |
bounds: (Rectangle 0 0 806 608) |
|
172 |
menu: mainMenu |
|
173 |
icon: defaultIcon |
|
174 |
) |
|
175 |
component: |
|
176 |
(SpecCollection |
|
177 |
collection: ( |
|
178 |
(ViewSpec |
|
179 |
name: 'Box1' |
|
180 |
layout: (LayoutFrame 0 0 0 0 0 1 -25 1) |
|
181 |
component: |
|
182 |
(SpecCollection |
|
183 |
collection: ( |
|
184 |
(VariableHorizontalPanelSpec |
|
185 |
name: 'MainHorizontalPanel' |
|
186 |
layout: (LayoutFrame 0 0 0 0 0 1 -40 1) |
|
187 |
component: |
|
188 |
(SpecCollection |
|
189 |
collection: ( |
|
190 |
(ViewSpec |
|
191 |
name: 'Box2' |
|
192 |
component: |
|
193 |
(SpecCollection |
|
194 |
collection: ( |
|
195 |
(VariableVerticalPanelSpec |
|
196 |
name: 'VariableVerticalPanel1' |
|
197 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
198 |
component: |
|
199 |
(SpecCollection |
|
200 |
collection: ( |
|
201 |
(SequenceViewSpec |
|
202 |
name: 'PagesLabelList' |
|
203 |
level: 0 |
|
204 |
enableChannel: false |
|
205 |
hasHorizontalScrollBar: true |
|
206 |
hasVerticalScrollBar: true |
|
207 |
miniScrollerHorizontal: true |
|
208 |
useIndex: true |
|
209 |
sequenceList: pageLabelsInList |
|
4190 | 210 |
) |
4470 | 211 |
(HTMLViewSpec |
212 |
name: 'HTMLBrowser1' |
|
213 |
level: 0 |
|
214 |
hasHorizontalScrollBar: true |
|
215 |
hasVerticalScrollBar: true |
|
216 |
miniScrollerHorizontal: true |
|
217 |
miniScrollerVertical: false |
|
218 |
htmlText: pageInfoHolder |
|
219 |
) |
|
220 |
) |
|
221 |
||
222 |
) |
|
223 |
handles: (Any 0.5 1.0) |
|
3811 | 224 |
) |
4470 | 225 |
) |
226 |
||
227 |
) |
|
228 |
) |
|
229 |
(SubCanvasSpec |
|
230 |
name: 'SubCanvas1' |
|
231 |
hasHorizontalScrollBar: false |
|
232 |
hasVerticalScrollBar: false |
|
233 |
miniScrollerHorizontal: false |
|
234 |
miniScrollerVertical: false |
|
235 |
specHolder: currentPageSpecHolder |
|
236 |
createNewBuilder: false |
|
3809 | 237 |
) |
4470 | 238 |
) |
239 |
||
240 |
) |
|
241 |
handles: (Any 0.5 1.0) |
|
242 |
) |
|
243 |
(HorizontalPanelViewSpec |
|
244 |
name: 'TwoPanelsPanel' |
|
245 |
layout: (LayoutFrame 0 0 -40 1 0 1 0 1) |
|
246 |
horizontalLayout: fit |
|
247 |
verticalLayout: fit |
|
248 |
horizontalSpace: 3 |
|
249 |
verticalSpace: 3 |
|
250 |
reverseOrderIfOKAtLeft: true |
|
251 |
component: |
|
252 |
(SpecCollection |
|
253 |
collection: ( |
|
254 |
(HorizontalPanelViewSpec |
|
255 |
name: 'ButtonPanel2' |
|
256 |
horizontalLayout: rightSpaceMax |
|
257 |
verticalLayout: center |
|
258 |
horizontalSpace: 3 |
|
259 |
verticalSpace: 3 |
|
260 |
ignoreInvisibleComponents: false |
|
261 |
reverseOrderIfOKAtLeft: true |
|
262 |
component: |
|
263 |
(SpecCollection |
|
264 |
collection: ( |
|
265 |
(ActionButtonSpec |
|
266 |
label: 'Cancel' |
|
267 |
name: 'Button8' |
|
268 |
visibilityChannel: cancelButtonVisible |
|
269 |
translateLabel: true |
|
270 |
resizeForLabel: true |
|
271 |
model: doCancel |
|
272 |
extent: (Point 80 22) |
|
273 |
) |
|
274 |
(ActionButtonSpec |
|
275 |
label: 'Finish' |
|
276 |
name: 'Button7' |
|
277 |
visibilityChannel: finishButtonVisible |
|
278 |
translateLabel: true |
|
279 |
resizeForLabel: true |
|
280 |
model: doFinish |
|
281 |
enableChannel: finishButtonEnabled |
|
282 |
extent: (Point 80 22) |
|
3843 | 283 |
) |
4470 | 284 |
) |
285 |
||
286 |
) |
|
287 |
extent: (Point 401 40) |
|
288 |
) |
|
289 |
(HorizontalPanelViewSpec |
|
290 |
name: 'ButtonPanel1' |
|
291 |
horizontalLayout: centerMax |
|
292 |
verticalLayout: center |
|
293 |
horizontalSpace: 3 |
|
294 |
verticalSpace: 3 |
|
295 |
component: |
|
296 |
(SpecCollection |
|
297 |
collection: ( |
|
298 |
(ActionButtonSpec |
|
299 |
label: 'Back' |
|
300 |
name: 'Button1' |
|
301 |
activeHelpKey: backButton |
|
302 |
visibilityChannel: backButtonVisible |
|
303 |
translateLabel: true |
|
304 |
labelChannel: backButtonLabelHolder |
|
305 |
model: goBackward |
|
306 |
enableChannel: backButtonEnabled |
|
307 |
useDefaultExtent: true |
|
3843 | 308 |
) |
4470 | 309 |
(ActionButtonSpec |
310 |
label: 'Next' |
|
311 |
name: 'Button2' |
|
312 |
activeHelpKey: nextButton |
|
313 |
visibilityChannel: forwardButtonVisible |
|
314 |
translateLabel: true |
|
315 |
labelChannel: nextButtonLabelHolder |
|
316 |
model: goForward |
|
317 |
enableChannel: forwardButtonEnabled |
|
318 |
useDefaultExtent: true |
|
319 |
) |
|
320 |
) |
|
321 |
||
322 |
) |
|
323 |
extent: (Point 402 40) |
|
3809 | 324 |
) |
4470 | 325 |
) |
326 |
||
327 |
) |
|
3796 | 328 |
) |
4470 | 329 |
) |
330 |
||
331 |
) |
|
3796 | 332 |
) |
4470 | 333 |
(LabelSpec |
334 |
label: 'Label' |
|
335 |
name: 'Label1' |
|
336 |
layout: (LayoutFrame 1 0 -25 1 -1 1 -1 1) |
|
337 |
level: -1 |
|
338 |
translateLabel: true |
|
339 |
labelChannel: infoHolder |
|
340 |
adjust: left |
|
341 |
) |
|
342 |
) |
|
343 |
||
344 |
) |
|
345 |
) |
|
3796 | 346 |
! ! |
347 |
||
348 |
!AssistantApplication class methodsFor:'menu specs'! |
|
349 |
||
3813 | 350 |
mainMenu |
351 |
"This resource specification was automatically generated |
|
352 |
by the MenuEditor of ST/X." |
|
353 |
||
354 |
"Do not manually edit this!! If it is corrupted, |
|
355 |
the MenuEditor may not be able to read the specification." |
|
356 |
||
357 |
" |
|
358 |
MenuEditor new openOnClass:AssistantApplication andSelector:#mainMenu |
|
359 |
(Menu new fromLiteralArrayEncoding:(AssistantApplication mainMenu)) startUp |
|
360 |
" |
|
3796 | 361 |
|
3813 | 362 |
<resource: #menu> |
3796 | 363 |
|
3813 | 364 |
^ |
365 |
#(Menu |
|
366 |
( |
|
367 |
(MenuItem |
|
368 |
label: 'File' |
|
369 |
translateLabel: true |
|
370 |
submenu: |
|
371 |
(Menu |
|
372 |
( |
|
373 |
(MenuItem |
|
374 |
label: 'Exit' |
|
3808 | 375 |
itemValue: closeRequest |
376 |
translateLabel: true |
|
3796 | 377 |
) |
3808 | 378 |
) |
379 |
nil |
|
380 |
nil |
|
3796 | 381 |
) |
3808 | 382 |
) |
383 |
(MenuItem |
|
3814 | 384 |
label: 'MENU_Help' |
385 |
startGroup: conditionalRight |
|
3808 | 386 |
translateLabel: true |
387 |
submenu: |
|
388 |
(Menu |
|
389 |
( |
|
390 |
(MenuItem |
|
391 |
label: 'Documentation' |
|
392 |
itemValue: openDocumentation |
|
393 |
translateLabel: true |
|
3796 | 394 |
) |
3808 | 395 |
(MenuItem |
396 |
label: '-' |
|
397 |
) |
|
398 |
(MenuItem |
|
399 |
label: 'About this Application...' |
|
400 |
itemValue: openAboutThisApplication |
|
401 |
translateLabel: true |
|
402 |
) |
|
403 |
) |
|
404 |
nil |
|
405 |
nil |
|
3796 | 406 |
) |
3808 | 407 |
) |
408 |
) |
|
409 |
nil |
|
410 |
nil |
|
3796 | 411 |
) |
412 |
! ! |
|
413 |
||
4190 | 414 |
!AssistantApplication class methodsFor:'queries'! |
415 |
||
416 |
isAbstract |
|
417 |
^ self == AssistantApplication |
|
418 |
! ! |
|
419 |
||
3813 | 420 |
!AssistantApplication class methodsFor:'required protocol'! |
421 |
||
422 |
assistantSpec |
|
423 |
"must return a sequenceable collection of assistantPageSpecs - one for each page" |
|
424 |
||
425 |
self subclassResponsibility |
|
426 |
! ! |
|
427 |
||
3796 | 428 |
!AssistantApplication methodsFor:'actions'! |
429 |
||
3813 | 430 |
canGoBackward |
431 |
|currentPageSpec previousPageSpec| |
|
3806 | 432 |
|
3813 | 433 |
"/ see if we are allowed to leave... |
434 |
currentPageSpec := self currentPageSpec. |
|
435 |
currentPageSpec canLeaveQuerySelector notNil ifTrue:[ |
|
436 |
(self perform:currentPageSpec canLeaveQuerySelector) ifFalse:[^ false]. |
|
3806 | 437 |
]. |
438 |
||
439 |
"/ see if we are allowed to enter the next... |
|
440 |
previousPageSpec := self previousEnabledPageSpec. |
|
441 |
previousPageSpec isNil ifTrue:[^ false]. |
|
442 |
||
443 |
previousPageSpec canEnterQuerySelector notNil ifTrue:[ |
|
444 |
(self perform:previousPageSpec canEnterQuerySelector) ifFalse:[^ false]. |
|
445 |
]. |
|
446 |
^ true |
|
447 |
! |
|
448 |
||
3813 | 449 |
canGoForward |
450 |
|currentPageSpec nextPageSpec| |
|
3806 | 451 |
|
3813 | 452 |
self currentPageIndex == self numberOfPages ifTrue:[^ false]. |
3806 | 453 |
|
3813 | 454 |
"/ see if we are allowed to leave... |
455 |
currentPageSpec := self currentPageSpec. |
|
456 |
currentPageSpec canLeaveQuerySelector notNil ifTrue:[ |
|
457 |
(self perform:currentPageSpec canLeaveQuerySelector) ifFalse:[^ false]. |
|
3806 | 458 |
]. |
459 |
||
460 |
"/ see if we are allowed to enter the next... |
|
461 |
nextPageSpec := self nextEnabledPageSpec. |
|
462 |
nextPageSpec isNil ifTrue:[^ false]. |
|
463 |
||
464 |
nextPageSpec canEnterQuerySelector notNil ifTrue:[ |
|
465 |
(self perform:nextPageSpec canEnterQuerySelector) ifFalse:[^ false]. |
|
466 |
]. |
|
467 |
^ true |
|
3813 | 468 |
! |
469 |
||
470 |
doCancel |
|
471 |
self closeRequest |
|
472 |
! |
|
3796 | 473 |
|
3813 | 474 |
doFinish |
475 |
self closeRequest |
|
476 |
! |
|
3796 | 477 |
|
3813 | 478 |
goBackward |
4135 | 479 |
(self canGoBackward) ifFalse:[^ self]. |
480 |
self gotoPage:((self indexOfPreviousEnabledPageSpec) max:1) |
|
481 |
||
482 |
"Modified: / 20-07-2012 / 12:37:40 / cg" |
|
483 |
! |
|
3813 | 484 |
|
4135 | 485 |
goForward |
486 |
(self canGoForward) ifFalse:[^ self]. |
|
487 |
self gotoPage:(self indexOfNextEnabledPageSpec) |
|
488 |
||
489 |
"Modified: / 20-07-2012 / 12:37:54 / cg" |
|
490 |
! |
|
491 |
||
492 |
gotoPage: pageIndex |
|
493 |
|currentPageSpec| |
|
3813 | 494 |
|
495 |
currentPageSpec := self currentPageSpec. |
|
496 |
currentPageSpec leaveCallbackSelector notNil ifTrue:[ |
|
3796 | 497 |
self perform:currentPageSpec leaveCallbackSelector |
498 |
]. |
|
499 |
||
4135 | 500 |
self currentPageIndexHolder value: pageIndex. |
3796 | 501 |
|
502 |
currentPageSpec := self currentPageSpec. |
|
503 |
currentPageSpec enterCallbackSelector notNil ifTrue:[ |
|
504 |
self perform:currentPageSpec enterCallbackSelector |
|
505 |
]. |
|
3806 | 506 |
|
507 |
self updateButtonEnableState. |
|
3796 | 508 |
|
4135 | 509 |
"Created: / 20-07-2012 / 12:37:12 / cg" |
3813 | 510 |
! ! |
511 |
||
512 |
!AssistantApplication methodsFor:'aspects'! |
|
513 |
||
514 |
assistantSpec |
|
515 |
^ self class assistantSpec |
|
3805 | 516 |
! |
517 |
||
3813 | 518 |
backButtonEnabled |
519 |
<resource: #uiAspect> |
|
3796 | 520 |
|
3813 | 521 |
backButtonEnabled isNil ifTrue:[ |
522 |
backButtonEnabled := false asValue. |
|
3796 | 523 |
]. |
3813 | 524 |
^ backButtonEnabled. |
3796 | 525 |
! |
526 |
||
3813 | 527 |
backButtonLabelHolder |
528 |
<resource: #uiAspect> |
|
3796 | 529 |
|
3813 | 530 |
backButtonLabelHolder isNil ifTrue:[ |
531 |
backButtonLabelHolder := self backButtonLabel asValue. |
|
532 |
]. |
|
533 |
^ backButtonLabelHolder. |
|
3796 | 534 |
! |
535 |
||
3813 | 536 |
backButtonVisible |
537 |
<resource: #uiAspect> |
|
3796 | 538 |
|
3813 | 539 |
backButtonVisible isNil ifTrue:[ |
540 |
backButtonVisible := true asValue. |
|
541 |
]. |
|
542 |
^ backButtonVisible. |
|
3796 | 543 |
! |
544 |
||
4142 | 545 |
cancelButtonVisible |
546 |
<resource: #uiAspect> |
|
547 |
||
548 |
cancelButtonVisible isNil ifTrue:[ |
|
549 |
cancelButtonVisible := true asValue. |
|
550 |
]. |
|
551 |
^ cancelButtonVisible. |
|
552 |
||
553 |
"Created: / 06-09-2012 / 16:41:11 / cg" |
|
554 |
! |
|
555 |
||
3813 | 556 |
currentPageIndexHolder |
557 |
<resource: #uiAspect> |
|
3796 | 558 |
|
3813 | 559 |
currentPageIndexHolder isNil ifTrue:[ |
560 |
currentPageIndexHolder := 1 asValue. |
|
561 |
currentPageIndexHolder onChangeSend:#updateCanvas to:self |
|
3796 | 562 |
]. |
563 |
^ currentPageIndexHolder. |
|
564 |
! |
|
565 |
||
3813 | 566 |
currentPageInfoHTMLHolder |
567 |
<resource: #uiAspect> |
|
568 |
||
569 |
currentPageInfoHTMLHolder isNil ifTrue:[ |
|
3796 | 570 |
currentPageInfoHTMLHolder := ValueHolder new. |
571 |
]. |
|
572 |
^ currentPageInfoHTMLHolder. |
|
573 |
! |
|
574 |
||
3813 | 575 |
currentPageSpecHolder |
576 |
<resource: #uiAspect> |
|
577 |
||
578 |
currentPageSpecHolder isNil ifTrue:[ |
|
3796 | 579 |
currentPageSpecHolder := nil asValue. |
580 |
]. |
|
581 |
^ currentPageSpecHolder. |
|
582 |
! |
|
583 |
||
3813 | 584 |
finishButtonEnabled |
585 |
<resource: #uiAspect> |
|
586 |
||
587 |
finishButtonEnabled isNil ifTrue:[ |
|
588 |
finishButtonEnabled := false asValue. |
|
589 |
]. |
|
590 |
^ finishButtonEnabled. |
|
591 |
! |
|
592 |
||
593 |
finishButtonVisible |
|
594 |
<resource: #uiAspect> |
|
595 |
||
596 |
finishButtonVisible isNil ifTrue:[ |
|
597 |
finishButtonVisible := false asValue. |
|
598 |
]. |
|
599 |
^ finishButtonVisible. |
|
600 |
! |
|
601 |
||
602 |
forwardButtonEnabled |
|
603 |
<resource: #uiAspect> |
|
604 |
||
605 |
forwardButtonEnabled isNil ifTrue:[ |
|
606 |
forwardButtonEnabled := false asValue. |
|
607 |
]. |
|
608 |
^ forwardButtonEnabled. |
|
609 |
! |
|
610 |
||
611 |
forwardButtonVisible |
|
612 |
<resource: #uiAspect> |
|
613 |
||
614 |
forwardButtonVisible isNil ifTrue:[ |
|
615 |
forwardButtonVisible := true asValue. |
|
616 |
]. |
|
617 |
^ forwardButtonVisible. |
|
618 |
! |
|
619 |
||
3858 | 620 |
infoHolder |
621 |
"info message at the bottom" |
|
622 |
||
623 |
<resource: #uiAspect> |
|
624 |
||
625 |
infoHolder isNil ifTrue:[ |
|
3968 | 626 |
infoHolder := nil asValue. |
3858 | 627 |
]. |
628 |
^ infoHolder. |
|
3968 | 629 |
|
630 |
"Modified: / 12-11-2010 / 12:33:01 / cg" |
|
3858 | 631 |
! |
632 |
||
3813 | 633 |
nextButtonLabelHolder |
634 |
<resource: #uiAspect> |
|
635 |
||
636 |
nextButtonLabelHolder isNil ifTrue:[ |
|
637 |
nextButtonLabelHolder := self nextButtonLabel asValue. |
|
638 |
]. |
|
639 |
^ nextButtonLabelHolder. |
|
640 |
! |
|
641 |
||
642 |
pageInfoHolder |
|
643 |
<resource: #uiAspect> |
|
644 |
||
645 |
pageInfoHolder isNil ifTrue:[ |
|
646 |
pageInfoHolder := nil asValue. |
|
647 |
]. |
|
648 |
^ pageInfoHolder. |
|
649 |
! |
|
650 |
||
651 |
pageLabelsInList |
|
652 |
pageLabelsInList isNil ifTrue:[ |
|
653 |
pageLabelsInList := List new. |
|
654 |
pageLabelsInList contents:(self pageLabelsInListWithBullet). |
|
655 |
]. |
|
656 |
^ pageLabelsInList |
|
657 |
! |
|
658 |
||
3805 | 659 |
pageLabelsInListWithBullet |
660 |
|newList| |
|
661 |
||
662 |
newList := self pageLabels. |
|
4420 | 663 |
newList := newList |
664 |
with:(1 to:newList size) |
|
3805 | 665 |
collect:[:entry :index | |
666 |
index == self currentPageIndex ifTrue:[ |
|
667 |
LabelAndTwoIcons new |
|
3861
2c920a8bab56
comment/format in: #pageLabelsInListWithBullet
Claus Gittinger <cg@exept.de>
parents:
3858
diff
changeset
|
668 |
string:(entry allBold |
5764 | 669 |
withColor:(TextView defaultSelectionForegroundColor) |
3861
2c920a8bab56
comment/format in: #pageLabelsInListWithBullet
Claus Gittinger <cg@exept.de>
parents:
3858
diff
changeset
|
670 |
on:(TextView defaultSelectionBackgroundColor) ); |
3805 | 671 |
icon:(self class rightArrowIcon); |
672 |
image2:(self class leftArrowIcon) |
|
673 |
] ifFalse:[ |
|
674 |
(self isPageEnabledAtIndex:index) ifFalse:[ |
|
5088 | 675 |
entry withColor:(Button defaultDisabledForegroundColor) "Color grey". |
3805 | 676 |
] ifTrue:[ |
677 |
entry |
|
678 |
]. |
|
679 |
]. |
|
680 |
]. |
|
681 |
^ newList |
|
3796 | 682 |
! ! |
683 |
||
3809 | 684 |
!AssistantApplication methodsFor:'help'! |
685 |
||
5676 | 686 |
helpTextForKey:aKey |
3813 | 687 |
<resource: #help> |
3809 | 688 |
|
3813 | 689 |
|text bindings nextSpec prevSpec| |
3809 | 690 |
|
5676 | 691 |
text := super helpTextForKey:aKey. |
5893 | 692 |
text isNil ifTrue:[^ nil]. |
693 |
||
3813 | 694 |
nextSpec := self nextEnabledPageSpec. |
695 |
prevSpec := self previousEnabledPageSpec. |
|
3809 | 696 |
|
697 |
bindings := Dictionary new. |
|
698 |
bindings |
|
699 |
at:#'previousPageInfo' |
|
700 |
put:(prevSpec notNil ifTrue:[ '"',prevSpec pageTitle,'"' ] ifFalse:['']). |
|
701 |
bindings |
|
702 |
at:#'nextPageInfo' |
|
703 |
put:(nextSpec notNil ifTrue:[ '"',nextSpec pageTitle,'"' ] ifFalse:['']). |
|
704 |
||
5875 | 705 |
^ self resources string:text withArguments:bindings. |
706 |
||
5893 | 707 |
"Modified: / 23-08-2018 / 21:02:45 / Claus Gittinger" |
3813 | 708 |
! ! |
3809 | 709 |
|
3813 | 710 |
!AssistantApplication methodsFor:'initialization & release'! |
3796 | 711 |
|
3813 | 712 |
postBuildWith:aBuilder |
713 |
|maxCanvasExtent| |
|
3805 | 714 |
|
3813 | 715 |
super postBuildWith:aBuilder. |
716 |
self updateCanvas. |
|
3805 | 717 |
|
718 |
maxCanvasExtent := (self assistantSpec |
|
719 |
collect:[:eachPageSpec | |
|
720 |
|windowSpecSelector specArray windowSpec| |
|
721 |
||
722 |
windowSpecSelector := eachPageSpec windowSpecSelector. |
|
723 |
specArray := self perform:windowSpecSelector ifNotUnderstood:[self class perform:windowSpecSelector]. |
|
724 |
windowSpec := specArray decodeAsLiteralArray. |
|
725 |
windowSpec window bounds extent. |
|
726 |
] |
|
727 |
) max. |
|
728 |
||
729 |
self window extent:(maxCanvasExtent + (200 @ 40)). |
|
4142 | 730 |
self builder window isModal ifFalse:[ |
731 |
self cancelButtonVisible value:false |
|
732 |
]. |
|
733 |
||
734 |
"Modified: / 06-09-2012 / 16:42:42 / cg" |
|
3796 | 735 |
! ! |
736 |
||
3813 | 737 |
!AssistantApplication methodsFor:'look'! |
3796 | 738 |
|
3813 | 739 |
backButtonLabel |
740 |
^ LabelAndIcon |
|
741 |
label:(resources string:'Back') |
|
742 |
icon:(self backButtonEnabled value |
|
743 |
ifTrue:[ToolbarIconLibrary leftArrow24x24Icon] |
|
744 |
ifFalse:[ToolbarIconLibrary leftArrow24x24disabledIcon]) |
|
3796 | 745 |
! |
746 |
||
3813 | 747 |
nextButtonLabel |
748 |
^ LabelAndTwoIcons new |
|
749 |
string:(resources string:'Next'); |
|
750 |
image2:(self forwardButtonEnabled value |
|
751 |
ifTrue:[ToolbarIconLibrary rightArrow24x24Icon] |
|
5056 | 752 |
ifFalse:[ToolbarIconLibrary rightArrow24x24disabledIcon]); |
753 |
yourself |
|
3796 | 754 |
! |
755 |
||
3813 | 756 |
pageLabels |
3861
2c920a8bab56
comment/format in: #pageLabelsInListWithBullet
Claus Gittinger <cg@exept.de>
parents:
3858
diff
changeset
|
757 |
^ self assistantSpec |
2c920a8bab56
comment/format in: #pageLabelsInListWithBullet
Claus Gittinger <cg@exept.de>
parents:
3858
diff
changeset
|
758 |
collect:[:specEntry | resources string:specEntry pageTitle]. |
3813 | 759 |
! ! |
3796 | 760 |
|
3813 | 761 |
!AssistantApplication methodsFor:'private'! |
3796 | 762 |
|
3813 | 763 |
canFinish |
764 |
|pageIndex pageSpec| |
|
3796 | 765 |
|
3813 | 766 |
pageIndex := self currentPageIndexHolder value. |
767 |
pageSpec := self assistantSpec at:pageIndex. |
|
768 |
^ pageSpec canLeaveQuerySelector isNil |
|
3796 | 769 |
or:[ self perform:pageSpec canLeaveQuerySelector ] |
770 |
! |
|
771 |
||
3813 | 772 |
currentPageIndex |
773 |
^ self currentPageIndexHolder value |
|
3796 | 774 |
! |
775 |
||
3813 | 776 |
currentPageSpec |
777 |
^ self assistantSpec at:(self currentPageIndex). |
|
778 |
! |
|
779 |
||
780 |
indexOfNextEnabledPageSpec |
|
3805 | 781 |
|delta currentPageIndex| |
782 |
||
783 |
currentPageIndex := self currentPageIndex. |
|
784 |
delta := 1. |
|
785 |
[ |
|
786 |
(currentPageIndex + delta) <= (self numberOfPages) |
|
787 |
and:[ (self isPageEnabledAtIndex:(currentPageIndex + delta)) not ] |
|
788 |
] whileTrue:[ |
|
789 |
delta := delta + 1. |
|
790 |
]. |
|
791 |
(currentPageIndex + delta) <= (self numberOfPages) ifTrue:[ |
|
792 |
^ (currentPageIndex + delta). |
|
793 |
]. |
|
794 |
^ nil |
|
795 |
! |
|
796 |
||
3813 | 797 |
indexOfPreviousEnabledPageSpec |
798 |
|delta currentPageIndex| |
|
799 |
||
800 |
currentPageIndex := self currentPageIndex. |
|
3805 | 801 |
delta := 1. |
802 |
[ |
|
3813 | 803 |
(currentPageIndex - delta) > 0 |
804 |
and:[ (self isPageEnabledAtIndex:(currentPageIndex - delta)) not ] |
|
3805 | 805 |
] whileTrue:[ |
806 |
delta := delta + 1. |
|
807 |
]. |
|
3813 | 808 |
(currentPageIndex - delta) > 0 ifTrue:[ |
809 |
^ (currentPageIndex - delta). |
|
3805 | 810 |
]. |
811 |
^ nil |
|
812 |
! |
|
813 |
||
3813 | 814 |
isPageEnabledAtIndex:index |
815 |
|isEnabledSelector| |
|
816 |
||
817 |
isEnabledSelector := (self assistantSpec at:index) isEnabledQuerySelector. |
|
818 |
^ isEnabledSelector isNil or:[ (self perform:isEnabledSelector) ] |
|
819 |
! |
|
820 |
||
821 |
nextEnabledPageSpec |
|
822 |
|index| |
|
823 |
||
824 |
index := self indexOfNextEnabledPageSpec. |
|
825 |
index isNil ifTrue:[^ nil]. |
|
826 |
^ self assistantSpec at:index. |
|
827 |
! |
|
828 |
||
829 |
nextPageSpec |
|
830 |
^ self assistantSpec at:(self currentPageIndex + 1). |
|
831 |
! |
|
832 |
||
833 |
numberOfPages |
|
834 |
^ self assistantSpec size |
|
835 |
! |
|
836 |
||
837 |
previousEnabledPageSpec |
|
838 |
|index| |
|
839 |
||
840 |
index := self indexOfPreviousEnabledPageSpec. |
|
841 |
index isNil ifTrue:[^ nil]. |
|
842 |
^ self assistantSpec at:index. |
|
843 |
! |
|
844 |
||
845 |
previousPageSpec |
|
846 |
^ self assistantSpec at:(self currentPageIndex - 1). |
|
3811 | 847 |
! ! |
848 |
||
849 |
!AssistantApplication methodsFor:'update'! |
|
3796 | 850 |
|
3813 | 851 |
updateButtonEnableState |
852 |
self backButtonEnabled value:(self canGoBackward). |
|
853 |
self forwardButtonEnabled value:(self canGoForward). |
|
854 |
self backButtonLabelHolder value:(self backButtonLabel). |
|
855 |
self nextButtonLabelHolder value:(self nextButtonLabel). |
|
3806 | 856 |
! |
857 |
||
3796 | 858 |
updateCanvas |
3815 | 859 |
"update some valueHolders and especially the current canvas, |
860 |
after a step in either direction" |
|
861 |
||
3796 | 862 |
|pageIndex pageSpec sel uiSpec| |
863 |
||
864 |
pageIndex := self currentPageIndex. |
|
865 |
pageSpec := self currentPageSpec. |
|
866 |
sel := pageSpec windowSpecSelector. |
|
3805 | 867 |
uiSpec := self perform:sel ifNotUnderstood:[ self class perform:sel ]. |
3796 | 868 |
|
3805 | 869 |
self pageLabelsInList contents:(self pageLabelsInListWithBullet). |
3796 | 870 |
self currentPageSpecHolder value:uiSpec. |
3815 | 871 |
|
872 |
self updateWindowLabelFor:pageSpec. |
|
3796 | 873 |
|
874 |
self finishButtonVisible value:(pageIndex == self numberOfPages). |
|
875 |
self backButtonEnabled value:(pageIndex > 1). |
|
876 |
self forwardButtonEnabled value:(pageIndex < self numberOfPages). |
|
877 |
self finishButtonEnabled value:(pageIndex == self numberOfPages and:[ self canFinish ]). |
|
878 |
||
879 |
self backButtonLabelHolder value:(self backButtonLabel). |
|
880 |
self nextButtonLabelHolder value:(self nextButtonLabel). |
|
3811 | 881 |
|
3968 | 882 |
self pageInfoHolder value:(resources string:pageSpec infoText). |
883 |
||
884 |
"Modified: / 12-11-2010 / 12:32:09 / cg" |
|
3815 | 885 |
! |
886 |
||
887 |
updateWindowLabelFor:aPageSpec |
|
888 |
self window label:(self class windowLabelTemplate bindWith:aPageSpec pageTitle). |
|
3796 | 889 |
! ! |
890 |
||
891 |
!AssistantApplication class methodsFor:'documentation'! |
|
892 |
||
4100 | 893 |
version |
5056 | 894 |
^ '$Header$' |
4100 | 895 |
! |
896 |
||
3796 | 897 |
version_CVS |
5056 | 898 |
^ '$Header$' |
3796 | 899 |
! ! |
4190 | 900 |