author | Claus Gittinger <cg@exept.de> |
Sun, 19 Jan 2020 17:32:41 +0100 | |
changeset 4429 | b9e79975c33a |
parent 4428 | 5111a837d71c |
child 4443 | 81b3abce89d0 |
permissions | -rw-r--r-- |
4369 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1419 | 3 |
" |
4 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
4173 | 5 |
All Rights Reserved |
1419 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libview2' }" |
|
15 |
||
3442 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
1419 | 18 |
Model subclass:#ApplicationModel |
4174 | 19 |
instanceVariableNames:'builder resources device masterApplication' |
20 |
classVariableNames:'DefaultExtents DefaultLabels DefaultVisuals |
|
21 |
RecentlyOpenedApplications' |
|
22 |
poolDictionaries:'' |
|
23 |
category:'Interface-Framework' |
|
138 | 24 |
! |
25 |
||
1419 | 26 |
ApplicationModel class instanceVariableNames:'ClassResources' |
27 |
||
28 |
" |
|
29 |
No other class instance variables are inherited by this class. |
|
30 |
" |
|
1350 | 31 |
! |
32 |
||
1419 | 33 |
!ApplicationModel class methodsFor:'documentation'! |
34 |
||
1417 | 35 |
copyright |
1419 | 36 |
" |
37 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
4173 | 38 |
All Rights Reserved |
1419 | 39 |
|
40 |
This software is furnished under a license and may be used |
|
41 |
only in accordance with the terms of that license and with the |
|
42 |
inclusion of the above copyright notice. This software may not |
|
43 |
be provided or otherwise made available to, or used by, any |
|
44 |
other person. No title to or ownership of the software is |
|
45 |
hereby transferred. |
|
46 |
" |
|
47 |
! |
|
48 |
||
49 |
documentation |
|
50 |
" |
|
51 |
Since many ST-80 classes are subclasses of ApplicationModel, this class |
|
52 |
is provided here to allow easier porting of ST-80 code. |
|
53 |
||
54 |
It does not (currently) provide all functionality and is NOT |
|
55 |
compatible to the corresponding ST80 class; therefore, manual |
|
56 |
changes have to be made to get those applications to run under ST/X. |
|
57 |
(but at least, this enables you to fileIn that code and have a superclass |
|
58 |
for them) |
|
59 |
||
60 |
As time goes by, ST/X applications are going to be converted to |
|
61 |
become subclasses of this abstract class - see Launcher for a |
|
62 |
first concrete example. |
|
63 |
||
64 |
||
65 |
ApplicationModel is prepared to build a view from a windowSpec, as |
|
66 |
created by the windowBuilder. If your subclass does not provide such |
|
67 |
a spec, you should at least redefine: |
|
68 |
||
4173 | 69 |
#openInterface - to create a topview and open it |
1419 | 70 |
|
71 |
you may want to redefine: |
|
72 |
||
4173 | 73 |
#closeRequest - to catch window closing |
74 |
#focusSequence - to define a sequence for focus-stepping |
|
1419 | 75 |
|
76 |
||
77 |
Once the interfaceBuilder is finished & released, subclasses can |
|
78 |
alternatively provide the spec via a #windowSpec method. |
|
79 |
||
80 |
The classResources have been put into this class to allow ST/X |
|
81 |
applications (which used to be subclasses of StandardSystemView) |
|
82 |
to migrate smoothly into ApplicationModels (which is better design ...). |
|
83 |
||
84 |
||
85 |
[Instance variables:] |
|
4173 | 86 |
resources ResourcePack language string translation |
87 |
||
88 |
builder WindowBuilder a builder who knows how to create |
|
89 |
a window hierarchy from a specification |
|
1419 | 90 |
|
91 |
||
92 |
Notice: this class was implemented using protocol information |
|
93 |
from alpha testers and PD code - it may not be complete or compatible to |
|
94 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
95 |
please forward a note to the ST/X team. |
|
96 |
||
97 |
||
98 |
[author:] |
|
4173 | 99 |
Claus Gittinger |
1419 | 100 |
|
101 |
[see also:] |
|
4173 | 102 |
StandardSystemView |
103 |
WindowGroup DeviceWorkstation |
|
1419 | 104 |
" |
2527 | 105 |
! |
106 |
||
107 |
howToDealWithMultipleApplicationInstances |
|
108 |
" |
|
109 |
The following relates to StandAlone applications (i.e. compiled exe's) only. |
|
110 |
If the user attempts to open another of the applications documents (after the first instance |
|
111 |
of the application has already been opened), it is sometimes required to notify the first |
|
112 |
application about this and to ask it to open an extra window on the second-clicked document. |
|
113 |
In other words: to get another of the first instances' windows instead of opening a window |
|
114 |
by the second application. |
|
115 |
||
116 |
This is implemented via the following mechanism (see StandaloneStartup): |
|
3704 | 117 |
the first application instance leaves the information about its existence somewhere |
118 |
(under win32: in the registry, the window-ID of its main window is remembered; |
|
119 |
under unix, its stored into a locked file). |
|
120 |
a mutex is created to prevent a race on this informationduring startup |
|
121 |
(under win32: a mutex proper; under unix, the above locked file will do) |
|
122 |
||
123 |
when the app is started the second time, it will not be able to acquire the mutex (and therefore |
|
2527 | 124 |
knows, that its the second instance). It will then send an event-message (win32: via copyData; |
125 |
unix. via sendClientEvent), to the first instance and pass the fileName of the document which |
|
126 |
is to be opened. The first instance receives this event and opens another window for it. |
|
127 |
The second instance simply exits and stops execution. |
|
128 |
This guarantees that only one instance of an application is executing (if desired). |
|
129 |
||
130 |
The implementation is found in: |
|
3704 | 131 |
StandaloneStartup: |
132 |
checkForAndExitIfAnotherApplicationInstanceIsRunning |
|
133 |
||
134 |
here: |
|
135 |
processOpenPathCommand:aFilename |
|
2527 | 136 |
|
137 |
By default, the event is ignored - subclasses which want to support that behavior MUST |
|
138 |
redefine processOpenPathCommand: in ApplicationModel and also make sure that |
|
139 |
checkForAndExitIfAnotherApplicationInstanceIsRunning is called for in StandaloneStartup. |
|
3297 | 140 |
|
2527 | 141 |
" |
1419 | 142 |
! ! |
143 |
||
144 |
!ApplicationModel class methodsFor:'initialization'! |
|
145 |
||
3297 | 146 |
initialize |
1419 | 147 |
self == ApplicationModel ifTrue:[ |
4173 | 148 |
Smalltalk addDependent:self |
1419 | 149 |
]. |
150 |
DefaultLabels isNil ifTrue:[ |
|
4173 | 151 |
DefaultLabels := IdentityDictionary new |
1419 | 152 |
]. |
153 |
DefaultVisuals isNil ifTrue:[ |
|
4173 | 154 |
DefaultVisuals := IdentityDictionary new |
1419 | 155 |
]. |
156 |
||
157 |
" |
|
158 |
ApplicationModel initialize |
|
159 |
" |
|
160 |
||
161 |
"Modified: 28.1.1997 / 12:31:38 / cg" |
|
162 |
! ! |
|
163 |
||
164 |
!ApplicationModel class methodsFor:'instance creation'! |
|
165 |
||
166 |
new |
|
167 |
"return a new initialized instance" |
|
168 |
||
1977
abd5df24333e
Make sure to return the new instance in #new (and not the return value
Stefan Vogel <sv@exept.de>
parents:
1972
diff
changeset
|
169 |
^ self basicNew basicInitialize; initialize; yourself. |
1419 | 170 |
! |
171 |
||
172 |
onDevice:aDevice |
|
1828 | 173 |
"return a new initialized instance, which shall open its interface on aDevice." |
174 |
||
175 |
^ (super basicNew basicInitialize setDevice:aDevice) initialize |
|
1419 | 176 |
! ! |
177 |
||
178 |
!ApplicationModel class methodsFor:'accessing'! |
|
179 |
||
180 |
application |
|
181 |
^ self |
|
182 |
||
3498 | 183 |
! |
184 |
||
185 |
applicationName |
|
186 |
"the name as shown in an about box or in the deployed package. |
|
187 |
If there is an application definition in my package, ask that one. |
|
188 |
Otherwise, return my name." |
|
189 |
||
190 |
|prjDef| |
|
191 |
||
192 |
(prjDef := self projectDefinitionClass) notNil ifTrue:[ |
|
193 |
prjDef isApplicationDefinition ifTrue:[ |
|
194 |
^ prjDef applicationName |
|
195 |
]. |
|
196 |
]. |
|
197 |
^ self name |
|
1419 | 198 |
! ! |
199 |
||
200 |
!ApplicationModel class methodsFor:'active help'! |
|
201 |
||
1538 | 202 |
flyByHelpSpec |
4047 | 203 |
"obsolete: only provided for backward compatibility. |
204 |
default is: take the oldStyle help-spec (should be redefined by concrete class)." |
|
1538 | 205 |
|
2569 | 206 |
^ self helpSpec |
1538 | 207 |
! |
208 |
||
1419 | 209 |
helpSpec |
1431 | 210 |
"default is: no help-spec (should be redefined by concrete class if help is wanted)." |
211 |
||
1419 | 212 |
^ IdentityDictionary new. |
213 |
! ! |
|
214 |
||
215 |
!ApplicationModel class methodsFor:'bindings'! |
|
216 |
||
217 |
actionFor:aKey |
|
218 |
"sent by the builder to ask for an actionBlock for |
|
219 |
a Button. The argument, aKey comes from an UI-spec |
|
220 |
for a buttons #action property. |
|
221 |
Here, a corresponding message is sent to myself, |
|
222 |
which ought to be defined in the application subclass. |
|
223 |
Alternatively, a subclass may redefine this method, to provide |
|
224 |
actionBlocks from a Dictionary or whatever. |
|
225 |
Typically, a block is returned there." |
|
226 |
||
227 |
^ nil |
|
228 |
||
229 |
||
230 |
! |
|
231 |
||
232 |
actionFor:aKey withValue:aValue |
|
233 |
"sent by the builder to ask for an actionBlock for |
|
3297 | 234 |
a Button which passes a value to the actionMethod. |
1419 | 235 |
The argument, aKey comes from an UI-spec |
236 |
for a buttons #action property. |
|
237 |
Here, a corresponding message is sent to myself, |
|
238 |
which ought to be defined in the application subclass. |
|
239 |
Alternatively, a subclass may redefine this method, to provide |
|
240 |
actionBlocks from a Dictionary or whatever. |
|
241 |
Typically, a block is returned there." |
|
242 |
||
243 |
^ nil |
|
244 |
||
245 |
||
246 |
! |
|
247 |
||
248 |
aspectFor:aKey |
|
249 |
"sent by the builder to ask for an aspect (a data model). |
|
250 |
The argument, aKey comes from an UI-spec |
|
251 |
for a components #aspect property. |
|
252 |
Here, a corresponding message is sent to myself, |
|
253 |
which ought to be defined in the application subclass. |
|
254 |
Alternatively, a subclass may redefine this method, to provide |
|
255 |
holders from a Dictionary or whatever. |
|
256 |
Typically, a valueHolder is returned there." |
|
257 |
||
258 |
^ self perform:aKey |
|
259 |
||
260 |
"/ ^ nil |
|
261 |
||
262 |
"Modified: / 27.10.1997 / 13:43:12 / cg" |
|
263 |
! |
|
264 |
||
265 |
clientFor:aKey |
|
266 |
"sent by the builder to ask for an application provided |
|
267 |
subcanvas's application. |
|
268 |
The argument, aKey comes from an UI-spec |
|
269 |
for a subcanvas's #client property. |
|
270 |
Here, a corresponding message is sent to myself, |
|
271 |
which ought to be defined in the application subclass. |
|
272 |
Alternatively, a subclass may redefine this method, to provide |
|
273 |
appModels from a Dictionary or whatever. |
|
274 |
Typically, an applicationModel is returned there." |
|
275 |
||
276 |
^ nil |
|
277 |
||
278 |
! |
|
279 |
||
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
280 |
colorFor:aSymbol |
2472 | 281 |
"sent by the builder to ask for an application provided color. |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
282 |
The argument, aKey comes from an UI-spec |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
283 |
for a widgets #*Color property. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
284 |
Here, a corresponding message is sent to myself, |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
285 |
which ought to be defined in the application subclass. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
286 |
Alternatively, a subclass may redefine this method, to provide |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
287 |
holders from a Dictionary or whatever. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
288 |
Typically, a color is returned there." |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
289 |
|
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
290 |
(self respondsTo:aSymbol) ifTrue:[ |
4173 | 291 |
^ (self perform:aSymbol) value. |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
292 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
293 |
|
2481
1fc2941fe30e
#colorFor:enhance color name resolution.
Stefan Vogel <sv@exept.de>
parents:
2472
diff
changeset
|
294 |
"fall back to a possibly well defined color name" |
1fc2941fe30e
#colorFor:enhance color name resolution.
Stefan Vogel <sv@exept.de>
parents:
2472
diff
changeset
|
295 |
^ Color name:aSymbol ifIllegal:nil. |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
296 |
! |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
297 |
|
1419 | 298 |
componentFor:aKey |
299 |
"sent by the builder to ask for an application provided |
|
300 |
component. |
|
301 |
The argument, aKey comes from an UI-spec |
|
302 |
for a viewHolders #view property. |
|
303 |
Here, a corresponding message is sent to myself, |
|
304 |
which ought to be defined in the application subclass. |
|
305 |
Alternatively, a subclass may redefine this method, to provide |
|
306 |
holders from a Dictionary or whatever. |
|
307 |
Typically, a view is returned there." |
|
308 |
||
309 |
(self respondsTo:aKey) ifTrue:[ |
|
4173 | 310 |
^ self perform:aKey |
1419 | 311 |
]. |
312 |
^ nil |
|
313 |
! |
|
314 |
||
2472 | 315 |
fontFor:aSymbol |
316 |
"sent by the builder to ask for an application provided font. |
|
317 |
The argument, aKey comes from an UI-spec |
|
318 |
for a widgets #*Font property. |
|
319 |
Here, a corresponding message is sent to myself, |
|
320 |
which ought to be defined in the application subclass. |
|
321 |
Alternatively, a subclass may redefine this method, to provide |
|
322 |
holders from a Dictionary or whatever. |
|
323 |
Typically, a font is returned there." |
|
324 |
||
325 |
(self respondsTo:aSymbol) ifTrue:[ |
|
4173 | 326 |
^ self perform:aSymbol. |
2472 | 327 |
]. |
328 |
||
329 |
"/ "fall back to a well defined font name" |
|
330 |
"/ (Font respondsTo:aSymbol) ifTrue:[ |
|
331 |
"/ ^ Font perform:aSymbol. |
|
332 |
"/ ]. |
|
333 |
^ nil |
|
334 |
! |
|
335 |
||
1419 | 336 |
labelFor:aKey |
337 |
"sent by the builder to ask for an application provided |
|
338 |
label for a component. |
|
339 |
The argument, aKey comes from an UI-spec |
|
340 |
for a components #label property. |
|
341 |
Here, a corresponding message is sent to myself, |
|
342 |
which ought to be defined in the application subclass. |
|
343 |
Alternatively, a subclass may redefine this method, to provide |
|
344 |
labels from a Dictionary or whatever. |
|
345 |
Typically, a string is returned there." |
|
346 |
||
2058 | 347 |
|app| |
348 |
||
349 |
app := self application. |
|
350 |
app isNil ifTrue:[^ nil]. |
|
351 |
(app respondsTo:aKey) ifTrue:[ |
|
4173 | 352 |
^ app perform:aKey |
1419 | 353 |
]. |
2058 | 354 |
^ app labelAt:aKey ifAbsent:nil |
1419 | 355 |
! |
356 |
||
357 |
listFor:aKey |
|
358 |
"sent by the builder to ask for an application provided |
|
359 |
holder for a list. |
|
360 |
The argument, aKey comes from an UI-spec |
|
361 |
for a listWidgets #list property. |
|
362 |
Here, a corresponding message is sent to myself, |
|
363 |
which ought to be defined in the application subclass. |
|
364 |
Alternatively, a subclass may redefine this method, to provide |
|
365 |
holders from a Dictionary or whatever. |
|
366 |
Typically, a list-holding model (SelectionInList) is returned there." |
|
367 |
||
368 |
|app| |
|
369 |
||
2058 | 370 |
app := self application. |
371 |
app notNil ifTrue:[ |
|
4173 | 372 |
(app respondsTo:aKey) ifTrue:[ |
373 |
^ app perform:aKey |
|
374 |
] |
|
1419 | 375 |
]. |
376 |
^ nil. |
|
377 |
||
378 |
"Modified: 4.3.1997 / 00:53:03 / cg" |
|
379 |
! |
|
380 |
||
381 |
menuFor:aKey |
|
382 |
"sent by the builder to ask for an application provided |
|
383 |
holder for a menu. |
|
384 |
The argument, aKey comes from an UI-spec |
|
385 |
for a widgets #menu property. |
|
386 |
Here, a corresponding message is sent to myself, |
|
387 |
which ought to be defined in the application subclass. |
|
388 |
Alternatively, a subclass may redefine this method, to provide |
|
389 |
holders from a Dictionary or whatever. |
|
390 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
391 |
||
392 |
^ self application perform:aKey |
|
393 |
||
394 |
! |
|
395 |
||
396 |
specificationFor:aKey |
|
397 |
"sent by the builder to ask for an application provided |
|
398 |
specification for a subcanvas or subspecification. |
|
399 |
The argument, aKey comes from an UI-spec |
|
400 |
for a subcanvases #specification property (minorKey). |
|
401 |
Here, a corresponding message is sent to myself, |
|
402 |
which ought to be defined in the application subclass. |
|
403 |
Alternatively, a subclass may redefine this method, to provide |
|
404 |
interfaceSpecifications from a Dictionary or whatever. |
|
405 |
Typically, an interfaceSpecification is returned there." |
|
406 |
||
1584 | 407 |
^ self |
4173 | 408 |
specificationFor:aKey |
409 |
application:self |
|
410 |
onDevice:nil |
|
1584 | 411 |
! |
412 |
||
413 |
specificationFor:aKey application:app onDevice:deviceOrNil |
|
414 |
"sent by the builder to ask for an application provided |
|
415 |
specification for a subcanvas or subspecification. |
|
416 |
The argument, aKey comes from an UI-spec |
|
417 |
for a subcanvases #specification property (minorKey). |
|
418 |
Here, a corresponding message is sent to myself, |
|
419 |
which ought to be defined in the application subclass. |
|
420 |
Alternatively, a subclass may redefine this method, to provide |
|
421 |
interfaceSpecifications from a Dictionary or whatever. |
|
422 |
Typically, an interfaceSpecification is returned there." |
|
423 |
||
424 |
|displayDevice displayDeviceType modifiedKey appClass| |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
425 |
|
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
426 |
"/ this code is so ugly... |
1584 | 427 |
"/ translate the specs name, if the display device type is different |
428 |
"/ for example, if the type is pda, the xxxSpec_pda spec will be used. |
|
2926
d6663298affa
changed: #specificationFor:application:onDevice:
Claus Gittinger <cg@exept.de>
parents:
2923
diff
changeset
|
429 |
displayDevice := deviceOrNil. |
d6663298affa
changed: #specificationFor:application:onDevice:
Claus Gittinger <cg@exept.de>
parents:
2923
diff
changeset
|
430 |
displayDevice isNil ifTrue:[ |
4173 | 431 |
displayDevice := Screen current. |
432 |
displayDevice isNil ifTrue:[ |
|
433 |
displayDevice := Screen default. |
|
434 |
] |
|
2926
d6663298affa
changed: #specificationFor:application:onDevice:
Claus Gittinger <cg@exept.de>
parents:
2923
diff
changeset
|
435 |
]. |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
436 |
displayDevice notNil ifTrue:[ |
4173 | 437 |
displayDeviceType := displayDevice deviceType. |
438 |
displayDeviceType notNil ifTrue:[ |
|
439 |
modifiedKey := (aKey , '_' , displayDeviceType) asSymbolIfInterned. |
|
440 |
modifiedKey notNil ifTrue:[ |
|
441 |
(app respondsTo:modifiedKey) ifTrue:[ |
|
442 |
^ app perform:modifiedKey |
|
443 |
]. |
|
444 |
app isBehavior ifFalse:[ |
|
445 |
appClass := app application. |
|
446 |
(appClass respondsTo:modifiedKey) ifTrue:[ |
|
447 |
^ appClass perform:modifiedKey |
|
448 |
]. |
|
449 |
]. |
|
450 |
] |
|
451 |
] |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
452 |
]. |
1584 | 453 |
|
454 |
app isBehavior ifFalse:[ |
|
4173 | 455 |
(app respondsTo:aKey) ifTrue:[ |
456 |
^ app perform:aKey |
|
457 |
]. |
|
458 |
appClass := app application. |
|
459 |
(appClass respondsTo:aKey) ifTrue:[ |
|
460 |
^ appClass perform:aKey |
|
461 |
]. |
|
462 |
^ app masterApplication specificationFor:aKey |
|
1584 | 463 |
]. |
464 |
||
465 |
^ app perform:aKey |
|
2926
d6663298affa
changed: #specificationFor:application:onDevice:
Claus Gittinger <cg@exept.de>
parents:
2923
diff
changeset
|
466 |
|
d6663298affa
changed: #specificationFor:application:onDevice:
Claus Gittinger <cg@exept.de>
parents:
2923
diff
changeset
|
467 |
"Modified: / 18-07-2011 / 09:28:15 / cg" |
1115 | 468 |
! |
469 |
||
2058 | 470 |
subApplicationFor:aKey |
3297 | 471 |
"sent by subCanvas to ask for an application inside itself. |
2058 | 472 |
The argument, aKey comes from a TabList-specs majorKey. |
473 |
Here, a corresponding message is sent to myself, |
|
474 |
which ought to be defined in the application subclass. |
|
475 |
Alternatively, a subclass may redefine this method, to provide |
|
476 |
an application from a Dictionary or whatever. |
|
477 |
Typically, an ApplicationModel subinstance is returned there." |
|
478 |
||
479 |
|app| |
|
480 |
||
481 |
app := self application. |
|
482 |
(app respondsTo:aKey) ifTrue:[ |
|
4173 | 483 |
^ app perform:aKey |
2058 | 484 |
]. |
485 |
^ nil |
|
486 |
! |
|
487 |
||
1419 | 488 |
visualFor:aKey |
489 |
"sent by the builder to ask for an application provided |
|
490 |
image or element for a label. |
|
491 |
The argument, aKey comes from an UI-spec |
|
492 |
for a widgets #label property, if LabelIsImage is turned on. |
|
493 |
Here, a corresponding message is sent to myself, |
|
494 |
which ought to be defined in the application subclass. |
|
495 |
Alternatively, a subclass may redefine this method, to provide |
|
496 |
images from a Dictionary or whatever. |
|
497 |
Typically, an image is returned there." |
|
498 |
||
1781 | 499 |
|app| |
500 |
||
501 |
app := self application. |
|
502 |
(app respondsTo:aKey) ifTrue:[ |
|
4173 | 503 |
^ app perform:aKey |
1419 | 504 |
]. |
1781 | 505 |
^ app visualAt:aKey ifAbsent:nil |
1419 | 506 |
! ! |
507 |
||
508 |
!ApplicationModel class methodsFor:'change & update'! |
|
509 |
||
510 |
update:something with:aParameter from:changedObject |
|
511 |
"flush resources on language changes" |
|
512 |
||
4189 | 513 |
(something == #Language or:[something == #LanguageTerritory]) ifTrue:[ |
4173 | 514 |
self flushAllClassResources |
1419 | 515 |
] |
516 |
||
517 |
"Created: 15.6.1996 / 15:13:29 / cg" |
|
518 |
! ! |
|
519 |
||
520 |
!ApplicationModel class methodsFor:'defaults'! |
|
521 |
||
2554
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
522 |
defaultHttpServerPort |
2769 | 523 |
"this is only used for web-applications" |
524 |
||
2554
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
525 |
^ HTTPServer defaultPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
526 |
! |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
527 |
|
1419 | 528 |
defaultIcon |
1431 | 529 |
"default is: no icon (should be redefined by concrete class if an icon is wanted)." |
530 |
||
1419 | 531 |
^ nil |
532 |
! |
|
533 |
||
2496
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
534 |
defaultIconForAboutBox |
2769 | 535 |
"the icon to be shown in my about-this-app dialog" |
536 |
||
2496
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
537 |
^ self defaultIcon |
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
538 |
! |
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
539 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
540 |
defaultServiceLinkName |
2580 | 541 |
"old web server interface - remove me" |
542 |
||
543 |
<resource: #obsolete> |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
544 |
^ '/portal' |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
545 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
546 |
|
1419 | 547 |
labelAt:aKey |
1431 | 548 |
"default is: no label (could be redefined by concrete class )." |
549 |
||
1419 | 550 |
^ nil |
551 |
! |
|
552 |
||
553 |
labelAt:aKey ifAbsent:aBlock |
|
1431 | 554 |
"default is: no label (could be redefined by concrete class )." |
555 |
||
1419 | 556 |
^ aBlock value |
557 |
! |
|
558 |
||
559 |
labelAt:aKey put:aValue |
|
560 |
"/ not yet implemented |
|
561 |
! |
|
562 |
||
563 |
labels |
|
564 |
"/ not yet implemented |
|
565 |
^ nil |
|
566 |
! |
|
567 |
||
568 |
visualAt:aKey |
|
1431 | 569 |
"default is: no visual (could be redefined by concrete class )." |
570 |
||
1419 | 571 |
^ nil |
572 |
! |
|
573 |
||
574 |
visualAt:aKey ifAbsent:aBlock |
|
1431 | 575 |
"default is: no visual (could be redefined by concrete class )." |
576 |
||
1419 | 577 |
^ aBlock value |
578 |
! |
|
579 |
||
580 |
visualAt:aKey put:aValue |
|
581 |
"/ not yet implemented |
|
582 |
! |
|
583 |
||
584 |
visuals |
|
585 |
"/ not yet implemented |
|
586 |
^ nil |
|
587 |
! ! |
|
588 |
||
3307 | 589 |
!ApplicationModel class methodsFor:'font helpers'! |
590 |
||
3308 | 591 |
resolveFont:aSelector |
592 |
"resolve the font descriobed by aSelector. |
|
593 |
Delegate to a WindowBuilder, whuch may forward to self fontOn:" |
|
594 |
||
595 |
|builder| |
|
596 |
||
597 |
builder := UIBuilder new isEditing:true; applicationClass:self. |
|
598 |
^ builder resolveFont:aSelector. |
|
3307 | 599 |
! ! |
600 |
||
3335 | 601 |
!ApplicationModel class methodsFor:'font specs'! |
602 |
||
603 |
buttonFont |
|
3758 | 604 |
"that is a symbolic font" |
605 |
||
3335 | 606 |
<resource: #fontSpec> |
607 |
||
608 |
^ Button defaultFont |
|
609 |
! |
|
610 |
||
3759 | 611 |
buttonFontBig |
612 |
"that is a symbolic font" |
|
613 |
||
614 |
<resource: #fontSpec> |
|
615 |
||
616 |
^ self bigFontFor:(self buttonFont) |
|
617 |
! |
|
618 |
||
3758 | 619 |
buttonFontSmall |
620 |
"that is a symbolic font" |
|
621 |
||
622 |
<resource: #fontSpec> |
|
623 |
||
624 |
^ self smallFontFor:(self buttonFont) |
|
625 |
! |
|
626 |
||
3335 | 627 |
inputFont |
3758 | 628 |
"that is a symbolic font" |
629 |
||
3335 | 630 |
<resource: #fontSpec> |
631 |
||
632 |
^ EditField defaultFont |
|
633 |
! |
|
634 |
||
3758 | 635 |
inputFontSmall |
636 |
"that is a symbolic font" |
|
637 |
||
638 |
<resource: #fontSpec> |
|
639 |
||
640 |
^ self smallFontFor:(self inputFont) |
|
641 |
! |
|
642 |
||
3335 | 643 |
labelFont |
3758 | 644 |
"that is a symbolic font" |
645 |
||
3335 | 646 |
<resource: #fontSpec> |
647 |
||
648 |
^ Label defaultFont |
|
649 |
! |
|
650 |
||
3759 | 651 |
labelFontBig |
652 |
"that is a symbolic font" |
|
653 |
||
654 |
<resource: #fontSpec> |
|
655 |
||
656 |
^ self bigFontFor:(self labelFont) |
|
657 |
! |
|
658 |
||
3758 | 659 |
labelFontSmall |
660 |
"that is a symbolic font" |
|
661 |
||
662 |
<resource: #fontSpec> |
|
663 |
||
664 |
^ self smallFontFor:(self labelFont) |
|
665 |
! |
|
666 |
||
3335 | 667 |
listFont |
3758 | 668 |
"that is a symbolic font" |
669 |
||
3335 | 670 |
<resource: #fontSpec> |
671 |
||
672 |
^ SelectionInListView defaultFont |
|
673 |
! |
|
674 |
||
3758 | 675 |
listFontSmall |
676 |
"that is a symbolic font" |
|
677 |
||
678 |
<resource: #fontSpec> |
|
679 |
||
680 |
^ self smallFontFor:(self listFont) |
|
681 |
! |
|
682 |
||
3335 | 683 |
menuFont |
3758 | 684 |
"that is a symbolic font" |
685 |
||
3335 | 686 |
<resource: #fontSpec> |
687 |
||
688 |
^ MenuView defaultFont |
|
689 |
! |
|
690 |
||
691 |
textFont |
|
3758 | 692 |
"that is a symbolic font" |
693 |
||
3335 | 694 |
<resource: #fontSpec> |
695 |
||
696 |
^ TextView defaultFont |
|
3758 | 697 |
! |
698 |
||
3759 | 699 |
textFontBig |
700 |
"that is a symbolic font" |
|
701 |
||
702 |
<resource: #fontSpec> |
|
703 |
||
704 |
^ self bigFontFor:(self textFont) |
|
705 |
! |
|
706 |
||
3758 | 707 |
textFontSmall |
708 |
"that is a symbolic font" |
|
709 |
||
710 |
<resource: #fontSpec> |
|
711 |
||
712 |
^ self smallFontFor:(self textFont) |
|
3335 | 713 |
! ! |
714 |
||
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
715 |
!ApplicationModel class methodsFor:'help'! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
716 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
717 |
aboutImage |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
718 |
"bitmap image or nil for an about box for this application." |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
719 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
720 |
^ self defaultIcon |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
721 |
! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
722 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
723 |
aboutThisApplicationLabel |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
724 |
"label for an about box for this application." |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
725 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
726 |
^ 'About This Application' |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
727 |
! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
728 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
729 |
aboutThisApplicationText |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
730 |
"text for an about box for this application." |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
731 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
732 |
|rev clsRev msg| |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
733 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
734 |
rev := ''. |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
735 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
736 |
(clsRev := self revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
3546 | 737 |
msg := "'\' withCRs ," self applicationName allBold, rev. |
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
738 |
^ msg |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
739 |
|
2981
da09f3d57773
changed: #aboutThisApplicationText
Claus Gittinger <cg@exept.de>
parents:
2980
diff
changeset
|
740 |
"Created: / 13-11-2001 / 12:28:36 / cg" |
2382 | 741 |
! |
742 |
||
743 |
documentationPath |
|
744 |
|packageDir| |
|
745 |
||
746 |
packageDir := Smalltalk getPackageDirectoryForPackage:(self package). |
|
747 |
packageDir isNil ifTrue:[ |
|
4173 | 748 |
packageDir := Filename defaultDirectory |
2382 | 749 |
]. |
750 |
#( |
|
4173 | 751 |
'documentation' |
752 |
'doc' |
|
2382 | 753 |
) do:[:subDir | |
4173 | 754 |
(packageDir construct:subDir) exists ifTrue:[ |
755 |
^ packageDir construct:subDir |
|
756 |
]. |
|
2382 | 757 |
]. |
758 |
^ packageDir construct:'doc' |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
759 |
! ! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
760 |
|
2797 | 761 |
!ApplicationModel class methodsFor:'history'! |
762 |
||
4239 | 763 |
defaultExtentFor:anApplicationClass |
764 |
"return a default extent for an app-class or nil. |
|
765 |
If the user has the corresponding userPreference set, |
|
766 |
previous extents are remembered (at close time) |
|
767 |
and used as default for the next opening." |
|
768 |
||
769 |
DefaultExtents notNil ifTrue:[ |
|
770 |
UserPreferences current shouldRememberLastExtent ifTrue:[ |
|
771 |
^ DefaultExtents at:anApplicationClass name ifAbsent:nil |
|
772 |
]. |
|
773 |
"/ flush remebered values |
|
774 |
DefaultExtents := nil. |
|
775 |
]. |
|
776 |
^ nil. |
|
777 |
||
778 |
"Modified: / 31-07-2013 / 18:20:28 / cg" |
|
779 |
! |
|
780 |
||
3366 | 781 |
forgetDefaultExtentFor:anApplicationClass |
782 |
"forget the remembered last extent for some application class. |
|
783 |
This is sent by the UIPainter, when a windowspec is saved, |
|
784 |
to bring up the application with its possibly changed default extent" |
|
785 |
||
786 |
DefaultExtents notNil ifTrue:[ |
|
787 |
DefaultExtents removeKey:anApplicationClass name ifAbsent:[] |
|
788 |
] |
|
789 |
! |
|
790 |
||
2797 | 791 |
forgetRecentlyOpenedApplications |
792 |
RecentlyOpenedApplications := nil |
|
793 |
! |
|
794 |
||
795 |
recentlyOpenedApplications |
|
796 |
^ RecentlyOpenedApplications ? #() |
|
797 |
! |
|
798 |
||
4240 | 799 |
rememberLastExtentOf:aWindow |
800 |
"remember the last extent of aWindow. |
|
801 |
This will be used as default extent when the same app is opened the next time" |
|
802 |
||
803 |
self rememberLastExtentOf:aWindow for:self |
|
804 |
||
805 |
"Created: / 02-03-2019 / 13:08:53 / Claus Gittinger" |
|
806 |
! |
|
807 |
||
808 |
rememberLastExtentOf:aWindow for:anApplicationClass |
|
4239 | 809 |
"remember the last extent for some application class. |
810 |
This will be used as default extent when the same app is opened the next time" |
|
811 |
||
812 |
DefaultExtents isNil ifTrue:[ |
|
813 |
DefaultExtents := Dictionary new. |
|
814 |
]. |
|
4240 | 815 |
DefaultExtents at:anApplicationClass name put:(aWindow extent). |
4239 | 816 |
|
817 |
"Created: / 02-03-2019 / 13:02:55 / Claus Gittinger" |
|
818 |
! |
|
819 |
||
2797 | 820 |
rememberRecentlyOpenedApplication |
3842 | 821 |
"support for the launcher's ''open recent...'' menu function. |
822 |
It is questionable, if dialogs should also be remembered |
|
823 |
(although it might be convenient dor developers)" |
|
824 |
||
825 |
|myName| |
|
826 |
||
827 |
myName := self name. |
|
2797 | 828 |
RecentlyOpenedApplications isNil ifTrue:[ |
3842 | 829 |
RecentlyOpenedApplications := OrderedCollection new. |
2797 | 830 |
]. |
3882 | 831 |
|
832 |
#FIXME. |
|
833 |
"/ wait for 2.12 with this - otherwise, we need a whole lot of retagging |
|
834 |
"/ due to the new SeqCollection... |
|
835 |
||
836 |
"/ RecentlyOpenedApplications removeAndAddFirst:myName. |
|
837 |
RecentlyOpenedApplications remove:(self name) ifAbsent:[]. |
|
838 |
RecentlyOpenedApplications addFirst:(self name). |
|
839 |
||
840 |
"Modified: / 11-02-2017 / 15:05:20 / cg" |
|
2797 | 841 |
! ! |
842 |
||
1997 | 843 |
!ApplicationModel class methodsFor:'private'! |
844 |
||
3759 | 845 |
bigFontFor:aFont |
846 |
|newSize| |
|
847 |
||
848 |
newSize := aFont size * 1.1. |
|
3760 | 849 |
newSize := newSize ceiling asInteger. |
3759 | 850 |
^ aFont asSize:newSize. |
851 |
! |
|
852 |
||
1997 | 853 |
selfResponsibleFor:aKey |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
854 |
<resource: #obsolete> |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
855 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
856 |
self obsoleteMethodWarning:'obsoleted for de-obfuscation'. |
1997 | 857 |
^ self respondsTo:aKey |
3759 | 858 |
! |
859 |
||
860 |
smallFontFor:aFont |
|
861 |
|newSize| |
|
862 |
||
863 |
newSize := aFont size * 0.9. |
|
3760 | 864 |
newSize := newSize floor asInteger. |
3759 | 865 |
^ aFont asSize:newSize. |
1997 | 866 |
! ! |
867 |
||
1419 | 868 |
!ApplicationModel class methodsFor:'queries'! |
869 |
||
870 |
interfaceSpecFor:aSelector |
|
871 |
"return an interface spec" |
|
3297 | 872 |
|
2850 | 873 |
|specOrSpecArray| |
874 |
||
875 |
specOrSpecArray := self application specificationFor:aSelector. |
|
876 |
specOrSpecArray isNil ifTrue:[^ nil]. |
|
877 |
||
878 |
"/ app could already return a decoded spec |
|
879 |
specOrSpecArray isCollection ifFalse:[^ specOrSpecArray]. |
|
880 |
||
881 |
"/ app returns a literal array |
|
3678 | 882 |
MissingClassInLiteralArrayErrorSignal |
883 |
handle:[:ex | |
|
884 |
|clsInMyNamespace className| |
|
885 |
||
886 |
className := ex missingClassName. |
|
887 |
className isSymbol ifTrue:[ |
|
888 |
"retry with my nameSpace" |
|
889 |
clsInMyNamespace := self nameSpace at:className. |
|
890 |
clsInMyNamespace notNil ifTrue:[ ex proceedWith:clsInMyNamespace]. |
|
891 |
]. |
|
892 |
self warn:ex description. |
|
893 |
ex proceedWith:nil |
|
894 |
] |
|
895 |
do:[ |
|
896 |
^ UISpecification from:specOrSpecArray |
|
897 |
] |
|
2287
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
898 |
|
2850 | 899 |
"Modified: / 25-07-2010 / 10:36:53 / cg" |
1419 | 900 |
! |
901 |
||
2999 | 902 |
isAbstract |
903 |
^ self == ApplicationModel |
|
904 |
||
905 |
" |
|
906 |
self isAbstract |
|
907 |
" |
|
908 |
||
909 |
"Created: / 02-03-2012 / 15:56:48 / cg" |
|
910 |
! |
|
911 |
||
1419 | 912 |
isVisualStartable |
1427 | 913 |
"return true, if this application can be started via #open. |
914 |
(to allow start of a change browser via double-click in the browser)" |
|
1419 | 915 |
|
3811 | 916 |
self isAbstract ifTrue:[^ false]. |
1556
388922a9c6eb
implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
917 |
((self respondsTo:#open) or:[self class includesSelector:#openInterface]) ifFalse:[^ false]. |
1419 | 918 |
"/ (self respondsTo:#windowSpec) ifFalse:[^ false]. |
919 |
^ true |
|
920 |
||
2999 | 921 |
"Created: / 27-10-1997 / 16:38:02 / cg" |
922 |
"Modified: / 02-03-2012 / 15:57:02 / cg" |
|
3192 | 923 |
! |
924 |
||
925 |
shouldRememberLastExtent |
|
926 |
"to be redefined by concrete applications: |
|
927 |
if true is answered, the application's extent is remembered on close |
|
928 |
and used as a default when opened the next time" |
|
929 |
||
3207 | 930 |
^ UserPreferences current shouldRememberLastExtent |
931 |
||
932 |
"Modified: / 31-07-2013 / 18:12:07 / cg" |
|
1419 | 933 |
! ! |
934 |
||
935 |
!ApplicationModel class methodsFor:'resources'! |
|
936 |
||
937 |
classResources |
|
1955
257a4acb852b
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
938 |
"if not already loaded, get the classes resourcePack and return it" |
1419 | 939 |
|
4198 | 940 |
|superPack parent| |
4196 | 941 |
|
1419 | 942 |
ClassResources isNil ifTrue:[ |
4173 | 943 |
ClassResources := super classResources. |
4196 | 944 |
self ~~ ApplicationModel ifTrue:[ |
4198 | 945 |
parent := self superclass. |
946 |
[parent package = self package] whileTrue:[ |
|
947 |
parent := parent superclass. |
|
948 |
]. |
|
949 |
superPack := parent classResources. |
|
4196 | 950 |
ClassResources isNil ifTrue:[ |
951 |
ClassResources := superPack. |
|
952 |
] ifFalse:[ |
|
4197 | 953 |
ClassResources addSuperPack:superPack. |
4194 | 954 |
] |
4192 | 955 |
]. |
1419 | 956 |
]. |
957 |
^ ClassResources |
|
4191 | 958 |
|
959 |
" |
|
4193 | 960 |
ApplicationModel flushAllClassResources |
4198 | 961 |
ApplicationModel classResources |
4195 | 962 |
MyApp classResources |
4191 | 963 |
WorkspaceApplication classResources |
964 |
Tools::NewSystemBrowser classResources |
|
965 |
" |
|
1419 | 966 |
! |
967 |
||
968 |
classResources:aResourcePack |
|
4199 | 969 |
"allow setting of the cached classResources" |
1419 | 970 |
|
971 |
ClassResources := aResourcePack |
|
972 |
! |
|
973 |
||
974 |
flushAllClassResources |
|
975 |
"flush all classes resource translations. |
|
976 |
Needed after a resource file / language setting has changed." |
|
977 |
||
978 |
ResourcePack flushCachedResourcePacks. |
|
979 |
self flushClassResources. |
|
980 |
self allSubclassesDo:[:aClass | |
|
4173 | 981 |
aClass flushClassResources. |
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
982 |
]. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
983 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
984 |
WindowGroup scheduledWindowGroups |
4173 | 985 |
do:[:wg | |
986 |
|app| |
|
987 |
||
988 |
(app := wg application) notNil ifTrue:[ |
|
989 |
app initializeResources |
|
990 |
] |
|
991 |
] |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
992 |
|
4191 | 993 |
" |
994 |
ApplicationModel flushAllClassResources |
|
995 |
" |
|
996 |
||
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
997 |
"Modified: / 13-09-2006 / 12:41:31 / cg" |
1419 | 998 |
! |
999 |
||
1000 |
flushClassResources |
|
1001 |
"flush classes resource string translations. |
|
1002 |
Needed whenever a resource file / language setting has changed" |
|
1003 |
||
1004 |
ClassResources := nil. |
|
1005 |
! |
|
1006 |
||
1007 |
resources |
|
3800 | 1008 |
"return the application's resources - |
2609
a78a9e0380b1
added warn:translate: to avoid double translation
Claus Gittinger <cg@exept.de>
parents:
2605
diff
changeset
|
1009 |
that's a ResourcePack containing national language strings" |
1419 | 1010 |
|
1011 |
^ self classResources |
|
1012 |
||
3800 | 1013 |
"Created: / 19-05-1998 / 20:14:00 / cg" |
1014 |
"Modified (comment): / 25-11-2016 / 15:26:14 / cg" |
|
1419 | 1015 |
! |
1016 |
||
1017 |
updateClassResources |
|
1018 |
"update my classResources" |
|
1019 |
||
1020 |
ClassResources := nil. |
|
1021 |
self classResources |
|
1022 |
! ! |
|
1023 |
||
1024 |
!ApplicationModel class methodsFor:'startup'! |
|
1025 |
||
1026 |
open |
|
3851 | 1027 |
"create an instance of the application and open its view. |
1028 |
Sorry, but for visualworks compatibility, the builder is returned, |
|
1029 |
not the application instance" |
|
1030 |
||
2797 | 1031 |
self rememberRecentlyOpenedApplication. |
1419 | 1032 |
^ self new open |
1033 |
||
1034 |
" |
|
1035 |
Launcher open |
|
1036 |
" |
|
1037 |
||
1038 |
"Modified: 13.1.1997 / 20:54:50 / cg" |
|
1039 |
! |
|
1040 |
||
1041 |
openAt:aLocation |
|
1042 |
"create an instance of the application and open its view |
|
1043 |
at some position." |
|
1044 |
||
2797 | 1045 |
self rememberRecentlyOpenedApplication. |
1419 | 1046 |
^ self new openAt:aLocation |
1047 |
||
1048 |
"Modified: 14.2.1997 / 20:28:41 / cg" |
|
1049 |
! |
|
1050 |
||
1051 |
openDialogInterface:anInterfaceSymbol |
|
1052 |
"create an instance of the application and open a view as |
|
1053 |
specified by anInterfaceSymbol." |
|
1054 |
||
1055 |
^ self openDialogInterface:anInterfaceSymbol withBindings:nil |
|
1056 |
||
1057 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
1058 |
"Created: 14.2.1997 / 20:33:10 / cg" |
|
1059 |
"Modified: 28.2.1997 / 14:07:36 / cg" |
|
1060 |
! |
|
1061 |
||
4287 | 1062 |
openDialogInterface:anInterfaceSymbolOrSpec withBindings:bindings |
1419 | 1063 |
"create an instance of the application and open a view as |
1064 |
specified by anInterfaceSymbol." |
|
1065 |
||
4287 | 1066 |
^ self new openDialogInterface:anInterfaceSymbolOrSpec withBindings:bindings |
1419 | 1067 |
|
1068 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
1069 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
1070 |
"Created: 28.2.1997 / 14:07:24 / cg" |
|
1071 |
! |
|
1072 |
||
1073 |
openDialogInterfaceSpec:anInterfaceSpec |
|
1074 |
"create an instance of the application and open a view as |
|
1075 |
specified by the given spec." |
|
1076 |
||
3297 | 1077 |
^ self new |
4173 | 1078 |
openDialogInterfaceSpec:anInterfaceSpec |
1079 |
withBindings:nil |
|
1419 | 1080 |
! |
1081 |
||
1082 |
openDialogInterfaceSpec:anInterfaceSpec withBindings:bindings |
|
1083 |
"create an instance of the application and open a view as |
|
1084 |
specified by the given spec." |
|
1085 |
||
3297 | 1086 |
^ self new |
4173 | 1087 |
openDialogInterfaceSpec:anInterfaceSpec |
1088 |
withBindings:bindings |
|
1419 | 1089 |
|
1090 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
1091 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
1092 |
"Created: 28.2.1997 / 14:07:24 / cg" |
|
1093 |
! |
|
1094 |
||
1095 |
openDialogSpec:aSpec |
|
1096 |
"create an instance of the application and open a view as |
|
1097 |
specified by aSpec." |
|
1098 |
||
1099 |
^ self openDialogSpec:aSpec withBindings:nil |
|
1100 |
||
1101 |
"Modified: / 5.9.1995 / 17:54:50 / claus" |
|
1102 |
"Modified: / 28.2.1997 / 14:07:36 / cg" |
|
1103 |
"Created: / 20.5.1998 / 20:27:08 / cg" |
|
1104 |
! |
|
1105 |
||
1106 |
openDialogSpec:aSpec withBindings:bindings |
|
1107 |
"create an instance of the application and open a view as |
|
1108 |
specified by the spec." |
|
1109 |
||
3297 | 1110 |
^ self new |
4173 | 1111 |
openDialogSpec:aSpec |
1112 |
withBindings:bindings |
|
1419 | 1113 |
|
1114 |
"Modified: / 5.9.1995 / 17:54:50 / claus" |
|
1115 |
"Modified: / 13.1.1997 / 20:55:02 / cg" |
|
1116 |
"Created: / 20.5.1998 / 20:26:37 / cg" |
|
1117 |
! |
|
1118 |
||
1119 |
openInterface:anInterfaceSymbol |
|
1120 |
"create an instance of the application and open a view as |
|
1121 |
specified by anInterfaceSymbol." |
|
1122 |
||
1123 |
^ self new openInterface:anInterfaceSymbol |
|
1124 |
||
1125 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
1126 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
1127 |
! |
|
1128 |
||
1129 |
openInterface:anInterfaceSymbol at:aPoint |
|
1130 |
"create an instance of the application and open a view as |
|
1131 |
specified by anInterfaceSymbol." |
|
1132 |
||
1133 |
^ self new openInterface:anInterfaceSymbol at:aPoint |
|
1134 |
||
1135 |
"Modified: 14.2.1997 / 20:28:47 / cg" |
|
1136 |
! |
|
1137 |
||
2843 | 1138 |
openLauncherOnInitializedDisplayNamed:displayName |
1139 |
|display app wsClass| |
|
1140 |
||
4186 | 1141 |
wsClass := #XWorkstation asClass. |
2843 | 1142 |
|
1143 |
[ |
|
4173 | 1144 |
display := wsClass newDispatchingFor:displayName. |
1145 |
display deviceIOErrorSignal handlerBlock:[:ex | |
|
1146 |
'DeviceWorkstation [warning]: stop dispatch due to I/O error: ' errorPrint. |
|
1147 |
display errorPrintCR. |
|
1148 |
display brokenConnection. |
|
1149 |
]. |
|
1150 |
||
1151 |
Screen currentScreenQuerySignal answer:display do:[ |
|
1152 |
Screen default isNil ifTrue:[ |
|
1153 |
Smalltalk secureFileIn:'keyboard.rc'. |
|
1154 |
"/ Smalltalk secureFileIn:'display.rc'. |
|
1155 |
display buttonTranslation:#(1 2 2 4 5 6 7). |
|
1156 |
Screen default:display. |
|
1157 |
]. |
|
1158 |
||
1159 |
app := NewLauncher new openAndWaitUntilVisible. |
|
1160 |
app windowGroup isNil ifTrue:[ |
|
1161 |
"terminate event processor on error" |
|
1162 |
display stopDispatch. |
|
1163 |
self error:'Cannot open'. |
|
1164 |
] ifFalse:[ |
|
1165 |
app windowGroup process addExitAction:[ |
|
1166 |
"reset the default display" |
|
1167 |
Screen default == display ifTrue:[ |
|
1168 |
Screen default:nil. |
|
1169 |
]. |
|
1170 |
]. |
|
1171 |
]. |
|
1172 |
] |
|
2843 | 1173 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
4173 | 1174 |
self error:('Cannot connect to display: <1s><br><2s>' |
1175 |
expandMacrosWith:displayName with:ex description). |
|
2843 | 1176 |
]. |
1177 |
^ app |
|
1178 |
||
1179 |
"Created: / 01-06-2010 / 11:23:52 / sr" |
|
4186 | 1180 |
"Modified: / 10-10-2018 / 00:39:49 / Claus Gittinger" |
2843 | 1181 |
! |
1182 |
||
1419 | 1183 |
openModal |
1184 |
"create an instance of the application and open its view modal" |
|
1185 |
||
1186 |
^ self new openModal |
|
1187 |
! |
|
1188 |
||
1189 |
openOn:anApplicationModel |
|
1190 |
"send an open message to the argument, anApplicationModel. |
|
3110 | 1191 |
I don't really understand what this method is useful for ..." |
1419 | 1192 |
|
1193 |
^ anApplicationModel open |
|
1194 |
||
1195 |
"Modified: 13.1.1997 / 20:55:05 / cg" |
|
1196 |
! |
|
1197 |
||
1198 |
openOnDevice:aDevice |
|
1199 |
"create an instance of the application and open its view |
|
3297 | 1200 |
on ANOTHER device. |
1419 | 1201 |
For more info, read the document on multiple display |
1202 |
support and the documentation of the DeviceWorkstation class." |
|
1203 |
||
3297 | 1204 |
Screen currentScreenQuerySignal |
4173 | 1205 |
answer:aDevice |
1206 |
do:[ |
|
1207 |
^ (self onDevice:aDevice) open |
|
1208 |
] |
|
1419 | 1209 |
|
1210 |
" |
|
1211 |
Launcher openOnDevice:Display |
|
1212 |
" |
|
1213 |
||
1214 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
1215 |
! |
|
1216 |
||
1217 |
openOnXScreenNamed:aScreenName |
|
1218 |
"create an instance of the application and open its view |
|
3297 | 1219 |
on some X display screen. The argument aScreenName must be |
1419 | 1220 |
a valid x-display name (i.e. of the form '<host>:<screenNr>' as in 'foo:0'). |
1221 |
For more info, read the document on multiple display |
|
1222 |
support and the documentation of the DeviceWorkstation class." |
|
1223 |
||
1570
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
1224 |
|newDevice| |
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
1225 |
|
3842 | 1226 |
(XWorkstation notNil and:[ XWorkstation isLoaded ]) ifFalse:[ |
1227 |
self warn:(self resources string:'Could not open display: %1 (no XWorkstation class)' with:aScreenName). |
|
1228 |
^ self |
|
1229 |
]. |
|
1230 |
||
1570
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
1231 |
[ |
3842 | 1232 |
newDevice := XWorkstation newDispatchingFor:aScreenName. |
1570
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
1233 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
3842 | 1234 |
self warn:(self resources string:'Could not open display: %1' with:aScreenName). |
1235 |
^ self |
|
995
63d1b9ce554b
Avoid invoking pre/postBuild twice for subCanvases which
Claus Gittinger <cg@exept.de>
parents:
983
diff
changeset
|
1236 |
]. |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1237 |
^ self openOnDevice:newDevice. |
1419 | 1238 |
|
1239 |
" |
|
1240 |
Launcher openOnXScreenNamed:'sgi:0' |
|
1241 |
Launcher openOnXScreenNamed:'foo:0' |
|
1242 |
NewLauncher openOnXScreenNamed:'dawn:0' |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1243 |
NewLauncher openOnXScreenNamed:'bitsy:0' |
1419 | 1244 |
SystemBrowser openOnXScreenNamed:'dawn:0' |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1245 |
SystemBrowser openOnXScreenNamed:'bitsy:0' |
3842 | 1246 |
SystemBrowser openOnXScreenNamed:'localhost:0' |
1419 | 1247 |
" |
1248 |
||
1249 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
1250 |
! |
|
1251 |
||
1252 |
openWithSpec:aSpecSymbol |
|
1253 |
"ST80 compatibility: |
|
1254 |
mhmh - what is the difference to #openInterface ?" |
|
1255 |
||
1256 |
^ self openInterface:aSpecSymbol |
|
1257 |
||
1258 |
"Modified: 29.8.1997 / 01:16:52 / cg" |
|
2542 | 1259 |
! ! |
1260 |
||
1261 |
!ApplicationModel class methodsFor:'startup-web applications'! |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1262 |
|
3780 | 1263 |
addRequiredForeignServicesTo:anHTTPServer |
1264 |
"a hook to allow web apps to register additional services; |
|
1265 |
typically: file services to deliver bitmaps" |
|
1266 |
||
1267 |
"/ intentionally left blank here; |
|
1268 |
"/ to be redefined in subclasses |
|
1269 |
! |
|
1270 |
||
2568 | 1271 |
initialPageSpec |
2769 | 1272 |
"this is only required for web-applications" |
1273 |
||
2568 | 1274 |
self subclassResponsibility |
1275 |
! |
|
1276 |
||
1277 |
pageSpec |
|
2769 | 1278 |
"this is only used for web-applications" |
1279 |
||
2568 | 1280 |
^ self windowSpec |
1281 |
! |
|
1282 |
||
1283 |
pageSpecs |
|
2769 | 1284 |
"this is only required for web-applications" |
1285 |
||
2568 | 1286 |
self subclassResponsibility |
1287 |
! |
|
1288 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1289 |
startAsWebService |
2631 | 1290 |
"this is not yet a public interface. For internal exept use only. |
1291 |
Start a web service for myself on the default webService linkURL. |
|
1292 |
The webService will create new instances of me for incoming sessions. |
|
1293 |
Answer the webService." |
|
2604
68f9951ec611
startAsWebService returns the new service
Claus Gittinger <cg@exept.de>
parents:
2586
diff
changeset
|
1294 |
|
68f9951ec611
startAsWebService returns the new service
Claus Gittinger <cg@exept.de>
parents:
2586
diff
changeset
|
1295 |
^ self startAsWebService:(self webServiceLinkName) |
2579 | 1296 |
|
1297 |
" |
|
1298 |
self startAsWebService |
|
1299 |
" |
|
1300 |
! |
|
1301 |
||
1302 |
startAsWebService:linkName |
|
2631 | 1303 |
"this is not yet a public interface. For internal exept use only. |
1304 |
Start a web service for myself on link, an URL. |
|
1305 |
The webService will create new instances of me for incoming sessions. |
|
1306 |
Answer the webService. |
|
2580 | 1307 |
Start a HTTP server, if not already running" |
1308 |
||
3297 | 1309 |
^ HTTPPortalService |
4173 | 1310 |
startWithApplication:self |
1311 |
link:linkName |
|
2579 | 1312 |
|
1313 |
" |
|
1314 |
self startAsWebService:'hello' |
|
1315 |
UBS::UBSUsecase startAsWebService:'uuu' |
|
1316 |
" |
|
1317 |
! |
|
1318 |
||
2629 | 1319 |
startAsWebService:linkName inServer:httpServer |
2631 | 1320 |
"this is not yet a public interface. For internal exept use only. |
1321 |
Start a web service for myself on the default webService linkURL. |
|
1322 |
The webService will create new instances of me for incoming sessions. |
|
1323 |
Answer the webService. |
|
2629 | 1324 |
Start a HTTP server, if not already running" |
1325 |
||
3297 | 1326 |
^ HTTPPortalService |
4173 | 1327 |
startWithApplication:self |
1328 |
inServer:httpServer |
|
1329 |
link:linkName |
|
2629 | 1330 |
|
1331 |
" |
|
1332 |
self startAsWebService:'hello' |
|
1333 |
UBS::UBSUsecase startAsWebService:'uuu' |
|
1334 |
" |
|
1335 |
! |
|
1336 |
||
1337 |
startAsWebService:linkName onPort:httpPort |
|
2631 | 1338 |
"this is not yet a public interface. For internal exept use only. |
1339 |
Start a web service for myself on the default webService linkURL. |
|
1340 |
The webService will create new instances of me for incoming sessions. |
|
1341 |
Answer the webService. |
|
2629 | 1342 |
Start a HTTP server, if not already running" |
1343 |
||
3780 | 1344 |
|service httpServer| |
1345 |
||
1346 |
service := HTTPPortalService |
|
1347 |
startWithApplication:self |
|
1348 |
inServer:(httpServer := HTTPServer serverOnPort:httpPort) |
|
1349 |
link:linkName. |
|
1350 |
self addRequiredForeignServicesTo:httpServer. |
|
1351 |
^ service. |
|
1352 |
||
2629 | 1353 |
" |
1354 |
self startAsWebService:'hello' |
|
1355 |
UBS::UBSUsecase startAsWebService:'uuu' |
|
1356 |
" |
|
1357 |
! |
|
1358 |
||
2579 | 1359 |
startAsWebService_old |
2542 | 1360 |
"this is not yet a public interface. For internal exept use only" |
1361 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1362 |
|app| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1363 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1364 |
app := self basicNew. |
2547
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
1365 |
app initializeAsWebServiceOnWebDevice:(WebApplicationDevice new). |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1366 |
app startAsWebService. |
2605 | 1367 |
^ app |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1368 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1369 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1370 |
PortalTests::TestApplication1 startAsWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1371 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1372 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1373 |
|
2632
ced2473521b1
changed #startInPortalService:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
1374 |
startInPortalService:aPortalServiceOrSession |
2542 | 1375 |
"this is not yet a public interface. For internal exept use only" |
1376 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1377 |
|app| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1378 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1379 |
app := self basicNew. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1380 |
app setDevice:(WebApplicationDevice new). |
2544
2df3456aa8f7
initialization if I am a webService
Claus Gittinger <cg@exept.de>
parents:
2543
diff
changeset
|
1381 |
app initialize. |
2543 | 1382 |
app initializeResources. |
2632
ced2473521b1
changed #startInPortalService:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
1383 |
app startInPortalService:aPortalServiceOrSession. |
2605 | 1384 |
^ app. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1385 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1386 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1387 |
PortalTests::TestApplication1 |
4173 | 1388 |
startInPortalService: |
1389 |
(HTTPPortalService allInstances select:[:s | s httpServer port = 8080]) first |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1390 |
" |
2579 | 1391 |
! |
1392 |
||
1393 |
webServiceLinkName |
|
1394 |
"the link name, under which instances of myself are found in the httpServer" |
|
1395 |
||
1396 |
"/ typically, redefined as: |
|
2581 | 1397 |
^ self name asLowercaseFirst |
2579 | 1398 |
"/ or |
1399 |
"/ ^ 'ubs' |
|
1400 |
||
2581 | 1401 |
"/ ^ self subclassResponsibility |
1419 | 1402 |
! ! |
1403 |
||
3455 | 1404 |
!ApplicationModel methodsFor:'Compatibility-VW'! |
1405 |
||
1406 |
mainWindow |
|
1407 |
^ self window topView. |
|
1408 |
! ! |
|
1409 |
||
1419 | 1410 |
!ApplicationModel methodsFor:'accessing'! |
1411 |
||
1412 |
application |
|
1413 |
"application knows about interfaceSpecs, menuSpecs etc. |
|
1414 |
Usually this is my class. |
|
1415 |
This may be redefined in subclasses" |
|
1416 |
||
1417 |
^ self class |
|
1418 |
||
1419 |
"Modified: / 5.2.1998 / 00:45:21 / stefan" |
|
1420 |
! |
|
1421 |
||
1422 |
builder |
|
1423 |
"return the applications builder; this one has more information |
|
1424 |
about views, components etc." |
|
1425 |
||
1426 |
^ builder |
|
1427 |
! |
|
1428 |
||
1429 |
builder:aBuilder |
|
1430 |
"set the applications builder. Normally, you should not set it |
|
1431 |
directly, but depend on the default builder, as created when the application |
|
1432 |
was created." |
|
1433 |
||
1434 |
builder := aBuilder |
|
1435 |
! |
|
1436 |
||
1602 | 1437 |
componentAt:name |
2747 | 1438 |
"return a component identified by its name" |
1439 |
||
1602 | 1440 |
^ self builder componentAt:name |
1441 |
! |
|
1442 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1443 |
device |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1444 |
device isNil ifTrue:[ |
4173 | 1445 |
self isWebService ifTrue:[ |
1446 |
device := WebApplicationDevice new |
|
1447 |
] |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1448 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1449 |
^ device |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1450 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
1451 |
|
1419 | 1452 |
masterApplication |
3279 | 1453 |
"return the master application, in which I am embedded, or nil, if I am the topmost application. |
1454 |
Useful for embedded sub applications to access outer windows and/or bindings from the master" |
|
1419 | 1455 |
|
1427 | 1456 |
^ masterApplication |
1457 |
! |
|
1419 | 1458 |
|
4094 | 1459 |
masterApplication:anApplication |
1419 | 1460 |
"set the value of the instance variable 'masterApplication' (automatically generated)" |
1461 |
||
4094 | 1462 |
anApplication == self ifTrue:[ |
1463 |
self proceedableError:'an application cannot be its own masterApplication'. |
|
1464 |
^ self |
|
1419 | 1465 |
]. |
4094 | 1466 |
masterApplication := anApplication. |
2566 | 1467 |
|
1468 |
"/ ensure that the device is compatible. |
|
2567 | 1469 |
masterApplication notNil ifTrue:[ |
4094 | 1470 |
device := masterApplication device. |
2567 | 1471 |
]. |
4094 | 1472 |
|
1473 |
"Modified: / 24-05-2018 / 13:47:33 / Claus Gittinger" |
|
1419 | 1474 |
! |
1475 |
||
1476 |
resources |
|
3800 | 1477 |
"return the application's resources - |
4094 | 1478 |
that's a ResourcePack containing national language strings. |
4334 | 1479 |
If I have a masterApplication, those resources are returned. |
1480 |
The instvar 'resources' can be accessed safely (and faster), once the UI is open" |
|
1988
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1481 |
|
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1482 |
resources isNil ifTrue:[ |
3800 | 1483 |
masterApplication notNil ifTrue:[ |
1484 |
^ masterApplication resources |
|
4094 | 1485 |
]. |
4192 | 1486 |
^ self class classResources. |
4094 | 1487 |
"/ ^ ResourcePack new |
2609
a78a9e0380b1
added warn:translate: to avoid double translation
Claus Gittinger <cg@exept.de>
parents:
2605
diff
changeset
|
1488 |
]. |
1419 | 1489 |
^ resources |
3800 | 1490 |
|
1491 |
"Modified (comment): / 25-11-2016 / 15:25:28 / cg" |
|
4094 | 1492 |
"Modified (comment): / 24-05-2018 / 13:43:11 / Claus Gittinger" |
1419 | 1493 |
! |
1494 |
||
1495 |
resources:aResourcePack |
|
3800 | 1496 |
"set the application's resources - usually this is done automatically, |
1419 | 1497 |
except for manually built dialogs" |
1498 |
||
1499 |
resources := aResourcePack |
|
3800 | 1500 |
|
1501 |
"Modified (comment): / 25-11-2016 / 15:25:36 / cg" |
|
1419 | 1502 |
! |
1503 |
||
3279 | 1504 |
topMasterApplication |
1505 |
"return the topmost master application. Useful when nested subapplications are used" |
|
1506 |
||
1507 |
masterApplication isNil ifTrue:[^ self]. |
|
1508 |
^ masterApplication topMasterApplication |
|
1509 |
! |
|
1510 |
||
3256 | 1511 |
topView |
1512 |
"SimpleView compatibility - answer my topWindow" |
|
1513 |
||
1514 |
^ self window |
|
1515 |
! |
|
1516 |
||
1419 | 1517 |
window |
1518 |
"return my topWindow - or nil, if I have no window (yet)" |
|
1519 |
||
1520 |
|win| |
|
1521 |
||
1522 |
builder isNil ifTrue:[^ nil]. |
|
1523 |
(win := builder window) notNil ifTrue:[ |
|
4173 | 1524 |
^ win |
1419 | 1525 |
]. |
1526 |
masterApplication notNil ifTrue:[ |
|
4173 | 1527 |
masterApplication ~~ self ifTrue:[ |
1528 |
"/ is that true ? |
|
1529 |
^ masterApplication window |
|
1530 |
] |
|
1419 | 1531 |
]. |
1532 |
^ nil. |
|
1533 |
||
1534 |
"Modified: / 18.9.1998 / 15:18:19 / cg" |
|
1535 |
! |
|
1536 |
||
1537 |
window:aTopView |
|
1538 |
"set my topWindow. |
|
1539 |
As a side effect, this creates a dummy builder if non has yet |
|
1540 |
been built. This prevents non-GUI-Painter apps from failing later, |
|
1541 |
when the builder is accessed." |
|
1542 |
||
1543 |
builder isNil ifTrue:[ |
|
4173 | 1544 |
self createBuilder |
1419 | 1545 |
]. |
1546 |
builder window:aTopView |
|
1547 |
||
1548 |
"Created: 18.4.1996 / 14:55:26 / cg" |
|
1549 |
! |
|
1550 |
||
3297 | 1551 |
windowGroup |
1419 | 1552 |
"return the applications windowGroup" |
1553 |
||
3881 | 1554 |
|myWindow wg| |
1419 | 1555 |
|
1556 |
builder notNil ifTrue:[ |
|
3881 | 1557 |
(myWindow := builder window) notNil ifTrue:[ |
3907 | 1558 |
^ myWindow windowGroup. |
1559 |
||
1560 |
"/ Disabled. Leads to Bug https://expeccoalm.exept.de/D179727 |
|
1561 |
"/ (Reopen of on ExpeccoSettingsDialog for the second time opens an empty window) |
|
1562 |
||
1563 |
"/ (wg := myWindow windowGroup) notNil ifTrue:[ |
|
1564 |
"/ ^ wg |
|
1565 |
"/ ]. |
|
3881 | 1566 |
#FIXME. "or at least: think about it" |
3906 | 1567 |
"/ Disabled. Leads to Bug https://expeccoalm.exept.de/D179727 |
1568 |
"/ (Close on ExpeccoSettingsDialog closes also Expecco) |
|
1569 |
"/ "/ mhmh - it seems that a window was previously closed |
|
1570 |
"/ "/ but kept around, and is now reopened. |
|
1571 |
"/ "/ So it lost its windowGroup. |
|
1572 |
"/ "/ happens for example, when the expecco-guiBrowser is closed and reopened. |
|
1573 |
"/ "/ Question is: is this to be fixed here, or should we look |
|
1574 |
"/ "/ at the place, where it is reopened... |
|
1575 |
"/ "/ for now, fix it on the fly if there is a master... |
|
1576 |
"/ "/ Don't do this unconditionally: |
|
1577 |
"/ "/ applications may (and do) run in a separate windowGroup |
|
1578 |
"/ "/ from the master - for example to allow interaction while the other |
|
1579 |
"/ "/ is busy. |
|
1580 |
"/ "/ So please do not reassign the wg, to my builder, iff it is already |
|
1581 |
"/ "/ non-nil there (i.e. do not move the code below to the top of this method). |
|
1582 |
"/ masterApplication notNil ifTrue:[ |
|
1583 |
"/ (wg := masterApplication windowGroup) notNil ifTrue:[ |
|
1584 |
"/ myWindow windowGroup:wg. |
|
1585 |
"/ ^ wg |
|
1586 |
"/ ]. |
|
1587 |
"/ ]. |
|
3881 | 1588 |
]. |
1419 | 1589 |
]. |
1590 |
masterApplication notNil ifTrue:[ |
|
3881 | 1591 |
^ masterApplication windowGroup |
1419 | 1592 |
]. |
1593 |
^ nil |
|
1594 |
||
3881 | 1595 |
"Modified (comment): / 11-02-2017 / 11:46:37 / cg" |
3195 | 1596 |
! |
1597 |
||
4265 | 1598 |
windowSensor |
1599 |
"return the applications windowSensor" |
|
1600 |
||
1601 |
|windowGroup| |
|
1602 |
||
1603 |
windowGroup := self windowGroup. |
|
1604 |
windowGroup isNil ifTrue:[ |
|
1605 |
^ nil. |
|
1606 |
]. |
|
1607 |
^ windowGroup sensor. |
|
1608 |
||
1609 |
"Created: / 14-05-2019 / 16:13:35 / Stefan Vogel" |
|
1610 |
! |
|
1611 |
||
3195 | 1612 |
windowTitle:aString |
3472 | 1613 |
builder windowTitle:aString |
1419 | 1614 |
! ! |
1615 |
||
1616 |
!ApplicationModel methodsFor:'binding access'! |
|
1617 |
||
1618 |
actionFor:aKey |
|
1619 |
"sent by the builder to ask for an actionBlock for |
|
1620 |
a Button. The argument, aKey comes from an UI-spec |
|
1621 |
for a buttons #action property. |
|
1622 |
Here, a corresponding message is sent to myself, |
|
1623 |
which ought to be defined in the application subclass. |
|
1624 |
Alternatively, a subclass may redefine this method, to provide |
|
1625 |
actionBlocks from a Dictionary or whatever. |
|
1626 |
Typically, a block is returned there." |
|
1627 |
||
4277 | 1628 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil action key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1629 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1630 |
masterApplication notNil ifTrue:[ |
4173 | 1631 |
(self respondsTo:aKey) ifFalse:[ |
1632 |
^ masterApplication actionFor:aKey |
|
1633 |
]. |
|
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1634 |
]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1635 |
|
2853 | 1636 |
^ MessageSend receiver:self selector:aKey |
1637 |
"/ ^ [self perform:aKey] "/ could use: MessageSend receiver:self selector:aKey |
|
1638 |
||
1639 |
"Modified: / 28-07-2010 / 11:56:49 / cg" |
|
4277 | 1640 |
"Modified: / 06-06-2019 / 23:26:56 / Claus Gittinger" |
1419 | 1641 |
! |
1642 |
||
1643 |
actionFor:aKey withValue:aValue |
|
1644 |
"sent by the builder to ask for an actionBlock for |
|
3297 | 1645 |
a Button which passes a value. |
1419 | 1646 |
The argument, aKey comes from an UI-spec for a buttons #action property. |
1647 |
Here, a corresponding message is sent to myself, |
|
1648 |
which ought to be defined in the application subclass. |
|
1649 |
Alternatively, a subclass may redefine this method, to provide |
|
1650 |
actionBlocks from a Dictionary or whatever. |
|
1651 |
Typically, a block is returned there." |
|
1652 |
||
4277 | 1653 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil action key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1654 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1655 |
masterApplication notNil ifTrue:[ |
4173 | 1656 |
(self respondsTo:aKey) ifFalse:[ |
1657 |
^ masterApplication actionFor:aKey withValue:aValue |
|
1658 |
]. |
|
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1659 |
]. |
2853 | 1660 |
|
2863 | 1661 |
"/ sigh - too many senders of #isBlock around... |
1662 |
"/ ^ MessageSend receiver:self selector:aKey argument:aValue |
|
1663 |
^ [self perform:aKey with:aValue] |
|
2853 | 1664 |
|
1665 |
"Modified: / 28-07-2010 / 11:56:42 / cg" |
|
2863 | 1666 |
"Modified: / 30-07-2010 / 10:40:35 / sr" |
4277 | 1667 |
"Modified: / 06-06-2019 / 23:27:03 / Claus Gittinger" |
1419 | 1668 |
! |
1669 |
||
2364 | 1670 |
actionFor:aKey withValue:value1 withValue:value2 |
3297 | 1671 |
"sent by the builder to ask for an actionBlock for a Button which passes two values. |
2364 | 1672 |
The argument, aKey comes from an UI-spec for a buttons #action property. |
1673 |
Here, a corresponding message is sent to myself, |
|
1674 |
which ought to be defined in the application subclass. |
|
1675 |
Alternatively, a subclass may redefine this method, to provide |
|
1676 |
actionBlocks from a Dictionary or whatever. |
|
1677 |
Typically, a block is returned there." |
|
1678 |
||
4277 | 1679 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil action key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1680 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1681 |
masterApplication notNil ifTrue:[ |
4173 | 1682 |
(self respondsTo:aKey) ifFalse:[ |
1683 |
^ masterApplication actionFor:aKey withValue:value1 withValue:value2 |
|
1684 |
]. |
|
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1685 |
]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1686 |
^ [self perform:aKey with:value1 with:value2] |
4277 | 1687 |
|
1688 |
"Modified: / 06-06-2019 / 23:27:07 / Claus Gittinger" |
|
2364 | 1689 |
! |
1690 |
||
1419 | 1691 |
aspectFor:aKey |
1692 |
"sent by the builder to ask for an aspect (a data model). |
|
1693 |
The argument, aKey comes from an UI-spec |
|
4107 | 1694 |
for a component's #aspect property. |
1419 | 1695 |
Here, a corresponding message is sent to myself, |
1696 |
which ought to be defined in the application subclass. |
|
1697 |
Alternatively, a subclass may redefine this method, to provide |
|
1698 |
holders from a Dictionary or whatever. |
|
1699 |
Typically, a valueHolder is returned there." |
|
1700 |
||
4277 | 1701 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil aspect key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1702 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1703 |
masterApplication notNil ifTrue:[ |
4107 | 1704 |
(self respondsTo:aKey) ifFalse:[ |
1705 |
^ masterApplication aspectFor:aKey |
|
1706 |
]. |
|
1419 | 1707 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1708 |
^ self perform:aKey |
1419 | 1709 |
|
4107 | 1710 |
"Modified: / 18-06-1998 / 20:33:23 / cg" |
4277 | 1711 |
"Modified: / 06-06-2019 / 23:27:12 / Claus Gittinger" |
1419 | 1712 |
! |
1713 |
||
1742
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1714 |
aspectOrNil:aKey forSubApplication:aSubApp |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1715 |
^ nil |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1716 |
! |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1717 |
|
3515 | 1718 |
aspectValueFor:aspectKeySymbol |
3514 | 1719 |
"fetch an aspect's value |
1720 |
same as (self aspectFor:aKey) value" |
|
1721 |
||
3515 | 1722 |
^ (self aspectFor:aspectKeySymbol) value |
1723 |
! |
|
1724 |
||
1725 |
aspectValueOr:default for:aspectKeySymbol |
|
1726 |
"common helper - fetches the aspect value; |
|
1727 |
if it is nil, return a default." |
|
1728 |
||
1729 |
^ (self aspectValueFor:aspectKeySymbol) ? default |
|
3514 | 1730 |
! |
1731 |
||
1419 | 1732 |
clientFor:aKey |
1733 |
"sent by the builder to ask for an application provided |
|
1734 |
subcanvas's application. |
|
1735 |
The argument, aKey comes from an UI-spec |
|
1736 |
for a subcanvas's #client property. |
|
1737 |
Here, a corresponding message is sent to myself, |
|
1738 |
which ought to be defined in the application subclass. |
|
1739 |
Alternatively, a subclass may redefine this method, to provide |
|
1740 |
appModels from a Dictionary or whatever. |
|
1741 |
Typically, an applicationModel is returned there." |
|
1742 |
||
4277 | 1743 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil client key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1744 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1745 |
masterApplication notNil ifTrue:[ |
4173 | 1746 |
(self respondsTo:aKey) ifFalse:[ |
1747 |
^ masterApplication clientFor:aKey |
|
1748 |
]. |
|
1419 | 1749 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1750 |
^ self perform:aKey |
1419 | 1751 |
|
4277 | 1752 |
"Modified: / 18-06-1998 / 20:33:30 / cg" |
1753 |
"Modified: / 06-06-2019 / 23:27:17 / Claus Gittinger" |
|
1419 | 1754 |
! |
1755 |
||
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1756 |
colorFor:aKey |
2472 | 1757 |
"sent by the builder to ask for an application provided color. |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1758 |
The argument, aKey comes from an UI-spec |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1759 |
for a widgets #*Color property. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1760 |
Here, a corresponding message is sent to myself, |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1761 |
which ought to be defined in the application subclass. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1762 |
Alternatively, a subclass may redefine this method, to provide |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1763 |
holders from a Dictionary or whatever. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1764 |
Typically, a color is returned there." |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1765 |
|
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1766 |
(self respondsTo:aKey) ifTrue:[ |
4173 | 1767 |
^ (self perform:aKey) value |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1768 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1769 |
(self class respondsTo:aKey) ifTrue:[ |
4173 | 1770 |
^ (self class perform:aKey) value |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1771 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1772 |
masterApplication notNil ifTrue:[ |
4173 | 1773 |
^ masterApplication colorFor:aKey |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1774 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1775 |
^ self class colorFor:aKey. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1776 |
! |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1777 |
|
1419 | 1778 |
componentFor:aKey |
4309 | 1779 |
"sent by the builder to ask for a component |
1780 |
provided by the application. |
|
1419 | 1781 |
The argument, aKey comes from an UI-spec |
4309 | 1782 |
for a viewHolder's #view property. |
1419 | 1783 |
Here, a corresponding message is sent to myself, |
4309 | 1784 |
which ought to be defined in the concrete application class. |
1785 |
Alternatively, a subclass may redefine this method, |
|
1786 |
to provide holders from a Dictionary or whatever. |
|
1787 |
Typically, a view/widget is returned there." |
|
1419 | 1788 |
|
4277 | 1789 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil component key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1790 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1791 |
masterApplication notNil ifTrue:[ |
4173 | 1792 |
(self respondsTo:aKey) ifFalse:[ |
1793 |
^ masterApplication componentFor:aKey |
|
1794 |
]. |
|
1419 | 1795 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1796 |
^ self perform:aKey |
1419 | 1797 |
|
4277 | 1798 |
"Modified: / 18-06-1998 / 20:33:36 / cg" |
1799 |
"Modified: / 06-06-2019 / 23:27:22 / Claus Gittinger" |
|
4309 | 1800 |
"Modified (comment): / 19-07-2019 / 11:23:47 / Claus Gittinger" |
1419 | 1801 |
! |
1802 |
||
2472 | 1803 |
fontFor:aKey |
1804 |
"sent by the builder to ask for an application provided font. |
|
1805 |
The argument, aKey comes from an UI-spec |
|
1806 |
for a widgets #*Font property. |
|
1807 |
Here, a corresponding message is sent to myself, |
|
1808 |
which ought to be defined in the application subclass. |
|
1809 |
Alternatively, a subclass may redefine this method, to provide |
|
1810 |
holders from a Dictionary or whatever. |
|
3308 | 1811 |
Typically, a font is returned there. |
1812 |
||
1813 |
Use #resolveFont:, if you are not a builder!!" |
|
2472 | 1814 |
|
1815 |
(self respondsTo:aKey) ifTrue:[ |
|
3308 | 1816 |
^ self perform:aKey |
2472 | 1817 |
]. |
1818 |
(self class respondsTo:aKey) ifTrue:[ |
|
3308 | 1819 |
^ self class perform:aKey |
2472 | 1820 |
]. |
1821 |
masterApplication notNil ifTrue:[ |
|
3308 | 1822 |
^ masterApplication fontFor:aKey |
2472 | 1823 |
]. |
1824 |
^ self class fontFor:aKey. |
|
1825 |
! |
|
1826 |
||
1419 | 1827 |
labelFor:aKey |
1828 |
"sent by the builder to ask for an application provided |
|
1829 |
label for a component. |
|
1830 |
The argument, aKey comes from an UI-spec |
|
1831 |
for a components #label property. |
|
1832 |
Here, a corresponding message is sent to myself, |
|
1833 |
which ought to be defined in the application subclass. |
|
1834 |
Alternatively, a subclass may redefine this method, to provide |
|
1835 |
labels from a Dictionary or whatever. |
|
1836 |
Typically, a string is returned there." |
|
1837 |
||
4277 | 1838 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil label key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1839 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1840 |
masterApplication notNil ifTrue:[ |
4173 | 1841 |
(self respondsTo:aKey) ifFalse:[ |
1842 |
^ masterApplication labelFor:aKey |
|
1843 |
]. |
|
1419 | 1844 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1845 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1846 |
(self respondsTo:aKey) ifFalse:[ |
4173 | 1847 |
(self class respondsTo:aKey) ifTrue:[ |
1848 |
^ self class perform:aKey |
|
1849 |
]. |
|
1997 | 1850 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1851 |
^ self perform:aKey |
4277 | 1852 |
|
1853 |
"Modified: / 06-06-2019 / 23:27:26 / Claus Gittinger" |
|
1419 | 1854 |
! |
1855 |
||
1856 |
listFor:aKey |
|
1857 |
"sent by the builder to ask for an application provided |
|
1858 |
holder for a list (for example, a popUpLists list). |
|
1859 |
The argument, aKey comes from an UI-spec |
|
1860 |
for a listWidgets #list property. |
|
1861 |
Here, a corresponding message is sent to myself, |
|
1862 |
which ought to be defined in the application subclass. |
|
1863 |
Alternatively, a subclass may redefine this method, to provide |
|
1864 |
holders from a Dictionary or whatever. |
|
1865 |
Typically, a list-holding model (SelectionInList) is returned there. |
|
1866 |
If the instance does not provide a value, a corresponding aspect |
|
1867 |
is asked for. If that fails as well, the app class is asked as a last |
|
1868 |
chance." |
|
1869 |
||
1870 |
|a| |
|
1871 |
||
4277 | 1872 |
aKey isNil ifTrue:[ ArgumentError raiseErrorString:'nil list key' ]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1873 |
|
1419 | 1874 |
a := self aspectFor:aKey. |
1875 |
a notNil ifTrue:[ |
|
4173 | 1876 |
^ a |
1419 | 1877 |
]. |
1878 |
^ self application listFor:aKey |
|
1879 |
||
4277 | 1880 |
"Modified: / 18-06-1998 / 20:33:50 / cg" |
1881 |
"Modified: / 06-06-2019 / 23:27:30 / Claus Gittinger" |
|
1419 | 1882 |
! |
1883 |
||
3297 | 1884 |
menuFor:key |
1885 |
"Sent by the builder to ask for an application provided |
|
1886 |
holder for a menu. The argument, `key`, comes from an UI-spec |
|
1419 | 1887 |
for a widgets #menu property. |
1888 |
Here, a corresponding message is sent to myself, |
|
1889 |
which ought to be defined in the application subclass. |
|
1890 |
Alternatively, a subclass may redefine this method, to provide |
|
1891 |
holders from a Dictionary or whatever. |
|
1892 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
1893 |
||
3297 | 1894 |
| menu | |
1895 |
||
4277 | 1896 |
key isNil ifTrue:[ ArgumentError raiseErrorString:'nil menu key' ]. |
3297 | 1897 |
|
1898 |
"/ Ask myself first... |
|
1899 |
(thisContext isRecursive not and:[ self respondsTo: key ]) ifTrue:[ |
|
4173 | 1900 |
menu := self perform: key |
3297 | 1901 |
] ifFalse:[ |
4173 | 1902 |
"/ Ask my class... |
1903 |
(self class respondsTo: key) ifTrue:[ |
|
1904 |
menu := self class perform: key |
|
1905 |
] ifFalse:[ |
|
1906 |
"/ Ask masterApplication if any... |
|
1907 |
masterApplication notNil ifTrue:[ |
|
1908 |
menu := masterApplication menuFor: key |
|
1909 |
]. |
|
1910 |
]. |
|
1419 | 1911 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1912 |
|
3297 | 1913 |
"/ If the provided menu is a menu spec, create Menu from it... |
1914 |
menu isArray ifTrue:[ |
|
4173 | 1915 |
menu := Menu decodeFromLiteralArray: menu. |
1997 | 1916 |
]. |
3297 | 1917 |
^ menu. |
1918 |
||
1919 |
"Modified: / 18-06-1998 / 20:33:56 / cg" |
|
1920 |
"Modified: / 24-01-2014 / 09:46:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4277 | 1921 |
"Modified: / 06-06-2019 / 23:27:35 / Claus Gittinger" |
1419 | 1922 |
! |
1923 |
||
1924 |
specificationFor:aKey |
|
1925 |
"sent by the builder to ask for an application provided |
|
1926 |
specification for a subcanvas or subspecification. |
|
1927 |
The argument, aKey comes from an UI-spec |
|
1928 |
for a subcanvases #specification property (minorKey). |
|
1929 |
Here, a corresponding message is sent to myself, |
|
1930 |
which ought to be defined in the application subclass. |
|
1931 |
Alternatively, a subclass may redefine this method, to provide |
|
1932 |
interfaceSpecifications from a Dictionary or whatever. |
|
1933 |
Typically, an interfaceSpecification is returned there." |
|
1934 |
||
3811 | 1935 |
^ self class |
1936 |
specificationFor:aKey |
|
1937 |
application:self |
|
1938 |
onDevice:(self graphicsDevice) |
|
1419 | 1939 |
! |
1940 |
||
2058 | 1941 |
subApplicationFor:aKey |
3297 | 1942 |
"sent by subCanvas to ask for an application inside itself. |
2058 | 1943 |
The argument, aKey comes from a TabList-specs majorKey. |
1944 |
Here, a corresponding message is sent to myself, |
|
1945 |
which ought to be defined in the application subclass. |
|
1946 |
Alternatively, a subclass may redefine this method, to provide |
|
1947 |
an application from a Dictionary or whatever. |
|
1948 |
Typically, an ApplicationModel subinstance is returned there." |
|
1949 |
||
1950 |
(self respondsTo:aKey) ifTrue:[ |
|
4173 | 1951 |
^ self perform:aKey |
2058 | 1952 |
]. |
1953 |
masterApplication notNil ifTrue:[ |
|
4173 | 1954 |
^ masterApplication subApplicationFor:aKey |
2058 | 1955 |
]. |
1956 |
^ nil. |
|
1957 |
! |
|
1958 |
||
1419 | 1959 |
visualFor:aKey |
1960 |
"sent by the builder to ask for an application provided |
|
1961 |
image or element for a label. |
|
1962 |
The argument, aKey comes from an UI-spec |
|
1963 |
for a widgets #label property, if LabelIsImage is turned on. |
|
1964 |
Here, a corresponding message is sent to myself, |
|
1965 |
which ought to be defined in the application subclass. |
|
1966 |
Alternatively, a subclass may redefine this method, to provide |
|
1967 |
images from a Dictionary or whatever. |
|
1968 |
Typically, an image is returned there." |
|
1969 |
||
1970 |
^ self application visualFor:aKey |
|
1971 |
! ! |
|
1972 |
||
2380 | 1973 |
!ApplicationModel methodsFor:'building'! |
1974 |
||
1975 |
allButOpen |
|
1976 |
"create my views from the windowSpec, but do not open the main window." |
|
1977 |
||
1978 |
^ self allButOpenInterface:(self defaultWindowSpecName). |
|
1979 |
||
1980 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
1981 |
! |
|
1982 |
||
1983 |
allButOpenFrom:aSpec |
|
1984 |
"create my views but do not open the main window. |
|
1985 |
The argument is a spec which defines the interface." |
|
1986 |
||
1987 |
|window| |
|
1988 |
||
2691 | 1989 |
window notNil ifTrue:[ |
4094 | 1990 |
self proceedableError:'building twice (window is already built) ?'. |
2691 | 1991 |
]. |
1992 |
||
2380 | 1993 |
"/ DISABLED; see comment in basicInitialize |
1994 |
"/ |
|
1995 |
"/ " |
|
1996 |
"/ here, we kludge a bit: up to now, the builder was an |
|
1997 |
"/ instance of the no-op WindowBuilder. Now, it becomes |
|
1998 |
"/ a UIBuilder .... |
|
1999 |
"/ This allows for ApplicationModels without a UIBuilder |
|
2000 |
"/ if not needed. |
|
2001 |
"/ " |
|
2002 |
"/ realBuilder := UIBuilder new. |
|
2003 |
"/ builder := realBuilder. |
|
2004 |
"/ builder application:self. |
|
2005 |
"/ builder bindings:builder bindings. |
|
2006 |
||
2007 |
builder isNil ifTrue:[ |
|
4094 | 2008 |
self createBuilder. |
2380 | 2009 |
]. |
2010 |
||
2011 |
self preBuildWith:builder. |
|
2012 |
builder buildWindowFromSpec:aSpec. |
|
2013 |
window := builder window. |
|
2014 |
||
2015 |
window model:self. |
|
2016 |
(window respondsTo:#application:) ifTrue:[ |
|
4094 | 2017 |
window application:self. |
2380 | 2018 |
]. |
2019 |
||
2020 |
self showingHelp ifTrue: [ActiveHelp startFor: self]. |
|
2021 |
self postBuildWith:builder. |
|
2022 |
||
4094 | 2023 |
"Modified: / 19-06-1998 / 03:35:31 / cg" |
2024 |
"Modified: / 24-05-2018 / 13:47:23 / Claus Gittinger" |
|
2380 | 2025 |
! |
2026 |
||
2027 |
allButOpenInterface:aSymbol |
|
2028 |
"create my views but do not open the main window. |
|
2029 |
The argument specifies a selector of a method, |
|
2030 |
which when sent to myself should return a spec. |
|
2031 |
Notice, this returns the windowBuilder." |
|
2032 |
||
2033 |
self allButOpenFrom:(self interfaceSpecFor:aSymbol). |
|
2034 |
^ builder |
|
2035 |
||
2036 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
2037 |
! |
|
2038 |
||
2039 |
buildSpec:specToBuild asSubCanvasWithBuilder:aBuilder |
|
2040 |
"build a subcanvases spec into aSubcanvas" |
|
2041 |
||
4092 | 2042 |
|sameAppAsTopApp prevSpec prevSource| |
2380 | 2043 |
|
2044 |
aBuilder notNil ifTrue:[ |
|
4092 | 2045 |
prevSpec := aBuilder spec. |
2046 |
prevSource := aBuilder source. |
|
2380 | 2047 |
]. |
2048 |
||
2049 |
builder isNil ifTrue:[ |
|
4092 | 2050 |
builder := aBuilder. |
2051 |
aBuilder isNil ifTrue:[ |
|
2052 |
self createBuilder |
|
2053 |
] |
|
2380 | 2054 |
]. |
2055 |
||
2056 |
aBuilder source:self. |
|
2057 |
||
2058 |
"/ if the subcanvases appModel is NOT the same as |
|
2059 |
"/ the topApp, it must be pre/post-built. |
|
2060 |
"/ Otherwise, we invoke pre/post-builtAsSubcanvas. |
|
2061 |
"/ which provides a hook for redefinition in concrete appModels. |
|
2062 |
"/ This avoids invoking pre/postBuild twice for subCanvases which |
|
2063 |
"/ have the topApp as appModel. |
|
2064 |
||
4092 | 2065 |
sameAppAsTopApp := aBuilder application == aBuilder window topView application. |
2066 |
sameAppAsTopApp ifTrue:[ |
|
2067 |
self preBuildAsSubcanvasWith:aBuilder. |
|
2380 | 2068 |
] ifFalse:[ |
4092 | 2069 |
self preBuildWith:aBuilder. |
2380 | 2070 |
]. |
2071 |
||
2072 |
aBuilder buildFromSpec:specToBuild. |
|
2073 |
||
4092 | 2074 |
sameAppAsTopApp ifTrue:[ |
2075 |
self postBuildAsSubcanvasWith:aBuilder. |
|
2380 | 2076 |
] ifFalse:[ |
4092 | 2077 |
self postBuildWith:aBuilder. |
2380 | 2078 |
]. |
2079 |
||
2080 |
prevSpec notNil ifTrue:[ |
|
4092 | 2081 |
"/ restore state in builder if original builder was used |
2082 |
aBuilder spec:prevSpec. |
|
2380 | 2083 |
]. |
2084 |
prevSource notNil ifTrue:[ |
|
4092 | 2085 |
"/ restore state in builder if original builder was used |
2086 |
aBuilder source:prevSource. |
|
2380 | 2087 |
]. |
2088 |
||
2089 |
^ aBuilder |
|
2090 |
||
2091 |
"Created: / 18-06-1998 / 20:08:45 / cg" |
|
2092 |
"Modified: / 27-10-2006 / 11:45:25 / cg" |
|
4092 | 2093 |
"Modified (format): / 22-05-2018 / 18:12:20 / Claus Gittinger" |
2380 | 2094 |
! |
2095 |
||
2096 |
buildSubCanvas:spec withBuilder:aBuilder |
|
2097 |
"build a subcanvases' spec into aSubcanvas" |
|
2098 |
||
2099 |
self buildSubCanvas:spec withMenu:false withBuilder:aBuilder |
|
2100 |
! |
|
2101 |
||
2102 |
buildSubCanvas:spec withMenu:withMenuBoolean withBuilder:aBuilder |
|
2103 |
"build a subcanvases' spec into aSubcanvas" |
|
2104 |
||
2105 |
|specToBuild| |
|
2106 |
||
2107 |
specToBuild := spec. |
|
2108 |
withMenuBoolean ifFalse:[ |
|
4173 | 2109 |
"/ subapps should not build the menu and other fullSpec stuff. |
2110 |
spec class == FullSpec ifTrue:[ |
|
2111 |
specToBuild := spec component. |
|
2112 |
] |
|
2380 | 2113 |
]. |
2114 |
self buildSpec:specToBuild asSubCanvasWithBuilder:aBuilder |
|
2115 |
! ! |
|
2116 |
||
1419 | 2117 |
!ApplicationModel methodsFor:'component manipulations'! |
2118 |
||
2119 |
components:aSymbolOrArray do:aBlock |
|
4309 | 2120 |
"evaluate aBlock for all components listed as aSymbolOrArray." |
1419 | 2121 |
|
2122 |
|coll| |
|
2123 |
||
2124 |
aSymbolOrArray isSymbol ifTrue:[ |
|
4173 | 2125 |
"/ a single components name |
2126 |
coll := Array with:aSymbolOrArray |
|
1419 | 2127 |
] ifFalse:[ |
4173 | 2128 |
coll := aSymbolOrArray |
1419 | 2129 |
]. |
2130 |
coll do:[:aSymbol | |
|
4173 | 2131 |
|component| |
2132 |
||
2133 |
(component := self componentFor:aSymbol) isNil ifFalse:[ |
|
2134 |
aBlock value:component |
|
2135 |
] |
|
1419 | 2136 |
] |
2137 |
||
4309 | 2138 |
"Modified: / 26-03-1997 / 16:23:14 / cg" |
2139 |
"Modified (comment): / 19-07-2019 / 11:24:07 / Claus Gittinger" |
|
1419 | 2140 |
! |
2141 |
||
2142 |
disable:aSymbolOrArray |
|
2143 |
"disable the components whose id's are aSymbolOrArray." |
|
2144 |
||
2145 |
self components:aSymbolOrArray do:[:comp | comp disable] |
|
2146 |
||
2147 |
"Modified: 14.2.1997 / 17:32:09 / cg" |
|
2148 |
! |
|
2149 |
||
2150 |
enable:aSymbolOrArray |
|
2151 |
"enables the component(s) identified by aSymbolOrArray." |
|
2152 |
||
2153 |
self components:aSymbolOrArray do:[:comp | comp enable] |
|
2154 |
||
2155 |
"Modified: 14.2.1997 / 17:32:19 / cg" |
|
2156 |
! |
|
2157 |
||
2158 |
invalidate:aSymbolOrArray |
|
2159 |
"invalidates the component(s) identified by aSymbolOrArray." |
|
2160 |
||
2161 |
self components:aSymbolOrArray do:[:comp | comp invalidate] |
|
2162 |
||
2163 |
"Modified: 14.2.1997 / 17:32:28 / cg" |
|
2164 |
! |
|
2165 |
||
2166 |
makeInvisible:aSymbolOrArray |
|
2167 |
"makes the components whose id's are aSymbolOrArray invisible" |
|
2168 |
||
2169 |
self components:aSymbolOrArray do:[:comp | comp beInvisible] |
|
2170 |
||
2171 |
"Modified: 14.2.1997 / 17:32:42 / cg" |
|
2172 |
! |
|
2173 |
||
2174 |
makeReadOnly:aSymbolOrArray |
|
2175 |
"make all components identified by aSymbolOrArray read only |
|
2176 |
(for editText components)." |
|
2177 |
||
2178 |
self components:aSymbolOrArray do:[:comp | comp readOnly:true] |
|
2179 |
||
2180 |
"Modified: 14.2.1997 / 17:36:22 / cg" |
|
2181 |
! |
|
2182 |
||
2183 |
makeVisible:aSymbolOrArray |
|
2184 |
"makes the components whose id's are aSymbolOrArray visible" |
|
2185 |
||
2186 |
self components:aSymbolOrArray do:[:comp | comp beVisible] |
|
2187 |
||
2188 |
"Modified: 14.2.1997 / 17:32:52 / cg" |
|
2189 |
! |
|
2190 |
||
2191 |
makeWritable:aSymbolOrArray |
|
3297 | 2192 |
"make all components identified by aSymbolOrArray writable |
1419 | 2193 |
(for editText components)." |
2194 |
||
2195 |
self components:aSymbolOrArray do:[:comp | comp readOnly:false] |
|
2196 |
||
2197 |
"Created: 14.2.1997 / 17:36:17 / cg" |
|
2198 |
! ! |
|
2199 |
||
4268 | 2200 |
!ApplicationModel methodsFor:'copying-private'! |
1419 | 2201 |
|
2202 |
postCopy |
|
2203 |
builder := device := nil. |
|
2204 |
||
2205 |
"Created: / 19.4.1998 / 11:44:44 / cg" |
|
2053 | 2206 |
! |
2207 |
||
2208 |
postDeepCopy |
|
2209 |
builder := device := nil. |
|
2210 |
||
2211 |
"Created: / 19.4.1998 / 11:44:44 / cg" |
|
1419 | 2212 |
! ! |
2213 |
||
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2214 |
!ApplicationModel methodsFor:'delayed actions (enqueue)'! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2215 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2216 |
delayedUpdate:something with:aParameter from:changedObject |
3297 | 2217 |
"support for delayed updates - |
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2218 |
subclasses which invoke #enqueueDelayedUpdate:with:from: (from #update:with:from:) |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2219 |
must also redefine this method, and perform the actual update there." |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2220 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2221 |
^ self |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2222 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2223 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2224 |
enqueueDelayedAction:aBlock |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2225 |
"This will enqueue a delayed action - the application-process will |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2226 |
eventually execute aBlock. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2227 |
Useful for synchronization" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2228 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2229 |
^ self |
4173 | 2230 |
enqueueMessage:#value |
2231 |
for:aBlock |
|
2232 |
arguments:#(). |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2233 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2234 |
"Modified: / 26.2.2000 / 18:01:44 / cg" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2235 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2236 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2237 |
enqueueDelayedUpdate:something with:aParameter from:changedObject |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2238 |
"support for delayed updates - to be invoked from a concrete classes |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2239 |
#update:with:from: method. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2240 |
This will enqueue a delayed update, and resend #delayedUpdate:with:from: |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2241 |
whenever the receiver is handling events. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2242 |
Especially useful, if many updates arrive at high frequency, to avoid |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2243 |
multiple redraws." |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2244 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2245 |
^ self |
3448 | 2246 |
enqueueMessage:#delayedUpdate:with:from: |
2247 |
for:self |
|
2248 |
arguments:{ something . aParameter . changedObject }. |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2249 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2250 |
"Modified: / 26.2.2000 / 18:01:44 / cg" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2251 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2252 |
|
3542 | 2253 |
enqueueMessage:selector |
2254 |
"enqueue a message without arguments to be sent to myself later, |
|
2255 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2256 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2257 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2258 |
from changes made in other browsers)" |
|
2259 |
||
2260 |
self enqueueMessage:selector for:self arguments:#() |
|
2261 |
! |
|
2262 |
||
3971 | 2263 |
enqueueMessage:selector argument:arg |
2264 |
"enqueue a message without arguments to be sent to myself later, |
|
2265 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2266 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2267 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2268 |
from changes made in other browsers)" |
|
2269 |
||
2270 |
self enqueueMessage:selector for:self arguments:{arg} |
|
2271 |
||
2272 |
"Created: / 21-08-2017 / 16:37:09 / cg" |
|
2273 |
! |
|
2274 |
||
3542 | 2275 |
enqueueMessage:selector arguments:argumentArray |
2276 |
"enqueue a message to be sent to myself later, |
|
2277 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2278 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2279 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2280 |
from changes made in other browsers)" |
|
2281 |
||
2282 |
self enqueueMessage:selector for:self arguments:argumentArray |
|
2283 |
! |
|
2284 |
||
2285 |
enqueueMessage:selector for:someone |
|
2286 |
"enqueue a message without arguments to be sent to someone later, |
|
2287 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2288 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2289 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2290 |
from changes made in other browsers)" |
|
2291 |
||
2292 |
self enqueueMessage:selector for:someone arguments:#() |
|
2293 |
! |
|
2294 |
||
3971 | 2295 |
enqueueMessage:selector for:someone argument:arg |
2296 |
"enqueue a message without arguments to be sent to someone later, |
|
2297 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2298 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2299 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2300 |
from changes made in other browsers)" |
|
2301 |
||
2302 |
self enqueueMessage:selector for:someone arguments:{ arg } |
|
2303 |
||
2304 |
"Created: / 21-08-2017 / 16:36:49 / cg" |
|
2305 |
! |
|
2306 |
||
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2307 |
enqueueMessage:selector for:someone arguments:argList |
3542 | 2308 |
"enqueue a message to be sent to someone later, when my process |
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2309 |
is back in its eventLoop. Also, filter duplicates. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2310 |
This is useful, to buffer redraws and avoid flicker due to multiple |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2311 |
redraws (especially in browsers, when reacting on changeMessages resulting |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2312 |
from changes made in other browsers)" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2313 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2314 |
|window sensor| |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2315 |
|
2561 | 2316 |
|
2317 |
self isWebService ifTrue:[ |
|
3444 | 2318 |
self breakPoint:#sr. |
2319 |
^ self |
|
2561 | 2320 |
]. |
2321 |
||
3527 | 2322 |
((window := self window) notNil and:[window isOpen]) ifTrue:[ |
3444 | 2323 |
sensor := window sensor. |
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2324 |
]. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2325 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2326 |
sensor isNil ifTrue:[ |
3444 | 2327 |
"no window (yet or any longer)" |
2328 |
someone perform:selector withArguments:argList. |
|
2329 |
^ self. |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2330 |
]. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2331 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2332 |
"/ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2333 |
"/ if such a message is already in the queue, ignore it. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2334 |
"/ Otherwise push it as an event, to be handled when my thread is |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2335 |
"/ back in the event loop. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2336 |
"/ |
3448 | 2337 |
sensor enqueueMessage:selector for:someone arguments:argList |
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2338 |
|
2902
c47d671282f9
comment/format in: #enqueueMessage:for:arguments:
Claus Gittinger <cg@exept.de>
parents:
2898
diff
changeset
|
2339 |
"Created: / 26-02-2000 / 18:01:31 / cg" |
c47d671282f9
comment/format in: #enqueueMessage:for:arguments:
Claus Gittinger <cg@exept.de>
parents:
2898
diff
changeset
|
2340 |
"Modified: / 23-03-2011 / 19:46:41 / cg" |
4154 | 2341 |
"Modified: / 02-08-2018 / 17:15:59 / Claus Gittinger" |
3543 | 2342 |
! |
2343 |
||
2344 |
enqueueMessage:selector with:argument |
|
2345 |
"enqueue a message with one argument to be sent to myself later, |
|
2346 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2347 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2348 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2349 |
from changes made in other browsers)" |
|
2350 |
||
2351 |
self enqueueMessage:selector for:self arguments:{ argument } |
|
2352 |
! |
|
2353 |
||
2354 |
enqueueMessage:selector with:argument1 with:argument2 |
|
2355 |
"enqueue a message with one argument to be sent to myself later, |
|
2356 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2357 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2358 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2359 |
from changes made in other browsers)" |
|
2360 |
||
2361 |
self enqueueMessage:selector for:self arguments:{ argument1. argument2 } |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2362 |
! ! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2363 |
|
1419 | 2364 |
!ApplicationModel methodsFor:'drag & drop'! |
2365 |
||
2557 | 2366 |
canDropObjects:aCollectionOfDropObjects |
1419 | 2367 |
"drop manager asked if a drop is possible |
2368 |
- should be redefined by apps which can do it, to return true" |
|
2369 |
||
2370 |
^ false |
|
2557 | 2371 |
! |
2372 |
||
2373 |
canDropObjects:aCollectionOfDropObjects in:aComponent |
|
2374 |
"drop manager asked if a drop is possible |
|
2375 |
- should be redefined by apps which can do it, to return true" |
|
2376 |
||
3297 | 2377 |
^ self canDropObjects:aCollectionOfDropObjects |
1419 | 2378 |
! |
2379 |
||
2261 | 2380 |
canDropObjects:aCollectionOfDropObjects in:aComponent at:position |
2405 | 2381 |
"drop manager asked if a drop is possible. |
2382 |
Should be redefined by apps which can do it, to return true" |
|
2252
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2383 |
|
2261 | 2384 |
^ self canDropObjects:aCollectionOfDropObjects in:aComponent |
2385 |
||
2386 |
"Created: / 13-10-2006 / 15:52:20 / cg" |
|
2079 | 2387 |
! |
2388 |
||
2557 | 2389 |
dropObjects:aCollectionOfDropObjects |
2079 | 2390 |
"drop manager wants to drop. |
2252
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2391 |
This is ony sent, if #canDrop: returned true. |
2865 | 2392 |
Must be redefined in order for drop to work." |
2393 |
||
2394 |
^ self subclassResponsibility |
|
2252
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2395 |
|
2262 | 2396 |
"Created: / 13-10-2006 / 18:25:06 / cg" |
2079 | 2397 |
! |
2398 |
||
4183 | 2399 |
dropObjects:aCollectionOfDropObjects at:aPointOrNil |
2400 |
"drop manager wants to drop. |
|
2401 |
This is ony sent, if #canDropObjects: returned true. |
|
2402 |
Must be redefined in order for drop to work." |
|
2403 |
||
2404 |
^ self dropObjects:aCollectionOfDropObjects. |
|
2405 |
||
2406 |
"Created: / 28-09-2018 / 12:07:00 / Stefan Vogel" |
|
2407 |
! |
|
2408 |
||
2557 | 2409 |
dropObjects:aCollectionOfDropObjects in:aComponent |
2410 |
"drop manager wants to drop. |
|
2411 |
This is ony sent, if #canDrop: returned true. |
|
2412 |
Must be redefine in order for drop to work." |
|
2413 |
||
2414 |
^ self dropObjects:aCollectionOfDropObjects |
|
2415 |
||
2416 |
! |
|
2417 |
||
2262 | 2418 |
dropObjects:aCollectionOfDropObjects in:aComponent at:aPoint |
1419 | 2419 |
"drop manager wants to drop. |
4183 | 2420 |
This is ony sent, if #canDropObjects:in: returned true. |
2421 |
Can be redefined in apps which return true to #canDropObjects:." |
|
2252
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2422 |
|
2557 | 2423 |
^ self dropObjects:aCollectionOfDropObjects in:aComponent |
2262 | 2424 |
|
2425 |
"Created: / 13-10-2006 / 18:25:13 / cg" |
|
4183 | 2426 |
"Modified (comment): / 28-09-2018 / 14:26:18 / Stefan Vogel" |
2824 | 2427 |
! |
2428 |
||
2429 |
droppedFile:aFilename in:aComponent |
|
2430 |
"ignored here - only sent by textView components, sometimes" |
|
1419 | 2431 |
! ! |
2432 |
||
2433 |
!ApplicationModel methodsFor:'easy bindings'! |
|
2434 |
||
2435 |
registerInterestIn:aValueModel using:aSelectorOrArray |
|
2436 |
"Register interest in a change in aValueModel using information in aSelectorOrArray. |
|
3297 | 2437 |
aSelectorOrArray can be one of three things: |
2438 |
||
4173 | 2439 |
1) nil in which case no interest is registered |
2440 |
2) a selector in which case the receiver is understood to be self |
|
2441 |
3) an Array in which case the size is two where the first element is the |
|
2442 |
message to be sent and the second element is the receiver." |
|
1419 | 2443 |
|
2444 |
aSelectorOrArray isNil ifTrue:[^ aValueModel]. |
|
2445 |
||
2446 |
(aSelectorOrArray isArray) ifTrue:[ |
|
4173 | 2447 |
aValueModel onChangeSend:(aSelectorOrArray at:1) to:(aSelectorOrArray at:2) |
1419 | 2448 |
] ifFalse: [ |
4173 | 2449 |
aValueModel onChangeSend:aSelectorOrArray to:self |
1419 | 2450 |
]. |
2451 |
^aValueModel |
|
2452 |
||
2453 |
"Modified: / 31.10.1997 / 18:19:44 / cg" |
|
980
3764f680134d
allow subclass to redefine subCanvas-pre/postBuilds;
Claus Gittinger <cg@exept.de>
parents:
978
diff
changeset
|
2454 |
! |
3764f680134d
allow subclass to redefine subCanvas-pre/postBuilds;
Claus Gittinger <cg@exept.de>
parents:
978
diff
changeset
|
2455 |
|
1419 | 2456 |
valueHolderFor:aSelector initialValue:anObject |
3297 | 2457 |
"Return a ValueHolder on anObject." |
1419 | 2458 |
|
2459 |
^ self valueHolderFor:aSelector initialValue:anObject changeMessage:nil |
|
2460 |
||
2461 |
||
2462 |
! |
|
2463 |
||
2464 |
valueHolderFor:aSelector initialValue:anObject changeMessage:aSelectorOrArrayOrNil |
|
3297 | 2465 |
"Return a ValueHolder on anObject. aSelectorOrArrayOrNil is the change information |
2466 |
for the ValueHolder. This argument is either a Symbol or an Array of two elements. |
|
1419 | 2467 |
If it is a Symbol, then it is the change message and the interested object is understood |
3738 | 2468 |
to be the receiver. If it is an Array, then the first element is the change message and |
3297 | 2469 |
the second element is the interested object. " |
1419 | 2470 |
|
2471 |
|holder| |
|
2472 |
||
2473 |
(builder bindings includesKey:aSelector) ifFalse:[ |
|
3738 | 2474 |
holder := ValueHolder with:anObject. |
2475 |
builder aspectAt:aSelector put:holder. |
|
2476 |
aSelectorOrArrayOrNil notNil ifTrue:[ |
|
2477 |
^ self registerInterestIn:holder using:aSelectorOrArrayOrNil |
|
2478 |
]. |
|
2479 |
^ holder |
|
1419 | 2480 |
]. |
2481 |
^ builder aspectAt:aSelector |
|
2482 |
||
2483 |
"Modified: / 21.5.1998 / 03:31:28 / cg" |
|
2484 |
! ! |
|
2485 |
||
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2486 |
!ApplicationModel methodsFor:'forced actions'! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2487 |
|
4289 | 2488 |
close |
2489 |
"this is sent by my topView when about to be closed |
|
2490 |
by the program (not by the windowManager). |
|
2491 |
Notice, that we get a closeRequest message if closed by the windowManager, |
|
2492 |
which can be rejected by the app (or confirmed via a dialog) |
|
2493 |
Could be redefined in subclasses." |
|
2494 |
||
2495 |
self closeDownViews |
|
2496 |
! |
|
2497 |
||
2498 |
closeDownViews |
|
2499 |
"close down the application's view(s)" |
|
2500 |
||
2501 |
<modifier: #super> "must be called if redefined" |
|
2502 |
||
2503 |
|wg wgProcess window| |
|
2504 |
||
2505 |
self release. |
|
2506 |
ActiveHelp stopFor:self. |
|
2507 |
||
2508 |
self shouldRememberLastExtent ifTrue:[ |
|
2509 |
self rememberLastExtent. |
|
2510 |
]. |
|
2511 |
wg := self windowGroup. |
|
2512 |
(wg notNil and:[wg isModal not]) ifTrue:[ |
|
2513 |
wgProcess := wg process. |
|
2514 |
(wgProcess notNil and:[Processor activeProcess ~~ wgProcess]) ifTrue:[ |
|
2515 |
wgProcess terminate |
|
2516 |
] ifFalse:[ |
|
2517 |
wg closeDownViews. |
|
2518 |
]. |
|
2519 |
^ self. |
|
2520 |
]. |
|
2521 |
||
2522 |
window := self window. |
|
2523 |
window notNil ifTrue:[ |
|
2524 |
window destroy. |
|
2525 |
]. |
|
2526 |
||
2527 |
"Modified: / 08-02-2017 / 00:24:14 / cg" |
|
2528 |
"Modified: / 03-03-2017 / 12:00:22 / stefan" |
|
2529 |
! |
|
2530 |
||
2531 |
closeRequest |
|
2532 |
"this is sent by my topView when about to be closed by the windowManager. |
|
2533 |
Could be redefined in subclasses to suppress close or confirm." |
|
2534 |
||
2535 |
<modifier: #super> "must be called if redefined" |
|
2536 |
||
2537 |
|sav window| |
|
2538 |
||
2539 |
window := self window. |
|
2540 |
window isNil ifTrue:[ |
|
2541 |
'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR. |
|
2542 |
^ self |
|
2543 |
]. |
|
2544 |
||
2545 |
window isTopView ifFalse:[ |
|
2546 |
window topView isModal ifTrue:[ |
|
2547 |
WindowGroup leaveSignal raise. |
|
2548 |
]. |
|
2549 |
||
2550 |
'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR. |
|
2551 |
^ self |
|
2552 |
]. |
|
2553 |
||
2554 |
"/ In multiView apps, tell my master. |
|
2555 |
"/ (but not if I am a modal reincarnation) |
|
2556 |
(masterApplication notNil |
|
2557 |
and:[window isModal not]) ifTrue:[ |
|
2558 |
||
2559 |
"/ temporary clear my masterApplication to prevent |
|
2560 |
"/ endless recursion, in case the master sends me |
|
2561 |
"/ a closeRequest (although, it is supposed to |
|
2562 |
"/ send me a closeDownViews ...) |
|
2563 |
||
2564 |
sav := masterApplication. |
|
2565 |
masterApplication := nil. |
|
2566 |
sav closeRequestFor:window. |
|
2567 |
||
2568 |
"/ restore - in case master did not want me to close ... |
|
2569 |
masterApplication := sav. |
|
2570 |
] ifFalse:[ |
|
2571 |
"/ ST/X does close-check by redefining this message without |
|
2572 |
"/ a supersend; |
|
2573 |
"/ VW does it by returning false from requestForWindowClose |
|
2574 |
"/ sigh. |
|
2575 |
||
2576 |
self requestForWindowClose ifTrue:[ |
|
2577 |
window isSlave ifTrue:[ |
|
2578 |
window destroy |
|
2579 |
] ifFalse:[ |
|
2580 |
self closeDownViews |
|
2581 |
] |
|
2582 |
] |
|
2583 |
]. |
|
2584 |
||
2585 |
"Modified: / 08-02-2017 / 00:25:11 / cg" |
|
2586 |
! |
|
2587 |
||
2588 |
closeRequestFor:aTopView |
|
2589 |
"this is sent by any of my topViews when about to be closed by the |
|
2590 |
windowmanager. For backward compatibility with single-view applications, |
|
2591 |
this is forwarded here to a simple (non topView-specific) closeRequest, |
|
2592 |
effectively closing all of my views. |
|
2593 |
MultiView applications should redefine this method if closing of individual |
|
2594 |
views closing is to be caught and/or should not close all of them." |
|
2595 |
||
2596 |
|savedMaster myWindow| |
|
2597 |
||
2598 |
myWindow := self window. |
|
2599 |
||
2600 |
"/ In multiView apps, tell my master. |
|
2601 |
"/ (but not if I am a modal reincarnation) |
|
2602 |
(masterApplication notNil |
|
2603 |
and:[myWindow topView isModal not]) ifTrue:[ |
|
2604 |
||
2605 |
"/ temporary clear my masterApplication to prevent |
|
2606 |
"/ endless recursion, in case the master sends me |
|
2607 |
"/ a closeRequest (although, it is supposed to |
|
2608 |
"/ send me a closeDownViews ...) |
|
2609 |
||
2610 |
savedMaster := masterApplication. |
|
2611 |
masterApplication := nil. |
|
2612 |
aTopView isSlave ifTrue:[ |
|
2613 |
savedMaster closeRequestFor:aTopView. |
|
2614 |
] ifFalse:[ |
|
2615 |
savedMaster closeRequestFor:myWindow. |
|
2616 |
]. |
|
2617 |
||
2618 |
"/ restore - in case master did not want me to close ... |
|
2619 |
masterApplication := savedMaster. |
|
2620 |
^ self |
|
2621 |
]. |
|
2622 |
||
2623 |
(aTopView == myWindow) ifTrue:[ |
|
2624 |
self closeRequest. |
|
2625 |
^ self |
|
2626 |
]. |
|
2627 |
||
2628 |
(aTopView isPartner or:[aTopView isMaster]) ifTrue:[ |
|
2629 |
aTopView application closeRequest. |
|
2630 |
self closeRequest. |
|
2631 |
^ self. |
|
2632 |
]. |
|
2633 |
aTopView isSlave ifTrue:[ |
|
2634 |
aTopView closeRequest |
|
2635 |
] ifFalse:[ |
|
2636 |
aTopView application closeRequest. |
|
2637 |
] |
|
2638 |
! |
|
2639 |
||
2640 |
doAccept |
|
2641 |
"this is invoked by the Return-Key (if returnIsOK) or |
|
2642 |
the ok-button (if any), IFF the application has been |
|
2643 |
opened modal (i.e. as a dialog)." |
|
2644 |
||
2645 |
"/ the following is a bad kludge - |
|
2646 |
"/ actually, modal apps should inherit from SimpleDialog |
|
2647 |
"/ (then, things would be clean) |
|
2648 |
"/ However, it may be useful, to open some app (which is normally |
|
2649 |
"/ modeless) as a modal one as well. |
|
2650 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
2651 |
"/ to remember the accept vs. cancel case. |
|
2652 |
"/ |
|
2653 |
self window isModal ifTrue:[ |
|
2654 |
masterApplication notNil ifTrue:[ |
|
2655 |
masterApplication window topView == self window topView ifTrue:[ |
|
2656 |
masterApplication window isModal ifTrue:[ |
|
2657 |
masterApplication doAccept. |
|
2658 |
^ self. |
|
2659 |
]. |
|
2660 |
]. |
|
2661 |
]. |
|
2662 |
||
2663 |
"/ mhmh - is this a good idea ? |
|
2664 |
self perform:#accept ifNotUnderstood:[self closeRequest]. |
|
2665 |
^ self |
|
2666 |
]. |
|
2667 |
||
2668 |
^ self "/ nothing done here ... |
|
2669 |
! |
|
2670 |
||
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2671 |
doAcceptByReturnKey |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2672 |
|acceptAction| |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2673 |
|
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2674 |
builder notNil ifTrue:[ |
4173 | 2675 |
acceptAction := builder bindingAt:#doAccept. |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2676 |
]. |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2677 |
acceptAction notNil ifTrue:[ |
4173 | 2678 |
acceptAction value |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2679 |
] ifFalse:[ |
4173 | 2680 |
self doAccept |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2681 |
] |
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2682 |
! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2683 |
|
4289 | 2684 |
doCancel |
2685 |
"this is invoked by the Escape-Key (if escapeIsCancel) or |
|
2686 |
the cancel-button (if any), IFF the application has been |
|
2687 |
opened modal (i.e. as a dialog)." |
|
2688 |
||
2689 |
"/ the following is a bad kludge - |
|
2690 |
"/ actually, modal apps should inherit from SimpleDialog |
|
2691 |
"/ (then, things would be clean) |
|
2692 |
"/ However, it may be useful, to open some app (which is normally |
|
2693 |
"/ modeless) as a modal one as well. |
|
2694 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
2695 |
"/ to remember the accept vs. cancel case. |
|
2696 |
"/ |
|
2697 |
self window isModal ifTrue:[ |
|
2698 |
"/ mhmh - is this a good idea ? |
|
2699 |
self perform:#cancel ifNotUnderstood:[self closeRequest]. |
|
2700 |
^ self |
|
2701 |
]. |
|
2702 |
^ self "/ nothing done here ... |
|
2703 |
! |
|
2704 |
||
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2705 |
doCancelByEscapeKey |
2010 | 2706 |
|cancelAction| |
2707 |
||
2708 |
builder notNil ifTrue:[ |
|
4173 | 2709 |
cancelAction := builder bindingAt:#doCancel. |
2010 | 2710 |
]. |
2711 |
cancelAction notNil ifTrue:[ |
|
4173 | 2712 |
cancelAction value |
2010 | 2713 |
] ifFalse:[ |
4173 | 2714 |
self doCancel |
2010 | 2715 |
] |
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2716 |
! ! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2717 |
|
1419 | 2718 |
!ApplicationModel methodsFor:'help'! |
2719 |
||
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2720 |
aboutImage |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2721 |
"bitmap image or nil for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2722 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2723 |
^ self class aboutImage |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2724 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2725 |
"Modified: / 13.11.2001 / 12:32:44 / cg" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2726 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2727 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2728 |
aboutThisApplicationLabel |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2729 |
"label for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2730 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2731 |
^ self class aboutThisApplicationLabel |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2732 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2733 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2734 |
aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2735 |
"text for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2736 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2737 |
^ self class aboutThisApplicationText |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2738 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2739 |
|
3240 | 2740 |
activeHelpViewFor:text onDevice:aDevice |
3297 | 2741 |
"redefinable to allow for applications to provide their own active help |
3239 | 2742 |
(aka tooltip) bubble window" |
2743 |
||
3240 | 2744 |
^ ActiveHelpView for:text onDevice:aDevice |
3239 | 2745 |
! |
2746 |
||
2520
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2747 |
flyByHelpDependsOnPositionIn:aView |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2748 |
"subclasses where the help-text depends upon the pointer position might |
4369 | 2749 |
want to redefine this. If true is returned, the flyByHelp watcher will |
2750 |
ask for the help text with every button motion. |
|
2751 |
Otherwise, it will only ask on enter." |
|
2520
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2752 |
|
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2753 |
^ false |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2754 |
! |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2755 |
|
4391 | 2756 |
helpKeyPressed |
2757 |
"called by <F1>" |
|
2758 |
||
2759 |
self openDocumentation |
|
2760 |
! |
|
2761 |
||
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2762 |
openAboutThisApplication |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2763 |
"opens an about box for this application. |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2764 |
Can be specialized by redefining #aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2765 |
and #aboutThisApplicationLabel" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2766 |
|
1531 | 2767 |
Dialog |
4173 | 2768 |
about:(self translateString:self aboutThisApplicationText) |
2769 |
label:(self translateString:self aboutThisApplicationLabel) |
|
2770 |
icon:self aboutImage |
|
1531 | 2771 |
|
2772 |
"Modified: / 17.11.2001 / 23:05:52 / cg" |
|
1419 | 2773 |
! |
2774 |
||
4369 | 2775 |
openDocumentation |
2776 |
"called by <F1> to open the default documentation. |
|
2777 |
Empty here." |
|
2778 |
||
2779 |
self openAboutThisApplication |
|
2780 |
! |
|
2781 |
||
1419 | 2782 |
openHelpViewOnFile:pathToHelpText |
2783 |
"open a help viewer (as opened by the help buttons). |
|
2784 |
The argument is a relative path within the help directory |
|
2785 |
(but a file under the current directory is tried first)" |
|
2786 |
||
2787 |
self withWaitCursorDo:[ |
|
4173 | 2788 |
HTMLDocumentView openFullOnHelpFile:pathToHelpText |
1419 | 2789 |
] |
2790 |
||
2791 |
! |
|
2792 |
||
2793 |
showActiveHelp:aHelpText for:view |
|
2794 |
"This is invoked from the activeHelp event listener, to display some popup-help |
|
4113 | 2795 |
for a component. |
2796 |
If false is returned, the help manager will pop up |
|
2797 |
some active help bubble; |
|
2798 |
if true is returned, it will assume that the |
|
1419 | 2799 |
help text has been already displayed and will not do any further actions. |
4113 | 2800 |
|
1419 | 2801 |
Here, we accept the help text, and push an event into out own input |
3764 | 2802 |
queue, so that the help text will be displayed asynchronously by myself, |
4113 | 2803 |
via the #showHelp:for: method, and return true. Always. |
2804 |
In theory, this can be redefined in concrete classes to handle active help differently." |
|
1419 | 2805 |
|
2806 |
|wg mySensor| |
|
2807 |
||
2808 |
self showingHelp ifFalse: [ |
|
3764 | 2809 |
^ true |
1419 | 2810 |
]. |
2811 |
||
2812 |
"/ NEW: push it into the event queue, to have it displayed |
|
3955 | 2813 |
"/ synchronously with other events. |
1419 | 2814 |
"/ (also any errors are reported as occurring in my context; |
2815 |
"/ instead of occurring in the activeHelp context). |
|
2816 |
||
2817 |
(wg := self windowGroup) notNil ifTrue:[ |
|
3764 | 2818 |
mySensor := wg sensor. |
2819 |
mySensor notNil ifTrue:[ |
|
2820 |
mySensor flushEventsFor:self withType:#showHelp:for:. |
|
2821 |
mySensor |
|
2822 |
pushUserEvent:#showHelp:for: for:self |
|
2823 |
withArguments:(Array with:aHelpText with:view). |
|
2824 |
^ true |
|
2825 |
] |
|
1419 | 2826 |
]. |
2827 |
||
2828 |
"/ mhmh - can this happen ? |
|
2829 |
||
2830 |
^ true |
|
2831 |
||
3955 | 2832 |
"Modified: / 21-08-1998 / 16:00:37 / cg" |
2833 |
"Modified (comment): / 22-05-2017 / 12:07:03 / mawalch" |
|
4113 | 2834 |
"Modified (comment): / 07-06-2018 / 10:45:44 / Claus Gittinger" |
1419 | 2835 |
! |
2836 |
||
2837 |
showHelp:aHelpText for:view |
|
4369 | 2838 |
"actual method which is supposed to display the tooltip help text. |
2839 |
Should be redefined in concrete classes, to put the tooltip text |
|
1419 | 2840 |
into some info label, or the windows title bar. |
2841 |
Here, the help text is ignored." |
|
2842 |
||
2843 |
masterApplication notNil ifTrue:[ |
|
4173 | 2844 |
masterApplication showHelp:aHelpText for:view |
1419 | 2845 |
]. |
2846 |
||
2847 |
"Modified: / 31.7.1998 / 19:13:59 / cg" |
|
2848 |
! |
|
2849 |
||
2850 |
showingHelp |
|
2851 |
"return true, if the activeHelp manager should invoke my #showHelp:for: |
|
2852 |
method, when the mouse pointer is moved over my widgets. |
|
2853 |
The default here is true, however, the #showHelp:for: methods are empty. |
|
2854 |
These should be redefined to put the help text into some info label, |
|
3791 | 2855 |
or into the view's title bar. |
1419 | 2856 |
You may also redefine the showingHelp/showingHelp: methods, to |
2857 |
remember the flag setting." |
|
2858 |
||
2859 |
^ true |
|
2860 |
||
2861 |
"Modified: / 31.7.1998 / 17:55:31 / cg" |
|
2862 |
! ! |
|
2863 |
||
4316 | 2864 |
!ApplicationModel methodsFor:'help - presentations'! |
2865 |
||
2866 |
showMeHowItWorks |
|
4317 | 2867 |
"present the default show, from a file named <majorKey>_<lang>.show. |
2868 |
The major key defaults to the classes name." |
|
2869 |
||
4316 | 2870 |
self showMeHowItWorks:nil |
4317 | 2871 |
|
2872 |
"<<END |
|
2873 |
ShowMeHowItWorks do: #( |
|
2874 |
show: 'this little show demonstrates how to open a class browser' |
|
2875 |
||
2876 |
intro |
|
2877 |
||
2878 |
(unless: ( isEmpty: ReceiverEditor ) do:( |
|
2879 |
(showing: 'you can clear the fields - by pressing the "Clear" button' do:( |
|
2880 |
fastMoveTo: ClearButton |
|
2881 |
click |
|
2882 |
)) |
|
2883 |
)) |
|
2884 |
||
2885 |
( showing: 'start by choosing the number of arguments,' do:( |
|
2886 |
moveTo: AllowedArguments |
|
2887 |
select: '1 argument' |
|
2888 |
)) |
|
2889 |
(showing: 'Click into the "receiver" field' do:( |
|
2890 |
moveTo: ReceiverEditor |
|
2891 |
click |
|
2892 |
)) |
|
2893 |
wait: 0.5 |
|
2894 |
(showing: 'Enter a value (or expression) into "receiver" field' do:( |
|
2895 |
type: '10' |
|
2896 |
)) |
|
2897 |
wait: 0.5 |
|
2898 |
(showing: 'Click into the "first argument" field' do:( |
|
2899 |
moveTo: Arg1Editor |
|
2900 |
click |
|
2901 |
)) |
|
2902 |
wait: 0.5 |
|
2903 |
(showing: 'and enter a value for the argument' do:( |
|
2904 |
type: '1' |
|
2905 |
)) |
|
2906 |
wait: 0.5 |
|
2907 |
(showing: 'Click into the "answer" field' do:( |
|
2908 |
fastMoveTo: AnswerEditor |
|
2909 |
click |
|
2910 |
)) |
|
2911 |
(showing: 'Enter the expected result value into the "answer" field' do:( |
|
2912 |
type: '11' |
|
2913 |
)) |
|
2914 |
wait: 0.5 |
|
2915 |
(showing: 'and finally, Click on the "search" button' do:( |
|
2916 |
fastMoveTo: SearchButton |
|
2917 |
click |
|
2918 |
)) |
|
2919 |
show: 'now, the finder searches for combinations that produce the desired result' |
|
2920 |
fastMoveTo: ResultList |
|
2921 |
show: 'and present code which would produce it in the answer list below' |
|
2922 |
show: 'if you select any item there,' |
|
2923 |
wait: 0.5 |
|
2924 |
selectIndex: 2 |
|
2925 |
wait: 0.5 |
|
2926 |
fastMoveTo: ImplementorsList |
|
2927 |
show: 'the implementations will be shown in the top right implementor list' |
|
2928 |
show: 'if you select any item there,' |
|
2929 |
selectIndex: 1 |
|
2930 |
wait: 0.5 |
|
2931 |
show: 'the implementation is shown in the bottom code editor' |
|
2932 |
fastMoveTo: CodeView |
|
2933 |
wait: 0.5 |
|
2934 |
show: 'Thank you for watching, indeed' |
|
2935 |
) |
|
2936 |
END" |
|
4316 | 2937 |
|
2938 |
"Created: / 18-07-2019 / 21:59:06 / Claus Gittinger" |
|
4317 | 2939 |
"Modified: / 23-07-2019 / 09:04:36 / Claus Gittinger" |
4316 | 2940 |
! |
2941 |
||
2942 |
showMeHowItWorks:minorKey |
|
4381 | 2943 |
"present the show, from a file named <majorKey>_<minorKey>_<lang>.show. |
4317 | 2944 |
Usually, the major key defaults to the classes name, |
2945 |
and the minor key is often emptyOrNil, if there is only one show." |
|
2946 |
||
2947 |
self showMeHowItWorks:minorKey inAny:(self showMeHowItWorksDefaultMajorKeys) |
|
2948 |
||
2949 |
"Modified: / 23-07-2019 / 09:08:00 / Claus Gittinger" |
|
4316 | 2950 |
! |
2951 |
||
2952 |
showMeHowItWorks:minorKey in:majorKey |
|
4317 | 2953 |
self showMeHowItWorks:minorKey inAny:{ majorKey } |
2954 |
||
2955 |
"Modified: / 23-07-2019 / 09:09:59 / Claus Gittinger" |
|
2956 |
! |
|
2957 |
||
2958 |
showMeHowItWorks:minorKey inAny:setOfMajorKeys |
|
4361 | 2959 |
"start a ShowMeHowItWorks presentation. |
2960 |
This is controlled by a spec, which is read from the resources/shows folder, |
|
2961 |
and is named <appClassName>_<lang>.show" |
|
2962 |
||
4381 | 2963 |
|fn rsrcDir| |
4316 | 2964 |
|
2965 |
rsrcDir := self class packageDirectory asFilename / 'resources' / 'shows'. |
|
2966 |
(rsrcDir exists) ifFalse:[ |
|
4317 | 2967 |
Dialog warn:'No presentations available for %1' with:(self className). |
4316 | 2968 |
^ self |
2969 |
]. |
|
4317 | 2970 |
|
2971 |
setOfMajorKeys do:[:eachTriedMajorKey | |
|
2972 |
fn := eachTriedMajorKey. |
|
2973 |
minorKey notEmptyOrNil ifTrue:[ |
|
2974 |
fn := fn,'_',minorKey |
|
2975 |
]. |
|
2976 |
||
2977 |
{ |
|
4361 | 2978 |
{ ('_',Smalltalk language,'.show') . Smalltalk language } . |
2979 |
{ ('_en','.show') . 'en' } . |
|
2980 |
{ '.show' . 'en' } |
|
2981 |
} pairsDo:[:rest :lang | |
|
4317 | 2982 |
|triedFn| |
2983 |
||
2984 |
triedFn := fn,rest. |
|
2985 |
(rsrcDir / triedFn) exists ifTrue:[ |
|
4361 | 2986 |
ShowMeHowItWorks new |
2987 |
application:self; |
|
2988 |
language:lang; |
|
4381 | 2989 |
doShowFile:(rsrcDir / triedFn). |
4317 | 2990 |
^ self |
2991 |
] |
|
2992 |
]. |
|
2993 |
]. |
|
4364 | 2994 |
Dialog warn:'No presentations available for %1 (missing show: "%2")' with:(self className) with:(fn,'.show'). |
4317 | 2995 |
|
2996 |
"Created: / 23-07-2019 / 09:09:37 / Claus Gittinger" |
|
2997 |
! |
|
2998 |
||
2999 |
showMeHowItWorksDefaultMajorKeys |
|
4362 | 3000 |
"Usually, the major key defaults to the classes name. |
3001 |
The returned keys are tried as filename prefixes in the resources/shows folder" |
|
3002 |
||
3003 |
^ { |
|
3004 |
self class name copyReplaceAll:$: with:$_. |
|
4317 | 3005 |
self class nameWithoutPrefix copyReplaceAll:$: with:$_ |
3006 |
} asSet |
|
3007 |
||
3008 |
" |
|
3009 |
Expecco::ProjectDifferenceBrowser basicNew showMeHowItWorksDefaultMajorKeys |
|
3010 |
Expecco::ProjectDifferenceBrowser basicNew showMeHowItWorks |
|
3011 |
" |
|
3012 |
||
3013 |
"Created: / 23-07-2019 / 09:07:37 / Claus Gittinger" |
|
4316 | 3014 |
! ! |
3015 |
||
2977 | 3016 |
!ApplicationModel methodsFor:'help texts'! |
3017 |
||
4047 | 3018 |
basicHelpTextForKey:aKey |
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
3019 |
"flyByHelp interface: return some short help text for a key. |
2977 | 3020 |
key is the symbol associated with some widget or menu item. |
3785 | 3021 |
Return the original (english) text as written in the helpSpec; |
4112 | 3022 |
The returned string (if any) needs to be translated as per language, |
3023 |
and also CR-expanded" |
|
2977 | 3024 |
|
3025 |
|helpSpecFromBindings helpText helpSpec "resourceArgs"| |
|
3026 |
||
4047 | 3027 |
helpSpecFromBindings := self aspectFor:#helpSpec. |
2977 | 3028 |
helpSpecFromBindings notNil ifTrue:[ |
3785 | 3029 |
helpText := helpSpecFromBindings at:aKey ifAbsent:nil. |
4047 | 3030 |
]. |
4109 | 3031 |
"/ helpText isNil ifTrue:[ |
3032 |
"/ "/ fall back for old apps |
|
3033 |
"/ helpSpecFromBindings := self aspectFor:#flyByHelpSpec. |
|
3034 |
"/ helpSpecFromBindings notNil ifTrue:[ |
|
3035 |
"/ helpText := helpSpecFromBindings at:aKey ifAbsent:nil. |
|
3036 |
"/ ]. |
|
3037 |
"/ ]. |
|
2977 | 3038 |
helpText isNil ifTrue:[ |
4047 | 3039 |
helpSpec := self helpSpec. |
3040 |
helpSpec isNil ifTrue:[ |
|
3041 |
"/ fall back for old apps |
|
3042 |
helpSpec := self perform:#flyByHelpSpec ifNotUnderstood:nil. |
|
3043 |
]. |
|
3785 | 3044 |
helpSpec notNil ifTrue:[ |
3045 |
helpText := helpSpec at:aKey ifAbsent:nil. |
|
3046 |
]. |
|
2977 | 3047 |
]. |
3048 |
||
4109 | 3049 |
helpText notNil ifTrue:[ |
3050 |
"/ new: allow for a collection (resource-key arg1 arg2...) |
|
3051 |
helpText isNonByteCollection ifTrue:[ |
|
3052 |
helpText := helpText first. |
|
3053 |
"/ resourceArgs := helpText copyFrom:2. |
|
3054 |
]. |
|
2977 | 3055 |
]. |
4109 | 3056 |
|
2977 | 3057 |
^ helpText |
3058 |
||
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
3059 |
"Modified: / 27-01-2012 / 14:30:20 / cg" |
3785 | 3060 |
"Modified (comment): / 17-11-2016 / 22:37:05 / cg" |
4109 | 3061 |
"Modified: / 06-06-2018 / 17:30:09 / Claus Gittinger" |
4112 | 3062 |
"Modified (comment): / 07-06-2018 / 10:38:37 / Claus Gittinger" |
2977 | 3063 |
! |
3064 |
||
4047 | 3065 |
helpSpec |
2977 | 3066 |
"activeHelp interface: return some short help text for a widget component" |
3067 |
||
3029 | 3068 |
|specFromBuilder| |
3069 |
||
3070 |
builder notNil ifTrue:[ |
|
4047 | 3071 |
(specFromBuilder := builder bindingAt:#helpSpec) notNil ifTrue:[ |
3072 |
^ specFromBuilder |
|
3073 |
]. |
|
3029 | 3074 |
]. |
4047 | 3075 |
^ self class helpSpec |
3076 |
! |
|
3077 |
||
3078 |
helpTextFor:aComponent |
|
3079 |
"activeHelp interface: return some help text for a widget component" |
|
2977 | 3080 |
|
3081 |
|key| |
|
3082 |
||
3083 |
builder notNil ifTrue:[ |
|
4120 | 3084 |
(key := builder helpKeyFor:aComponent) notNil ifTrue:[ |
3085 |
^ self helpTextForKey:key |
|
3086 |
] |
|
2977 | 3087 |
]. |
3088 |
masterApplication notNil ifTrue:[ |
|
4120 | 3089 |
^ masterApplication helpTextFor:aComponent |
2977 | 3090 |
]. |
3091 |
^ nil |
|
3092 |
||
4120 | 3093 |
"Modified: / 31-07-1998 / 23:03:10 / cg" |
3094 |
"Modified: / 08-06-2018 / 13:01:09 / Claus Gittinger" |
|
2977 | 3095 |
! |
3096 |
||
4047 | 3097 |
helpTextFor:aComponent at:aPoint |
4039 | 3098 |
"if not redefined by subclass, fall back to general method" |
3099 |
||
4047 | 3100 |
^ self helpTextFor:aComponent |
4039 | 3101 |
|
3102 |
"Created: / 09-01-2018 / 16:32:40 / stefan" |
|
3103 |
! |
|
3104 |
||
4047 | 3105 |
helpTextForKey:aKey |
4152 | 3106 |
"flyByHelp interface: |
3107 |
return some short help text for a key. |
|
3108 |
Key is the symbol associated with some widget or menu item. |
|
3109 |
(from my helpSpec); |
|
3110 |
Return a language variant (if available). |
|
3111 |
Special: with CTRL, show how it is generated (the helpKey or action block)" |
|
2977 | 3112 |
|
4243 | 3113 |
|helpText translatedHelpText translatedKey master| |
3114 |
||
3115 |
"/ ActiveHelp debugging:true. |
|
4221 | 3116 |
"/ ActiveHelp debugging:false. |
4243 | 3117 |
ActiveHelp debugging ifTrue:[ |
3118 |
Transcript showCR:'app: %1; help key: %2' with:self with:aKey |
|
3119 |
]. |
|
2977 | 3120 |
|
4047 | 3121 |
helpText := self basicHelpTextForKey:aKey. |
2977 | 3122 |
helpText isNil ifTrue:[ |
4243 | 3123 |
"/ try all masters... |
3124 |
master := masterApplication. |
|
3125 |
[helpText isNil and:[master notNil]] whileTrue:[ |
|
4039 | 3126 |
"here we get an already translated helpText" |
4243 | 3127 |
helpText := master basicHelpTextForKey:aKey. |
3128 |
master masterApplication ~~ master ifTrue:[ |
|
3129 |
master := master masterApplication. |
|
3130 |
]. |
|
4039 | 3131 |
]. |
3132 |
helpText isNil ifTrue:[ |
|
3133 |
"there is no help text - resolve key from resources" |
|
4157 | 3134 |
helpText := (self translateString:aKey). |
4059 | 3135 |
helpText = aKey ifTrue:[ |
4384 | 3136 |
"/ nothing came... |
3137 |
||
3138 |
"/ special: if ctrl is pressed, show the helpkey |
|
4232 | 3139 |
(FlyByHelp helpKeyInsteadOfHelpTextQuery query ? false) ifTrue:[ |
4243 | 3140 |
^ c'Helpkey (%1): %2\nHold CTRL and press SHIFT for menu' bindWith:self with:aKey. |
4232 | 3141 |
]. |
4109 | 3142 |
helpText := nil |
4059 | 3143 |
]. |
4112 | 3144 |
^ helpText. |
4039 | 3145 |
]. |
2977 | 3146 |
]. |
3147 |
"/ kludge to allow for dynamic translation by the application itself, avoiding the key translation below. |
|
3148 |
helpText isBlock ifTrue:[ |
|
4232 | 3149 |
(FlyByHelp helpKeyInsteadOfHelpTextQuery query ? false) ifTrue:[ |
4229 | 3150 |
^ 'HelpText-block: ',helpText printString,c'\nHold CTRL and press SHIFT for menu'. |
4152 | 3151 |
]. |
4039 | 3152 |
^ helpText value. |
2977 | 3153 |
]. |
3154 |
||
4200 | 3155 |
"/ special: if ctrl is pressed, show the helpkey |
4232 | 3156 |
(helpText notNil) ifTrue:[ |
3157 |
(FlyByHelp helpKeyInsteadOfHelpTextQuery query ? false) ifTrue:[ |
|
4243 | 3158 |
^ c'Helpkey (%1): %2\nHold CTRL and press SHIFT for menu' bindWith:self with:aKey. |
4232 | 3159 |
]. |
4120 | 3160 |
]. |
3161 |
||
2977 | 3162 |
"get the translation" |
3163 |
translatedHelpText := self translateString:helpText. |
|
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
3164 |
(helpText = aKey and:[ translatedHelpText = helpText ]) ifTrue:[ |
4039 | 3165 |
"there is no translation in the resources - maybe there is one for the key?" |
3166 |
translatedKey := self translateString:aKey. |
|
3167 |
translatedKey ~~ aKey ifTrue:[ |
|
3168 |
translatedHelpText := translatedKey. |
|
3169 |
]. |
|
2977 | 3170 |
]. |
4174 | 3171 |
^ translatedHelpText. |
2977 | 3172 |
|
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
3173 |
"Modified: / 27-01-2012 / 14:33:54 / cg" |
4039 | 3174 |
"Modified (comment): / 09-01-2018 / 17:36:30 / stefan" |
4243 | 3175 |
"Modified: / 07-03-2019 / 22:53:48 / Claus Gittinger" |
2977 | 3176 |
! |
3177 |
||
4047 | 3178 |
helpTextForKey:aKey row:aRowNr |
2977 | 3179 |
"Special interface for DataSet - get the active help text for a specific row" |
3180 |
||
3181 |
"Default: no row specific help" |
|
3182 |
||
4047 | 3183 |
^ self helpTextForKey:aKey. |
2977 | 3184 |
! ! |
3185 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3186 |
!ApplicationModel methodsFor:'hooks'! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3187 |
|
2185 | 3188 |
aboutToOpen:whichTopView |
3189 |
"the topView is about to be opened. |
|
3190 |
This is sent by whichTopView, right before its really open |
|
3191 |
(i.e. finally visible)" |
|
3192 |
||
3193 |
self preOpenWith:builder |
|
3194 |
! |
|
3195 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3196 |
commonPostBuild |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3197 |
"a common hook for postBuildWith: and postBuildAsSubcanvasWith:." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3198 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3199 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3200 |
commonPostOpen |
3864 | 3201 |
"a common hook for postOpenWith:, postOpenAsSubcanvasWith: and postOpenAsDialogWith:. |
3202 |
Notice: redefined methods should do a super send. |
|
3203 |
otherwise resources might be undefined." |
|
3204 |
||
3205 |
<modifier: #super> |
|
3206 |
||
3860 | 3207 |
resources isNil ifTrue:[ |
3208 |
resources := self resources |
|
3209 |
]. |
|
3864 | 3210 |
|
3211 |
"Modified: / 07-02-2017 / 18:43:35 / cg" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3212 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3213 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3214 |
commonPreBuild |
2921 | 3215 |
"a common hook for preBuildWith:, preBuildAsSubcanvasWith: and preBuildAsDialogWith:." |
3216 |
||
3217 |
"Modified (comment): / 07-07-2011 / 17:13:51 / cg" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3218 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3219 |
|
3297 | 3220 |
commonPreOpen |
3221 |
"A common hook for preOpenWith:, preOpenAsSubcanvasWith: and preOpenAsDialogWith:." |
|
3222 |
||
3223 |
"Created: / 05-03-2014 / 18:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3224 |
! |
|
3225 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3226 |
postApplicationProcessCreate:newProcess windowGroup:newGroup |
3297 | 3227 |
"this is sent whenever a new application is launched from this app, |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3228 |
which forks its own windowGroup process. Allows for process group management, |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3229 |
or process-global exception handlers to be installed. |
4182 | 3230 |
Nothing done here - can be redefined in concrete applications" |
3231 |
||
3232 |
"Modified (comment): / 25-09-2018 / 12:20:16 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3233 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3234 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3235 |
postBuildAsSubcanvasWith:aBuilder |
4092 | 3236 |
"this is sent after an interface is built from a spec as subcanvas, |
3237 |
and the appModel is the same as the topWindow's application. |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3238 |
Can be redefined in subclasses for additional setup after |
2921 | 3239 |
the subcanvas' view has been built, but not yet opened." |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3240 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3241 |
|sameApp| |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3242 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3243 |
sameApp := aBuilder application == aBuilder window topView application. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3244 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3245 |
"/ If I am opened as subcanvas in another application |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3246 |
"/ then treat this like a regular open. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3247 |
"/ otherwise ignore it. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3248 |
sameApp ifFalse:[ |
4092 | 3249 |
self postBuildWith:aBuilder. |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3250 |
] ifTrue:[ |
4092 | 3251 |
"/ I no not think, that this is a good default |
3252 |
"/ self commonPostBuild. |
|
2921 | 3253 |
]. |
3254 |
||
3255 |
"Modified (comment): / 07-07-2011 / 17:16:30 / cg" |
|
4092 | 3256 |
"Modified (comment): / 22-05-2018 / 18:11:42 / Claus Gittinger" |
2921 | 3257 |
! |
3258 |
||
3259 |
postBuildDialogWith:aBuilder |
|
3260 |
"this is sent after an interface is built from a spec as dialog with me |
|
3261 |
as a source (for aspects) i.e. via openDialogInterface:. |
|
3262 |
Can be redefined in subclasses for additional setup after |
|
3263 |
the dialog's view has been built, but not yet opened." |
|
3264 |
||
3265 |
|sameApp| |
|
3266 |
||
3267 |
sameApp := (aBuilder application == aBuilder window topView application). |
|
3268 |
||
3269 |
"/ If I am opened as subcanvas in another application |
|
3270 |
"/ then treat this like a regular open. |
|
3271 |
"/ otherwise ignore it. |
|
3272 |
sameApp ifFalse:[ |
|
4173 | 3273 |
self postBuildWith:aBuilder. |
2921 | 3274 |
] ifTrue:[ |
4173 | 3275 |
self commonPostBuild. |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3276 |
]. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3277 |
|
2921 | 3278 |
"Modified: / 08-07-1998 / 18:28:55 / cg" |
3279 |
"Created: / 07-07-2011 / 17:20:29 / cg" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3280 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3281 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3282 |
postBuildWith:aBuilder |
4092 | 3283 |
"this is sent after an interface is built from a spec, |
3284 |
but only iff the appModel is not the same as the topView's app |
|
3285 |
(i.e. if it is not a build for the same appModel again). |
|
3286 |
In that case, postBuildAsSubcanvasWith is invoked. |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3287 |
Can be redefined in subclasses for additional setup after |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3288 |
the view has been built, but not yet opened." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3289 |
|
3864 | 3290 |
<modifier: #super> "must be called if redefined" |
3291 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3292 |
self commonPostBuild |
3864 | 3293 |
|
3294 |
"Modified: / 08-02-2017 / 00:22:38 / cg" |
|
4092 | 3295 |
"Modified (comment): / 22-05-2018 / 18:11:31 / Claus Gittinger" |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3296 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3297 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3298 |
postOpenAsSubcanvasWith:aBuilder |
4093 | 3299 |
"this is sent after the application's window is opened inside another application. |
2921 | 3300 |
Can be redefined in subclasses for actions after showing the canvas view." |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3301 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3302 |
self commonPostOpen |
2921 | 3303 |
|
3304 |
"Modified (comment): / 07-07-2011 / 17:16:46 / cg" |
|
4093 | 3305 |
"Modified (comment): / 22-05-2018 / 18:42:11 / Claus Gittinger" |
2921 | 3306 |
! |
3307 |
||
3308 |
postOpenDialogWith:aBuilder |
|
4369 | 3309 |
"this is sent after the applicationÄs window is opened as a dialog with me |
2921 | 3310 |
as a source (for aspects) i.e. via openDialogInterface:. |
3311 |
Can be redefined in subclasses for actions after opening a dialog view." |
|
3312 |
||
3297 | 3313 |
self commonPostOpen |
3314 |
||
2921 | 3315 |
"Created: / 07-07-2011 / 17:20:37 / cg" |
3297 | 3316 |
"Modified: / 05-03-2014 / 18:42:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4093 | 3317 |
"Modified (comment): / 22-05-2018 / 18:42:15 / Claus Gittinger" |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3318 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3319 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3320 |
postOpenWith:aBuilder |
4093 | 3321 |
"this is sent after the application's main window is opened. |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3322 |
Can be redefined in subclasses for actions after opening the view." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3323 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3324 |
self commonPostOpen |
4093 | 3325 |
|
3326 |
"Modified (comment): / 22-05-2018 / 18:42:19 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3327 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3328 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3329 |
preBuildAsSubcanvasWith:aBuilder |
4092 | 3330 |
"this is sent before an interface is built from a spec as a subcanvas, |
3331 |
and the appModel is the same as the topWindow's application. |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3332 |
Can be redefined for apps which need to be informed about that." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3333 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3334 |
self commonPreBuild |
4092 | 3335 |
|
3336 |
"Modified (comment): / 22-05-2018 / 18:11:04 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3337 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3338 |
|
2921 | 3339 |
preBuildDialogWith:aBuilder |
3340 |
"this is sent before an interface is built from a spec as a dialog with me |
|
3341 |
as a source (for aspects) i.e. via openDialogInterface:. |
|
3342 |
Can be redefined for apps which need to be informed about that." |
|
3343 |
||
3344 |
"Created: / 07-07-2011 / 17:20:48 / cg" |
|
3345 |
! |
|
3346 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3347 |
preBuildWith:aBuilder |
4092 | 3348 |
"this is sent before an interface is built from a spec, |
3349 |
but only iff the appModel is not the same as the topView's app |
|
3350 |
(i.e. if it is not a build for the same appModel again). |
|
3351 |
In that case, preBuildAsSubcanvasWith is invoked. |
|
3352 |
Can be redefined in subclasses." |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3353 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3354 |
self commonPreBuild |
4092 | 3355 |
|
3356 |
"Modified (comment): / 22-05-2018 / 18:10:31 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3357 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3358 |
|
3297 | 3359 |
preOpenAsSubcanvasWith:aBuilder |
3360 |
"this is sent before the applications window is opened inside another application. |
|
3361 |
Can be redefined in subclasses for actions after showing the canvas view." |
|
3362 |
||
3363 |
self commonPreOpen |
|
3364 |
||
3365 |
"Created: / 05-03-2014 / 18:40:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3366 |
! |
|
3367 |
||
3368 |
preOpenDialogWith:aBuilder |
|
3369 |
"this is sent after the applications window is opened as a dialog with me |
|
3370 |
as a source (for aspects) i.e. via openDialogInterface:. |
|
3371 |
Can be redefined in subclasses for actions after opening a dialog view." |
|
3372 |
||
3373 |
self commonPreOpen |
|
3374 |
||
3375 |
"Created: / 05-03-2014 / 18:41:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3376 |
! |
|
3377 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3378 |
preOpenWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3379 |
"this is sent before the applications main window is opened. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3380 |
Can be redefined in subclasses for actions right before opening the view." |
4408 | 3381 |
! |
3382 |
||
3383 |
processOutsideButtonEventWhileModal:anEvent |
|
3384 |
"a button event (press/release) arrived for another view, |
|
3385 |
while I (a topView) am open as modal view. |
|
3386 |
Can be redefined to react on clicks outside (eg. CriticsWindow); |
|
3387 |
if handled, the redefining method should return true. |
|
3388 |
If not handled, it should return false." |
|
3389 |
||
3390 |
^ false |
|
3391 |
||
3392 |
"Created: / 13-12-2019 / 11:54:28 / Stefan Reise" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3393 |
! ! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
3394 |
|
1419 | 3395 |
!ApplicationModel methodsFor:'initialization'! |
3396 |
||
3397 |
addTopViewsToCurrentProject |
|
3398 |
"add all of my topViews to the current projects list of views. |
|
3399 |
This allows hiding views on a per-project basis. |
|
3400 |
Applications which do not want to be switched with projects |
|
3401 |
(such as the Launcher), may redefine this to a noop." |
|
3402 |
||
1972 | 3403 |
|wg| |
3404 |
||
3405 |
(wg := self windowGroup) notNil ifTrue:[ |
|
4173 | 3406 |
(wg topViews ? #()) do:[:aView | |
3407 |
aView addToCurrentProject |
|
3408 |
] |
|
1419 | 3409 |
] |
3410 |
||
3411 |
"Modified: 17.1.1997 / 19:43:39 / cg" |
|
3412 |
! |
|
3413 |
||
3414 |
basicInitialize |
|
3415 |
"initialize the application. |
|
3416 |
Since ST-80 applications seem commonly to redefine #initialize |
|
3417 |
without doing a super initialize, the real initialization is |
|
3418 |
done here ..." |
|
3419 |
||
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3420 |
self initializeDevice. |
1419 | 3421 |
|
3422 |
"claus: I wanted to delay the creation & assignment of the |
|
3423 |
builder till later, to allow setting to another builder. |
|
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3424 |
however, some (old) ST-80 code seems to access the builder right after instance |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3425 |
creation, which might lead to trouble. |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3426 |
On the other hand, some (newer) apps (RefactoringBrowser) depend on this being set |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3427 |
late. |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3428 |
So, we leave it undefined here. Do not uncomment the following lines. |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3429 |
" |
1419 | 3430 |
|
3431 |
"/ builder := self builderClass new. |
|
3432 |
"/ builder notNil ifTrue:[builder application:self]. |
|
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3433 |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3434 |
self initializeResources. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3435 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3436 |
"Modified: / 13-09-2006 / 12:39:30 / cg" |
1419 | 3437 |
! |
3438 |
||
3439 |
initialize |
|
3440 |
"nothing done here; |
|
3441 |
but can be redefined in concrete applications" |
|
3442 |
! |
|
3443 |
||
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3444 |
initializeDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3445 |
self isWebService ifTrue:[ |
4173 | 3446 |
self initializeWebServiceDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3447 |
] ifFalse:[ |
4173 | 3448 |
self initializeScreenDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3449 |
]. |
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3450 |
! |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3451 |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3452 |
initializeResources |
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3453 |
"initialize the applications resources (NLS support)." |
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3454 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3455 |
resources := self class classResources. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3456 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3457 |
"Created: / 13-09-2006 / 12:39:22 / cg" |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3458 |
! |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3459 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3460 |
initializeScreenDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3461 |
Screen notNil ifTrue:[ |
3523 | 3462 |
device := Screen current. |
3524 | 3463 |
(device notNil and:[device isOpen not]) ifTrue:[ |
4284 | 3464 |
(self className,' [warning]: screen device is not open') errorPrintCR |
3523 | 3465 |
]. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3466 |
] |
4284 | 3467 |
|
3468 |
"Modified: / 28-06-2019 / 08:40:51 / Claus Gittinger" |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3469 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3470 |
|
1419 | 3471 |
setDevice:aDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3472 |
"set the device (i.e. some Screen), where the application shall open its view(s). |
1419 | 3473 |
The default device (if not set here) will be the current screen." |
3474 |
||
3475 |
device := aDevice |
|
3476 |
||
3477 |
"Created: 5.7.1996 / 12:01:40 / cg" |
|
3478 |
"Modified: 17.1.1997 / 19:44:09 / cg" |
|
3479 |
! ! |
|
3480 |
||
4309 | 3481 |
|
1419 | 3482 |
!ApplicationModel methodsFor:'opening'! |
3483 |
||
3750 | 3484 |
hideWindows |
3943 | 3485 |
|wg| |
3486 |
||
3487 |
wg := self windowGroup. |
|
3488 |
wg notNil ifTrue:[ |
|
3489 |
wg hideTopViews. |
|
3490 |
]. |
|
3491 |
||
3492 |
"Modified: / 17-03-2017 / 17:22:31 / stefan" |
|
3750 | 3493 |
! |
3494 |
||
1419 | 3495 |
open |
2980 | 3496 |
"open a standard interface. |
3851 | 3497 |
Sorry, but for visualworks compatibility, the builder is returned, |
3498 |
not the receiver." |
|
1419 | 3499 |
|
3500 |
^ self openInterface |
|
3501 |
||
2980 | 3502 |
"Modified: / 03-05-1996 / 13:39:15 / cg" |
3503 |
"Modified (comment): / 27-12-2011 / 10:42:15 / cg" |
|
1419 | 3504 |
! |
3505 |
||
1592
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3506 |
openAndWaitUntilVisible |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3507 |
"open a standard interface, and wait until my window is visible" |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3508 |
|
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3509 |
self open. |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3510 |
self window waitUntilVisible. |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3511 |
! |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3512 |
|
1634 | 3513 |
openAs:windowType |
2980 | 3514 |
"open a standard interface as slave, partner, dialog, popUp, undecorated etc. |
3515 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1634 | 3516 |
|
3517 |
^ self openInterfaceAs:windowType |
|
3518 |
||
2898 | 3519 |
"Modified: / 04-03-2011 / 15:03:19 / cg" |
2980 | 3520 |
"Modified (comment): / 27-12-2011 / 10:42:28 / cg" |
1634 | 3521 |
! |
3522 |
||
3523 |
openAsSlave |
|
1726 | 3524 |
"open a standard interface as slave. |
3525 |
Notice: there is still a need to make the current window a master |
|
4173 | 3526 |
(see code and comments in WindowBuilder >> openAt:withExtent:andType:)" |
1634 | 3527 |
|
3528 |
^ self openAs:#slave |
|
1724 | 3529 |
|
3530 |
" |
|
3531 |
WorkspaceApplication new openAsSlave. |
|
3532 |
" |
|
1634 | 3533 |
! |
3534 |
||
1419 | 3535 |
openAt:aPoint |
3536 |
"open a standard interface at some point" |
|
3537 |
||
3538 |
^ self openInterfaceAt:aPoint |
|
3539 |
||
3540 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
3541 |
"Created: 14.2.1997 / 20:17:41 / cg" |
|
3542 |
! |
|
3543 |
||
3181 | 3544 |
openAtPointer |
3545 |
"open a standard interface at the current pointer position. |
|
3546 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
3547 |
||
3548 |
^ self openInterfaceAt:(device pointerPosition) |
|
3549 |
! |
|
3550 |
||
1419 | 3551 |
openInterface |
3552 |
"open a standard interface. |
|
3553 |
||
3297 | 3554 |
Subclasses which do not have an interfaceSpec |
1419 | 3555 |
should redefine this method and create & open their view(s) there. |
2980 | 3556 |
(see Launcher as an example). |
3557 |
||
3558 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1419 | 3559 |
|
1985 | 3560 |
^ self openInterface:(self defaultWindowSpecName) |
1419 | 3561 |
|
2980 | 3562 |
"Modified: / 09-09-1996 / 22:39:23 / stefan" |
3563 |
"Modified: / 23-01-1998 / 18:16:50 / cg" |
|
3564 |
"Modified (comment): / 27-12-2011 / 10:42:04 / cg" |
|
1419 | 3565 |
! |
3566 |
||
3567 |
openInterface:aSymbol |
|
2895 | 3568 |
"open a specific interface. |
3569 |
||
1419 | 3570 |
The argument, aSymbol specifies which interface. The concrete |
3571 |
application subclass must provide a method with that name, |
|
3297 | 3572 |
which must return an interfaceSpec. |
2895 | 3573 |
This is forwarded to the builder to create the views. |
2980 | 3574 |
Typically, applications only use one interface, returned by the #windowSpec method. |
3575 |
||
3576 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1419 | 3577 |
|
3578 |
self allButOpenInterface:aSymbol. |
|
3579 |
self openWindow. |
|
3580 |
^ builder |
|
3581 |
||
2895 | 3582 |
"Modified: / 03-03-2011 / 18:57:04 / cg" |
2980 | 3583 |
"Modified (comment): / 27-12-2011 / 10:41:54 / cg" |
1419 | 3584 |
! |
3585 |
||
1634 | 3586 |
openInterface:aSymbol as:windowType |
2895 | 3587 |
"open a specific interface in a special mode. |
3588 |
||
3297 | 3589 |
The argument, aSymbol specifies which interface. |
1634 | 3590 |
The concrete application subclass must provide a method with that name, |
3591 |
which must return an interfaceSpec. This is forwarded to the builder to create the views. |
|
3592 |
Typically, applications only use one interface, returned by the #windowSpec method. |
|
2980 | 3593 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc. |
3594 |
||
3595 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1634 | 3596 |
|
3597 |
self allButOpenInterface:aSymbol. |
|
3598 |
self openWindowAs:windowType. |
|
3599 |
^ builder |
|
3600 |
||
2895 | 3601 |
"Modified: / 03-03-2011 / 18:56:23 / cg" |
2980 | 3602 |
"Modified (comment): / 27-12-2011 / 10:42:37 / cg" |
1634 | 3603 |
! |
3604 |
||
1419 | 3605 |
openInterface:aSymbol at:aLocation |
3297 | 3606 |
"open a specific interface at a location in default mode. |
1419 | 3607 |
|
3608 |
The argument, aSymbol specifies which interface. The concrete |
|
3609 |
application subclass must provide a method with that name, |
|
3610 |
which must return an interfaceSpec. This is forwarded to |
|
3611 |
the builder to create the views. |
|
3297 | 3612 |
Typically, applications only use one interface, |
1419 | 3613 |
returned by the #windowSpec method." |
3614 |
||
3615 |
self allButOpenInterface:aSymbol. |
|
3616 |
self openWindowAt:aLocation. |
|
3617 |
^ builder |
|
3618 |
||
2895 | 3619 |
"Created: / 14-02-1997 / 20:19:44 / cg" |
3620 |
"Modified: / 03-03-2011 / 18:55:26 / cg" |
|
1419 | 3621 |
! |
3622 |
||
1634 | 3623 |
openInterfaceAs:windowType |
2895 | 3624 |
"open a standard interface in a special mode. |
3625 |
||
2898 | 3626 |
The windowType can be any of #slave, #partner, #dialog, #popUp, #undecorated etc." |
1634 | 3627 |
|
1985 | 3628 |
^ self openInterface:(self defaultWindowSpecName) as:windowType |
1634 | 3629 |
|
2895 | 3630 |
"Modified: / 09-09-1996 / 22:39:23 / stefan" |
2898 | 3631 |
"Modified: / 04-03-2011 / 15:03:28 / cg" |
1634 | 3632 |
! |
3633 |
||
1419 | 3634 |
openInterfaceAt:aLocation |
3635 |
"open a standard interface." |
|
3636 |
||
1985 | 3637 |
^ self openInterface:(self defaultWindowSpecName) at:aLocation |
1419 | 3638 |
|
3639 |
"Created: / 14.2.1997 / 20:18:20 / cg" |
|
3640 |
"Modified: / 23.1.1998 / 18:17:13 / cg" |
|
3641 |
! |
|
3642 |
||
3643 |
openInterfaceModal |
|
2980 | 3644 |
"open a standard interface as a modal dialog. |
3645 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1419 | 3646 |
|
1985 | 3647 |
^ self openInterfaceModal:(self defaultWindowSpecName) |
1419 | 3648 |
|
2895 | 3649 |
"Modified: / 09-09-1996 / 22:39:23 / stefan" |
3650 |
"Modified: / 03-03-2011 / 18:54:48 / cg" |
|
2980 | 3651 |
"Modified (comment): / 27-12-2011 / 10:42:53 / cg" |
1419 | 3652 |
! |
3653 |
||
3654 |
openInterfaceModal:aSymbol |
|
3297 | 3655 |
"open a specific interface as a modal dialog. |
1419 | 3656 |
The argument, aSymbol specifies which interface. The concrete |
3657 |
application subclass must provide a method with that name, |
|
3658 |
which must return an interfaceSpec. This is forwarded to |
|
3659 |
the builder to create the views. |
|
3297 | 3660 |
Typically, applications only use one interface, |
1419 | 3661 |
returned by the #windowSpec method." |
3662 |
||
3663 |
self allButOpenInterface:aSymbol. |
|
3664 |
self openWindowModal. |
|
3665 |
^ builder |
|
3666 |
||
3667 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
969
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
3668 |
! |
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
3669 |
|
1419 | 3670 |
openInterfaceModal:aSymbol at:location |
3297 | 3671 |
"open a specific interface modal at some screen location. |
1419 | 3672 |
The argument, aSymbol specifies which interface. The concrete |
3673 |
application subclass must provide a method with that name, |
|
3674 |
which must return an interfaceSpec. This is forwarded to |
|
3675 |
the builder to create the views. |
|
3297 | 3676 |
Typically, applications only use one interface, |
1419 | 3677 |
returned by the #windowSpec method." |
3678 |
||
3679 |
self allButOpenInterface:aSymbol. |
|
3680 |
self openWindowModalAt:location. |
|
3681 |
^ builder |
|
3682 |
||
3683 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
3684 |
! |
|
3685 |
||
3686 |
openModal |
|
3687 |
"open a standard interface as a modal dialog" |
|
3688 |
||
3689 |
^ self openInterfaceModal |
|
3690 |
||
3691 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
3692 |
! |
|
3693 |
||
3618 | 3694 |
openModalAtPointer |
3695 |
"open a standard interface modal at the current pointer position. |
|
3696 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
3697 |
||
3698 |
^ self openInterfaceModal:(self defaultWindowSpecName) at:(device pointerPosition) |
|
3699 |
! |
|
3700 |
||
1419 | 3701 |
openOnDevice:aDevice |
3702 |
"open a standard interface on some other device" |
|
3703 |
||
3704 |
self setDevice:aDevice. |
|
3365 | 3705 |
Screen currentScreenQuerySignal |
3706 |
answer:aDevice |
|
3707 |
do:[ |
|
3708 |
^ self open |
|
3709 |
] |
|
1419 | 3710 |
|
3711 |
"Created: 13.1.1997 / 21:24:11 / cg" |
|
3712 |
"Modified: 13.1.1997 / 21:24:30 / cg" |
|
3713 |
! |
|
3714 |
||
3715 |
openSpec:anInterfaceSpec |
|
3716 |
"open a view as specified in anInterfaceSpec." |
|
3717 |
||
3718 |
self allButOpenFrom:anInterfaceSpec. |
|
3719 |
self openWindow. |
|
3720 |
^ builder |
|
3721 |
||
3722 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
3723 |
"Created: / 20.5.1998 / 20:08:51 / cg" |
|
3724 |
! |
|
3725 |
||
2393 | 3726 |
openSpec:anInterfaceSpec withBindings:bindings |
3727 |
"open a view as specified in anInterfaceSpec." |
|
3728 |
||
2624 | 3729 |
self openSpec:anInterfaceSpec withBindings:bindings modal:false |
3730 |
! |
|
3731 |
||
3732 |
openSpec:anInterfaceSpec withBindings:bindings modal:modal |
|
3733 |
"open a view as specified in anInterfaceSpec." |
|
3734 |
||
2393 | 3735 |
self createBuilder. |
3297 | 3736 |
builder bindings:bindings. |
2393 | 3737 |
self allButOpenFrom:anInterfaceSpec. |
2624 | 3738 |
modal ifTrue:[ |
4173 | 3739 |
self openWindowModal. |
2624 | 3740 |
] ifFalse:[ |
4173 | 3741 |
self openWindow. |
2624 | 3742 |
] |
2393 | 3743 |
! |
3744 |
||
1419 | 3745 |
openSpecModal:anInterfaceSpec |
3746 |
"open an interface spec modal" |
|
3747 |
||
3748 |
self allButOpenFrom:anInterfaceSpec. |
|
3749 |
self openWindowModal. |
|
3750 |
^ builder |
|
3751 |
||
3752 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
3753 |
"Created: / 20.5.1998 / 20:20:21 / cg" |
|
3754 |
! |
|
3755 |
||
3756 |
openWindow |
|
3297 | 3757 |
"open the window |
2921 | 3758 |
- assumes that the builder has already setup the interface." |
3759 |
||
3760 |
builder "openWindow." |
|
4173 | 3761 |
openAt:nil |
3762 |
withExtent:(self defaultWindowExtent) |
|
3763 |
andType:(self defaultWindowType) |
|
1419 | 3764 |
|
2270
a7c797806d46
correctly restore the application after building a sub-app
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
3765 |
"Created: / 14-02-1997 / 20:20:39 / cg" |
2923 | 3766 |
"Modified: / 11-07-2011 / 22:30:27 / cg" |
1419 | 3767 |
! |
3768 |
||
1634 | 3769 |
openWindowAs:windowType |
3297 | 3770 |
"open the window - assumes that the builder has already setup the interface. |
1634 | 3771 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc." |
3772 |
||
3297 | 3773 |
builder |
4173 | 3774 |
openAt:nil |
3775 |
withExtent:(self defaultWindowExtent) |
|
3776 |
andType:windowType |
|
2921 | 3777 |
|
2923 | 3778 |
"Modified: / 11-07-2011 / 22:30:35 / cg" |
1634 | 3779 |
! |
3780 |
||
2931 | 3781 |
openWindowAs:windowType at:originOrNil |
3297 | 3782 |
"open the window - assumes that the builder has already setup the interface. |
2931 | 3783 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc." |
3784 |
||
3297 | 3785 |
builder |
4173 | 3786 |
openAt:originOrNil |
3787 |
withExtent:(self defaultWindowExtent) |
|
3788 |
andType:windowType |
|
2931 | 3789 |
|
3790 |
"Modified: / 11-07-2011 / 22:30:35 / cg" |
|
3791 |
"Created: / 25-07-2011 / 16:00:24 / cg" |
|
3792 |
! |
|
3793 |
||
2921 | 3794 |
openWindowAt:aPoint |
3297 | 3795 |
"open the window |
2921 | 3796 |
- assumes that the builder has already setup the interface." |
3797 |
||
3798 |
builder "openWindowAt:aLocation." |
|
4173 | 3799 |
openAt:aPoint |
3800 |
withExtent:(self defaultWindowExtent) |
|
3801 |
andType:(self defaultWindowType) |
|
2921 | 3802 |
|
3803 |
"Created: / 14-02-1997 / 20:20:55 / cg" |
|
1419 | 3804 |
! |
3805 |
||
3806 |
openWindowAtCenter |
|
3807 |
"open the window centered on the screen |
|
3808 |
- assumes that the builder has already setup the interface." |
|
3809 |
||
3810 |
builder openWindowAt:#center |
|
3811 |
||
3812 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
3813 |
! |
|
3814 |
||
3815 |
openWindowModal |
|
2921 | 3816 |
"open the window as a modal dialog |
3817 |
- assumes that the builder has already setup the interface." |
|
1419 | 3818 |
|
3819 |
"/ builder openDialog. |
|
3820 |
builder |
|
4173 | 3821 |
openAt:nil |
3822 |
withExtent:(self defaultWindowExtent) |
|
3823 |
andType:#dialog |
|
1419 | 3824 |
|
2921 | 3825 |
"Created: / 14-02-1997 / 20:20:39 / cg" |
1419 | 3826 |
! |
3827 |
||
3828 |
openWindowModalAt:aLocation |
|
2921 | 3829 |
"open the window as a modal dialog |
3830 |
- assumes that the builder has already setup the interface." |
|
1419 | 3831 |
|
3832 |
builder openDialogAt:aLocation. |
|
3833 |
||
2921 | 3834 |
"Created: / 14-02-1997 / 20:20:55 / cg" |
1419 | 3835 |
! |
3836 |
||
1478 | 3837 |
openWithExtent:extPoint |
3838 |
"open a standard interface with given extent" |
|
3839 |
||
3840 |
|bldr| |
|
3841 |
||
3842 |
bldr := self allButOpen. |
|
3843 |
bldr openWithExtent:extPoint. |
|
3844 |
^ bldr |
|
3845 |
||
3846 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
3847 |
! |
|
3848 |
||
1968 | 3849 |
opened:whichTopView |
3850 |
"the topView has been opened. |
|
3851 |
This is sent by whichTopView, when its really open |
|
3852 |
(i.e. finally visible)" |
|
3853 |
||
3854 |
self addTopViewsToCurrentProject. |
|
3855 |
self postOpenWith:builder |
|
3750 | 3856 |
! |
3857 |
||
3858 |
showWindows |
|
3859 |
self window map;activate. |
|
3860 |
! |
|
3861 |
||
3862 |
unhideWindows |
|
3863 |
self windowGroup unhideTopViews |
|
4321 | 3864 |
! |
3865 |
||
3866 |
waitUntilVisible |
|
3867 |
"wait until my window is visible" |
|
3868 |
||
3869 |
self window waitUntilVisible. |
|
1419 | 3870 |
! ! |
3871 |
||
2921 | 3872 |
!ApplicationModel methodsFor:'opening-dialogs'! |
3873 |
||
3874 |
openDialog |
|
3297 | 3875 |
"open my window as a modal dialog |
2921 | 3876 |
- assumes that the builder has already setup the interface." |
3877 |
||
3878 |
self window beToolDialog. |
|
3879 |
^ builder openDialog. |
|
3880 |
||
3881 |
"Modified: / 14-02-1997 / 20:32:52 / cg" |
|
3882 |
"Modified (comment): / 07-07-2011 / 17:25:45 / cg" |
|
3883 |
! |
|
3884 |
||
3540 | 3885 |
openDialogAt:aPoint |
3886 |
"open my window as a modal dialog |
|
3887 |
- assumes that the builder has already setup the interface." |
|
3888 |
||
3889 |
self window beToolDialog. |
|
3890 |
^ builder openDialogAt:aPoint. |
|
3891 |
! |
|
3892 |
||
3893 |
openDialogAtPointer |
|
3894 |
"open my window as a modal dialog |
|
3895 |
- assumes that the builder has already setup the interface." |
|
3896 |
||
3897 |
^ self openDialogAt:(device pointerPosition). |
|
3898 |
! |
|
3899 |
||
2921 | 3900 |
openDialogInterface:aSelector |
3901 |
"open a dialog" |
|
3902 |
||
3903 |
"/ Notice: the opened dialog will be technically another instance |
|
3904 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3905 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3906 |
||
3907 |
^ self openDialogInterface:aSelector withBindings:nil |
|
3908 |
||
3909 |
"Modified: / 28-02-1997 / 14:08:01 / cg" |
|
3910 |
"Modified (comment): / 07-07-2011 / 17:25:26 / cg" |
|
3911 |
! |
|
3912 |
||
4287 | 3913 |
openDialogInterface:anInterfaceSymbolOrSpec withBindings:bindings |
2921 | 3914 |
"open a dialog, given a spec-selector" |
3915 |
||
3916 |
"/ Notice: the opened dialog will be technically another instance |
|
3917 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3918 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3919 |
||
3297 | 3920 |
^ SimpleDialog new |
4173 | 3921 |
openFor:self |
4287 | 3922 |
interface:anInterfaceSymbolOrSpec |
4173 | 3923 |
withBindings:bindings |
2921 | 3924 |
|
3925 |
"Created: / 28-02-1997 / 14:07:45 / cg" |
|
3926 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3927 |
"Modified (comment): / 07-07-2011 / 17:25:23 / cg" |
|
3928 |
! |
|
3929 |
||
3930 |
openDialogInterfaceSpec:aSpec withBindings:bindings |
|
3931 |
"open a dialog, given a spec" |
|
3932 |
||
3933 |
"/ Notice: the opened dialog will be technically another instance |
|
3934 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3935 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3936 |
||
3297 | 3937 |
^ SimpleDialog new |
4173 | 3938 |
openFor:self |
3939 |
interfaceSpec:aSpec |
|
3940 |
withBindings:bindings |
|
2921 | 3941 |
|
3942 |
"Created: / 28-02-1997 / 14:07:45 / cg" |
|
3943 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3944 |
"Modified (comment): / 07-07-2011 / 17:25:20 / cg" |
|
3945 |
! |
|
3946 |
||
3496 | 3947 |
openDialogModeless |
3948 |
"open my window as a modal dialog |
|
3949 |
- assumes that the builder has already setup the interface." |
|
3950 |
||
3951 |
self window beToolDialog. |
|
3952 |
^ builder open. |
|
3953 |
||
3954 |
"Modified: / 14-02-1997 / 20:32:52 / cg" |
|
3955 |
"Modified (comment): / 07-07-2011 / 17:25:45 / cg" |
|
3956 |
! |
|
3957 |
||
2921 | 3958 |
openDialogSpec:aSpec withBindings:bindings |
3959 |
"open a dialog" |
|
3960 |
||
3961 |
"/ Notice: the opened dialog will be technically another instance |
|
3962 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3963 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3964 |
||
3297 | 3965 |
^ SimpleDialog new |
4173 | 3966 |
openFor:self |
3967 |
spec:aSpec |
|
3968 |
withBindings:bindings |
|
2921 | 3969 |
|
3970 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3971 |
"Created: / 20-05-1998 / 20:27:56 / cg" |
|
3496 | 3972 |
! |
3973 |
||
3974 |
openDialogSpecModeless:aSpec withBindings:bindings |
|
3975 |
"open a dialog, but without blocking the caller" |
|
3976 |
||
3977 |
"/ Notice: the opened dialog will be technically another instance |
|
3978 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3979 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3980 |
||
3981 |
^ SimpleDialog new |
|
3982 |
openModelessFor:self |
|
3983 |
spec:aSpec |
|
3984 |
withBindings:bindings |
|
3985 |
||
3986 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3987 |
"Created: / 20-05-1998 / 20:27:56 / cg" |
|
2921 | 3988 |
! ! |
3989 |
||
2380 | 3990 |
!ApplicationModel methodsFor:'opening-webInterface'! |
3991 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3992 |
addToService |
3297 | 3993 |
self service |
4173 | 3994 |
addPage:(builder page) |
3995 |
link:(self webLink) |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3996 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3997 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3998 |
createWebBuilder |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3999 |
"create a Web-UIBuilder if not already present" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4000 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4001 |
builder isNil ifTrue:[ |
4173 | 4002 |
builder := self webBuilderClass new. |
4003 |
builder application:self. |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4004 |
] |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4005 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4006 |
"Created: / 19.6.1998 / 03:32:37 / cg" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4007 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4008 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4009 |
defaultPageSpecName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4010 |
^ #pageSpec |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4011 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4012 |
|
2380 | 4013 |
defineInterface |
4014 |
"define a standard interface. |
|
4015 |
||
3297 | 4016 |
Subclasses which do not have an interfaceSpec |
2380 | 4017 |
should redefine this method and create their page there." |
4018 |
||
4019 |
^ self defineInterface:(self defaultPageSpecName) |
|
4020 |
! |
|
4021 |
||
4022 |
defineInterface:aSpecSymbol |
|
4023 |
"define an interface." |
|
4024 |
||
4025 |
^ self defineInterfaceFrom:(self interfaceSpecFor:aSpecSymbol) |
|
4026 |
! |
|
4027 |
||
4028 |
defineInterfaceFrom:aSpec |
|
4029 |
"define an interface (setup a page), given a spec." |
|
4030 |
||
4031 |
|page| |
|
4032 |
||
4033 |
builder isNil ifTrue:[ |
|
4173 | 4034 |
self createWebBuilder. |
2380 | 4035 |
]. |
4036 |
||
4037 |
self preBuildWith:builder. |
|
4038 |
builder buildPageFromSpec:aSpec. |
|
4039 |
page := builder page. |
|
4040 |
page application:self. |
|
4041 |
||
4042 |
self postBuildWith:builder. |
|
4043 |
||
4044 |
"Modified: / 19.6.1998 / 03:35:31 / cg" |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4045 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4046 |
|
2554
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
4047 |
httpServerPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
4048 |
"on which port will a HTTP server be started" |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
4049 |
|
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
4050 |
^ self class defaultHttpServerPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
4051 |
! |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
4052 |
|
2547
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4053 |
initializeAsWebServiceOnWebDevice:webDevice |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4054 |
self setDevice:(WebApplicationDevice new). |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4055 |
self initialize. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4056 |
self initializeWebServiceDevice. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4057 |
self initializeResources. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4058 |
! |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4059 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4060 |
initializeWebServiceDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4061 |
"no real device here; instead, we need a web service in which I register. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4062 |
The device is a dummy one, to make the protocol transparent & compatible" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4063 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4064 |
|server| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4065 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4066 |
self service isNil ifTrue:[ |
4173 | 4067 |
server := HTTPServer serverOnPort:(self httpServerPort). |
4068 |
||
4069 |
self service:(server |
|
4070 |
serviceForLink:(self serviceLinkName) |
|
4071 |
ifAbsent:[ |
|
4072 |
|service| |
|
4073 |
||
4074 |
service := HTTPPortalService new. |
|
4075 |
service linkName:(self serviceLinkName). |
|
4076 |
service class unRegisterServiceOn:server. |
|
4077 |
service registerServiceOn:server. |
|
4078 |
service |
|
4079 |
]). |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4080 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4081 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4082 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4083 |
pageSpecs |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4084 |
^ self class pageSpecs |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4085 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4086 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4087 |
service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4088 |
device isNil ifTrue:[^ nil]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4089 |
self assert:(device isWebServiceDevice). |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4090 |
^ device service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4091 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4092 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4093 |
service:something |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4094 |
self device service:something. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4095 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4096 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4097 |
serviceLinkName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4098 |
^ self class defaultServiceLinkName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4099 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4100 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4101 |
startAsWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4102 |
device isNil ifTrue:[ |
4173 | 4103 |
self initializeDevice. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4104 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4105 |
self startInPortalService:self service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4106 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4107 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4108 |
self new startInWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4109 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4110 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4111 |
|
3297 | 4112 |
startInPortalService:aPortalServiceOrSession |
2632
ced2473521b1
changed #startInPortalService:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
4113 |
aPortalServiceOrSession application:self. |
ced2473521b1
changed #startInPortalService:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
4114 |
self service:aPortalServiceOrSession. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4115 |
self defineInterface. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4116 |
self addToService. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4117 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4118 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4119 |
webBuilderClass |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4120 |
"return the UIBuilder class for me. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4121 |
This method can be redefined if (eventually) there are |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4122 |
spec readers for other UI languages (motif UIL ?)" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4123 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4124 |
^ WebPageBuilder |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4125 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4126 |
"Created: / 19.6.1998 / 01:39:26 / cg" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4127 |
"Modified: / 19.6.1998 / 01:45:24 / cg" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4128 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4129 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4130 |
webLink |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4131 |
"if nil is returned, I will install my page(s) right under the serviceLink (i.e. /portal/nn). |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4132 |
Otherwise, they will be under (i.e. /portal/link/nn)" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4133 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4134 |
^ self device webLink |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4135 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4136 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4137 |
webLink:something |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4138 |
self device webLink:something |
2380 | 4139 |
! ! |
4140 |
||
1419 | 4141 |
!ApplicationModel methodsFor:'private'! |
4142 |
||
4143 |
builderClass |
|
4144 |
"return the UIBuilder class for me. |
|
4145 |
This method can be redefined if (eventually) there are |
|
4146 |
spec readers for other UI languages (motif UIL ?)" |
|
4147 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4148 |
self isWebService ifTrue:[ |
4173 | 4149 |
^ self webBuilderClass |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4150 |
]. |
1419 | 4151 |
^ UIBuilder |
4152 |
||
4153 |
"Created: / 19.6.1998 / 01:39:26 / cg" |
|
4154 |
"Modified: / 19.6.1998 / 01:45:24 / cg" |
|
4155 |
! |
|
4156 |
||
4157 |
createBuilder |
|
1431 | 4158 |
"create a WindowBuilder if not already present" |
4159 |
||
1419 | 4160 |
builder isNil ifTrue:[ |
4173 | 4161 |
builder := self builderClass new. |
4162 |
builder application:self. |
|
1419 | 4163 |
] |
4164 |
||
4165 |
"Created: / 19.6.1998 / 03:32:37 / cg" |
|
4166 |
! ! |
|
4167 |
||
4168 |
!ApplicationModel methodsFor:'queries'! |
|
4169 |
||
4289 | 4170 |
applicationWindowClass |
4171 |
"return the class used for my (top-) windows" |
|
4172 |
||
4173 |
^ ApplicationWindow |
|
4174 |
! |
|
4175 |
||
4275 | 4176 |
ctrlDown |
4428 | 4177 |
"answer true if the control key is currently pressed" |
4178 |
||
4429 | 4179 |
"/ cg: the following code breaks with menu-panels / popup menus, |
4180 |
"/ where the activeGroup seems to be different/nil temporarily, |
|
4181 |
"/ leading to isVisible to return true although it should not, |
|
4182 |
"/ leading to an item being not drawn (although the space for it was reserved initially) |
|
4428 | 4183 |
"/ |activeGroup| |
4184 |
"/ |
|
4185 |
"/ (activeGroup := WindowGroup activeGroup) isNil ifTrue:[ |
|
4186 |
"/ ^ false |
|
4187 |
"/ ]. |
|
4188 |
"/ ^ activeGroup sensor ctrlDown. |
|
4189 |
^ Screen current ctrlDown |
|
4275 | 4190 |
|
4191 |
"Created: / 06-06-2019 / 15:24:51 / Stefan Vogel" |
|
4312 | 4192 |
"Modified: / 20-07-2019 / 08:41:30 / Claus Gittinger" |
4275 | 4193 |
! |
4194 |
||
2923 | 4195 |
defaultWindowExtent |
4077 | 4196 |
"return my default window extent or nil. |
4197 |
Return nil if the defaul extent should be computed by other means. |
|
4198 |
||
4199 |
The code here asks for the last extent of an instance of this class." |
|
3947 | 4200 |
|
3203 | 4201 |
^ self class defaultExtentFor:self class |
2923 | 4202 |
|
4203 |
"Created: / 11-07-2011 / 22:30:12 / cg" |
|
3947 | 4204 |
"Modified (comment): / 09-04-2017 / 22:30:52 / cg" |
4077 | 4205 |
"Modified (comment): / 20-03-2018 / 11:42:16 / stefan" |
2923 | 4206 |
! |
4207 |
||
1985 | 4208 |
defaultWindowSpecName |
4209 |
^ #windowSpec |
|
4210 |
! |
|
4211 |
||
1419 | 4212 |
defaultWindowType |
4213 |
"Applications come up non-modal, by default" |
|
4214 |
||
4215 |
^ #normal |
|
4216 |
||
4217 |
"Created: 17.1.1997 / 19:57:34 / cg" |
|
4218 |
! |
|
4219 |
||
4220 |
graphicsDevice |
|
4221 |
"return the device I want to open my views on. |
|
4222 |
The default (if not created with #onDevice:) is the currently |
|
4223 |
active screen." |
|
4224 |
||
4225 |
^ device |
|
4226 |
||
4227 |
"Created: 5.7.1996 / 17:51:31 / cg" |
|
1132
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
4228 |
! |
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
4229 |
|
2373 | 4230 |
interfaceSpecFor:aSelectorOrSpec |
1419 | 4231 |
"return an interface spec. |
4232 |
Here, the query is forwarded to my class. |
|
4233 |
Can be refefined in subclasses which want to provide per-instance specs." |
|
4234 |
||
3297 | 4235 |
aSelectorOrSpec isSymbol ifFalse:[ |
3677 | 4236 |
(aSelectorOrSpec isKindOf:UISpecification) ifTrue:[^ aSelectorOrSpec]. |
2373 | 4237 |
]. |
3677 | 4238 |
UnhandledAttributeInLiteralArrayErrorSignal handle:[:ex | |
4239 |
"/ that is to support debugging - to easily find the bad spec |
|
4333 | 4240 |
Transcript showCR:'%1 [warning]: Error in spec (%2):' |
4284 | 4241 |
with:self className |
3677 | 4242 |
with:aSelectorOrSpec. |
4243 |
Transcript showCR:ex description. |
|
4244 |
ex proceed. |
|
4245 |
] do:[ |
|
4246 |
^ self class interfaceSpecFor:aSelectorOrSpec |
|
4247 |
]. |
|
4284 | 4248 |
|
2373 | 4249 |
"Created: / 25-01-1998 / 19:45:12 / cg" |
4250 |
"Modified: / 14-01-2008 / 17:54:29 / cg" |
|
4284 | 4251 |
"Modified: / 28-06-2019 / 08:41:03 / Claus Gittinger" |
1419 | 4252 |
! |
4253 |
||
1481
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4254 |
isOpen |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4255 |
"answer true if the application's window is open" |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4256 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4257 |
|win| |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4258 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4259 |
^ (win := self window) notNil and:[win isOpen] |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4260 |
! |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
4261 |
|
3484 | 4262 |
isShown |
4263 |
"answer true if the application's window is shown" |
|
4264 |
||
4265 |
|win| |
|
4266 |
||
4267 |
^ (win := self window) notNil and:[win shown] |
|
4268 |
! |
|
4269 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4270 |
isWebService |
4270 | 4271 |
^ device notNil and:[ device "askFor:#" isWebServiceDevice ] |
4272 |
||
4273 |
"Modified: / 27-05-2019 / 20:05:48 / Claus Gittinger" |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4274 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
4275 |
|
1419 | 4276 |
processName |
4277 |
"return a name to be shown for me in the process monitor" |
|
4278 |
||
4279 |
self class == ApplicationModel ifTrue:[ |
|
4173 | 4280 |
^ 'Application' |
1419 | 4281 |
]. |
4282 |
^ self class nameWithoutPrefix |
|
4283 |
||
4284 |
"Modified: / 4.12.1997 / 12:39:14 / cg" |
|
4285 |
! |
|
4286 |
||
4287 |
resolveClassNamed:something inClass:aClass |
|
4288 |
"return the class from something, a class, symbol, string or nil. |
|
1548 | 4289 |
first we are looking in the namespace of the application, then in the |
4290 |
current namespace and finally in Smalltalk |
|
1419 | 4291 |
" |
4292 |
||
4293 |
^ Smalltalk resolveName:something inClass:aClass. |
|
4294 |
! |
|
4295 |
||
3304 | 4296 |
resolveFont:something |
3308 | 4297 |
"resolve the font. Delegate to windowBuilder" |
4298 |
||
3304 | 4299 |
^ builder resolveFont:something |
4300 |
! |
|
4301 |
||
1419 | 4302 |
resolveName:something |
4303 |
"return the class from something, a class, symbol, string or nil. |
|
1548 | 4304 |
first we are looking in the namespace of the application, then in the |
2099 | 4305 |
current namespace and finally in Smalltalk" |
4306 |
||
1419 | 4307 |
^ self resolveName:something inClass:self class |
4308 |
! |
|
4309 |
||
4310 |
resolveName:something inClass:aClass |
|
4311 |
"return the class from something, a class, symbol, string or nil. |
|
3297 | 4312 |
first we are looking in the namespace of the application, |
2099 | 4313 |
then in the current namespace and finally in Smalltalk" |
4314 |
||
1419 | 4315 |
|cls| |
4316 |
||
4317 |
aClass notNil ifTrue:[ |
|
4173 | 4318 |
(cls := Smalltalk resolveName:something inClass:aClass) notNil ifTrue:[ |
4319 |
^ cls |
|
4320 |
]. |
|
4321 |
||
4322 |
masterApplication notNil ifTrue:[ |
|
4323 |
^ masterApplication resolveName:something |
|
4324 |
] |
|
1419 | 4325 |
]. |
4326 |
^ nil |
|
4327 |
! |
|
4328 |
||
2380 | 4329 |
selfResponsibleFor:aKey |
4330 |
"internal: return true, if I am to provide a value for some aspect." |
|
4331 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
4332 |
<resource: #obsolete> |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
4333 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
4334 |
self obsoleteMethodWarning:'obsoleted for de-obfuscation'. |
2380 | 4335 |
^ (aKey isNil or:[masterApplication isNil or:[self respondsTo:aKey]]) |
4336 |
! |
|
4337 |
||
3192 | 4338 |
shouldRememberLastExtent |
4339 |
"to be redefined by concrete applications: |
|
4340 |
if true is answered, the application's extent is remembered on close |
|
4341 |
and used as a default when opened the next time" |
|
4342 |
||
4343 |
^ self class shouldRememberLastExtent |
|
4344 |
! |
|
4345 |
||
1419 | 4346 |
topApplication |
4347 |
"return the top-master application" |
|
4348 |
||
4349 |
masterApplication isNil ifTrue:[ |
|
4173 | 4350 |
^ self |
1419 | 4351 |
]. |
4352 |
^ masterApplication topApplication |
|
4353 |
||
4354 |
"Created: / 6.6.1998 / 19:40:42 / cg" |
|
4355 |
! ! |
|
4356 |
||
1766 | 4357 |
!ApplicationModel methodsFor:'startup & release'! |
1419 | 4358 |
|
4256 | 4359 |
activate |
4360 |
"Activate my top window (i.e. deiconify & raise and assign focus)" |
|
4361 |
||
4362 |
self topView |
|
4363 |
raiseDeiconified; |
|
4364 |
activate |
|
4365 |
||
4366 |
" |
|
4367 |
|app| |
|
4368 |
app := WorkspaceApplication new. |
|
4369 |
app openAndWaitUntilVisible. |
|
4370 |
app window collapse. |
|
4371 |
Delay waitForSeconds:3. |
|
4372 |
app activate. |
|
4373 |
" |
|
4374 |
||
4375 |
"Created: / 20-04-2019 / 09:01:46 / Claus Gittinger" |
|
4376 |
! |
|
4377 |
||
1419 | 4378 |
releaseAsSubCanvas |
4379 |
"a subcanvas is closed or switching to a new application. |
|
4380 |
Can be redefined to perform a self release in this case." |
|
4381 |
||
4382 |
"/ used to self release here, |
|
4383 |
"/ but that is incompatible to VW (RefactoryBrowser). |
|
4384 |
"/ Therefore, if you need it, you MUST now redefine |
|
4385 |
"/ this method. |
|
4386 |
! |
|
4387 |
||
3203 | 4388 |
rememberLastExtent |
4239 | 4389 |
"remember my window's current extent for the next open. |
4390 |
This is sent when closing the window, |
|
4391 |
so that it will open with that extent as default the next time" |
|
3203 | 4392 |
|
4393 |
|window| |
|
4394 |
||
4395 |
window := self window. |
|
4396 |
(window notNil and:[window isTopView]) ifTrue:[ |
|
4240 | 4397 |
self class rememberLastExtentOf:window |
3203 | 4398 |
]. |
4399 |
||
4400 |
"Created: / 31-07-2013 / 14:41:33 / cg" |
|
4240 | 4401 |
"Modified: / 02-03-2019 / 13:09:12 / Claus Gittinger" |
3203 | 4402 |
! |
4403 |
||
1419 | 4404 |
restarted |
4405 |
"sent by my topWindow, when restarted from an image. |
|
4406 |
Nothing done here, but can be redefined to perform any actions |
|
4407 |
required to reset the application after an image-restart. |
|
4408 |
(for example: check if application files are still around, restart |
|
4409 |
subprocesses etc.)." |
|
4410 |
||
4411 |
"Modified: 1.6.1996 / 16:55:50 / cg" |
|
4412 |
! |
|
4413 |
||
4414 |
saveAndTerminateRequest |
|
4415 |
"some windowManagers send this to shut down an application |
|
4416 |
and have it save its state for restart. |
|
4417 |
Can be redefined in subclasses" |
|
4418 |
||
4419 |
self closeRequest |
|
4420 |
! |
|
4421 |
||
4422 |
saveAndTerminateRequestFor:aTopView |
|
4423 |
"some windowManagers send this to shut down an application |
|
4424 |
and have it save its state for restart. |
|
4425 |
Can be redefined in subclasses" |
|
4426 |
||
4427 |
self saveAndTerminateRequest |
|
4428 |
! ! |
|
4429 |
||
4076 | 4430 |
!ApplicationModel methodsFor:'testing'! |
4431 |
||
4432 |
isApplicationModel |
|
4433 |
^ true |
|
4434 |
! ! |
|
4435 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4436 |
!ApplicationModel methodsFor:'translating'! |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4437 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4438 |
translateString:aString |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4439 |
"translate aString to the current language. |
3754 | 4440 |
We use the resources as default. |
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4441 |
Subclasses may redefine this to use another mechanism" |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4442 |
|
4169 | 4443 |
aString size == 0 ifTrue:[^ '']. |
4164 | 4444 |
^ self resources stringWithCRs:aString asString |
3799 | 4445 |
|
3936 | 4446 |
"Modified: / 27-02-2017 / 13:50:46 / cg" |
4164 | 4447 |
"Modified: / 09-08-2018 / 18:08:56 / Claus Gittinger" |
3799 | 4448 |
! |
4449 |
||
4450 |
translateString:aString with:anArgument |
|
4451 |
"translate aString to the current language. |
|
4452 |
We use the resources as default. |
|
4453 |
Subclasses may redefine this to use another mechanism" |
|
4454 |
||
4164 | 4455 |
^ self resources stringWithCRs:aString asString with:anArgument |
3799 | 4456 |
|
4457 |
"Created: / 25-11-2016 / 09:54:32 / cg" |
|
4164 | 4458 |
"Modified: / 09-08-2018 / 18:09:26 / Claus Gittinger" |
4155 | 4459 |
! |
4460 |
||
4461 |
translateString:aString with:argument1 with:argument2 |
|
4462 |
"translate aString to the current language. |
|
4463 |
We use the resources as default. |
|
4464 |
Subclasses may redefine this to use another mechanism" |
|
4465 |
||
4164 | 4466 |
^ self resources stringWithCRs:aString asString with:argument1 with:argument2 |
4155 | 4467 |
|
4468 |
"Created: / 09-08-2018 / 15:08:11 / Claus Gittinger" |
|
4164 | 4469 |
"Modified: / 09-08-2018 / 18:09:30 / Claus Gittinger" |
4155 | 4470 |
! |
4471 |
||
4171 | 4472 |
translateString:aString with:argument1 with:argument2 with:argument3 |
4473 |
"translate aString to the current language. |
|
4474 |
We use the resources as default. |
|
4475 |
Subclasses may redefine this to use another mechanism" |
|
4476 |
||
4477 |
^ self resources stringWithCRs:aString asString with:argument1 with:argument2 with:argument3 |
|
4478 |
||
4479 |
"Created: / 16-08-2018 / 21:16:40 / Claus Gittinger" |
|
4480 |
! |
|
4481 |
||
4155 | 4482 |
translateString:aString withArguments:anArgumentVector |
4483 |
"translate aString to the current language. |
|
4484 |
We use the resources as default. |
|
4485 |
Subclasses may redefine this to use another mechanism" |
|
4486 |
||
4164 | 4487 |
^ self resources stringWithCRs:aString asString withArguments:anArgumentVector |
4155 | 4488 |
|
4489 |
"Created: / 09-08-2018 / 14:53:55 / Claus Gittinger" |
|
4164 | 4490 |
"Modified: / 09-08-2018 / 18:09:34 / Claus Gittinger" |
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4491 |
! ! |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4492 |
|
2869 | 4493 |
!ApplicationModel methodsFor:'user interaction & notifications'! |
4494 |
||
4495 |
beep |
|
3442 | 4496 |
"output an audible beep or bell on my screen device" |
4497 |
||
4498 |
device notNil ifTrue:[ |
|
4499 |
device beep. |
|
4500 |
]. |
|
2869 | 4501 |
! |
4502 |
||
4049 | 4503 |
beepInEditor |
4050 | 4504 |
"output an audible beep or bell on my screen device. |
4505 |
||
4506 |
beep to wakeup the user after some error/not found condition in an editor. |
|
4507 |
Use this ONLY to beep in response to a bad user operation (not system failure beeps). |
|
4508 |
Can be disabled via the settings if too annoying" |
|
4509 |
||
4049 | 4510 |
|
4511 |
device notNil ifTrue:[ |
|
4512 |
device beepInEditor. |
|
4513 |
]. |
|
4514 |
! |
|
4515 |
||
2869 | 4516 |
information:aString |
3799 | 4517 |
"like Object's information, but translates the string via the |
4518 |
resourcePack, thus giving a translated string automatically" |
|
4519 |
||
4155 | 4520 |
self informationTranslated:aString |
3799 | 4521 |
|
4522 |
"Created: / 20-05-1998 / 03:48:43 / cg" |
|
4523 |
"Modified: / 25-11-2016 / 09:55:53 / cg" |
|
4155 | 4524 |
"Modified: / 09-08-2018 / 14:51:32 / Claus Gittinger" |
4098 | 4525 |
! |
4526 |
||
4527 |
information:aString translate:aBoolean |
|
4528 |
"like Object's information, but translates the string via the |
|
4529 |
resourcePack, thus giving a translated string automatically" |
|
4530 |
||
4155 | 4531 |
self informationUntranslated:(aBoolean |
4532 |
ifTrue:[ self translateString:(aString?'') ] |
|
4098 | 4533 |
ifFalse:[ aString ]) |
4534 |
||
4535 |
"Created: / 01-06-2018 / 12:51:06 / Claus Gittinger" |
|
4155 | 4536 |
"Modified: / 09-08-2018 / 14:47:38 / Claus Gittinger" |
4537 |
! |
|
4538 |
||
4539 |
information:aString with:anArgument |
|
4540 |
"like Object's information, but translates the string via the |
|
4541 |
resourcePack, thus giving a translated string automatically" |
|
4542 |
||
4543 |
self informationTranslated:aString with:anArgument |
|
4544 |
||
4545 |
"Created: / 09-08-2018 / 14:50:55 / Claus Gittinger" |
|
4546 |
! |
|
4547 |
||
4548 |
information:aString with:anArgument translate:aBoolean |
|
4549 |
"like Object's information, but translates the string via the |
|
4550 |
resourcePack, thus giving a translated string automatically" |
|
4551 |
||
4552 |
self informationUntranslated: |
|
4553 |
(aBoolean |
|
4554 |
ifTrue:[ self translateString:(aString?'') with:anArgument ] |
|
4555 |
ifFalse:[ aString ]) |
|
4556 |
||
4557 |
"Created: / 09-08-2018 / 14:51:06 / Claus Gittinger" |
|
4558 |
! |
|
4559 |
||
4560 |
information:aString with:argument1 with:argument2 |
|
4561 |
"like Object's information, but translates the string via the |
|
4562 |
resourcePack, thus giving a translated string automatically" |
|
4563 |
||
4564 |
self informationTranslated:aString with:argument1 with:argument2 |
|
4565 |
||
4566 |
"Created: / 09-08-2018 / 15:07:28 / Claus Gittinger" |
|
4567 |
! |
|
4568 |
||
4170 | 4569 |
information:aString with:argument1 with:argument2 with:argument3 |
4570 |
"like Object's information, but translates the string via the |
|
4571 |
resourcePack, thus giving a translated string automatically" |
|
4572 |
||
4573 |
self informationTranslated:aString with:argument1 with:argument2 with:argument3 |
|
4574 |
||
4575 |
"Created: / 16-08-2018 / 21:15:19 / Claus Gittinger" |
|
4576 |
! |
|
4577 |
||
4578 |
information:aString withArguments:arguments |
|
4579 |
"like Object's information, but translates the string via the |
|
4580 |
resourcePack, thus giving a translated string automatically" |
|
4581 |
||
4582 |
self informationTranslated:aString withArguments:arguments |
|
4583 |
||
4584 |
"Created: / 16-08-2018 / 21:15:30 / Claus Gittinger" |
|
4585 |
! |
|
4586 |
||
4155 | 4587 |
informationHolder |
4588 |
"applications which want to show this in some info-area at the bottom |
|
4589 |
should redefine this to return a value holder or action-block" |
|
4590 |
||
4591 |
^ [:infoUntranslated | super information:infoUntranslated] |
|
4592 |
||
4593 |
"Created: / 09-08-2018 / 14:48:45 / Claus Gittinger" |
|
3799 | 4594 |
! |
4595 |
||
4596 |
informationTranslated:aString |
|
4597 |
"like Object's information, but translates the string via the |
|
2869 | 4598 |
resourcePack, thus giving a translated string automatically" |
4599 |
||
4155 | 4600 |
self informationUntranslated:(self translateString:aString) |
3799 | 4601 |
|
4602 |
"Created: / 25-11-2016 / 09:59:47 / cg" |
|
4155 | 4603 |
"Modified: / 09-08-2018 / 14:47:41 / Claus Gittinger" |
3799 | 4604 |
! |
4605 |
||
4606 |
informationTranslated:aString with:anArgument |
|
4607 |
"like Object's information, but translates the string via the |
|
4608 |
resourcePack, thus giving a translated string automatically" |
|
4609 |
||
4155 | 4610 |
self informationUntranslated:(self translateString:aString with:anArgument) |
3799 | 4611 |
|
4612 |
"Created: / 25-11-2016 / 10:01:32 / cg" |
|
4155 | 4613 |
"Modified: / 09-08-2018 / 14:47:45 / Claus Gittinger" |
4614 |
! |
|
4615 |
||
4616 |
informationTranslated:aString with:argument1 with:argument2 |
|
4617 |
"like Object's information, but translates the string via the |
|
4618 |
resourcePack, thus giving a translated string automatically" |
|
4619 |
||
4620 |
self informationUntranslated:(self translateString:aString with:argument1 with:argument2) |
|
4621 |
||
4622 |
"Created: / 09-08-2018 / 15:07:50 / Claus Gittinger" |
|
4623 |
! |
|
4624 |
||
4170 | 4625 |
informationTranslated:aString with:argument1 with:argument2 with:argument3 |
4626 |
"like Object's information, but translates the string via the |
|
4627 |
resourcePack, thus giving a translated string automatically" |
|
4628 |
||
4629 |
self informationUntranslated: |
|
4630 |
(self translateString:aString with:argument1 with:argument2 with:argument3) |
|
4631 |
||
4632 |
"Created: / 16-08-2018 / 21:15:47 / Claus Gittinger" |
|
4633 |
! |
|
4634 |
||
4635 |
informationTranslated:aString withArguments:arguments |
|
4636 |
"like Object's information, but translates the string via the |
|
4637 |
resourcePack, thus giving a translated string automatically" |
|
4638 |
||
4639 |
self informationUntranslated: |
|
4640 |
(self translateString:aString withArguments:arguments) |
|
4641 |
||
4642 |
"Created: / 16-08-2018 / 21:16:05 / Claus Gittinger" |
|
4643 |
! |
|
4644 |
||
4172 | 4645 |
informationUntranslated:aStringOrNil |
4155 | 4646 |
"applications which want to show this in some info-area at the bottom |
4647 |
may redefine this or the informationHolder message." |
|
4648 |
||
4172 | 4649 |
self informationHolder value:aStringOrNil |
4155 | 4650 |
|
4651 |
"Created: / 09-08-2018 / 14:47:06 / Claus Gittinger" |
|
4172 | 4652 |
"Modified (format): / 18-08-2018 / 11:12:21 / Claus Gittinger" |
2869 | 4653 |
! |
4654 |
||
4655 |
notify:aString |
|
4091 | 4656 |
"like Object's notify, but translates the string via the |
2869 | 4657 |
resourcePack, thus giving a translated string automatically" |
4658 |
||
4155 | 4659 |
super notify:(self translateString:aString) |
4660 |
||
4661 |
"Created: / 20-05-1998 / 01:14:52 / cg" |
|
4662 |
"Modified: / 13-11-2001 / 20:10:12 / cg" |
|
4663 |
"Modified: / 09-08-2018 / 14:52:27 / Claus Gittinger" |
|
2869 | 4664 |
! |
4665 |
||
4666 |
openDocumentationFile:aFilename |
|
4667 |
HTMLDocumentView notNil ifTrue:[ |
|
4063 | 4668 |
HTMLDocumentView |
4669 |
openFullOnDocumentationFile:aFilename |
|
4670 |
searchIn:{ (self class packageDirectory / 'doc/online') }. |
|
2869 | 4671 |
]. |
4672 |
! |
|
4673 |
||
4674 |
restoreCursors |
|
4675 |
"restore the original cursors in all of my views" |
|
4676 |
||
4143 | 4677 |
^ self windowGroup restoreCursors |
4678 |
||
4679 |
"Created: / 01-06-1996 / 17:01:24 / cg" |
|
4680 |
"Modified: / 04-07-2018 / 11:11:17 / stefan" |
|
2869 | 4681 |
! |
4682 |
||
4683 |
showCursor:aCursor |
|
4684 |
"set all of my views cursor to aCursor. |
|
4685 |
It can be restored with #restoreCursor." |
|
4686 |
||
4143 | 4687 |
^ self windowGroup showCursor:aCursor |
4688 |
||
4689 |
"Created: / 01-06-1996 / 17:01:09 / cg" |
|
4690 |
"Modified: / 04-07-2018 / 11:11:26 / stefan" |
|
2869 | 4691 |
! |
4692 |
||
4693 |
warn:aString |
|
3179 | 4694 |
"like Object's warn, but translates the string via the |
2869 | 4695 |
resourcePack, thus giving a translated string automatically" |
4696 |
||
4157 | 4697 |
self warnUntranslated:(self translateString:aString) |
4698 |
||
4699 |
"Created: / 20-05-1998 / 01:14:52 / cg" |
|
4700 |
"Modified: / 13-11-2001 / 20:10:12 / cg" |
|
4701 |
"Modified: / 09-08-2018 / 15:37:12 / Claus Gittinger" |
|
2869 | 4702 |
! |
4703 |
||
4704 |
warn:aString translate:aBoolean |
|
4091 | 4705 |
"like Object's warn, but optionally translates the string via the |
2869 | 4706 |
resourcePack, thus giving a translated string automatically" |
4707 |
||
4157 | 4708 |
self warnUntranslated: |
4709 |
(aBoolean |
|
4155 | 4710 |
ifTrue:[ (self translateString:aString) ] |
4091 | 4711 |
ifFalse:[ aString ]). |
4155 | 4712 |
|
4157 | 4713 |
"Modified (format): / 09-08-2018 / 15:37:28 / Claus Gittinger" |
2869 | 4714 |
! |
4715 |
||
4716 |
warn:aString with:arg |
|
4091 | 4717 |
"like Object's warn, but translates the string via the |
2869 | 4718 |
resourcePack, thus giving a translated string automatically" |
4719 |
||
4720 |
self warn:aString withArguments:(Array with:arg) |
|
4721 |
! |
|
4722 |
||
4723 |
warn:aString with:arg1 with:arg2 |
|
4091 | 4724 |
"like Object's warn, but translates the string via the |
2869 | 4725 |
resourcePack, thus giving a translated string automatically" |
4726 |
||
4727 |
self warn:aString withArguments:(Array with:arg1 with:arg2) |
|
4728 |
! |
|
4729 |
||
4730 |
warn:aString with:arg1 with:arg2 with:arg3 |
|
4091 | 4731 |
"like Object's warn, but translates the string via the |
2869 | 4732 |
resourcePack, thus giving a translated string automatically" |
4733 |
||
4734 |
self warn:aString withArguments:(Array with:arg1 with:arg2 with:arg3) |
|
4735 |
! |
|
4736 |
||
4737 |
warn:aString with:arg1 with:arg2 with:arg3 with:arg4 |
|
4091 | 4738 |
"like Object's warn, but translates the string via the |
2869 | 4739 |
resourcePack, thus giving a translated string automatically" |
4740 |
||
4741 |
self warn:aString withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) |
|
4742 |
||
4743 |
"Created: / 23.2.2000 / 09:43:04 / cg" |
|
4744 |
! |
|
4745 |
||
4746 |
warn:aString withArguments:argArray |
|
4091 | 4747 |
"like Object's warn, but translates the string via the |
2869 | 4748 |
resourcePack, thus giving a translated string automatically. |
4749 |
Also translates \'s to newLine." |
|
4750 |
||
4157 | 4751 |
self warnUntranslated:(self translateString:aString withArguments:argArray). |
4752 |
||
4753 |
"Modified: / 09-08-2018 / 15:38:12 / Claus Gittinger" |
|
4754 |
! |
|
4755 |
||
4756 |
warnUntranslated:aString |
|
4180 | 4757 |
"do not translate the string via the resourcePack" |
4157 | 4758 |
|
4759 |
super warn:aString. |
|
4760 |
||
4761 |
"Created: / 09-08-2018 / 15:33:29 / Claus Gittinger" |
|
4180 | 4762 |
"Modified (comment): / 20-09-2018 / 09:46:26 / Stefan Vogel" |
2869 | 4763 |
! |
4764 |
||
4765 |
withCursor:aCursor do:aBlock |
|
4766 |
"evaluate aBlock, showing aCursor in my topView and all of its subviews. |
|
4767 |
Return the value of aBlock." |
|
4768 |
||
3317 | 4769 |
|w| |
2869 | 4770 |
|
4771 |
w := self window. |
|
4772 |
w notNil ifTrue:[ |
|
3317 | 4773 |
^ w topView withCursor:aCursor do:aBlock |
2869 | 4774 |
]. |
3317 | 4775 |
^ aCursor showWhile:aBlock. |
2869 | 4776 |
|
4777 |
"Modified: / 23.9.1998 / 17:00:25 / cg" |
|
4778 |
! |
|
4779 |
||
4780 |
withExecuteCursorDo:aBlock |
|
4781 |
"evaluate aBlock, showing an executeCursor in my topView and all of its subviews. |
|
4782 |
Return the value of aBlock." |
|
4783 |
||
4784 |
^ self withCursor:(Cursor execute) do:aBlock |
|
4785 |
||
4786 |
"Created: 14.12.1995 / 20:57:03 / cg" |
|
4787 |
! |
|
4788 |
||
4789 |
withReadCursorDo:aBlock |
|
4790 |
"evaluate aBlock, showing a readCursor in my topView and all of its subviews. |
|
4791 |
Return the value of aBlock." |
|
4792 |
||
4793 |
^ self withCursor:(Cursor read) do:aBlock |
|
4794 |
||
4795 |
"Created: 14.12.1995 / 20:56:47 / cg" |
|
4796 |
"Modified: 14.12.1995 / 20:57:36 / cg" |
|
4797 |
! |
|
4798 |
||
3297 | 4799 |
withVisibleCursor:aCursor do:aBlock |
2869 | 4800 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
4801 |
Return the value of aBlock. |
|
2940
4d8f61704b4a
comment/format in: #withVisibleCursor:do:
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
4802 |
Ensure, that the cursor is visible by the user for a minimal amount of time." |
3297 | 4803 |
|
2869 | 4804 |
|ret| |
4805 |
||
3297 | 4806 |
self |
4173 | 4807 |
withCursor:aCursor do:[ |
4808 |
|time| |
|
4809 |
||
4810 |
time := Time millisecondsToRun:[ ret := aBlock value]. |
|
4811 |
time := UserPreferences current waitCursorVisibleTime - time. |
|
4812 |
time > 0 ifTrue:[ |
|
4813 |
Delay waitForMilliseconds:time. |
|
4814 |
]. |
|
4815 |
]. |
|
2869 | 4816 |
^ ret. |
2940
4d8f61704b4a
comment/format in: #withVisibleCursor:do:
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
4817 |
|
4d8f61704b4a
comment/format in: #withVisibleCursor:do:
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
4818 |
"Modified (comment): / 12-09-2011 / 12:14:31 / cg" |
2869 | 4819 |
! |
4820 |
||
4821 |
withWaitCursorDo:aBlock |
|
4822 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
|
4823 |
Return the value of aBlock." |
|
4824 |
||
4825 |
^ self withCursor:(Cursor wait) do:aBlock |
|
4826 |
! |
|
4827 |
||
3297 | 4828 |
withWaitCursorVisibleDo:aBlock |
2869 | 4829 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
4830 |
Return the value of aBlock. |
|
4831 |
Guarantee, that the cursor is visible by the user for a minimal amount of time." |
|
4832 |
||
4833 |
^ self withVisibleCursor:(Cursor wait) do:aBlock |
|
3013 | 4834 |
! |
4835 |
||
4836 |
withWriteCursorDo:aBlock |
|
4837 |
"evaluate aBlock, showing a writeCursor in my topView and all of its subviews. |
|
4838 |
Return the value of aBlock." |
|
4839 |
||
4840 |
^ self withCursor:(Cursor write) do:aBlock |
|
4841 |
||
4842 |
"Created: / 27-07-2012 / 09:42:53 / cg" |
|
2869 | 4843 |
! ! |
4844 |
||
1419 | 4845 |
!ApplicationModel methodsFor:'window events'! |
4846 |
||
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4847 |
clientMessage:msgType format:msgFormat eventData:msgData |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4848 |
"a client message - very X-Window specific and only useful for special applications. |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4849 |
Subclasses prepared to receive them should redefine this method" |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4850 |
! |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4851 |
|
2526
d2be37e49195
changed #copyDataEvent:eventData:
Claus Gittinger <cg@exept.de>
parents:
2522
diff
changeset
|
4852 |
copyDataEvent:parameter eventData:msgData |
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4853 |
"a client message - very Win32 specific and only useful for special applications. |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4854 |
Subclasses prepared to receive them should redefine this method" |
2527 | 4855 |
|
4856 |
|messageStream command argument| |
|
4857 |
||
4858 |
messageStream := msgData asString readStream. |
|
4859 |
command := messageStream upTo: $:. |
|
4860 |
argument := messageStream upTo: Character null. |
|
4861 |
self processApplicationCommand:command with:argument |
|
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4862 |
! |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4863 |
|
3416 | 4864 |
delayedAutoRaiseEventFor:oneOfMyViews |
4865 |
"called with a delay by the focusIn code, iff the userPref setting is active. |
|
4866 |
Some (a small number only) may want to prevent autoraise in certain situations |
|
4867 |
- for example, if one view is controlling another. |
|
4868 |
These get a chance to redefine this method" |
|
4869 |
||
4870 |
oneOfMyViews raise. |
|
4871 |
! |
|
4872 |
||
1419 | 4873 |
dispatchEvent:event |
4874 |
"dispatch a user-pushed event. |
|
4875 |
This allows for events for an appModel to be pushed into the event queue |
|
4876 |
the same way as events for a view are pushable." |
|
4877 |
||
3297 | 4878 |
^ self |
4173 | 4879 |
dispatchEvent:event |
4880 |
withFocusOn:nil |
|
4881 |
delegate:true |
|
1419 | 4882 |
|
4883 |
! |
|
4884 |
||
4885 |
dispatchEvent:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
|
4886 |
"dispatch a user-pushed event. |
|
4887 |
This allows for events for an appModel to be pushed into the event queue |
|
4888 |
the same way as events for a view are pushable." |
|
4889 |
||
4890 |
self perform:evType withArguments:evArgs |
|
4891 |
||
4892 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
4893 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
1290 | 4894 |
! |
4895 |
||
1419 | 4896 |
dispatchEvent:ev type:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
4897 |
"dispatch a user-pushed event. |
|
4898 |
This allows for events for an appModel to be pushed into the event queue |
|
4899 |
the same way as events for a view are pushable." |
|
4900 |
||
4901 |
self perform:evType withArguments:evArgs |
|
4902 |
||
4903 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
4904 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
4905 |
! |
|
4906 |
||
3297 | 4907 |
dispatchEvent:event withFocusOn:focusViewOrNil |
1419 | 4908 |
"dispatch a user-pushed event. |
4909 |
This allows for events for an appModel to be pushed into the event queue |
|
4910 |
the same way as events for a view are pushable." |
|
4911 |
||
3297 | 4912 |
^ self |
4173 | 4913 |
dispatchEvent:event |
4914 |
withFocusOn:focusViewOrNil |
|
4915 |
delegate:true |
|
1419 | 4916 |
|
4917 |
||
4918 |
! |
|
4919 |
||
4920 |
dispatchEvent:event withFocusOn:focusViewOrNil delegate:doDelegate |
|
4921 |
"dispatch a user-pushed event. |
|
4922 |
This allows for events for an appModel to be pushed into the event queue |
|
4923 |
the same way as events for a view are pushable." |
|
4924 |
||
3297 | 4925 |
^ self |
4173 | 4926 |
dispatchEvent:event |
4927 |
type:event type |
|
4928 |
arguments:(event arguments) |
|
4929 |
withFocusOn:focusViewOrNil |
|
4930 |
delegate:doDelegate |
|
1419 | 4931 |
|
4932 |
||
4933 |
! |
|
4934 |
||
4935 |
noticeOfWindowClose:aWindow |
|
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4936 |
"sent when a topView or applicationSubView has been closed. |
1419 | 4937 |
Can be redefined in subclasses for cleanup." |
4938 |
||
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4939 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4940 |
self windowEvent:(#close -> aWindow) from:aWindow. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4941 |
^ self |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4942 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4943 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4944 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4945 |
! |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4946 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4947 |
noticeOfWindowOpen:aWindow |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4948 |
"sent when a topView or applicationSubView has been opened. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4949 |
Can be redefined in subclasses." |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4950 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4951 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4952 |
self windowEvent:(#open -> aWindow) from:aWindow. |
1419 | 4953 |
^ self |
4954 |
||
4955 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
|
4956 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
4957 |
! |
|
4958 |
||
2527 | 4959 |
processApplicationCommand:command with:argument |
4960 |
"a message from a secondary application instance (the exe has been started again). |
|
4961 |
Typically, the command is one like 'openPath:', as generated in StandaloneStartup." |
|
4962 |
||
4963 |
command = 'openPath' ifTrue:[ |
|
4173 | 4964 |
self processOpenPathCommand:argument. |
4965 |
^ self. |
|
2527 | 4966 |
]. |
4967 |
||
4968 |
Transcript showCR: 'Invalid command received: ', command. |
|
4969 |
! |
|
4970 |
||
4971 |
processOpenPathCommand:argument |
|
4972 |
"a message from a secondary application instance (the exe has been started again) |
|
4973 |
to open another window on document as found in the pathName argument. |
|
4974 |
Left blank (i.e. ignored) here, but can be redefined to open up another application |
|
4975 |
editor window if supported." |
|
4976 |
! |
|
4977 |
||
3200
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4978 |
processShortcut:aKeyEvent |
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4979 |
"a shortcut key event as forwarded from the keyboardProcessor - if there is the |
3297 | 4980 |
shortcut key defined, process the shortcut and return true - otherwise false." |
3200
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4981 |
|
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4982 |
^false |
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4983 |
|
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4984 |
"Created: / 23-07-2013 / 18:10:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4985 |
! |
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4986 |
|
1419 | 4987 |
requestForWindowClose |
4988 |
"the applicationWindow wants to know, if a close |
|
4989 |
is ok. Return false if not." |
|
4990 |
||
4991 |
|w k| |
|
4992 |
||
4993 |
builder notNil ifTrue:[ |
|
4173 | 4994 |
(w := builder window) notNil ifTrue:[ |
4995 |
(k := w keyboardProcessor) notNil ifTrue:[ |
|
4996 |
^ k requestForWindowClose |
|
4997 |
] |
|
4998 |
] |
|
1419 | 4999 |
]. |
5000 |
^ true |
|
5001 |
||
5002 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
5003 |
"Created: / 19.6.1998 / 01:34:58 / cg" |
|
5004 |
! |
|
5005 |
||
5006 |
showActivity:someMessage |
|
5007 |
"some activityNotification shalt be communicated to |
|
5008 |
the user. Forwarded from the topView and ignored here. |
|
5009 |
Can be redefined in concrete applications to show the |
|
5010 |
message either in some infoView (infoLabel as in Windows) |
|
5011 |
or in the title area (as done in the browsers)" |
|
5012 |
||
4272 | 5013 |
"/ should be redefined in concrete appModels to display this in an info area |
5014 |
"/ at the bottom of the main window. (see implementors on how to do this) |
|
5015 |
||
5016 |
Logger debug:'activity: %1' with:someMessage. |
|
1419 | 5017 |
^ self |
5018 |
||
4272 | 5019 |
"Created: / 16-12-1995 / 18:41:04 / cg" |
5020 |
"Modified: / 24-04-1996 / 09:34:22 / cg" |
|
5021 |
"Modified: / 28-05-2019 / 15:57:55 / Claus Gittinger" |
|
1419 | 5022 |
! |
5023 |
||
5024 |
windowEvent:anEvent from:anApplicationWindow |
|
5025 |
"dummy: windowEvent forwarding is not yet implemented" |
|
5026 |
||
5027 |
^ self |
|
5028 |
||
5029 |
"Modified: 24.4.1996 / 09:32:50 / cg" |
|
5030 |
! ! |
|
5031 |
||
5032 |
!ApplicationModel class methodsFor:'documentation'! |
|
5033 |
||
2753
f8c6eadde7bb
changed: #flyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2747
diff
changeset
|
5034 |
version_CVS |
3484 | 5035 |
^ '$Header$' |
85 | 5036 |
! ! |
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
5037 |
|
3108 | 5038 |
|
1419 | 5039 |
ApplicationModel initialize! |