3796
|
1 |
"{ Package: 'stx:libwidg2' }"
|
|
2 |
|
|
3 |
ApplicationModel subclass:#AssistantApplication
|
|
4 |
instanceVariableNames:'currentPageSpecHolder backButtonEnabled forwardButtonEnabled
|
|
5 |
backButtonVisible forwardButtonVisible finishButtonVisible
|
3805
|
6 |
finishButtonEnabled currentPageInfoHTMLHolder
|
3796
|
7 |
currentPageIndexHolder backButtonLabelHolder
|
3805
|
8 |
nextButtonLabelHolder pageLabelsInList'
|
3796
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'Views-DialogBoxes'
|
|
12 |
!
|
|
13 |
|
|
14 |
!AssistantApplication class methodsFor:'documentation'!
|
|
15 |
|
|
16 |
documentation
|
|
17 |
"
|
|
18 |
an easy to use framework for assistant-dialog applications.
|
3807
|
19 |
These are multipage applications, in which the user is able to navigate
|
|
20 |
along achain of pages as specified in the AssistantSpec
|
|
21 |
|
|
22 |
see stx:doc/coding:DemoAssistant for a demo example.
|
|
23 |
see ProjectBuilderAssistantApplication for a concrete example.
|
3796
|
24 |
"
|
|
25 |
! !
|
|
26 |
|
3809
|
27 |
!AssistantApplication class methodsFor:'help'!
|
|
28 |
|
|
29 |
flyByHelpSpec
|
|
30 |
<resource: #help>
|
|
31 |
|
|
32 |
^ super flyByHelpSpec addPairsFrom:#(
|
|
33 |
|
|
34 |
#backButton
|
|
35 |
'Navigate to the previous page %(previousPageInfo)'
|
|
36 |
|
|
37 |
#nextButton
|
|
38 |
'Navigate to the next page %(nextPageInfo)'
|
|
39 |
|
|
40 |
)
|
|
41 |
! !
|
|
42 |
|
3805
|
43 |
!AssistantApplication class methodsFor:'image specs'!
|
|
44 |
|
|
45 |
bulletIcon
|
|
46 |
"This resource specification was automatically generated
|
|
47 |
by the ImageEditor of ST/X."
|
|
48 |
|
|
49 |
"Do not manually edit this!! If it is corrupted,
|
|
50 |
the ImageEditor may not be able to read the specification."
|
|
51 |
|
|
52 |
"
|
|
53 |
self bulletIcon inspect
|
|
54 |
ImageEditor openOnClass:self andSelector:#bulletIcon
|
|
55 |
Icon flushCachedIcons
|
|
56 |
"
|
|
57 |
|
|
58 |
<resource: #image>
|
|
59 |
|
|
60 |
^Icon
|
|
61 |
constantNamed:'AssistantApplication class bulletIcon'
|
|
62 |
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:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@<@O<@?0G? _>A?8G? O<@?0@<@@@@@@@@@b') ; yourself); yourself]
|
|
63 |
!
|
|
64 |
|
|
65 |
leftArrowIcon
|
|
66 |
"This resource specification was automatically generated
|
|
67 |
by the ImageEditor of ST/X."
|
|
68 |
|
|
69 |
"Do not manually edit this!! If it is corrupted,
|
|
70 |
the ImageEditor may not be able to read the specification."
|
|
71 |
|
|
72 |
"
|
|
73 |
self leftArrowIcon inspect
|
|
74 |
ImageEditor openOnClass:self andSelector:#leftArrowIcon
|
|
75 |
Icon flushCachedIcons
|
|
76 |
"
|
|
77 |
|
|
78 |
<resource: #image>
|
|
79 |
|
|
80 |
^Icon
|
|
81 |
constantNamed:'AssistantApplication class leftArrowIcon'
|
|
82 |
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:((Depth1Image 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]
|
|
83 |
!
|
|
84 |
|
|
85 |
rightArrowIcon
|
|
86 |
"This resource specification was automatically generated
|
|
87 |
by the ImageEditor of ST/X."
|
|
88 |
|
|
89 |
"Do not manually edit this!! If it is corrupted,
|
|
90 |
the ImageEditor may not be able to read the specification."
|
|
91 |
|
|
92 |
"
|
|
93 |
self rightArrowIcon inspect
|
|
94 |
ImageEditor openOnClass:self andSelector:#rightArrowIcon
|
|
95 |
Icon flushCachedIcons
|
|
96 |
"
|
|
97 |
|
|
98 |
<resource: #image>
|
|
99 |
|
|
100 |
^Icon
|
|
101 |
constantNamed:'AssistantApplication class rightArrowIcon'
|
|
102 |
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:((Depth1Image 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]
|
|
103 |
! !
|
|
104 |
|
3796
|
105 |
!AssistantApplication class methodsFor:'interface specs'!
|
|
106 |
|
|
107 |
windowSpec
|
|
108 |
"This resource specification was automatically generated
|
|
109 |
by the UIPainter of ST/X."
|
|
110 |
|
|
111 |
"Do not manually edit this!! If it is corrupted,
|
|
112 |
the UIPainter may not be able to read the specification."
|
|
113 |
|
|
114 |
"
|
|
115 |
UIPainter new openOnClass:AssistantApplication andSelector:#windowSpec
|
|
116 |
AssistantApplication new openInterface:#windowSpec
|
|
117 |
AssistantApplication open
|
|
118 |
"
|
|
119 |
|
|
120 |
<resource: #canvas>
|
|
121 |
|
|
122 |
^
|
|
123 |
#(FullSpec
|
|
124 |
name: windowSpec
|
|
125 |
window:
|
|
126 |
(WindowSpec
|
|
127 |
label: 'NewApplication'
|
|
128 |
name: 'NewApplication'
|
|
129 |
bounds: (Rectangle 0 0 534 440)
|
3808
|
130 |
menu: mainMenu
|
3796
|
131 |
)
|
|
132 |
component:
|
|
133 |
(SpecCollection
|
|
134 |
collection: (
|
3808
|
135 |
(MenuPanelSpec
|
|
136 |
name: 'ToolBar1'
|
|
137 |
layout: (LayoutFrame 0 0 0 0 0 1 40 0)
|
|
138 |
menu: toolbarMenu
|
|
139 |
textDefault: true
|
|
140 |
)
|
3809
|
141 |
(ViewSpec
|
|
142 |
name: 'Box1'
|
|
143 |
layout: (LayoutFrame 0 0 40 0 0 1 -25 1)
|
3796
|
144 |
component:
|
|
145 |
(SpecCollection
|
|
146 |
collection: (
|
3809
|
147 |
(VariableHorizontalPanelSpec
|
|
148 |
name: 'VariableHorizontalPanel1'
|
|
149 |
layout: (LayoutFrame 0 0 0 0 0 1 -40 1)
|
|
150 |
component:
|
|
151 |
(SpecCollection
|
|
152 |
collection: (
|
|
153 |
(SequenceViewSpec
|
|
154 |
name: 'List1'
|
|
155 |
level: 0
|
|
156 |
enableChannel: false
|
|
157 |
hasHorizontalScrollBar: true
|
|
158 |
hasVerticalScrollBar: true
|
|
159 |
useIndex: true
|
|
160 |
sequenceList: pageLabelsInList
|
|
161 |
)
|
|
162 |
(SubCanvasSpec
|
|
163 |
name: 'SubCanvas1'
|
|
164 |
hasHorizontalScrollBar: false
|
|
165 |
hasVerticalScrollBar: false
|
|
166 |
miniScrollerHorizontal: false
|
|
167 |
miniScrollerVertical: false
|
|
168 |
specHolder: currentPageSpecHolder
|
|
169 |
createNewBuilder: false
|
|
170 |
)
|
|
171 |
)
|
|
172 |
|
|
173 |
)
|
|
174 |
handles: (Any 0.5 1.0)
|
3796
|
175 |
)
|
3809
|
176 |
(HorizontalPanelViewSpec
|
|
177 |
name: 'ButtonPanel1'
|
|
178 |
layout: (LayoutFrame 0 0 -40 1 0 0.5 0 1)
|
|
179 |
horizontalLayout: centerMax
|
|
180 |
verticalLayout: center
|
|
181 |
horizontalSpace: 3
|
|
182 |
verticalSpace: 3
|
|
183 |
component:
|
|
184 |
(SpecCollection
|
|
185 |
collection: (
|
|
186 |
(ActionButtonSpec
|
|
187 |
label: 'Back'
|
|
188 |
name: 'Button1'
|
|
189 |
activeHelpKey: backButton
|
|
190 |
visibilityChannel: backButtonVisible
|
|
191 |
translateLabel: true
|
|
192 |
labelChannel: backButtonLabelHolder
|
|
193 |
model: goBackward
|
|
194 |
enableChannel: backButtonEnabled
|
|
195 |
extent: (Point 132 22)
|
|
196 |
)
|
|
197 |
(ActionButtonSpec
|
|
198 |
label: 'Next'
|
|
199 |
name: 'Button2'
|
|
200 |
activeHelpKey: nextButton
|
|
201 |
visibilityChannel: forwardButtonVisible
|
|
202 |
translateLabel: true
|
|
203 |
labelChannel: nextButtonLabelHolder
|
|
204 |
model: goForward
|
|
205 |
enableChannel: forwardButtonEnabled
|
|
206 |
extent: (Point 132 22)
|
|
207 |
)
|
|
208 |
)
|
|
209 |
|
|
210 |
)
|
3796
|
211 |
)
|
3809
|
212 |
(HorizontalPanelViewSpec
|
|
213 |
name: 'ButtonPanel2'
|
|
214 |
layout: (LayoutFrame 0 0.5 -40 1 0 1 0 1)
|
|
215 |
horizontalLayout: centerMax
|
|
216 |
verticalLayout: center
|
|
217 |
horizontalSpace: 3
|
|
218 |
verticalSpace: 3
|
|
219 |
ignoreInvisibleComponents: false
|
|
220 |
component:
|
|
221 |
(SpecCollection
|
|
222 |
collection: (
|
|
223 |
(ActionButtonSpec
|
|
224 |
label: 'Finish'
|
|
225 |
name: 'Button7'
|
|
226 |
visibilityChannel: finishButtonVisible
|
|
227 |
translateLabel: true
|
|
228 |
resizeForLabel: true
|
|
229 |
model: doFinish
|
|
230 |
enableChannel: finishButtonEnabled
|
|
231 |
extent: (Point 65 22)
|
|
232 |
)
|
|
233 |
(ActionButtonSpec
|
|
234 |
label: 'Cancel'
|
|
235 |
name: 'Button8'
|
|
236 |
translateLabel: true
|
|
237 |
resizeForLabel: true
|
|
238 |
model: doCancel
|
|
239 |
extent: (Point 65 22)
|
|
240 |
)
|
|
241 |
)
|
|
242 |
|
|
243 |
)
|
3796
|
244 |
)
|
|
245 |
)
|
|
246 |
|
|
247 |
)
|
|
248 |
)
|
3809
|
249 |
(LabelSpec
|
|
250 |
label: 'Label'
|
|
251 |
name: 'Label1'
|
|
252 |
layout: (LayoutFrame 1 0 -25 1 -1 1 -1 1)
|
|
253 |
level: -1
|
|
254 |
translateLabel: true
|
|
255 |
labelChannel: infoHolder
|
|
256 |
adjust: left
|
3796
|
257 |
)
|
|
258 |
)
|
|
259 |
|
|
260 |
)
|
|
261 |
)
|
|
262 |
! !
|
|
263 |
|
|
264 |
!AssistantApplication class methodsFor:'menu specs'!
|
|
265 |
|
|
266 |
mainMenu
|
3808
|
267 |
"This resource specification was automatically generated
|
|
268 |
by the MenuEditor of ST/X."
|
3796
|
269 |
|
|
270 |
"Do not manually edit this!! If it is corrupted,
|
|
271 |
the MenuEditor may not be able to read the specification."
|
|
272 |
|
|
273 |
"
|
|
274 |
MenuEditor new openOnClass:AssistantApplication andSelector:#mainMenu
|
3808
|
275 |
(Menu new fromLiteralArrayEncoding:(AssistantApplication mainMenu)) startUp
|
3796
|
276 |
"
|
|
277 |
|
|
278 |
<resource: #menu>
|
|
279 |
|
3808
|
280 |
^
|
|
281 |
#(Menu
|
|
282 |
(
|
|
283 |
(MenuItem
|
|
284 |
label: 'File'
|
|
285 |
translateLabel: true
|
|
286 |
submenu:
|
|
287 |
(Menu
|
|
288 |
(
|
|
289 |
(MenuItem
|
|
290 |
label: 'Exit'
|
|
291 |
itemValue: closeRequest
|
|
292 |
translateLabel: true
|
3796
|
293 |
)
|
3808
|
294 |
)
|
|
295 |
nil
|
|
296 |
nil
|
3796
|
297 |
)
|
3808
|
298 |
)
|
|
299 |
(MenuItem
|
|
300 |
label: 'Help'
|
|
301 |
translateLabel: true
|
|
302 |
startGroup: right
|
|
303 |
submenu:
|
|
304 |
(Menu
|
|
305 |
(
|
|
306 |
(MenuItem
|
|
307 |
label: 'Documentation'
|
|
308 |
itemValue: openDocumentation
|
|
309 |
translateLabel: true
|
3796
|
310 |
)
|
3808
|
311 |
(MenuItem
|
|
312 |
label: '-'
|
|
313 |
)
|
|
314 |
(MenuItem
|
|
315 |
label: 'About this Application...'
|
|
316 |
itemValue: openAboutThisApplication
|
|
317 |
translateLabel: true
|
|
318 |
)
|
|
319 |
)
|
|
320 |
nil
|
|
321 |
nil
|
3796
|
322 |
)
|
3808
|
323 |
)
|
|
324 |
)
|
|
325 |
nil
|
|
326 |
nil
|
3796
|
327 |
)
|
|
328 |
! !
|
|
329 |
|
3805
|
330 |
!AssistantApplication class methodsFor:'required protocol'!
|
|
331 |
|
|
332 |
assistantSpec
|
|
333 |
"must return a sequenceable collection of assistantPageSpecs - one for each page"
|
|
334 |
|
|
335 |
self subclassResponsibility
|
|
336 |
! !
|
|
337 |
|
3796
|
338 |
!AssistantApplication methodsFor:'actions'!
|
|
339 |
|
3806
|
340 |
canGoBackward
|
|
341 |
|currentPageSpec previousPageSpec|
|
|
342 |
|
|
343 |
"/ see if we are allowed to leave...
|
|
344 |
currentPageSpec := self currentPageSpec.
|
|
345 |
currentPageSpec canLeaveQuerySelector notNil ifTrue:[
|
|
346 |
(self perform:currentPageSpec canLeaveQuerySelector) ifFalse:[^ false].
|
|
347 |
].
|
|
348 |
|
|
349 |
"/ see if we are allowed to enter the next...
|
|
350 |
previousPageSpec := self previousEnabledPageSpec.
|
|
351 |
previousPageSpec isNil ifTrue:[^ false].
|
|
352 |
|
|
353 |
previousPageSpec canEnterQuerySelector notNil ifTrue:[
|
|
354 |
(self perform:previousPageSpec canEnterQuerySelector) ifFalse:[^ false].
|
|
355 |
].
|
|
356 |
^ true
|
|
357 |
!
|
|
358 |
|
|
359 |
canGoForward
|
|
360 |
|currentPageSpec nextPageSpec|
|
|
361 |
|
|
362 |
self currentPageIndex == self numberOfPages ifTrue:[^ false].
|
|
363 |
|
|
364 |
"/ see if we are allowed to leave...
|
|
365 |
currentPageSpec := self currentPageSpec.
|
|
366 |
currentPageSpec canLeaveQuerySelector notNil ifTrue:[
|
|
367 |
(self perform:currentPageSpec canLeaveQuerySelector) ifFalse:[^ false].
|
|
368 |
].
|
|
369 |
|
|
370 |
"/ see if we are allowed to enter the next...
|
|
371 |
nextPageSpec := self nextEnabledPageSpec.
|
|
372 |
nextPageSpec isNil ifTrue:[^ false].
|
|
373 |
|
|
374 |
nextPageSpec canEnterQuerySelector notNil ifTrue:[
|
|
375 |
(self perform:nextPageSpec canEnterQuerySelector) ifFalse:[^ false].
|
|
376 |
].
|
|
377 |
^ true
|
|
378 |
!
|
|
379 |
|
3796
|
380 |
doCancel
|
|
381 |
self closeRequest
|
|
382 |
!
|
|
383 |
|
|
384 |
doFinish
|
|
385 |
self closeRequest
|
|
386 |
!
|
|
387 |
|
|
388 |
goBackward
|
3806
|
389 |
|currentPageSpec|
|
3796
|
390 |
|
3806
|
391 |
(self canGoBackward) ifFalse:[^ self].
|
|
392 |
|
3796
|
393 |
currentPageSpec := self currentPageSpec.
|
|
394 |
currentPageSpec leaveCallbackSelector notNil ifTrue:[
|
|
395 |
self perform:currentPageSpec leaveCallbackSelector
|
|
396 |
].
|
|
397 |
|
3805
|
398 |
self currentPageIndexHolder value:((self indexOfPreviousEnabledPageSpec) max:1).
|
3796
|
399 |
|
|
400 |
currentPageSpec := self currentPageSpec.
|
|
401 |
currentPageSpec enterCallbackSelector notNil ifTrue:[
|
|
402 |
self perform:currentPageSpec enterCallbackSelector
|
|
403 |
].
|
3806
|
404 |
|
|
405 |
self updateButtonEnableState.
|
3796
|
406 |
!
|
|
407 |
|
|
408 |
goForward
|
3806
|
409 |
|currentPageSpec|
|
3796
|
410 |
|
3806
|
411 |
(self canGoForward) ifFalse:[^ self].
|
|
412 |
|
3796
|
413 |
currentPageSpec := self currentPageSpec.
|
|
414 |
currentPageSpec leaveCallbackSelector notNil ifTrue:[
|
|
415 |
self perform:currentPageSpec leaveCallbackSelector
|
|
416 |
].
|
|
417 |
|
3805
|
418 |
self currentPageIndexHolder value:(self indexOfNextEnabledPageSpec).
|
3796
|
419 |
|
|
420 |
currentPageSpec := self currentPageSpec.
|
|
421 |
currentPageSpec enterCallbackSelector notNil ifTrue:[
|
|
422 |
self perform:currentPageSpec enterCallbackSelector
|
|
423 |
].
|
3806
|
424 |
|
|
425 |
self updateButtonEnableState.
|
3796
|
426 |
! !
|
|
427 |
|
|
428 |
!AssistantApplication methodsFor:'aspects'!
|
|
429 |
|
3805
|
430 |
assistantSpec
|
|
431 |
^ self class assistantSpec
|
|
432 |
!
|
|
433 |
|
3796
|
434 |
backButtonEnabled
|
|
435 |
<resource: #uiAspect>
|
|
436 |
|
|
437 |
backButtonEnabled isNil ifTrue:[
|
|
438 |
backButtonEnabled := false asValue.
|
|
439 |
].
|
|
440 |
^ backButtonEnabled.
|
|
441 |
!
|
|
442 |
|
|
443 |
backButtonLabelHolder
|
|
444 |
<resource: #uiAspect>
|
|
445 |
|
|
446 |
backButtonLabelHolder isNil ifTrue:[
|
|
447 |
backButtonLabelHolder := self backButtonLabel asValue.
|
|
448 |
].
|
|
449 |
^ backButtonLabelHolder.
|
|
450 |
!
|
|
451 |
|
|
452 |
backButtonVisible
|
|
453 |
<resource: #uiAspect>
|
|
454 |
|
|
455 |
backButtonVisible isNil ifTrue:[
|
|
456 |
backButtonVisible := true asValue.
|
|
457 |
].
|
|
458 |
^ backButtonVisible.
|
|
459 |
!
|
|
460 |
|
|
461 |
currentPageIndexHolder
|
|
462 |
<resource: #uiAspect>
|
|
463 |
|
|
464 |
currentPageIndexHolder isNil ifTrue:[
|
|
465 |
currentPageIndexHolder := 1 asValue.
|
|
466 |
currentPageIndexHolder onChangeSend:#updateCanvas to:self
|
|
467 |
].
|
|
468 |
^ currentPageIndexHolder.
|
|
469 |
!
|
|
470 |
|
|
471 |
currentPageInfoHTMLHolder
|
|
472 |
<resource: #uiAspect>
|
|
473 |
|
|
474 |
currentPageInfoHTMLHolder isNil ifTrue:[
|
|
475 |
currentPageInfoHTMLHolder := ValueHolder new.
|
|
476 |
].
|
|
477 |
^ currentPageInfoHTMLHolder.
|
|
478 |
!
|
|
479 |
|
|
480 |
currentPageSpecHolder
|
|
481 |
<resource: #uiAspect>
|
|
482 |
|
|
483 |
currentPageSpecHolder isNil ifTrue:[
|
|
484 |
currentPageSpecHolder := nil asValue.
|
|
485 |
].
|
|
486 |
^ currentPageSpecHolder.
|
|
487 |
!
|
|
488 |
|
|
489 |
finishButtonEnabled
|
|
490 |
<resource: #uiAspect>
|
|
491 |
|
|
492 |
finishButtonEnabled isNil ifTrue:[
|
|
493 |
finishButtonEnabled := false asValue.
|
|
494 |
].
|
|
495 |
^ finishButtonEnabled.
|
|
496 |
!
|
|
497 |
|
|
498 |
finishButtonVisible
|
|
499 |
<resource: #uiAspect>
|
|
500 |
|
|
501 |
finishButtonVisible isNil ifTrue:[
|
|
502 |
finishButtonVisible := false asValue.
|
|
503 |
].
|
|
504 |
^ finishButtonVisible.
|
|
505 |
!
|
|
506 |
|
|
507 |
forwardButtonEnabled
|
|
508 |
<resource: #uiAspect>
|
|
509 |
|
|
510 |
forwardButtonEnabled isNil ifTrue:[
|
|
511 |
forwardButtonEnabled := false asValue.
|
|
512 |
].
|
|
513 |
^ forwardButtonEnabled.
|
|
514 |
!
|
|
515 |
|
|
516 |
forwardButtonVisible
|
|
517 |
<resource: #uiAspect>
|
|
518 |
|
|
519 |
forwardButtonVisible isNil ifTrue:[
|
|
520 |
forwardButtonVisible := true asValue.
|
|
521 |
].
|
|
522 |
^ forwardButtonVisible.
|
|
523 |
!
|
|
524 |
|
|
525 |
nextButtonLabelHolder
|
|
526 |
<resource: #uiAspect>
|
|
527 |
|
|
528 |
nextButtonLabelHolder isNil ifTrue:[
|
|
529 |
nextButtonLabelHolder := self nextButtonLabel asValue.
|
|
530 |
].
|
|
531 |
^ nextButtonLabelHolder.
|
3805
|
532 |
!
|
|
533 |
|
|
534 |
pageLabelsInList
|
|
535 |
pageLabelsInList isNil ifTrue:[
|
|
536 |
pageLabelsInList := List new.
|
|
537 |
pageLabelsInList contents:(self pageLabelsInListWithBullet).
|
|
538 |
].
|
|
539 |
^ pageLabelsInList
|
|
540 |
!
|
|
541 |
|
|
542 |
pageLabelsInListWithBullet
|
|
543 |
|newList|
|
|
544 |
|
|
545 |
newList := self pageLabels.
|
|
546 |
newList := newList with:(1 to:newList size)
|
|
547 |
collect:[:entry :index |
|
|
548 |
index == self currentPageIndex ifTrue:[
|
|
549 |
LabelAndTwoIcons new
|
|
550 |
string:entry;
|
|
551 |
icon:(self class rightArrowIcon);
|
|
552 |
image2:(self class leftArrowIcon)
|
|
553 |
] ifFalse:[
|
|
554 |
(self isPageEnabledAtIndex:index) ifFalse:[
|
|
555 |
entry asText colorizeAllWith:(Button defaultDisabledForegroundColor) "Color grey".
|
|
556 |
] ifTrue:[
|
|
557 |
entry
|
|
558 |
].
|
|
559 |
].
|
|
560 |
].
|
|
561 |
^ newList
|
3796
|
562 |
! !
|
|
563 |
|
3809
|
564 |
!AssistantApplication methodsFor:'help'!
|
|
565 |
|
|
566 |
flyByHelpTextForKey:aKey
|
|
567 |
<resource: #help>
|
|
568 |
|
|
569 |
|text bindings nextSpec prevSpec|
|
|
570 |
|
|
571 |
text := super flyByHelpTextForKey:aKey.
|
|
572 |
|
|
573 |
nextSpec := self nextEnabledPageSpec.
|
|
574 |
prevSpec := self previousEnabledPageSpec.
|
|
575 |
|
|
576 |
bindings := Dictionary new.
|
|
577 |
bindings
|
|
578 |
at:#'previousPageInfo'
|
|
579 |
put:(prevSpec notNil ifTrue:[ '"',prevSpec pageTitle,'"' ] ifFalse:['']).
|
|
580 |
bindings
|
|
581 |
at:#'nextPageInfo'
|
|
582 |
put:(nextSpec notNil ifTrue:[ '"',nextSpec pageTitle,'"' ] ifFalse:['']).
|
|
583 |
|
|
584 |
^ self resources string:text withArgs:bindings.
|
|
585 |
! !
|
|
586 |
|
3796
|
587 |
!AssistantApplication methodsFor:'initialization & release'!
|
|
588 |
|
|
589 |
postBuildWith:aBuilder
|
3805
|
590 |
|maxCanvasExtent|
|
|
591 |
|
3796
|
592 |
super postBuildWith:aBuilder.
|
|
593 |
self updateCanvas.
|
3805
|
594 |
|
|
595 |
maxCanvasExtent := (self assistantSpec
|
|
596 |
collect:[:eachPageSpec |
|
|
597 |
|windowSpecSelector specArray windowSpec|
|
|
598 |
|
|
599 |
windowSpecSelector := eachPageSpec windowSpecSelector.
|
|
600 |
specArray := self perform:windowSpecSelector ifNotUnderstood:[self class perform:windowSpecSelector].
|
|
601 |
windowSpec := specArray decodeAsLiteralArray.
|
|
602 |
windowSpec window bounds extent.
|
|
603 |
]
|
|
604 |
) max.
|
|
605 |
|
|
606 |
self window extent:(maxCanvasExtent + (200 @ 40)).
|
3796
|
607 |
! !
|
|
608 |
|
|
609 |
!AssistantApplication methodsFor:'look'!
|
|
610 |
|
|
611 |
backButtonLabel
|
|
612 |
^ LabelAndIcon
|
|
613 |
label:(resources string:'Back')
|
|
614 |
icon:(self backButtonEnabled value
|
|
615 |
ifTrue:[ToolbarIconLibrary leftArrow24x24Icon]
|
|
616 |
ifFalse:[ToolbarIconLibrary leftArrow24x24disabledIcon])
|
|
617 |
!
|
|
618 |
|
|
619 |
nextButtonLabel
|
|
620 |
^ LabelAndTwoIcons new
|
|
621 |
string:(resources string:'Next');
|
|
622 |
image2:(self forwardButtonEnabled value
|
|
623 |
ifTrue:[ToolbarIconLibrary rightArrow24x24Icon]
|
|
624 |
ifFalse:[ToolbarIconLibrary rightArrow24x24disabledIcon])
|
|
625 |
!
|
|
626 |
|
|
627 |
pageLabels
|
|
628 |
^ self assistantSpec collect:[:specEntry | specEntry pageTitle].
|
|
629 |
! !
|
|
630 |
|
|
631 |
!AssistantApplication methodsFor:'private'!
|
|
632 |
|
|
633 |
canFinish
|
|
634 |
|pageIndex pageSpec|
|
|
635 |
|
|
636 |
pageIndex := self currentPageIndexHolder value.
|
|
637 |
pageSpec := self assistantSpec at:pageIndex.
|
|
638 |
^ pageSpec canLeaveQuerySelector isNil
|
|
639 |
or:[ self perform:pageSpec canLeaveQuerySelector ]
|
|
640 |
!
|
|
641 |
|
|
642 |
currentPageIndex
|
|
643 |
^ self currentPageIndexHolder value
|
|
644 |
!
|
|
645 |
|
|
646 |
currentPageSpec
|
|
647 |
^ self assistantSpec at:(self currentPageIndex).
|
|
648 |
!
|
|
649 |
|
3805
|
650 |
indexOfNextEnabledPageSpec
|
|
651 |
|delta currentPageIndex|
|
|
652 |
|
|
653 |
currentPageIndex := self currentPageIndex.
|
|
654 |
delta := 1.
|
|
655 |
[
|
|
656 |
(currentPageIndex + delta) <= (self numberOfPages)
|
|
657 |
and:[ (self isPageEnabledAtIndex:(currentPageIndex + delta)) not ]
|
|
658 |
] whileTrue:[
|
|
659 |
delta := delta + 1.
|
|
660 |
].
|
|
661 |
(currentPageIndex + delta) <= (self numberOfPages) ifTrue:[
|
|
662 |
^ (currentPageIndex + delta).
|
|
663 |
].
|
|
664 |
^ nil
|
|
665 |
!
|
|
666 |
|
|
667 |
indexOfPreviousEnabledPageSpec
|
|
668 |
|delta currentPageIndex|
|
|
669 |
|
|
670 |
currentPageIndex := self currentPageIndex.
|
|
671 |
delta := 1.
|
|
672 |
[
|
|
673 |
(currentPageIndex - delta) > 0
|
|
674 |
and:[ (self isPageEnabledAtIndex:(currentPageIndex - delta)) not ]
|
|
675 |
] whileTrue:[
|
|
676 |
delta := delta + 1.
|
|
677 |
].
|
|
678 |
(currentPageIndex - delta) > 0 ifTrue:[
|
|
679 |
^ (currentPageIndex - delta).
|
|
680 |
].
|
|
681 |
^ nil
|
|
682 |
!
|
|
683 |
|
|
684 |
isPageEnabledAtIndex:index
|
|
685 |
|isEnabledSelector|
|
|
686 |
|
|
687 |
isEnabledSelector := (self assistantSpec at:index) isEnabledQuerySelector.
|
|
688 |
^ isEnabledSelector isNil or:[ (self perform:isEnabledSelector) ]
|
|
689 |
!
|
|
690 |
|
|
691 |
nextEnabledPageSpec
|
|
692 |
|index|
|
|
693 |
|
|
694 |
index := self indexOfNextEnabledPageSpec.
|
|
695 |
index isNil ifTrue:[^ nil].
|
|
696 |
^ self assistantSpec at:index.
|
|
697 |
!
|
|
698 |
|
3796
|
699 |
nextPageSpec
|
|
700 |
^ self assistantSpec at:(self currentPageIndex + 1).
|
|
701 |
!
|
|
702 |
|
|
703 |
numberOfPages
|
|
704 |
^ self assistantSpec size
|
|
705 |
!
|
|
706 |
|
3805
|
707 |
previousEnabledPageSpec
|
|
708 |
|index|
|
|
709 |
|
|
710 |
index := self indexOfPreviousEnabledPageSpec.
|
|
711 |
index isNil ifTrue:[^ nil].
|
|
712 |
^ self assistantSpec at:index.
|
|
713 |
!
|
|
714 |
|
3796
|
715 |
previousPageSpec
|
|
716 |
^ self assistantSpec at:(self currentPageIndex - 1).
|
|
717 |
!
|
|
718 |
|
3806
|
719 |
updateButtonEnableState
|
|
720 |
self backButtonEnabled value:(self canGoBackward).
|
|
721 |
self forwardButtonEnabled value:(self canGoForward).
|
|
722 |
self backButtonLabelHolder value:(self backButtonLabel).
|
|
723 |
self nextButtonLabelHolder value:(self nextButtonLabel).
|
|
724 |
!
|
|
725 |
|
3796
|
726 |
updateCanvas
|
|
727 |
|pageIndex pageSpec sel uiSpec|
|
|
728 |
|
|
729 |
pageIndex := self currentPageIndex.
|
|
730 |
pageSpec := self currentPageSpec.
|
|
731 |
sel := pageSpec windowSpecSelector.
|
3805
|
732 |
uiSpec := self perform:sel ifNotUnderstood:[ self class perform:sel ].
|
3796
|
733 |
|
3805
|
734 |
self pageLabelsInList contents:(self pageLabelsInListWithBullet).
|
3796
|
735 |
self currentPageSpecHolder value:uiSpec.
|
|
736 |
self window label:(pageSpec pageTitle).
|
|
737 |
|
|
738 |
self finishButtonVisible value:(pageIndex == self numberOfPages).
|
|
739 |
self backButtonEnabled value:(pageIndex > 1).
|
|
740 |
self forwardButtonEnabled value:(pageIndex < self numberOfPages).
|
|
741 |
self finishButtonEnabled value:(pageIndex == self numberOfPages and:[ self canFinish ]).
|
|
742 |
|
|
743 |
self backButtonLabelHolder value:(self backButtonLabel).
|
|
744 |
self nextButtonLabelHolder value:(self nextButtonLabel).
|
|
745 |
! !
|
|
746 |
|
|
747 |
!AssistantApplication class methodsFor:'documentation'!
|
|
748 |
|
|
749 |
version_CVS
|
3809
|
750 |
^ '$Header: /cvs/stx/stx/libwidg2/AssistantApplication.st,v 1.7 2009-10-21 13:32:50 cg Exp $'
|
3796
|
751 |
! !
|