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