author | convert-repo |
Wed, 29 May 2019 03:28:40 +0000 | |
changeset 4273 | 917882cc2024 |
parent 4272 | a9fd4c6d13b3 |
child 4275 | 47c5eb544d7a |
permissions | -rw-r--r-- |
4270 | 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 |
||
1062 |
openDialogInterface:anInterfaceSymbol withBindings:bindings |
|
1063 |
"create an instance of the application and open a view as |
|
1064 |
specified by anInterfaceSymbol." |
|
1065 |
||
1066 |
^ self new openDialogInterface:anInterfaceSymbol withBindings:bindings |
|
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. |
1479 |
If I have a masterApplication, those resources are returned." |
|
1988
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1480 |
|
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1481 |
resources isNil ifTrue:[ |
3800 | 1482 |
masterApplication notNil ifTrue:[ |
1483 |
^ masterApplication resources |
|
4094 | 1484 |
]. |
4192 | 1485 |
^ self class classResources. |
4094 | 1486 |
"/ ^ ResourcePack new |
2609
a78a9e0380b1
added warn:translate: to avoid double translation
Claus Gittinger <cg@exept.de>
parents:
2605
diff
changeset
|
1487 |
]. |
1419 | 1488 |
^ resources |
3800 | 1489 |
|
1490 |
"Modified (comment): / 25-11-2016 / 15:25:28 / cg" |
|
4094 | 1491 |
"Modified (comment): / 24-05-2018 / 13:43:11 / Claus Gittinger" |
1419 | 1492 |
! |
1493 |
||
1494 |
resources:aResourcePack |
|
3800 | 1495 |
"set the application's resources - usually this is done automatically, |
1419 | 1496 |
except for manually built dialogs" |
1497 |
||
1498 |
resources := aResourcePack |
|
3800 | 1499 |
|
1500 |
"Modified (comment): / 25-11-2016 / 15:25:36 / cg" |
|
1419 | 1501 |
! |
1502 |
||
3279 | 1503 |
topMasterApplication |
1504 |
"return the topmost master application. Useful when nested subapplications are used" |
|
1505 |
||
1506 |
masterApplication isNil ifTrue:[^ self]. |
|
1507 |
^ masterApplication topMasterApplication |
|
1508 |
! |
|
1509 |
||
3256 | 1510 |
topView |
1511 |
"SimpleView compatibility - answer my topWindow" |
|
1512 |
||
1513 |
^ self window |
|
1514 |
! |
|
1515 |
||
1419 | 1516 |
window |
1517 |
"return my topWindow - or nil, if I have no window (yet)" |
|
1518 |
||
1519 |
|win| |
|
1520 |
||
1521 |
builder isNil ifTrue:[^ nil]. |
|
1522 |
(win := builder window) notNil ifTrue:[ |
|
4173 | 1523 |
^ win |
1419 | 1524 |
]. |
1525 |
masterApplication notNil ifTrue:[ |
|
4173 | 1526 |
masterApplication ~~ self ifTrue:[ |
1527 |
"/ is that true ? |
|
1528 |
^ masterApplication window |
|
1529 |
] |
|
1419 | 1530 |
]. |
1531 |
^ nil. |
|
1532 |
||
1533 |
"Modified: / 18.9.1998 / 15:18:19 / cg" |
|
1534 |
! |
|
1535 |
||
1536 |
window:aTopView |
|
1537 |
"set my topWindow. |
|
1538 |
As a side effect, this creates a dummy builder if non has yet |
|
1539 |
been built. This prevents non-GUI-Painter apps from failing later, |
|
1540 |
when the builder is accessed." |
|
1541 |
||
1542 |
builder isNil ifTrue:[ |
|
4173 | 1543 |
self createBuilder |
1419 | 1544 |
]. |
1545 |
builder window:aTopView |
|
1546 |
||
1547 |
"Created: 18.4.1996 / 14:55:26 / cg" |
|
1548 |
! |
|
1549 |
||
3297 | 1550 |
windowGroup |
1419 | 1551 |
"return the applications windowGroup" |
1552 |
||
3881 | 1553 |
|myWindow wg| |
1419 | 1554 |
|
1555 |
builder notNil ifTrue:[ |
|
3881 | 1556 |
(myWindow := builder window) notNil ifTrue:[ |
3907 | 1557 |
^ myWindow windowGroup. |
1558 |
||
1559 |
"/ Disabled. Leads to Bug https://expeccoalm.exept.de/D179727 |
|
1560 |
"/ (Reopen of on ExpeccoSettingsDialog for the second time opens an empty window) |
|
1561 |
||
1562 |
"/ (wg := myWindow windowGroup) notNil ifTrue:[ |
|
1563 |
"/ ^ wg |
|
1564 |
"/ ]. |
|
3881 | 1565 |
#FIXME. "or at least: think about it" |
3906 | 1566 |
"/ Disabled. Leads to Bug https://expeccoalm.exept.de/D179727 |
1567 |
"/ (Close on ExpeccoSettingsDialog closes also Expecco) |
|
1568 |
"/ "/ mhmh - it seems that a window was previously closed |
|
1569 |
"/ "/ but kept around, and is now reopened. |
|
1570 |
"/ "/ So it lost its windowGroup. |
|
1571 |
"/ "/ happens for example, when the expecco-guiBrowser is closed and reopened. |
|
1572 |
"/ "/ Question is: is this to be fixed here, or should we look |
|
1573 |
"/ "/ at the place, where it is reopened... |
|
1574 |
"/ "/ for now, fix it on the fly if there is a master... |
|
1575 |
"/ "/ Don't do this unconditionally: |
|
1576 |
"/ "/ applications may (and do) run in a separate windowGroup |
|
1577 |
"/ "/ from the master - for example to allow interaction while the other |
|
1578 |
"/ "/ is busy. |
|
1579 |
"/ "/ So please do not reassign the wg, to my builder, iff it is already |
|
1580 |
"/ "/ non-nil there (i.e. do not move the code below to the top of this method). |
|
1581 |
"/ masterApplication notNil ifTrue:[ |
|
1582 |
"/ (wg := masterApplication windowGroup) notNil ifTrue:[ |
|
1583 |
"/ myWindow windowGroup:wg. |
|
1584 |
"/ ^ wg |
|
1585 |
"/ ]. |
|
1586 |
"/ ]. |
|
3881 | 1587 |
]. |
1419 | 1588 |
]. |
1589 |
masterApplication notNil ifTrue:[ |
|
3881 | 1590 |
^ masterApplication windowGroup |
1419 | 1591 |
]. |
1592 |
^ nil |
|
1593 |
||
3881 | 1594 |
"Modified (comment): / 11-02-2017 / 11:46:37 / cg" |
3195 | 1595 |
! |
1596 |
||
4265 | 1597 |
windowSensor |
1598 |
"return the applications windowSensor" |
|
1599 |
||
1600 |
|windowGroup| |
|
1601 |
||
1602 |
windowGroup := self windowGroup. |
|
1603 |
windowGroup isNil ifTrue:[ |
|
1604 |
^ nil. |
|
1605 |
]. |
|
1606 |
^ windowGroup sensor. |
|
1607 |
||
1608 |
"Created: / 14-05-2019 / 16:13:35 / Stefan Vogel" |
|
1609 |
! |
|
1610 |
||
3195 | 1611 |
windowTitle:aString |
3472 | 1612 |
builder windowTitle:aString |
1419 | 1613 |
! ! |
1614 |
||
1615 |
!ApplicationModel methodsFor:'binding access'! |
|
1616 |
||
1617 |
actionFor:aKey |
|
1618 |
"sent by the builder to ask for an actionBlock for |
|
1619 |
a Button. The argument, aKey comes from an UI-spec |
|
1620 |
for a buttons #action property. |
|
1621 |
Here, a corresponding message is sent to myself, |
|
1622 |
which ought to be defined in the application subclass. |
|
1623 |
Alternatively, a subclass may redefine this method, to provide |
|
1624 |
actionBlocks from a Dictionary or whatever. |
|
1625 |
Typically, a block is returned there." |
|
1626 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1627 |
aKey isNil ifTrue:[ self error:'nil action key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1628 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1629 |
masterApplication notNil ifTrue:[ |
4173 | 1630 |
(self respondsTo:aKey) ifFalse:[ |
1631 |
^ masterApplication actionFor:aKey |
|
1632 |
]. |
|
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1633 |
]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1634 |
|
2853 | 1635 |
^ MessageSend receiver:self selector:aKey |
1636 |
"/ ^ [self perform:aKey] "/ could use: MessageSend receiver:self selector:aKey |
|
1637 |
||
1638 |
"Modified: / 28-07-2010 / 11:56:49 / cg" |
|
1419 | 1639 |
! |
1640 |
||
1641 |
actionFor:aKey withValue:aValue |
|
1642 |
"sent by the builder to ask for an actionBlock for |
|
3297 | 1643 |
a Button which passes a value. |
1419 | 1644 |
The argument, aKey comes from an UI-spec for a buttons #action property. |
1645 |
Here, a corresponding message is sent to myself, |
|
1646 |
which ought to be defined in the application subclass. |
|
1647 |
Alternatively, a subclass may redefine this method, to provide |
|
1648 |
actionBlocks from a Dictionary or whatever. |
|
1649 |
Typically, a block is returned there." |
|
1650 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1651 |
aKey isNil ifTrue:[ self error:'nil action key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1652 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1653 |
masterApplication notNil ifTrue:[ |
4173 | 1654 |
(self respondsTo:aKey) ifFalse:[ |
1655 |
^ masterApplication actionFor:aKey withValue:aValue |
|
1656 |
]. |
|
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1657 |
]. |
2853 | 1658 |
|
2863 | 1659 |
"/ sigh - too many senders of #isBlock around... |
1660 |
"/ ^ MessageSend receiver:self selector:aKey argument:aValue |
|
1661 |
^ [self perform:aKey with:aValue] |
|
2853 | 1662 |
|
1663 |
"Modified: / 28-07-2010 / 11:56:42 / cg" |
|
2863 | 1664 |
"Modified: / 30-07-2010 / 10:40:35 / sr" |
1419 | 1665 |
! |
1666 |
||
2364 | 1667 |
actionFor:aKey withValue:value1 withValue:value2 |
3297 | 1668 |
"sent by the builder to ask for an actionBlock for a Button which passes two values. |
2364 | 1669 |
The argument, aKey comes from an UI-spec for a buttons #action property. |
1670 |
Here, a corresponding message is sent to myself, |
|
1671 |
which ought to be defined in the application subclass. |
|
1672 |
Alternatively, a subclass may redefine this method, to provide |
|
1673 |
actionBlocks from a Dictionary or whatever. |
|
1674 |
Typically, a block is returned there." |
|
1675 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1676 |
aKey isNil ifTrue:[ self error:'nil action key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1677 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1678 |
masterApplication notNil ifTrue:[ |
4173 | 1679 |
(self respondsTo:aKey) ifFalse:[ |
1680 |
^ masterApplication actionFor:aKey withValue:value1 withValue:value2 |
|
1681 |
]. |
|
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1682 |
]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1683 |
^ [self perform:aKey with:value1 with:value2] |
2364 | 1684 |
! |
1685 |
||
1419 | 1686 |
aspectFor:aKey |
1687 |
"sent by the builder to ask for an aspect (a data model). |
|
1688 |
The argument, aKey comes from an UI-spec |
|
4107 | 1689 |
for a component's #aspect property. |
1419 | 1690 |
Here, a corresponding message is sent to myself, |
1691 |
which ought to be defined in the application subclass. |
|
1692 |
Alternatively, a subclass may redefine this method, to provide |
|
1693 |
holders from a Dictionary or whatever. |
|
1694 |
Typically, a valueHolder is returned there." |
|
1695 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1696 |
aKey isNil ifTrue:[ self error:'nil aspect key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1697 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1698 |
masterApplication notNil ifTrue:[ |
4107 | 1699 |
(self respondsTo:aKey) ifFalse:[ |
1700 |
^ masterApplication aspectFor:aKey |
|
1701 |
]. |
|
1419 | 1702 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1703 |
^ self perform:aKey |
1419 | 1704 |
|
4107 | 1705 |
"Modified: / 18-06-1998 / 20:33:23 / cg" |
1706 |
"Modified (comment): / 04-06-2018 / 13:38:27 / Claus Gittinger" |
|
1419 | 1707 |
! |
1708 |
||
1742
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1709 |
aspectOrNil:aKey forSubApplication:aSubApp |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1710 |
^ nil |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1711 |
! |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1712 |
|
3515 | 1713 |
aspectValueFor:aspectKeySymbol |
3514 | 1714 |
"fetch an aspect's value |
1715 |
same as (self aspectFor:aKey) value" |
|
1716 |
||
3515 | 1717 |
^ (self aspectFor:aspectKeySymbol) value |
1718 |
! |
|
1719 |
||
1720 |
aspectValueOr:default for:aspectKeySymbol |
|
1721 |
"common helper - fetches the aspect value; |
|
1722 |
if it is nil, return a default." |
|
1723 |
||
1724 |
^ (self aspectValueFor:aspectKeySymbol) ? default |
|
3514 | 1725 |
! |
1726 |
||
1419 | 1727 |
clientFor:aKey |
1728 |
"sent by the builder to ask for an application provided |
|
1729 |
subcanvas's application. |
|
1730 |
The argument, aKey comes from an UI-spec |
|
1731 |
for a subcanvas's #client property. |
|
1732 |
Here, a corresponding message is sent to myself, |
|
1733 |
which ought to be defined in the application subclass. |
|
1734 |
Alternatively, a subclass may redefine this method, to provide |
|
1735 |
appModels from a Dictionary or whatever. |
|
1736 |
Typically, an applicationModel is returned there." |
|
1737 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1738 |
aKey isNil ifTrue:[ self error:'nil client key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1739 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1740 |
masterApplication notNil ifTrue:[ |
4173 | 1741 |
(self respondsTo:aKey) ifFalse:[ |
1742 |
^ masterApplication clientFor:aKey |
|
1743 |
]. |
|
1419 | 1744 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1745 |
^ self perform:aKey |
1419 | 1746 |
|
1747 |
"Modified: / 18.6.1998 / 20:33:30 / cg" |
|
1748 |
! |
|
1749 |
||
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1750 |
colorFor:aKey |
2472 | 1751 |
"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
|
1752 |
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
|
1753 |
for a widgets #*Color property. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1754 |
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
|
1755 |
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
|
1756 |
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
|
1757 |
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
|
1758 |
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
|
1759 |
|
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1760 |
(self respondsTo:aKey) ifTrue:[ |
4173 | 1761 |
^ (self perform:aKey) value |
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1762 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1763 |
(self class respondsTo:aKey) ifTrue:[ |
4173 | 1764 |
^ (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
|
1765 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1766 |
masterApplication notNil ifTrue:[ |
4173 | 1767 |
^ masterApplication colorFor:aKey |
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 colorFor:aKey. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1770 |
! |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1771 |
|
1419 | 1772 |
componentFor:aKey |
1773 |
"sent by the builder to ask for an application provided |
|
1774 |
component. |
|
1775 |
The argument, aKey comes from an UI-spec |
|
1776 |
for a viewHolders #view property. |
|
1777 |
Here, a corresponding message is sent to myself, |
|
1778 |
which ought to be defined in the application subclass. |
|
1779 |
Alternatively, a subclass may redefine this method, to provide |
|
1780 |
holders from a Dictionary or whatever. |
|
1781 |
Typically, a view is returned there." |
|
1782 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1783 |
aKey isNil ifTrue:[ self error:'nil component key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1784 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1785 |
masterApplication notNil ifTrue:[ |
4173 | 1786 |
(self respondsTo:aKey) ifFalse:[ |
1787 |
^ masterApplication componentFor:aKey |
|
1788 |
]. |
|
1419 | 1789 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1790 |
^ self perform:aKey |
1419 | 1791 |
|
1792 |
"Modified: / 18.6.1998 / 20:33:36 / cg" |
|
1793 |
! |
|
1794 |
||
2472 | 1795 |
fontFor:aKey |
1796 |
"sent by the builder to ask for an application provided font. |
|
1797 |
The argument, aKey comes from an UI-spec |
|
1798 |
for a widgets #*Font property. |
|
1799 |
Here, a corresponding message is sent to myself, |
|
1800 |
which ought to be defined in the application subclass. |
|
1801 |
Alternatively, a subclass may redefine this method, to provide |
|
1802 |
holders from a Dictionary or whatever. |
|
3308 | 1803 |
Typically, a font is returned there. |
1804 |
||
1805 |
Use #resolveFont:, if you are not a builder!!" |
|
2472 | 1806 |
|
1807 |
(self respondsTo:aKey) ifTrue:[ |
|
3308 | 1808 |
^ self perform:aKey |
2472 | 1809 |
]. |
1810 |
(self class respondsTo:aKey) ifTrue:[ |
|
3308 | 1811 |
^ self class perform:aKey |
2472 | 1812 |
]. |
1813 |
masterApplication notNil ifTrue:[ |
|
3308 | 1814 |
^ masterApplication fontFor:aKey |
2472 | 1815 |
]. |
1816 |
^ self class fontFor:aKey. |
|
1817 |
! |
|
1818 |
||
1419 | 1819 |
labelFor:aKey |
1820 |
"sent by the builder to ask for an application provided |
|
1821 |
label for a component. |
|
1822 |
The argument, aKey comes from an UI-spec |
|
1823 |
for a components #label property. |
|
1824 |
Here, a corresponding message is sent to myself, |
|
1825 |
which ought to be defined in the application subclass. |
|
1826 |
Alternatively, a subclass may redefine this method, to provide |
|
1827 |
labels from a Dictionary or whatever. |
|
1828 |
Typically, a string is returned there." |
|
1829 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1830 |
aKey isNil ifTrue:[ self error:'nil label key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1831 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1832 |
masterApplication notNil ifTrue:[ |
4173 | 1833 |
(self respondsTo:aKey) ifFalse:[ |
1834 |
^ masterApplication labelFor:aKey |
|
1835 |
]. |
|
1419 | 1836 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1837 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1838 |
(self respondsTo:aKey) ifFalse:[ |
4173 | 1839 |
(self class respondsTo:aKey) ifTrue:[ |
1840 |
^ self class perform:aKey |
|
1841 |
]. |
|
1997 | 1842 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1843 |
^ self perform:aKey |
1419 | 1844 |
! |
1845 |
||
1846 |
listFor:aKey |
|
1847 |
"sent by the builder to ask for an application provided |
|
1848 |
holder for a list (for example, a popUpLists list). |
|
1849 |
The argument, aKey comes from an UI-spec |
|
1850 |
for a listWidgets #list property. |
|
1851 |
Here, a corresponding message is sent to myself, |
|
1852 |
which ought to be defined in the application subclass. |
|
1853 |
Alternatively, a subclass may redefine this method, to provide |
|
1854 |
holders from a Dictionary or whatever. |
|
1855 |
Typically, a list-holding model (SelectionInList) is returned there. |
|
1856 |
If the instance does not provide a value, a corresponding aspect |
|
1857 |
is asked for. If that fails as well, the app class is asked as a last |
|
1858 |
chance." |
|
1859 |
||
1860 |
|a| |
|
1861 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1862 |
aKey isNil ifTrue:[ self error:'nil list key' ]. |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1863 |
|
1419 | 1864 |
a := self aspectFor:aKey. |
1865 |
a notNil ifTrue:[ |
|
4173 | 1866 |
^ a |
1419 | 1867 |
]. |
1868 |
^ self application listFor:aKey |
|
1869 |
||
1870 |
"Modified: / 18.6.1998 / 20:33:50 / cg" |
|
1871 |
! |
|
1872 |
||
3297 | 1873 |
menuFor:key |
1874 |
"Sent by the builder to ask for an application provided |
|
1875 |
holder for a menu. The argument, `key`, comes from an UI-spec |
|
1419 | 1876 |
for a widgets #menu property. |
1877 |
Here, a corresponding message is sent to myself, |
|
1878 |
which ought to be defined in the application subclass. |
|
1879 |
Alternatively, a subclass may redefine this method, to provide |
|
1880 |
holders from a Dictionary or whatever. |
|
1881 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
1882 |
||
3297 | 1883 |
| menu | |
1884 |
||
1885 |
key isNil ifTrue:[ self error:'nil menu key' ]. |
|
1886 |
||
1887 |
"/ Ask myself first... |
|
1888 |
(thisContext isRecursive not and:[ self respondsTo: key ]) ifTrue:[ |
|
4173 | 1889 |
menu := self perform: key |
3297 | 1890 |
] ifFalse:[ |
4173 | 1891 |
"/ Ask my class... |
1892 |
(self class respondsTo: key) ifTrue:[ |
|
1893 |
menu := self class perform: key |
|
1894 |
] ifFalse:[ |
|
1895 |
"/ Ask masterApplication if any... |
|
1896 |
masterApplication notNil ifTrue:[ |
|
1897 |
menu := masterApplication menuFor: key |
|
1898 |
]. |
|
1899 |
]. |
|
1419 | 1900 |
]. |
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
1901 |
|
3297 | 1902 |
"/ If the provided menu is a menu spec, create Menu from it... |
1903 |
menu isArray ifTrue:[ |
|
4173 | 1904 |
menu := Menu decodeFromLiteralArray: menu. |
1997 | 1905 |
]. |
3297 | 1906 |
^ menu. |
1907 |
||
1908 |
"Modified: / 18-06-1998 / 20:33:56 / cg" |
|
1909 |
"Modified: / 24-01-2014 / 09:46:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1419 | 1910 |
! |
1911 |
||
1912 |
specificationFor:aKey |
|
1913 |
"sent by the builder to ask for an application provided |
|
1914 |
specification for a subcanvas or subspecification. |
|
1915 |
The argument, aKey comes from an UI-spec |
|
1916 |
for a subcanvases #specification property (minorKey). |
|
1917 |
Here, a corresponding message is sent to myself, |
|
1918 |
which ought to be defined in the application subclass. |
|
1919 |
Alternatively, a subclass may redefine this method, to provide |
|
1920 |
interfaceSpecifications from a Dictionary or whatever. |
|
1921 |
Typically, an interfaceSpecification is returned there." |
|
1922 |
||
3811 | 1923 |
^ self class |
1924 |
specificationFor:aKey |
|
1925 |
application:self |
|
1926 |
onDevice:(self graphicsDevice) |
|
1419 | 1927 |
! |
1928 |
||
2058 | 1929 |
subApplicationFor:aKey |
3297 | 1930 |
"sent by subCanvas to ask for an application inside itself. |
2058 | 1931 |
The argument, aKey comes from a TabList-specs majorKey. |
1932 |
Here, a corresponding message is sent to myself, |
|
1933 |
which ought to be defined in the application subclass. |
|
1934 |
Alternatively, a subclass may redefine this method, to provide |
|
1935 |
an application from a Dictionary or whatever. |
|
1936 |
Typically, an ApplicationModel subinstance is returned there." |
|
1937 |
||
1938 |
(self respondsTo:aKey) ifTrue:[ |
|
4173 | 1939 |
^ self perform:aKey |
2058 | 1940 |
]. |
1941 |
masterApplication notNil ifTrue:[ |
|
4173 | 1942 |
^ masterApplication subApplicationFor:aKey |
2058 | 1943 |
]. |
1944 |
^ nil. |
|
1945 |
! |
|
1946 |
||
1419 | 1947 |
visualFor:aKey |
1948 |
"sent by the builder to ask for an application provided |
|
1949 |
image or element for a label. |
|
1950 |
The argument, aKey comes from an UI-spec |
|
1951 |
for a widgets #label property, if LabelIsImage is turned on. |
|
1952 |
Here, a corresponding message is sent to myself, |
|
1953 |
which ought to be defined in the application subclass. |
|
1954 |
Alternatively, a subclass may redefine this method, to provide |
|
1955 |
images from a Dictionary or whatever. |
|
1956 |
Typically, an image is returned there." |
|
1957 |
||
1958 |
^ self application visualFor:aKey |
|
1959 |
! ! |
|
1960 |
||
2380 | 1961 |
!ApplicationModel methodsFor:'building'! |
1962 |
||
1963 |
allButOpen |
|
1964 |
"create my views from the windowSpec, but do not open the main window." |
|
1965 |
||
1966 |
^ self allButOpenInterface:(self defaultWindowSpecName). |
|
1967 |
||
1968 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
1969 |
! |
|
1970 |
||
1971 |
allButOpenFrom:aSpec |
|
1972 |
"create my views but do not open the main window. |
|
1973 |
The argument is a spec which defines the interface." |
|
1974 |
||
1975 |
|window| |
|
1976 |
||
2691 | 1977 |
window notNil ifTrue:[ |
4094 | 1978 |
self proceedableError:'building twice (window is already built) ?'. |
2691 | 1979 |
]. |
1980 |
||
2380 | 1981 |
"/ DISABLED; see comment in basicInitialize |
1982 |
"/ |
|
1983 |
"/ " |
|
1984 |
"/ here, we kludge a bit: up to now, the builder was an |
|
1985 |
"/ instance of the no-op WindowBuilder. Now, it becomes |
|
1986 |
"/ a UIBuilder .... |
|
1987 |
"/ This allows for ApplicationModels without a UIBuilder |
|
1988 |
"/ if not needed. |
|
1989 |
"/ " |
|
1990 |
"/ realBuilder := UIBuilder new. |
|
1991 |
"/ builder := realBuilder. |
|
1992 |
"/ builder application:self. |
|
1993 |
"/ builder bindings:builder bindings. |
|
1994 |
||
1995 |
builder isNil ifTrue:[ |
|
4094 | 1996 |
self createBuilder. |
2380 | 1997 |
]. |
1998 |
||
1999 |
self preBuildWith:builder. |
|
2000 |
builder buildWindowFromSpec:aSpec. |
|
2001 |
window := builder window. |
|
2002 |
||
2003 |
window model:self. |
|
2004 |
(window respondsTo:#application:) ifTrue:[ |
|
4094 | 2005 |
window application:self. |
2380 | 2006 |
]. |
2007 |
||
2008 |
self showingHelp ifTrue: [ActiveHelp startFor: self]. |
|
2009 |
self postBuildWith:builder. |
|
2010 |
||
4094 | 2011 |
"Modified: / 19-06-1998 / 03:35:31 / cg" |
2012 |
"Modified: / 24-05-2018 / 13:47:23 / Claus Gittinger" |
|
2380 | 2013 |
! |
2014 |
||
2015 |
allButOpenInterface:aSymbol |
|
2016 |
"create my views but do not open the main window. |
|
2017 |
The argument specifies a selector of a method, |
|
2018 |
which when sent to myself should return a spec. |
|
2019 |
Notice, this returns the windowBuilder." |
|
2020 |
||
2021 |
self allButOpenFrom:(self interfaceSpecFor:aSymbol). |
|
2022 |
^ builder |
|
2023 |
||
2024 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
2025 |
! |
|
2026 |
||
2027 |
buildSpec:specToBuild asSubCanvasWithBuilder:aBuilder |
|
2028 |
"build a subcanvases spec into aSubcanvas" |
|
2029 |
||
4092 | 2030 |
|sameAppAsTopApp prevSpec prevSource| |
2380 | 2031 |
|
2032 |
aBuilder notNil ifTrue:[ |
|
4092 | 2033 |
prevSpec := aBuilder spec. |
2034 |
prevSource := aBuilder source. |
|
2380 | 2035 |
]. |
2036 |
||
2037 |
builder isNil ifTrue:[ |
|
4092 | 2038 |
builder := aBuilder. |
2039 |
aBuilder isNil ifTrue:[ |
|
2040 |
self createBuilder |
|
2041 |
] |
|
2380 | 2042 |
]. |
2043 |
||
2044 |
aBuilder source:self. |
|
2045 |
||
2046 |
"/ if the subcanvases appModel is NOT the same as |
|
2047 |
"/ the topApp, it must be pre/post-built. |
|
2048 |
"/ Otherwise, we invoke pre/post-builtAsSubcanvas. |
|
2049 |
"/ which provides a hook for redefinition in concrete appModels. |
|
2050 |
"/ This avoids invoking pre/postBuild twice for subCanvases which |
|
2051 |
"/ have the topApp as appModel. |
|
2052 |
||
4092 | 2053 |
sameAppAsTopApp := aBuilder application == aBuilder window topView application. |
2054 |
sameAppAsTopApp ifTrue:[ |
|
2055 |
self preBuildAsSubcanvasWith:aBuilder. |
|
2380 | 2056 |
] ifFalse:[ |
4092 | 2057 |
self preBuildWith:aBuilder. |
2380 | 2058 |
]. |
2059 |
||
2060 |
aBuilder buildFromSpec:specToBuild. |
|
2061 |
||
4092 | 2062 |
sameAppAsTopApp ifTrue:[ |
2063 |
self postBuildAsSubcanvasWith:aBuilder. |
|
2380 | 2064 |
] ifFalse:[ |
4092 | 2065 |
self postBuildWith:aBuilder. |
2380 | 2066 |
]. |
2067 |
||
2068 |
prevSpec notNil ifTrue:[ |
|
4092 | 2069 |
"/ restore state in builder if original builder was used |
2070 |
aBuilder spec:prevSpec. |
|
2380 | 2071 |
]. |
2072 |
prevSource notNil ifTrue:[ |
|
4092 | 2073 |
"/ restore state in builder if original builder was used |
2074 |
aBuilder source:prevSource. |
|
2380 | 2075 |
]. |
2076 |
||
2077 |
^ aBuilder |
|
2078 |
||
2079 |
"Created: / 18-06-1998 / 20:08:45 / cg" |
|
2080 |
"Modified: / 27-10-2006 / 11:45:25 / cg" |
|
4092 | 2081 |
"Modified (format): / 22-05-2018 / 18:12:20 / Claus Gittinger" |
2380 | 2082 |
! |
2083 |
||
2084 |
buildSubCanvas:spec withBuilder:aBuilder |
|
2085 |
"build a subcanvases' spec into aSubcanvas" |
|
2086 |
||
2087 |
self buildSubCanvas:spec withMenu:false withBuilder:aBuilder |
|
2088 |
! |
|
2089 |
||
2090 |
buildSubCanvas:spec withMenu:withMenuBoolean withBuilder:aBuilder |
|
2091 |
"build a subcanvases' spec into aSubcanvas" |
|
2092 |
||
2093 |
|specToBuild| |
|
2094 |
||
2095 |
specToBuild := spec. |
|
2096 |
withMenuBoolean ifFalse:[ |
|
4173 | 2097 |
"/ subapps should not build the menu and other fullSpec stuff. |
2098 |
spec class == FullSpec ifTrue:[ |
|
2099 |
specToBuild := spec component. |
|
2100 |
] |
|
2380 | 2101 |
]. |
2102 |
self buildSpec:specToBuild asSubCanvasWithBuilder:aBuilder |
|
2103 |
! ! |
|
2104 |
||
1419 | 2105 |
!ApplicationModel methodsFor:'component manipulations'! |
2106 |
||
2107 |
components:aSymbolOrArray do:aBlock |
|
2108 |
"evaluate aBlock for all components listed aSymbolOrArray." |
|
2109 |
||
2110 |
|coll| |
|
2111 |
||
2112 |
aSymbolOrArray isSymbol ifTrue:[ |
|
4173 | 2113 |
"/ a single components name |
2114 |
coll := Array with:aSymbolOrArray |
|
1419 | 2115 |
] ifFalse:[ |
4173 | 2116 |
coll := aSymbolOrArray |
1419 | 2117 |
]. |
2118 |
coll do:[:aSymbol | |
|
4173 | 2119 |
|component| |
2120 |
||
2121 |
(component := self componentFor:aSymbol) isNil ifFalse:[ |
|
2122 |
aBlock value:component |
|
2123 |
] |
|
1419 | 2124 |
] |
2125 |
||
2126 |
"Modified: 26.3.1997 / 16:23:14 / cg" |
|
2127 |
! |
|
2128 |
||
2129 |
disable:aSymbolOrArray |
|
2130 |
"disable the components whose id's are aSymbolOrArray." |
|
2131 |
||
2132 |
self components:aSymbolOrArray do:[:comp | comp disable] |
|
2133 |
||
2134 |
"Modified: 14.2.1997 / 17:32:09 / cg" |
|
2135 |
! |
|
2136 |
||
2137 |
enable:aSymbolOrArray |
|
2138 |
"enables the component(s) identified by aSymbolOrArray." |
|
2139 |
||
2140 |
self components:aSymbolOrArray do:[:comp | comp enable] |
|
2141 |
||
2142 |
"Modified: 14.2.1997 / 17:32:19 / cg" |
|
2143 |
! |
|
2144 |
||
2145 |
invalidate:aSymbolOrArray |
|
2146 |
"invalidates the component(s) identified by aSymbolOrArray." |
|
2147 |
||
2148 |
self components:aSymbolOrArray do:[:comp | comp invalidate] |
|
2149 |
||
2150 |
"Modified: 14.2.1997 / 17:32:28 / cg" |
|
2151 |
! |
|
2152 |
||
2153 |
makeInvisible:aSymbolOrArray |
|
2154 |
"makes the components whose id's are aSymbolOrArray invisible" |
|
2155 |
||
2156 |
self components:aSymbolOrArray do:[:comp | comp beInvisible] |
|
2157 |
||
2158 |
"Modified: 14.2.1997 / 17:32:42 / cg" |
|
2159 |
! |
|
2160 |
||
2161 |
makeReadOnly:aSymbolOrArray |
|
2162 |
"make all components identified by aSymbolOrArray read only |
|
2163 |
(for editText components)." |
|
2164 |
||
2165 |
self components:aSymbolOrArray do:[:comp | comp readOnly:true] |
|
2166 |
||
2167 |
"Modified: 14.2.1997 / 17:36:22 / cg" |
|
2168 |
! |
|
2169 |
||
2170 |
makeVisible:aSymbolOrArray |
|
2171 |
"makes the components whose id's are aSymbolOrArray visible" |
|
2172 |
||
2173 |
self components:aSymbolOrArray do:[:comp | comp beVisible] |
|
2174 |
||
2175 |
"Modified: 14.2.1997 / 17:32:52 / cg" |
|
2176 |
! |
|
2177 |
||
2178 |
makeWritable:aSymbolOrArray |
|
3297 | 2179 |
"make all components identified by aSymbolOrArray writable |
1419 | 2180 |
(for editText components)." |
2181 |
||
2182 |
self components:aSymbolOrArray do:[:comp | comp readOnly:false] |
|
2183 |
||
2184 |
"Created: 14.2.1997 / 17:36:17 / cg" |
|
2185 |
! ! |
|
2186 |
||
4268 | 2187 |
!ApplicationModel methodsFor:'copying-private'! |
1419 | 2188 |
|
2189 |
postCopy |
|
2190 |
builder := device := nil. |
|
2191 |
||
2192 |
"Created: / 19.4.1998 / 11:44:44 / cg" |
|
2053 | 2193 |
! |
2194 |
||
2195 |
postDeepCopy |
|
2196 |
builder := device := nil. |
|
2197 |
||
2198 |
"Created: / 19.4.1998 / 11:44:44 / cg" |
|
1419 | 2199 |
! ! |
2200 |
||
3651 | 2201 |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2202 |
!ApplicationModel methodsFor:'delayed actions (enqueue)'! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2203 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2204 |
delayedUpdate:something with:aParameter from:changedObject |
3297 | 2205 |
"support for delayed updates - |
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2206 |
subclasses which invoke #enqueueDelayedUpdate:with:from: (from #update:with:from:) |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2207 |
must also redefine this method, and perform the actual update there." |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2208 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2209 |
^ self |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2210 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2211 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2212 |
enqueueDelayedAction:aBlock |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2213 |
"This will enqueue a delayed action - the application-process will |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2214 |
eventually execute aBlock. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2215 |
Useful for synchronization" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2216 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2217 |
^ self |
4173 | 2218 |
enqueueMessage:#value |
2219 |
for:aBlock |
|
2220 |
arguments:#(). |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2221 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2222 |
"Modified: / 26.2.2000 / 18:01:44 / cg" |
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 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2225 |
enqueueDelayedUpdate:something with:aParameter from:changedObject |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2226 |
"support for delayed updates - to be invoked from a concrete classes |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2227 |
#update:with:from: method. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2228 |
This will enqueue a delayed update, and resend #delayedUpdate:with:from: |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2229 |
whenever the receiver is handling events. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2230 |
Especially useful, if many updates arrive at high frequency, to avoid |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2231 |
multiple redraws." |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2232 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2233 |
^ self |
3448 | 2234 |
enqueueMessage:#delayedUpdate:with:from: |
2235 |
for:self |
|
2236 |
arguments:{ something . aParameter . changedObject }. |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2237 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2238 |
"Modified: / 26.2.2000 / 18:01:44 / cg" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2239 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2240 |
|
3542 | 2241 |
enqueueMessage:selector |
2242 |
"enqueue a message without arguments to be sent to myself later, |
|
2243 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2244 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2245 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2246 |
from changes made in other browsers)" |
|
2247 |
||
2248 |
self enqueueMessage:selector for:self arguments:#() |
|
2249 |
! |
|
2250 |
||
3971 | 2251 |
enqueueMessage:selector argument:arg |
2252 |
"enqueue a message without arguments to be sent to myself later, |
|
2253 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2254 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2255 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2256 |
from changes made in other browsers)" |
|
2257 |
||
2258 |
self enqueueMessage:selector for:self arguments:{arg} |
|
2259 |
||
2260 |
"Created: / 21-08-2017 / 16:37:09 / cg" |
|
2261 |
! |
|
2262 |
||
3542 | 2263 |
enqueueMessage:selector arguments:argumentArray |
2264 |
"enqueue a message 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:argumentArray |
|
2271 |
! |
|
2272 |
||
2273 |
enqueueMessage:selector for:someone |
|
2274 |
"enqueue a message without arguments to be sent to someone later, |
|
2275 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2276 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2277 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2278 |
from changes made in other browsers)" |
|
2279 |
||
2280 |
self enqueueMessage:selector for:someone arguments:#() |
|
2281 |
! |
|
2282 |
||
3971 | 2283 |
enqueueMessage:selector for:someone argument:arg |
2284 |
"enqueue a message without arguments to be sent to someone later, |
|
2285 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2286 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2287 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2288 |
from changes made in other browsers)" |
|
2289 |
||
2290 |
self enqueueMessage:selector for:someone arguments:{ arg } |
|
2291 |
||
2292 |
"Created: / 21-08-2017 / 16:36:49 / cg" |
|
2293 |
! |
|
2294 |
||
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2295 |
enqueueMessage:selector for:someone arguments:argList |
3542 | 2296 |
"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
|
2297 |
is back in its eventLoop. Also, filter duplicates. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2298 |
This is useful, to buffer redraws and avoid flicker due to multiple |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2299 |
redraws (especially in browsers, when reacting on changeMessages resulting |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2300 |
from changes made in other browsers)" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2301 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2302 |
|window sensor| |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2303 |
|
2561 | 2304 |
|
2305 |
self isWebService ifTrue:[ |
|
3444 | 2306 |
self breakPoint:#sr. |
2307 |
^ self |
|
2561 | 2308 |
]. |
2309 |
||
3527 | 2310 |
((window := self window) notNil and:[window isOpen]) ifTrue:[ |
3444 | 2311 |
sensor := window sensor. |
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2312 |
]. |
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 |
sensor isNil ifTrue:[ |
3444 | 2315 |
"no window (yet or any longer)" |
2316 |
someone perform:selector withArguments:argList. |
|
2317 |
^ self. |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2318 |
]. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2319 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2320 |
"/ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2321 |
"/ if such a message is already in the queue, ignore it. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2322 |
"/ 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
|
2323 |
"/ back in the event loop. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2324 |
"/ |
3448 | 2325 |
sensor enqueueMessage:selector for:someone arguments:argList |
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2326 |
|
2902
c47d671282f9
comment/format in: #enqueueMessage:for:arguments:
Claus Gittinger <cg@exept.de>
parents:
2898
diff
changeset
|
2327 |
"Created: / 26-02-2000 / 18:01:31 / cg" |
c47d671282f9
comment/format in: #enqueueMessage:for:arguments:
Claus Gittinger <cg@exept.de>
parents:
2898
diff
changeset
|
2328 |
"Modified: / 23-03-2011 / 19:46:41 / cg" |
4154 | 2329 |
"Modified: / 02-08-2018 / 17:15:59 / Claus Gittinger" |
3543 | 2330 |
! |
2331 |
||
2332 |
enqueueMessage:selector with:argument |
|
2333 |
"enqueue a message with one argument to be sent to myself later, |
|
2334 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2335 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2336 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2337 |
from changes made in other browsers)" |
|
2338 |
||
2339 |
self enqueueMessage:selector for:self arguments:{ argument } |
|
2340 |
! |
|
2341 |
||
2342 |
enqueueMessage:selector with:argument1 with:argument2 |
|
2343 |
"enqueue a message with one argument to be sent to myself later, |
|
2344 |
when my process is back in its eventLoop. Also, filter duplicates. |
|
2345 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
2346 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
2347 |
from changes made in other browsers)" |
|
2348 |
||
2349 |
self enqueueMessage:selector for:self arguments:{ argument1. argument2 } |
|
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2350 |
! ! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
2351 |
|
1419 | 2352 |
!ApplicationModel methodsFor:'drag & drop'! |
2353 |
||
2557 | 2354 |
canDropObjects:aCollectionOfDropObjects |
1419 | 2355 |
"drop manager asked if a drop is possible |
2356 |
- should be redefined by apps which can do it, to return true" |
|
2357 |
||
2358 |
^ false |
|
2557 | 2359 |
! |
2360 |
||
2361 |
canDropObjects:aCollectionOfDropObjects in:aComponent |
|
2362 |
"drop manager asked if a drop is possible |
|
2363 |
- should be redefined by apps which can do it, to return true" |
|
2364 |
||
3297 | 2365 |
^ self canDropObjects:aCollectionOfDropObjects |
1419 | 2366 |
! |
2367 |
||
2261 | 2368 |
canDropObjects:aCollectionOfDropObjects in:aComponent at:position |
2405 | 2369 |
"drop manager asked if a drop is possible. |
2370 |
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
|
2371 |
|
2261 | 2372 |
^ self canDropObjects:aCollectionOfDropObjects in:aComponent |
2373 |
||
2374 |
"Created: / 13-10-2006 / 15:52:20 / cg" |
|
2079 | 2375 |
! |
2376 |
||
2557 | 2377 |
dropObjects:aCollectionOfDropObjects |
2079 | 2378 |
"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
|
2379 |
This is ony sent, if #canDrop: returned true. |
2865 | 2380 |
Must be redefined in order for drop to work." |
2381 |
||
2382 |
^ self subclassResponsibility |
|
2252
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2383 |
|
2262 | 2384 |
"Created: / 13-10-2006 / 18:25:06 / cg" |
2079 | 2385 |
! |
2386 |
||
4183 | 2387 |
dropObjects:aCollectionOfDropObjects at:aPointOrNil |
2388 |
"drop manager wants to drop. |
|
2389 |
This is ony sent, if #canDropObjects: returned true. |
|
2390 |
Must be redefined in order for drop to work." |
|
2391 |
||
2392 |
^ self dropObjects:aCollectionOfDropObjects. |
|
2393 |
||
2394 |
"Created: / 28-09-2018 / 12:07:00 / Stefan Vogel" |
|
2395 |
! |
|
2396 |
||
2557 | 2397 |
dropObjects:aCollectionOfDropObjects in:aComponent |
2398 |
"drop manager wants to drop. |
|
2399 |
This is ony sent, if #canDrop: returned true. |
|
2400 |
Must be redefine in order for drop to work." |
|
2401 |
||
2402 |
^ self dropObjects:aCollectionOfDropObjects |
|
2403 |
||
2404 |
! |
|
2405 |
||
2262 | 2406 |
dropObjects:aCollectionOfDropObjects in:aComponent at:aPoint |
1419 | 2407 |
"drop manager wants to drop. |
4183 | 2408 |
This is ony sent, if #canDropObjects:in: returned true. |
2409 |
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
|
2410 |
|
2557 | 2411 |
^ self dropObjects:aCollectionOfDropObjects in:aComponent |
2262 | 2412 |
|
2413 |
"Created: / 13-10-2006 / 18:25:13 / cg" |
|
4183 | 2414 |
"Modified (comment): / 28-09-2018 / 14:26:18 / Stefan Vogel" |
2824 | 2415 |
! |
2416 |
||
2417 |
droppedFile:aFilename in:aComponent |
|
2418 |
"ignored here - only sent by textView components, sometimes" |
|
1419 | 2419 |
! ! |
2420 |
||
2421 |
!ApplicationModel methodsFor:'easy bindings'! |
|
2422 |
||
2423 |
registerInterestIn:aValueModel using:aSelectorOrArray |
|
2424 |
"Register interest in a change in aValueModel using information in aSelectorOrArray. |
|
3297 | 2425 |
aSelectorOrArray can be one of three things: |
2426 |
||
4173 | 2427 |
1) nil in which case no interest is registered |
2428 |
2) a selector in which case the receiver is understood to be self |
|
2429 |
3) an Array in which case the size is two where the first element is the |
|
2430 |
message to be sent and the second element is the receiver." |
|
1419 | 2431 |
|
2432 |
aSelectorOrArray isNil ifTrue:[^ aValueModel]. |
|
2433 |
||
2434 |
(aSelectorOrArray isArray) ifTrue:[ |
|
4173 | 2435 |
aValueModel onChangeSend:(aSelectorOrArray at:1) to:(aSelectorOrArray at:2) |
1419 | 2436 |
] ifFalse: [ |
4173 | 2437 |
aValueModel onChangeSend:aSelectorOrArray to:self |
1419 | 2438 |
]. |
2439 |
^aValueModel |
|
2440 |
||
2441 |
"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
|
2442 |
! |
3764f680134d
allow subclass to redefine subCanvas-pre/postBuilds;
Claus Gittinger <cg@exept.de>
parents:
978
diff
changeset
|
2443 |
|
1419 | 2444 |
valueHolderFor:aSelector initialValue:anObject |
3297 | 2445 |
"Return a ValueHolder on anObject." |
1419 | 2446 |
|
2447 |
^ self valueHolderFor:aSelector initialValue:anObject changeMessage:nil |
|
2448 |
||
2449 |
||
2450 |
! |
|
2451 |
||
2452 |
valueHolderFor:aSelector initialValue:anObject changeMessage:aSelectorOrArrayOrNil |
|
3297 | 2453 |
"Return a ValueHolder on anObject. aSelectorOrArrayOrNil is the change information |
2454 |
for the ValueHolder. This argument is either a Symbol or an Array of two elements. |
|
1419 | 2455 |
If it is a Symbol, then it is the change message and the interested object is understood |
3738 | 2456 |
to be the receiver. If it is an Array, then the first element is the change message and |
3297 | 2457 |
the second element is the interested object. " |
1419 | 2458 |
|
2459 |
|holder| |
|
2460 |
||
2461 |
(builder bindings includesKey:aSelector) ifFalse:[ |
|
3738 | 2462 |
holder := ValueHolder with:anObject. |
2463 |
builder aspectAt:aSelector put:holder. |
|
2464 |
aSelectorOrArrayOrNil notNil ifTrue:[ |
|
2465 |
^ self registerInterestIn:holder using:aSelectorOrArrayOrNil |
|
2466 |
]. |
|
2467 |
^ holder |
|
1419 | 2468 |
]. |
2469 |
^ builder aspectAt:aSelector |
|
2470 |
||
2471 |
"Modified: / 21.5.1998 / 03:31:28 / cg" |
|
2472 |
! ! |
|
2473 |
||
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2474 |
!ApplicationModel methodsFor:'forced actions'! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2475 |
|
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2476 |
doAcceptByReturnKey |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2477 |
|acceptAction| |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2478 |
|
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2479 |
builder notNil ifTrue:[ |
4173 | 2480 |
acceptAction := builder bindingAt:#doAccept. |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2481 |
]. |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2482 |
acceptAction notNil ifTrue:[ |
4173 | 2483 |
acceptAction value |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2484 |
] ifFalse:[ |
4173 | 2485 |
self doAccept |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
2486 |
] |
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2487 |
! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2488 |
|
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2489 |
doCancelByEscapeKey |
2010 | 2490 |
|cancelAction| |
2491 |
||
2492 |
builder notNil ifTrue:[ |
|
4173 | 2493 |
cancelAction := builder bindingAt:#doCancel. |
2010 | 2494 |
]. |
2495 |
cancelAction notNil ifTrue:[ |
|
4173 | 2496 |
cancelAction value |
2010 | 2497 |
] ifFalse:[ |
4173 | 2498 |
self doCancel |
2010 | 2499 |
] |
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2500 |
! ! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
2501 |
|
1419 | 2502 |
!ApplicationModel methodsFor:'help'! |
2503 |
||
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2504 |
aboutImage |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2505 |
"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
|
2506 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2507 |
^ self class aboutImage |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2508 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2509 |
"Modified: / 13.11.2001 / 12:32:44 / cg" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2510 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2511 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2512 |
aboutThisApplicationLabel |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2513 |
"label for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2514 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2515 |
^ self class aboutThisApplicationLabel |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2516 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2517 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2518 |
aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2519 |
"text for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2520 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2521 |
^ self class aboutThisApplicationText |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2522 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2523 |
|
3240 | 2524 |
activeHelpViewFor:text onDevice:aDevice |
3297 | 2525 |
"redefinable to allow for applications to provide their own active help |
3239 | 2526 |
(aka tooltip) bubble window" |
2527 |
||
3240 | 2528 |
^ ActiveHelpView for:text onDevice:aDevice |
3239 | 2529 |
! |
2530 |
||
2520
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2531 |
flyByHelpDependsOnPositionIn:aView |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2532 |
"subclasses where the help-text depends upon the pointer position might |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2533 |
want to redefine this" |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2534 |
|
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2535 |
^ false |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2536 |
! |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
2537 |
|
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2538 |
openAboutThisApplication |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2539 |
"opens an about box for this application. |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2540 |
Can be specialized by redefining #aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2541 |
and #aboutThisApplicationLabel" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
2542 |
|
1531 | 2543 |
Dialog |
4173 | 2544 |
about:(self translateString:self aboutThisApplicationText) |
2545 |
label:(self translateString:self aboutThisApplicationLabel) |
|
2546 |
icon:self aboutImage |
|
1531 | 2547 |
|
2548 |
"Modified: / 17.11.2001 / 23:05:52 / cg" |
|
1419 | 2549 |
! |
2550 |
||
2551 |
openHelpViewOnFile:pathToHelpText |
|
2552 |
"open a help viewer (as opened by the help buttons). |
|
2553 |
The argument is a relative path within the help directory |
|
2554 |
(but a file under the current directory is tried first)" |
|
2555 |
||
2556 |
self withWaitCursorDo:[ |
|
4173 | 2557 |
HTMLDocumentView openFullOnHelpFile:pathToHelpText |
1419 | 2558 |
] |
2559 |
||
2560 |
! |
|
2561 |
||
2562 |
showActiveHelp:aHelpText for:view |
|
2563 |
"This is invoked from the activeHelp event listener, to display some popup-help |
|
4113 | 2564 |
for a component. |
2565 |
If false is returned, the help manager will pop up |
|
2566 |
some active help bubble; |
|
2567 |
if true is returned, it will assume that the |
|
1419 | 2568 |
help text has been already displayed and will not do any further actions. |
4113 | 2569 |
|
1419 | 2570 |
Here, we accept the help text, and push an event into out own input |
3764 | 2571 |
queue, so that the help text will be displayed asynchronously by myself, |
4113 | 2572 |
via the #showHelp:for: method, and return true. Always. |
2573 |
In theory, this can be redefined in concrete classes to handle active help differently." |
|
1419 | 2574 |
|
2575 |
|wg mySensor| |
|
2576 |
||
2577 |
self showingHelp ifFalse: [ |
|
3764 | 2578 |
^ true |
1419 | 2579 |
]. |
2580 |
||
2581 |
"/ NEW: push it into the event queue, to have it displayed |
|
3955 | 2582 |
"/ synchronously with other events. |
1419 | 2583 |
"/ (also any errors are reported as occurring in my context; |
2584 |
"/ instead of occurring in the activeHelp context). |
|
2585 |
||
2586 |
(wg := self windowGroup) notNil ifTrue:[ |
|
3764 | 2587 |
mySensor := wg sensor. |
2588 |
mySensor notNil ifTrue:[ |
|
2589 |
mySensor flushEventsFor:self withType:#showHelp:for:. |
|
2590 |
mySensor |
|
2591 |
pushUserEvent:#showHelp:for: for:self |
|
2592 |
withArguments:(Array with:aHelpText with:view). |
|
2593 |
^ true |
|
2594 |
] |
|
1419 | 2595 |
]. |
2596 |
||
2597 |
"/ mhmh - can this happen ? |
|
2598 |
||
2599 |
^ true |
|
2600 |
||
3955 | 2601 |
"Modified: / 21-08-1998 / 16:00:37 / cg" |
2602 |
"Modified (comment): / 22-05-2017 / 12:07:03 / mawalch" |
|
4113 | 2603 |
"Modified (comment): / 07-06-2018 / 10:45:44 / Claus Gittinger" |
1419 | 2604 |
! |
2605 |
||
2606 |
showHelp:aHelpText for:view |
|
2607 |
"actual method which is supposed to display the help text. |
|
2608 |
Should be redefined in concrete classes, to put the help text |
|
2609 |
into some info label, or the windows title bar. |
|
2610 |
Here, the help text is ignored." |
|
2611 |
||
2612 |
masterApplication notNil ifTrue:[ |
|
4173 | 2613 |
masterApplication showHelp:aHelpText for:view |
1419 | 2614 |
]. |
2615 |
||
2616 |
"Modified: / 31.7.1998 / 19:13:59 / cg" |
|
2617 |
! |
|
2618 |
||
2619 |
showingHelp |
|
2620 |
"return true, if the activeHelp manager should invoke my #showHelp:for: |
|
2621 |
method, when the mouse pointer is moved over my widgets. |
|
2622 |
The default here is true, however, the #showHelp:for: methods are empty. |
|
2623 |
These should be redefined to put the help text into some info label, |
|
3791 | 2624 |
or into the view's title bar. |
1419 | 2625 |
You may also redefine the showingHelp/showingHelp: methods, to |
2626 |
remember the flag setting." |
|
2627 |
||
2628 |
^ true |
|
2629 |
||
2630 |
"Modified: / 31.7.1998 / 17:55:31 / cg" |
|
2631 |
! ! |
|
2632 |
||
2977 | 2633 |
!ApplicationModel methodsFor:'help texts'! |
2634 |
||
4047 | 2635 |
basicHelpTextForKey:aKey |
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
2636 |
"flyByHelp interface: return some short help text for a key. |
2977 | 2637 |
key is the symbol associated with some widget or menu item. |
3785 | 2638 |
Return the original (english) text as written in the helpSpec; |
4112 | 2639 |
The returned string (if any) needs to be translated as per language, |
2640 |
and also CR-expanded" |
|
2977 | 2641 |
|
2642 |
|helpSpecFromBindings helpText helpSpec "resourceArgs"| |
|
2643 |
||
4047 | 2644 |
helpSpecFromBindings := self aspectFor:#helpSpec. |
2977 | 2645 |
helpSpecFromBindings notNil ifTrue:[ |
3785 | 2646 |
helpText := helpSpecFromBindings at:aKey ifAbsent:nil. |
4047 | 2647 |
]. |
4109 | 2648 |
"/ helpText isNil ifTrue:[ |
2649 |
"/ "/ fall back for old apps |
|
2650 |
"/ helpSpecFromBindings := self aspectFor:#flyByHelpSpec. |
|
2651 |
"/ helpSpecFromBindings notNil ifTrue:[ |
|
2652 |
"/ helpText := helpSpecFromBindings at:aKey ifAbsent:nil. |
|
2653 |
"/ ]. |
|
2654 |
"/ ]. |
|
2977 | 2655 |
helpText isNil ifTrue:[ |
4047 | 2656 |
helpSpec := self helpSpec. |
2657 |
helpSpec isNil ifTrue:[ |
|
2658 |
"/ fall back for old apps |
|
2659 |
helpSpec := self perform:#flyByHelpSpec ifNotUnderstood:nil. |
|
2660 |
]. |
|
3785 | 2661 |
helpSpec notNil ifTrue:[ |
2662 |
helpText := helpSpec at:aKey ifAbsent:nil. |
|
2663 |
]. |
|
2977 | 2664 |
]. |
2665 |
||
4109 | 2666 |
helpText notNil ifTrue:[ |
2667 |
"/ new: allow for a collection (resource-key arg1 arg2...) |
|
2668 |
helpText isNonByteCollection ifTrue:[ |
|
2669 |
helpText := helpText first. |
|
2670 |
"/ resourceArgs := helpText copyFrom:2. |
|
2671 |
]. |
|
2977 | 2672 |
]. |
4109 | 2673 |
|
2977 | 2674 |
^ helpText |
2675 |
||
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
2676 |
"Modified: / 27-01-2012 / 14:30:20 / cg" |
3785 | 2677 |
"Modified (comment): / 17-11-2016 / 22:37:05 / cg" |
4109 | 2678 |
"Modified: / 06-06-2018 / 17:30:09 / Claus Gittinger" |
4112 | 2679 |
"Modified (comment): / 07-06-2018 / 10:38:37 / Claus Gittinger" |
2977 | 2680 |
! |
2681 |
||
4047 | 2682 |
helpSpec |
2977 | 2683 |
"activeHelp interface: return some short help text for a widget component" |
2684 |
||
3029 | 2685 |
|specFromBuilder| |
2686 |
||
2687 |
builder notNil ifTrue:[ |
|
4047 | 2688 |
(specFromBuilder := builder bindingAt:#helpSpec) notNil ifTrue:[ |
2689 |
^ specFromBuilder |
|
2690 |
]. |
|
3029 | 2691 |
]. |
4047 | 2692 |
^ self class helpSpec |
2693 |
! |
|
2694 |
||
2695 |
helpTextFor:aComponent |
|
2696 |
"activeHelp interface: return some help text for a widget component" |
|
2977 | 2697 |
|
2698 |
|key| |
|
2699 |
||
2700 |
builder notNil ifTrue:[ |
|
4120 | 2701 |
(key := builder helpKeyFor:aComponent) notNil ifTrue:[ |
2702 |
^ self helpTextForKey:key |
|
2703 |
] |
|
2977 | 2704 |
]. |
2705 |
masterApplication notNil ifTrue:[ |
|
4120 | 2706 |
^ masterApplication helpTextFor:aComponent |
2977 | 2707 |
]. |
2708 |
^ nil |
|
2709 |
||
4120 | 2710 |
"Modified: / 31-07-1998 / 23:03:10 / cg" |
2711 |
"Modified: / 08-06-2018 / 13:01:09 / Claus Gittinger" |
|
2977 | 2712 |
! |
2713 |
||
4047 | 2714 |
helpTextFor:aComponent at:aPoint |
4039 | 2715 |
"if not redefined by subclass, fall back to general method" |
2716 |
||
4047 | 2717 |
^ self helpTextFor:aComponent |
4039 | 2718 |
|
2719 |
"Created: / 09-01-2018 / 16:32:40 / stefan" |
|
2720 |
! |
|
2721 |
||
4047 | 2722 |
helpTextForKey:aKey |
4152 | 2723 |
"flyByHelp interface: |
2724 |
return some short help text for a key. |
|
2725 |
Key is the symbol associated with some widget or menu item. |
|
2726 |
(from my helpSpec); |
|
2727 |
Return a language variant (if available). |
|
2728 |
Special: with CTRL, show how it is generated (the helpKey or action block)" |
|
2977 | 2729 |
|
4243 | 2730 |
|helpText translatedHelpText translatedKey master| |
2731 |
||
2732 |
"/ ActiveHelp debugging:true. |
|
4221 | 2733 |
"/ ActiveHelp debugging:false. |
4243 | 2734 |
ActiveHelp debugging ifTrue:[ |
2735 |
Transcript showCR:'app: %1; help key: %2' with:self with:aKey |
|
2736 |
]. |
|
2977 | 2737 |
|
4047 | 2738 |
helpText := self basicHelpTextForKey:aKey. |
2977 | 2739 |
helpText isNil ifTrue:[ |
4243 | 2740 |
"/ try all masters... |
2741 |
master := masterApplication. |
|
2742 |
[helpText isNil and:[master notNil]] whileTrue:[ |
|
4039 | 2743 |
"here we get an already translated helpText" |
4243 | 2744 |
helpText := master basicHelpTextForKey:aKey. |
2745 |
master masterApplication ~~ master ifTrue:[ |
|
2746 |
master := master masterApplication. |
|
2747 |
]. |
|
4039 | 2748 |
]. |
2749 |
helpText isNil ifTrue:[ |
|
2750 |
"there is no help text - resolve key from resources" |
|
4157 | 2751 |
helpText := (self translateString:aKey). |
4059 | 2752 |
helpText = aKey ifTrue:[ |
4232 | 2753 |
(FlyByHelp helpKeyInsteadOfHelpTextQuery query ? false) ifTrue:[ |
4243 | 2754 |
^ c'Helpkey (%1): %2\nHold CTRL and press SHIFT for menu' bindWith:self with:aKey. |
4232 | 2755 |
]. |
4059 | 2756 |
"/ nothing came... |
4109 | 2757 |
helpText := nil |
4059 | 2758 |
]. |
4112 | 2759 |
^ helpText. |
4039 | 2760 |
]. |
2977 | 2761 |
]. |
2762 |
"/ kludge to allow for dynamic translation by the application itself, avoiding the key translation below. |
|
2763 |
helpText isBlock ifTrue:[ |
|
4232 | 2764 |
(FlyByHelp helpKeyInsteadOfHelpTextQuery query ? false) ifTrue:[ |
4229 | 2765 |
^ 'HelpText-block: ',helpText printString,c'\nHold CTRL and press SHIFT for menu'. |
4152 | 2766 |
]. |
4039 | 2767 |
^ helpText value. |
2977 | 2768 |
]. |
2769 |
||
4200 | 2770 |
"/ special: if ctrl is pressed, show the helpkey |
4232 | 2771 |
(helpText notNil) ifTrue:[ |
2772 |
(FlyByHelp helpKeyInsteadOfHelpTextQuery query ? false) ifTrue:[ |
|
4243 | 2773 |
^ c'Helpkey (%1): %2\nHold CTRL and press SHIFT for menu' bindWith:self with:aKey. |
4232 | 2774 |
]. |
4120 | 2775 |
]. |
2776 |
||
2977 | 2777 |
"get the translation" |
2778 |
translatedHelpText := self translateString:helpText. |
|
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
2779 |
(helpText = aKey and:[ translatedHelpText = helpText ]) ifTrue:[ |
4039 | 2780 |
"there is no translation in the resources - maybe there is one for the key?" |
2781 |
translatedKey := self translateString:aKey. |
|
2782 |
translatedKey ~~ aKey ifTrue:[ |
|
2783 |
translatedHelpText := translatedKey. |
|
2784 |
]. |
|
2977 | 2785 |
]. |
4174 | 2786 |
^ translatedHelpText. |
2977 | 2787 |
|
2983
8e31ab670ea3
comment/format in: #basicFlyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
2788 |
"Modified: / 27-01-2012 / 14:33:54 / cg" |
4039 | 2789 |
"Modified (comment): / 09-01-2018 / 17:36:30 / stefan" |
4243 | 2790 |
"Modified: / 07-03-2019 / 22:53:48 / Claus Gittinger" |
2977 | 2791 |
! |
2792 |
||
4047 | 2793 |
helpTextForKey:aKey row:aRowNr |
2977 | 2794 |
"Special interface for DataSet - get the active help text for a specific row" |
2795 |
||
2796 |
"Default: no row specific help" |
|
2797 |
||
4047 | 2798 |
^ self helpTextForKey:aKey. |
2977 | 2799 |
! ! |
2800 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2801 |
!ApplicationModel methodsFor:'hooks'! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2802 |
|
2185 | 2803 |
aboutToOpen:whichTopView |
2804 |
"the topView is about to be opened. |
|
2805 |
This is sent by whichTopView, right before its really open |
|
2806 |
(i.e. finally visible)" |
|
2807 |
||
2808 |
self preOpenWith:builder |
|
2809 |
! |
|
2810 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2811 |
commonPostBuild |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2812 |
"a common hook for postBuildWith: and postBuildAsSubcanvasWith:." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2813 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2814 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2815 |
commonPostOpen |
3864 | 2816 |
"a common hook for postOpenWith:, postOpenAsSubcanvasWith: and postOpenAsDialogWith:. |
2817 |
Notice: redefined methods should do a super send. |
|
2818 |
otherwise resources might be undefined." |
|
2819 |
||
2820 |
<modifier: #super> |
|
2821 |
||
3860 | 2822 |
resources isNil ifTrue:[ |
2823 |
resources := self resources |
|
2824 |
]. |
|
3864 | 2825 |
|
2826 |
"Modified: / 07-02-2017 / 18:43:35 / cg" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2827 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2828 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2829 |
commonPreBuild |
2921 | 2830 |
"a common hook for preBuildWith:, preBuildAsSubcanvasWith: and preBuildAsDialogWith:." |
2831 |
||
2832 |
"Modified (comment): / 07-07-2011 / 17:13:51 / cg" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2833 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2834 |
|
3297 | 2835 |
commonPreOpen |
2836 |
"A common hook for preOpenWith:, preOpenAsSubcanvasWith: and preOpenAsDialogWith:." |
|
2837 |
||
2838 |
"Created: / 05-03-2014 / 18:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2839 |
! |
|
2840 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2841 |
postApplicationProcessCreate:newProcess windowGroup:newGroup |
3297 | 2842 |
"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
|
2843 |
which forks its own windowGroup process. Allows for process group management, |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2844 |
or process-global exception handlers to be installed. |
4182 | 2845 |
Nothing done here - can be redefined in concrete applications" |
2846 |
||
2847 |
"Modified (comment): / 25-09-2018 / 12:20:16 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2848 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2849 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2850 |
postBuildAsSubcanvasWith:aBuilder |
4092 | 2851 |
"this is sent after an interface is built from a spec as subcanvas, |
2852 |
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
|
2853 |
Can be redefined in subclasses for additional setup after |
2921 | 2854 |
the subcanvas' view has been built, but not yet opened." |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2855 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2856 |
|sameApp| |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2857 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2858 |
sameApp := aBuilder application == aBuilder window topView application. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2859 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2860 |
"/ If I am opened as subcanvas in another application |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2861 |
"/ then treat this like a regular open. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2862 |
"/ otherwise ignore it. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2863 |
sameApp ifFalse:[ |
4092 | 2864 |
self postBuildWith:aBuilder. |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2865 |
] ifTrue:[ |
4092 | 2866 |
"/ I no not think, that this is a good default |
2867 |
"/ self commonPostBuild. |
|
2921 | 2868 |
]. |
2869 |
||
2870 |
"Modified (comment): / 07-07-2011 / 17:16:30 / cg" |
|
4092 | 2871 |
"Modified (comment): / 22-05-2018 / 18:11:42 / Claus Gittinger" |
2921 | 2872 |
! |
2873 |
||
2874 |
postBuildDialogWith:aBuilder |
|
2875 |
"this is sent after an interface is built from a spec as dialog with me |
|
2876 |
as a source (for aspects) i.e. via openDialogInterface:. |
|
2877 |
Can be redefined in subclasses for additional setup after |
|
2878 |
the dialog's view has been built, but not yet opened." |
|
2879 |
||
2880 |
|sameApp| |
|
2881 |
||
2882 |
sameApp := (aBuilder application == aBuilder window topView application). |
|
2883 |
||
2884 |
"/ If I am opened as subcanvas in another application |
|
2885 |
"/ then treat this like a regular open. |
|
2886 |
"/ otherwise ignore it. |
|
2887 |
sameApp ifFalse:[ |
|
4173 | 2888 |
self postBuildWith:aBuilder. |
2921 | 2889 |
] ifTrue:[ |
4173 | 2890 |
self commonPostBuild. |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2891 |
]. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2892 |
|
2921 | 2893 |
"Modified: / 08-07-1998 / 18:28:55 / cg" |
2894 |
"Created: / 07-07-2011 / 17:20:29 / cg" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2895 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2896 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2897 |
postBuildWith:aBuilder |
4092 | 2898 |
"this is sent after an interface is built from a spec, |
2899 |
but only iff the appModel is not the same as the topView's app |
|
2900 |
(i.e. if it is not a build for the same appModel again). |
|
2901 |
In that case, postBuildAsSubcanvasWith is invoked. |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2902 |
Can be redefined in subclasses for additional setup after |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2903 |
the view has been built, but not yet opened." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2904 |
|
3864 | 2905 |
<modifier: #super> "must be called if redefined" |
2906 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2907 |
self commonPostBuild |
3864 | 2908 |
|
2909 |
"Modified: / 08-02-2017 / 00:22:38 / cg" |
|
4092 | 2910 |
"Modified (comment): / 22-05-2018 / 18:11:31 / Claus Gittinger" |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2911 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2912 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2913 |
postOpenAsSubcanvasWith:aBuilder |
4093 | 2914 |
"this is sent after the application's window is opened inside another application. |
2921 | 2915 |
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
|
2916 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2917 |
self commonPostOpen |
2921 | 2918 |
|
2919 |
"Modified (comment): / 07-07-2011 / 17:16:46 / cg" |
|
4093 | 2920 |
"Modified (comment): / 22-05-2018 / 18:42:11 / Claus Gittinger" |
2921 | 2921 |
! |
2922 |
||
2923 |
postOpenDialogWith:aBuilder |
|
4270 | 2924 |
"this is sent after the applicationÄs window is opened as a dialog with me |
2921 | 2925 |
as a source (for aspects) i.e. via openDialogInterface:. |
2926 |
Can be redefined in subclasses for actions after opening a dialog view." |
|
2927 |
||
3297 | 2928 |
self commonPostOpen |
2929 |
||
2921 | 2930 |
"Created: / 07-07-2011 / 17:20:37 / cg" |
3297 | 2931 |
"Modified: / 05-03-2014 / 18:42:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4093 | 2932 |
"Modified (comment): / 22-05-2018 / 18:42:15 / Claus Gittinger" |
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2933 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2934 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2935 |
postOpenWith:aBuilder |
4093 | 2936 |
"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
|
2937 |
Can be redefined in subclasses for actions after opening the view." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2938 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2939 |
self commonPostOpen |
4093 | 2940 |
|
2941 |
"Modified (comment): / 22-05-2018 / 18:42:19 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2942 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2943 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2944 |
preBuildAsSubcanvasWith:aBuilder |
4092 | 2945 |
"this is sent before an interface is built from a spec as a subcanvas, |
2946 |
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
|
2947 |
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
|
2948 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2949 |
self commonPreBuild |
4092 | 2950 |
|
2951 |
"Modified (comment): / 22-05-2018 / 18:11:04 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2952 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2953 |
|
2921 | 2954 |
preBuildDialogWith:aBuilder |
2955 |
"this is sent before an interface is built from a spec as a dialog with me |
|
2956 |
as a source (for aspects) i.e. via openDialogInterface:. |
|
2957 |
Can be redefined for apps which need to be informed about that." |
|
2958 |
||
2959 |
"Created: / 07-07-2011 / 17:20:48 / cg" |
|
2960 |
! |
|
2961 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2962 |
preBuildWith:aBuilder |
4092 | 2963 |
"this is sent before an interface is built from a spec, |
2964 |
but only iff the appModel is not the same as the topView's app |
|
2965 |
(i.e. if it is not a build for the same appModel again). |
|
2966 |
In that case, preBuildAsSubcanvasWith is invoked. |
|
2967 |
Can be redefined in subclasses." |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2968 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2969 |
self commonPreBuild |
4092 | 2970 |
|
2971 |
"Modified (comment): / 22-05-2018 / 18:10:31 / Claus Gittinger" |
|
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2972 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2973 |
|
3297 | 2974 |
preOpenAsSubcanvasWith:aBuilder |
2975 |
"this is sent before the applications window is opened inside another application. |
|
2976 |
Can be redefined in subclasses for actions after showing the canvas view." |
|
2977 |
||
2978 |
self commonPreOpen |
|
2979 |
||
2980 |
"Created: / 05-03-2014 / 18:40:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2981 |
! |
|
2982 |
||
2983 |
preOpenDialogWith:aBuilder |
|
2984 |
"this is sent after the applications window is opened as a dialog with me |
|
2985 |
as a source (for aspects) i.e. via openDialogInterface:. |
|
2986 |
Can be redefined in subclasses for actions after opening a dialog view." |
|
2987 |
||
2988 |
self commonPreOpen |
|
2989 |
||
2990 |
"Created: / 05-03-2014 / 18:41:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2991 |
! |
|
2992 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2993 |
preOpenWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2994 |
"this is sent before the applications main window is opened. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2995 |
Can be redefined in subclasses for actions right before opening the view." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2996 |
! ! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2997 |
|
1419 | 2998 |
!ApplicationModel methodsFor:'initialization'! |
2999 |
||
3000 |
addTopViewsToCurrentProject |
|
3001 |
"add all of my topViews to the current projects list of views. |
|
3002 |
This allows hiding views on a per-project basis. |
|
3003 |
Applications which do not want to be switched with projects |
|
3004 |
(such as the Launcher), may redefine this to a noop." |
|
3005 |
||
1972 | 3006 |
|wg| |
3007 |
||
3008 |
(wg := self windowGroup) notNil ifTrue:[ |
|
4173 | 3009 |
(wg topViews ? #()) do:[:aView | |
3010 |
aView addToCurrentProject |
|
3011 |
] |
|
1419 | 3012 |
] |
3013 |
||
3014 |
"Modified: 17.1.1997 / 19:43:39 / cg" |
|
3015 |
! |
|
3016 |
||
3017 |
basicInitialize |
|
3018 |
"initialize the application. |
|
3019 |
Since ST-80 applications seem commonly to redefine #initialize |
|
3020 |
without doing a super initialize, the real initialization is |
|
3021 |
done here ..." |
|
3022 |
||
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3023 |
self initializeDevice. |
1419 | 3024 |
|
3025 |
"claus: I wanted to delay the creation & assignment of the |
|
3026 |
builder till later, to allow setting to another builder. |
|
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3027 |
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
|
3028 |
creation, which might lead to trouble. |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3029 |
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
|
3030 |
late. |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3031 |
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
|
3032 |
" |
1419 | 3033 |
|
3034 |
"/ builder := self builderClass new. |
|
3035 |
"/ builder notNil ifTrue:[builder application:self]. |
|
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3036 |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3037 |
self initializeResources. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3038 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3039 |
"Modified: / 13-09-2006 / 12:39:30 / cg" |
1419 | 3040 |
! |
3041 |
||
3042 |
initialize |
|
3043 |
"nothing done here; |
|
3044 |
but can be redefined in concrete applications" |
|
3045 |
! |
|
3046 |
||
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3047 |
initializeDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3048 |
self isWebService ifTrue:[ |
4173 | 3049 |
self initializeWebServiceDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3050 |
] ifFalse:[ |
4173 | 3051 |
self initializeScreenDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3052 |
]. |
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3053 |
! |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3054 |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3055 |
initializeResources |
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
3056 |
"initialize the applications resources (NLS support)." |
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3057 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3058 |
resources := self class classResources. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3059 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3060 |
"Created: / 13-09-2006 / 12:39:22 / cg" |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3061 |
! |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
3062 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3063 |
initializeScreenDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3064 |
Screen notNil ifTrue:[ |
3523 | 3065 |
device := Screen current. |
3524 | 3066 |
(device notNil and:[device isOpen not]) ifTrue:[ |
3067 |
(self class name,' [warning]: screen device is not open') errorPrintCR |
|
3523 | 3068 |
]. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3069 |
] |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3070 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3071 |
|
1419 | 3072 |
setDevice:aDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3073 |
"set the device (i.e. some Screen), where the application shall open its view(s). |
1419 | 3074 |
The default device (if not set here) will be the current screen." |
3075 |
||
3076 |
device := aDevice |
|
3077 |
||
3078 |
"Created: 5.7.1996 / 12:01:40 / cg" |
|
3079 |
"Modified: 17.1.1997 / 19:44:09 / cg" |
|
3080 |
! ! |
|
3081 |
||
3082 |
!ApplicationModel methodsFor:'opening'! |
|
3083 |
||
3750 | 3084 |
hideWindows |
3943 | 3085 |
|wg| |
3086 |
||
3087 |
wg := self windowGroup. |
|
3088 |
wg notNil ifTrue:[ |
|
3089 |
wg hideTopViews. |
|
3090 |
]. |
|
3091 |
||
3092 |
"Modified: / 17-03-2017 / 17:22:31 / stefan" |
|
3750 | 3093 |
! |
3094 |
||
1419 | 3095 |
open |
2980 | 3096 |
"open a standard interface. |
3851 | 3097 |
Sorry, but for visualworks compatibility, the builder is returned, |
3098 |
not the receiver." |
|
1419 | 3099 |
|
3100 |
^ self openInterface |
|
3101 |
||
2980 | 3102 |
"Modified: / 03-05-1996 / 13:39:15 / cg" |
3103 |
"Modified (comment): / 27-12-2011 / 10:42:15 / cg" |
|
1419 | 3104 |
! |
3105 |
||
1592
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3106 |
openAndWaitUntilVisible |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3107 |
"open a standard interface, and wait until my window is visible" |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3108 |
|
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3109 |
self open. |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3110 |
self window waitUntilVisible. |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3111 |
! |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
3112 |
|
1634 | 3113 |
openAs:windowType |
2980 | 3114 |
"open a standard interface as slave, partner, dialog, popUp, undecorated etc. |
3115 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1634 | 3116 |
|
3117 |
^ self openInterfaceAs:windowType |
|
3118 |
||
2898 | 3119 |
"Modified: / 04-03-2011 / 15:03:19 / cg" |
2980 | 3120 |
"Modified (comment): / 27-12-2011 / 10:42:28 / cg" |
1634 | 3121 |
! |
3122 |
||
3123 |
openAsSlave |
|
1726 | 3124 |
"open a standard interface as slave. |
3125 |
Notice: there is still a need to make the current window a master |
|
4173 | 3126 |
(see code and comments in WindowBuilder >> openAt:withExtent:andType:)" |
1634 | 3127 |
|
3128 |
^ self openAs:#slave |
|
1724 | 3129 |
|
3130 |
" |
|
3131 |
WorkspaceApplication new openAsSlave. |
|
3132 |
" |
|
1634 | 3133 |
! |
3134 |
||
1419 | 3135 |
openAt:aPoint |
3136 |
"open a standard interface at some point" |
|
3137 |
||
3138 |
^ self openInterfaceAt:aPoint |
|
3139 |
||
3140 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
3141 |
"Created: 14.2.1997 / 20:17:41 / cg" |
|
3142 |
! |
|
3143 |
||
3181 | 3144 |
openAtPointer |
3145 |
"open a standard interface at the current pointer position. |
|
3146 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
3147 |
||
3148 |
^ self openInterfaceAt:(device pointerPosition) |
|
3149 |
! |
|
3150 |
||
1419 | 3151 |
openInterface |
3152 |
"open a standard interface. |
|
3153 |
||
3297 | 3154 |
Subclasses which do not have an interfaceSpec |
1419 | 3155 |
should redefine this method and create & open their view(s) there. |
2980 | 3156 |
(see Launcher as an example). |
3157 |
||
3158 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1419 | 3159 |
|
1985 | 3160 |
^ self openInterface:(self defaultWindowSpecName) |
1419 | 3161 |
|
2980 | 3162 |
"Modified: / 09-09-1996 / 22:39:23 / stefan" |
3163 |
"Modified: / 23-01-1998 / 18:16:50 / cg" |
|
3164 |
"Modified (comment): / 27-12-2011 / 10:42:04 / cg" |
|
1419 | 3165 |
! |
3166 |
||
3167 |
openInterface:aSymbol |
|
2895 | 3168 |
"open a specific interface. |
3169 |
||
1419 | 3170 |
The argument, aSymbol specifies which interface. The concrete |
3171 |
application subclass must provide a method with that name, |
|
3297 | 3172 |
which must return an interfaceSpec. |
2895 | 3173 |
This is forwarded to the builder to create the views. |
2980 | 3174 |
Typically, applications only use one interface, returned by the #windowSpec method. |
3175 |
||
3176 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1419 | 3177 |
|
3178 |
self allButOpenInterface:aSymbol. |
|
3179 |
self openWindow. |
|
3180 |
^ builder |
|
3181 |
||
2895 | 3182 |
"Modified: / 03-03-2011 / 18:57:04 / cg" |
2980 | 3183 |
"Modified (comment): / 27-12-2011 / 10:41:54 / cg" |
1419 | 3184 |
! |
3185 |
||
1634 | 3186 |
openInterface:aSymbol as:windowType |
2895 | 3187 |
"open a specific interface in a special mode. |
3188 |
||
3297 | 3189 |
The argument, aSymbol specifies which interface. |
1634 | 3190 |
The concrete application subclass must provide a method with that name, |
3191 |
which must return an interfaceSpec. This is forwarded to the builder to create the views. |
|
3192 |
Typically, applications only use one interface, returned by the #windowSpec method. |
|
2980 | 3193 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc. |
3194 |
||
3195 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1634 | 3196 |
|
3197 |
self allButOpenInterface:aSymbol. |
|
3198 |
self openWindowAs:windowType. |
|
3199 |
^ builder |
|
3200 |
||
2895 | 3201 |
"Modified: / 03-03-2011 / 18:56:23 / cg" |
2980 | 3202 |
"Modified (comment): / 27-12-2011 / 10:42:37 / cg" |
1634 | 3203 |
! |
3204 |
||
1419 | 3205 |
openInterface:aSymbol at:aLocation |
3297 | 3206 |
"open a specific interface at a location in default mode. |
1419 | 3207 |
|
3208 |
The argument, aSymbol specifies which interface. The concrete |
|
3209 |
application subclass must provide a method with that name, |
|
3210 |
which must return an interfaceSpec. This is forwarded to |
|
3211 |
the builder to create the views. |
|
3297 | 3212 |
Typically, applications only use one interface, |
1419 | 3213 |
returned by the #windowSpec method." |
3214 |
||
3215 |
self allButOpenInterface:aSymbol. |
|
3216 |
self openWindowAt:aLocation. |
|
3217 |
^ builder |
|
3218 |
||
2895 | 3219 |
"Created: / 14-02-1997 / 20:19:44 / cg" |
3220 |
"Modified: / 03-03-2011 / 18:55:26 / cg" |
|
1419 | 3221 |
! |
3222 |
||
1634 | 3223 |
openInterfaceAs:windowType |
2895 | 3224 |
"open a standard interface in a special mode. |
3225 |
||
2898 | 3226 |
The windowType can be any of #slave, #partner, #dialog, #popUp, #undecorated etc." |
1634 | 3227 |
|
1985 | 3228 |
^ self openInterface:(self defaultWindowSpecName) as:windowType |
1634 | 3229 |
|
2895 | 3230 |
"Modified: / 09-09-1996 / 22:39:23 / stefan" |
2898 | 3231 |
"Modified: / 04-03-2011 / 15:03:28 / cg" |
1634 | 3232 |
! |
3233 |
||
1419 | 3234 |
openInterfaceAt:aLocation |
3235 |
"open a standard interface." |
|
3236 |
||
1985 | 3237 |
^ self openInterface:(self defaultWindowSpecName) at:aLocation |
1419 | 3238 |
|
3239 |
"Created: / 14.2.1997 / 20:18:20 / cg" |
|
3240 |
"Modified: / 23.1.1998 / 18:17:13 / cg" |
|
3241 |
! |
|
3242 |
||
3243 |
openInterfaceModal |
|
2980 | 3244 |
"open a standard interface as a modal dialog. |
3245 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
1419 | 3246 |
|
1985 | 3247 |
^ self openInterfaceModal:(self defaultWindowSpecName) |
1419 | 3248 |
|
2895 | 3249 |
"Modified: / 09-09-1996 / 22:39:23 / stefan" |
3250 |
"Modified: / 03-03-2011 / 18:54:48 / cg" |
|
2980 | 3251 |
"Modified (comment): / 27-12-2011 / 10:42:53 / cg" |
1419 | 3252 |
! |
3253 |
||
3254 |
openInterfaceModal:aSymbol |
|
3297 | 3255 |
"open a specific interface as a modal dialog. |
1419 | 3256 |
The argument, aSymbol specifies which interface. The concrete |
3257 |
application subclass must provide a method with that name, |
|
3258 |
which must return an interfaceSpec. This is forwarded to |
|
3259 |
the builder to create the views. |
|
3297 | 3260 |
Typically, applications only use one interface, |
1419 | 3261 |
returned by the #windowSpec method." |
3262 |
||
3263 |
self allButOpenInterface:aSymbol. |
|
3264 |
self openWindowModal. |
|
3265 |
^ builder |
|
3266 |
||
3267 |
"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
|
3268 |
! |
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
3269 |
|
1419 | 3270 |
openInterfaceModal:aSymbol at:location |
3297 | 3271 |
"open a specific interface modal at some screen location. |
1419 | 3272 |
The argument, aSymbol specifies which interface. The concrete |
3273 |
application subclass must provide a method with that name, |
|
3274 |
which must return an interfaceSpec. This is forwarded to |
|
3275 |
the builder to create the views. |
|
3297 | 3276 |
Typically, applications only use one interface, |
1419 | 3277 |
returned by the #windowSpec method." |
3278 |
||
3279 |
self allButOpenInterface:aSymbol. |
|
3280 |
self openWindowModalAt:location. |
|
3281 |
^ builder |
|
3282 |
||
3283 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
3284 |
! |
|
3285 |
||
3286 |
openModal |
|
3287 |
"open a standard interface as a modal dialog" |
|
3288 |
||
3289 |
^ self openInterfaceModal |
|
3290 |
||
3291 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
3292 |
! |
|
3293 |
||
3618 | 3294 |
openModalAtPointer |
3295 |
"open a standard interface modal at the current pointer position. |
|
3296 |
Sorry, but for visualworks compatibility, the builder is returned" |
|
3297 |
||
3298 |
^ self openInterfaceModal:(self defaultWindowSpecName) at:(device pointerPosition) |
|
3299 |
! |
|
3300 |
||
1419 | 3301 |
openOnDevice:aDevice |
3302 |
"open a standard interface on some other device" |
|
3303 |
||
3304 |
self setDevice:aDevice. |
|
3365 | 3305 |
Screen currentScreenQuerySignal |
3306 |
answer:aDevice |
|
3307 |
do:[ |
|
3308 |
^ self open |
|
3309 |
] |
|
1419 | 3310 |
|
3311 |
"Created: 13.1.1997 / 21:24:11 / cg" |
|
3312 |
"Modified: 13.1.1997 / 21:24:30 / cg" |
|
3313 |
! |
|
3314 |
||
3315 |
openSpec:anInterfaceSpec |
|
3316 |
"open a view as specified in anInterfaceSpec." |
|
3317 |
||
3318 |
self allButOpenFrom:anInterfaceSpec. |
|
3319 |
self openWindow. |
|
3320 |
^ builder |
|
3321 |
||
3322 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
3323 |
"Created: / 20.5.1998 / 20:08:51 / cg" |
|
3324 |
! |
|
3325 |
||
2393 | 3326 |
openSpec:anInterfaceSpec withBindings:bindings |
3327 |
"open a view as specified in anInterfaceSpec." |
|
3328 |
||
2624 | 3329 |
self openSpec:anInterfaceSpec withBindings:bindings modal:false |
3330 |
! |
|
3331 |
||
3332 |
openSpec:anInterfaceSpec withBindings:bindings modal:modal |
|
3333 |
"open a view as specified in anInterfaceSpec." |
|
3334 |
||
2393 | 3335 |
self createBuilder. |
3297 | 3336 |
builder bindings:bindings. |
2393 | 3337 |
self allButOpenFrom:anInterfaceSpec. |
2624 | 3338 |
modal ifTrue:[ |
4173 | 3339 |
self openWindowModal. |
2624 | 3340 |
] ifFalse:[ |
4173 | 3341 |
self openWindow. |
2624 | 3342 |
] |
2393 | 3343 |
! |
3344 |
||
1419 | 3345 |
openSpecModal:anInterfaceSpec |
3346 |
"open an interface spec modal" |
|
3347 |
||
3348 |
self allButOpenFrom:anInterfaceSpec. |
|
3349 |
self openWindowModal. |
|
3350 |
^ builder |
|
3351 |
||
3352 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
3353 |
"Created: / 20.5.1998 / 20:20:21 / cg" |
|
3354 |
! |
|
3355 |
||
3356 |
openWindow |
|
3297 | 3357 |
"open the window |
2921 | 3358 |
- assumes that the builder has already setup the interface." |
3359 |
||
3360 |
builder "openWindow." |
|
4173 | 3361 |
openAt:nil |
3362 |
withExtent:(self defaultWindowExtent) |
|
3363 |
andType:(self defaultWindowType) |
|
1419 | 3364 |
|
2270
a7c797806d46
correctly restore the application after building a sub-app
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
3365 |
"Created: / 14-02-1997 / 20:20:39 / cg" |
2923 | 3366 |
"Modified: / 11-07-2011 / 22:30:27 / cg" |
1419 | 3367 |
! |
3368 |
||
1634 | 3369 |
openWindowAs:windowType |
3297 | 3370 |
"open the window - assumes that the builder has already setup the interface. |
1634 | 3371 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc." |
3372 |
||
3297 | 3373 |
builder |
4173 | 3374 |
openAt:nil |
3375 |
withExtent:(self defaultWindowExtent) |
|
3376 |
andType:windowType |
|
2921 | 3377 |
|
2923 | 3378 |
"Modified: / 11-07-2011 / 22:30:35 / cg" |
1634 | 3379 |
! |
3380 |
||
2931 | 3381 |
openWindowAs:windowType at:originOrNil |
3297 | 3382 |
"open the window - assumes that the builder has already setup the interface. |
2931 | 3383 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc." |
3384 |
||
3297 | 3385 |
builder |
4173 | 3386 |
openAt:originOrNil |
3387 |
withExtent:(self defaultWindowExtent) |
|
3388 |
andType:windowType |
|
2931 | 3389 |
|
3390 |
"Modified: / 11-07-2011 / 22:30:35 / cg" |
|
3391 |
"Created: / 25-07-2011 / 16:00:24 / cg" |
|
3392 |
! |
|
3393 |
||
2921 | 3394 |
openWindowAt:aPoint |
3297 | 3395 |
"open the window |
2921 | 3396 |
- assumes that the builder has already setup the interface." |
3397 |
||
3398 |
builder "openWindowAt:aLocation." |
|
4173 | 3399 |
openAt:aPoint |
3400 |
withExtent:(self defaultWindowExtent) |
|
3401 |
andType:(self defaultWindowType) |
|
2921 | 3402 |
|
3403 |
"Created: / 14-02-1997 / 20:20:55 / cg" |
|
1419 | 3404 |
! |
3405 |
||
3406 |
openWindowAtCenter |
|
3407 |
"open the window centered on the screen |
|
3408 |
- assumes that the builder has already setup the interface." |
|
3409 |
||
3410 |
builder openWindowAt:#center |
|
3411 |
||
3412 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
3413 |
! |
|
3414 |
||
3415 |
openWindowModal |
|
2921 | 3416 |
"open the window as a modal dialog |
3417 |
- assumes that the builder has already setup the interface." |
|
1419 | 3418 |
|
3419 |
"/ builder openDialog. |
|
3420 |
builder |
|
4173 | 3421 |
openAt:nil |
3422 |
withExtent:(self defaultWindowExtent) |
|
3423 |
andType:#dialog |
|
1419 | 3424 |
|
2921 | 3425 |
"Created: / 14-02-1997 / 20:20:39 / cg" |
1419 | 3426 |
! |
3427 |
||
3428 |
openWindowModalAt:aLocation |
|
2921 | 3429 |
"open the window as a modal dialog |
3430 |
- assumes that the builder has already setup the interface." |
|
1419 | 3431 |
|
3432 |
builder openDialogAt:aLocation. |
|
3433 |
||
2921 | 3434 |
"Created: / 14-02-1997 / 20:20:55 / cg" |
1419 | 3435 |
! |
3436 |
||
1478 | 3437 |
openWithExtent:extPoint |
3438 |
"open a standard interface with given extent" |
|
3439 |
||
3440 |
|bldr| |
|
3441 |
||
3442 |
bldr := self allButOpen. |
|
3443 |
bldr openWithExtent:extPoint. |
|
3444 |
^ bldr |
|
3445 |
||
3446 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
3447 |
! |
|
3448 |
||
1968 | 3449 |
opened:whichTopView |
3450 |
"the topView has been opened. |
|
3451 |
This is sent by whichTopView, when its really open |
|
3452 |
(i.e. finally visible)" |
|
3453 |
||
3454 |
self addTopViewsToCurrentProject. |
|
3455 |
self postOpenWith:builder |
|
3750 | 3456 |
! |
3457 |
||
3458 |
showWindows |
|
3459 |
self window map;activate. |
|
3460 |
! |
|
3461 |
||
3462 |
unhideWindows |
|
3463 |
self windowGroup unhideTopViews |
|
1419 | 3464 |
! ! |
3465 |
||
2921 | 3466 |
!ApplicationModel methodsFor:'opening-dialogs'! |
3467 |
||
3468 |
openDialog |
|
3297 | 3469 |
"open my window as a modal dialog |
2921 | 3470 |
- assumes that the builder has already setup the interface." |
3471 |
||
3472 |
self window beToolDialog. |
|
3473 |
^ builder openDialog. |
|
3474 |
||
3475 |
"Modified: / 14-02-1997 / 20:32:52 / cg" |
|
3476 |
"Modified (comment): / 07-07-2011 / 17:25:45 / cg" |
|
3477 |
! |
|
3478 |
||
3540 | 3479 |
openDialogAt:aPoint |
3480 |
"open my window as a modal dialog |
|
3481 |
- assumes that the builder has already setup the interface." |
|
3482 |
||
3483 |
self window beToolDialog. |
|
3484 |
^ builder openDialogAt:aPoint. |
|
3485 |
! |
|
3486 |
||
3487 |
openDialogAtPointer |
|
3488 |
"open my window as a modal dialog |
|
3489 |
- assumes that the builder has already setup the interface." |
|
3490 |
||
3491 |
^ self openDialogAt:(device pointerPosition). |
|
3492 |
! |
|
3493 |
||
2921 | 3494 |
openDialogInterface:aSelector |
3495 |
"open a dialog" |
|
3496 |
||
3497 |
"/ Notice: the opened dialog will be technically another instance |
|
3498 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3499 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3500 |
||
3501 |
^ self openDialogInterface:aSelector withBindings:nil |
|
3502 |
||
3503 |
"Modified: / 28-02-1997 / 14:08:01 / cg" |
|
3504 |
"Modified (comment): / 07-07-2011 / 17:25:26 / cg" |
|
3505 |
! |
|
3506 |
||
3507 |
openDialogInterface:aSelector withBindings:bindings |
|
3508 |
"open a dialog, given a spec-selector" |
|
3509 |
||
3510 |
"/ Notice: the opened dialog will be technically another instance |
|
3511 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3512 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3513 |
||
3297 | 3514 |
^ SimpleDialog new |
4173 | 3515 |
openFor:self |
3516 |
interface:aSelector |
|
3517 |
withBindings:bindings |
|
2921 | 3518 |
|
3519 |
"Created: / 28-02-1997 / 14:07:45 / cg" |
|
3520 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3521 |
"Modified (comment): / 07-07-2011 / 17:25:23 / cg" |
|
3522 |
! |
|
3523 |
||
3524 |
openDialogInterfaceSpec:aSpec withBindings:bindings |
|
3525 |
"open a dialog, given a spec" |
|
3526 |
||
3527 |
"/ Notice: the opened dialog will be technically another instance |
|
3528 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3529 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3530 |
||
3297 | 3531 |
^ SimpleDialog new |
4173 | 3532 |
openFor:self |
3533 |
interfaceSpec:aSpec |
|
3534 |
withBindings:bindings |
|
2921 | 3535 |
|
3536 |
"Created: / 28-02-1997 / 14:07:45 / cg" |
|
3537 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3538 |
"Modified (comment): / 07-07-2011 / 17:25:20 / cg" |
|
3539 |
! |
|
3540 |
||
3496 | 3541 |
openDialogModeless |
3542 |
"open my window as a modal dialog |
|
3543 |
- assumes that the builder has already setup the interface." |
|
3544 |
||
3545 |
self window beToolDialog. |
|
3546 |
^ builder open. |
|
3547 |
||
3548 |
"Modified: / 14-02-1997 / 20:32:52 / cg" |
|
3549 |
"Modified (comment): / 07-07-2011 / 17:25:45 / cg" |
|
3550 |
! |
|
3551 |
||
2921 | 3552 |
openDialogSpec:aSpec withBindings:bindings |
3553 |
"open a dialog" |
|
3554 |
||
3555 |
"/ Notice: the opened dialog will be technically another instance |
|
3556 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3557 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3558 |
||
3297 | 3559 |
^ SimpleDialog new |
4173 | 3560 |
openFor:self |
3561 |
spec:aSpec |
|
3562 |
withBindings:bindings |
|
2921 | 3563 |
|
3564 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3565 |
"Created: / 20-05-1998 / 20:27:56 / cg" |
|
3496 | 3566 |
! |
3567 |
||
3568 |
openDialogSpecModeless:aSpec withBindings:bindings |
|
3569 |
"open a dialog, but without blocking the caller" |
|
3570 |
||
3571 |
"/ Notice: the opened dialog will be technically another instance |
|
3572 |
"/ (of SimpleDialog) but use me as aspect provider. |
|
3573 |
"/ It will call postOpenDialog: and postBuildDialog: as callbacks. |
|
3574 |
||
3575 |
^ SimpleDialog new |
|
3576 |
openModelessFor:self |
|
3577 |
spec:aSpec |
|
3578 |
withBindings:bindings |
|
3579 |
||
3580 |
"Modified: / 23-01-1998 / 18:18:14 / cg" |
|
3581 |
"Created: / 20-05-1998 / 20:27:56 / cg" |
|
2921 | 3582 |
! ! |
3583 |
||
2380 | 3584 |
!ApplicationModel methodsFor:'opening-webInterface'! |
3585 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3586 |
addToService |
3297 | 3587 |
self service |
4173 | 3588 |
addPage:(builder page) |
3589 |
link:(self webLink) |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3590 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3591 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3592 |
createWebBuilder |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3593 |
"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
|
3594 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3595 |
builder isNil ifTrue:[ |
4173 | 3596 |
builder := self webBuilderClass new. |
3597 |
builder application:self. |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3598 |
] |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3599 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3600 |
"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
|
3601 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3602 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3603 |
defaultPageSpecName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3604 |
^ #pageSpec |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3605 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3606 |
|
2380 | 3607 |
defineInterface |
3608 |
"define a standard interface. |
|
3609 |
||
3297 | 3610 |
Subclasses which do not have an interfaceSpec |
2380 | 3611 |
should redefine this method and create their page there." |
3612 |
||
3613 |
^ self defineInterface:(self defaultPageSpecName) |
|
3614 |
! |
|
3615 |
||
3616 |
defineInterface:aSpecSymbol |
|
3617 |
"define an interface." |
|
3618 |
||
3619 |
^ self defineInterfaceFrom:(self interfaceSpecFor:aSpecSymbol) |
|
3620 |
! |
|
3621 |
||
3622 |
defineInterfaceFrom:aSpec |
|
3623 |
"define an interface (setup a page), given a spec." |
|
3624 |
||
3625 |
|page| |
|
3626 |
||
3627 |
builder isNil ifTrue:[ |
|
4173 | 3628 |
self createWebBuilder. |
2380 | 3629 |
]. |
3630 |
||
3631 |
self preBuildWith:builder. |
|
3632 |
builder buildPageFromSpec:aSpec. |
|
3633 |
page := builder page. |
|
3634 |
page application:self. |
|
3635 |
||
3636 |
self postBuildWith:builder. |
|
3637 |
||
3638 |
"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
|
3639 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3640 |
|
2554
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
3641 |
httpServerPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
3642 |
"on which port will a HTTP server be started" |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
3643 |
|
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
3644 |
^ self class defaultHttpServerPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
3645 |
! |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
3646 |
|
2547
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3647 |
initializeAsWebServiceOnWebDevice:webDevice |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3648 |
self setDevice:(WebApplicationDevice new). |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3649 |
self initialize. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3650 |
self initializeWebServiceDevice. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3651 |
self initializeResources. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3652 |
! |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3653 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3654 |
initializeWebServiceDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3655 |
"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
|
3656 |
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
|
3657 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3658 |
|server| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3659 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3660 |
self service isNil ifTrue:[ |
4173 | 3661 |
server := HTTPServer serverOnPort:(self httpServerPort). |
3662 |
||
3663 |
self service:(server |
|
3664 |
serviceForLink:(self serviceLinkName) |
|
3665 |
ifAbsent:[ |
|
3666 |
|service| |
|
3667 |
||
3668 |
service := HTTPPortalService new. |
|
3669 |
service linkName:(self serviceLinkName). |
|
3670 |
service class unRegisterServiceOn:server. |
|
3671 |
service registerServiceOn:server. |
|
3672 |
service |
|
3673 |
]). |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3674 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3675 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3676 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3677 |
pageSpecs |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3678 |
^ self class pageSpecs |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3679 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3680 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3681 |
service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3682 |
device isNil ifTrue:[^ nil]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3683 |
self assert:(device isWebServiceDevice). |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3684 |
^ device service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3685 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3686 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3687 |
service:something |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3688 |
self device service:something. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3689 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3690 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3691 |
serviceLinkName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3692 |
^ self class defaultServiceLinkName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3693 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3694 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3695 |
startAsWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3696 |
device isNil ifTrue:[ |
4173 | 3697 |
self initializeDevice. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3698 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3699 |
self startInPortalService:self service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3700 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3701 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3702 |
self new startInWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3703 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3704 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3705 |
|
3297 | 3706 |
startInPortalService:aPortalServiceOrSession |
2632
ced2473521b1
changed #startInPortalService:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
3707 |
aPortalServiceOrSession application:self. |
ced2473521b1
changed #startInPortalService:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
3708 |
self service:aPortalServiceOrSession. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3709 |
self defineInterface. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3710 |
self addToService. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3711 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3712 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3713 |
webBuilderClass |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3714 |
"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
|
3715 |
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
|
3716 |
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
|
3717 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3718 |
^ WebPageBuilder |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3719 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3720 |
"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
|
3721 |
"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
|
3722 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3723 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3724 |
webLink |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3725 |
"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
|
3726 |
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
|
3727 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3728 |
^ self device webLink |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3729 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3730 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3731 |
webLink:something |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3732 |
self device webLink:something |
2380 | 3733 |
! ! |
3734 |
||
1419 | 3735 |
!ApplicationModel methodsFor:'private'! |
3736 |
||
3737 |
builderClass |
|
3738 |
"return the UIBuilder class for me. |
|
3739 |
This method can be redefined if (eventually) there are |
|
3740 |
spec readers for other UI languages (motif UIL ?)" |
|
3741 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3742 |
self isWebService ifTrue:[ |
4173 | 3743 |
^ self webBuilderClass |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3744 |
]. |
1419 | 3745 |
^ UIBuilder |
3746 |
||
3747 |
"Created: / 19.6.1998 / 01:39:26 / cg" |
|
3748 |
"Modified: / 19.6.1998 / 01:45:24 / cg" |
|
3749 |
! |
|
3750 |
||
3751 |
createBuilder |
|
1431 | 3752 |
"create a WindowBuilder if not already present" |
3753 |
||
1419 | 3754 |
builder isNil ifTrue:[ |
4173 | 3755 |
builder := self builderClass new. |
3756 |
builder application:self. |
|
1419 | 3757 |
] |
3758 |
||
3759 |
"Created: / 19.6.1998 / 03:32:37 / cg" |
|
3760 |
! ! |
|
3761 |
||
3762 |
!ApplicationModel methodsFor:'queries'! |
|
3763 |
||
2923 | 3764 |
defaultWindowExtent |
4077 | 3765 |
"return my default window extent or nil. |
3766 |
Return nil if the defaul extent should be computed by other means. |
|
3767 |
||
3768 |
The code here asks for the last extent of an instance of this class." |
|
3947 | 3769 |
|
3203 | 3770 |
^ self class defaultExtentFor:self class |
2923 | 3771 |
|
3772 |
"Created: / 11-07-2011 / 22:30:12 / cg" |
|
3947 | 3773 |
"Modified (comment): / 09-04-2017 / 22:30:52 / cg" |
4077 | 3774 |
"Modified (comment): / 20-03-2018 / 11:42:16 / stefan" |
2923 | 3775 |
! |
3776 |
||
1985 | 3777 |
defaultWindowSpecName |
3778 |
^ #windowSpec |
|
3779 |
! |
|
3780 |
||
1419 | 3781 |
defaultWindowType |
3782 |
"Applications come up non-modal, by default" |
|
3783 |
||
3784 |
^ #normal |
|
3785 |
||
3786 |
"Created: 17.1.1997 / 19:57:34 / cg" |
|
3787 |
! |
|
3788 |
||
3789 |
graphicsDevice |
|
3790 |
"return the device I want to open my views on. |
|
3791 |
The default (if not created with #onDevice:) is the currently |
|
3792 |
active screen." |
|
3793 |
||
3794 |
^ device |
|
3795 |
||
3796 |
"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
|
3797 |
! |
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
3798 |
|
2373 | 3799 |
interfaceSpecFor:aSelectorOrSpec |
1419 | 3800 |
"return an interface spec. |
3801 |
Here, the query is forwarded to my class. |
|
3802 |
Can be refefined in subclasses which want to provide per-instance specs." |
|
3803 |
||
3297 | 3804 |
aSelectorOrSpec isSymbol ifFalse:[ |
3677 | 3805 |
(aSelectorOrSpec isKindOf:UISpecification) ifTrue:[^ aSelectorOrSpec]. |
2373 | 3806 |
]. |
3677 | 3807 |
UnhandledAttributeInLiteralArrayErrorSignal handle:[:ex | |
3808 |
"/ that is to support debugging - to easily find the bad spec |
|
3809 |
Transcript showCR:'%1 [warning]: Error in spec (%2):' withCRs |
|
3810 |
with:self class name |
|
3811 |
with:aSelectorOrSpec. |
|
3812 |
Transcript showCR:ex description. |
|
3813 |
ex proceed. |
|
3814 |
] do:[ |
|
3815 |
^ self class interfaceSpecFor:aSelectorOrSpec |
|
3816 |
]. |
|
3817 |
||
2373 | 3818 |
"Created: / 25-01-1998 / 19:45:12 / cg" |
3819 |
"Modified: / 14-01-2008 / 17:54:29 / cg" |
|
1419 | 3820 |
! |
3821 |
||
1481
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
3822 |
isOpen |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
3823 |
"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
|
3824 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
3825 |
|win| |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
3826 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
3827 |
^ (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
|
3828 |
! |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
3829 |
|
3484 | 3830 |
isShown |
3831 |
"answer true if the application's window is shown" |
|
3832 |
||
3833 |
|win| |
|
3834 |
||
3835 |
^ (win := self window) notNil and:[win shown] |
|
3836 |
! |
|
3837 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3838 |
isWebService |
4270 | 3839 |
^ device notNil and:[ device "askFor:#" isWebServiceDevice ] |
3840 |
||
3841 |
"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
|
3842 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
3843 |
|
1419 | 3844 |
processName |
3845 |
"return a name to be shown for me in the process monitor" |
|
3846 |
||
3847 |
self class == ApplicationModel ifTrue:[ |
|
4173 | 3848 |
^ 'Application' |
1419 | 3849 |
]. |
3850 |
^ self class nameWithoutPrefix |
|
3851 |
||
3852 |
"Modified: / 4.12.1997 / 12:39:14 / cg" |
|
3853 |
! |
|
3854 |
||
3855 |
resolveClassNamed:something inClass:aClass |
|
3856 |
"return the class from something, a class, symbol, string or nil. |
|
1548 | 3857 |
first we are looking in the namespace of the application, then in the |
3858 |
current namespace and finally in Smalltalk |
|
1419 | 3859 |
" |
3860 |
||
3861 |
^ Smalltalk resolveName:something inClass:aClass. |
|
3862 |
! |
|
3863 |
||
3304 | 3864 |
resolveFont:something |
3308 | 3865 |
"resolve the font. Delegate to windowBuilder" |
3866 |
||
3304 | 3867 |
^ builder resolveFont:something |
3868 |
! |
|
3869 |
||
1419 | 3870 |
resolveName:something |
3871 |
"return the class from something, a class, symbol, string or nil. |
|
1548 | 3872 |
first we are looking in the namespace of the application, then in the |
2099 | 3873 |
current namespace and finally in Smalltalk" |
3874 |
||
1419 | 3875 |
^ self resolveName:something inClass:self class |
3876 |
! |
|
3877 |
||
3878 |
resolveName:something inClass:aClass |
|
3879 |
"return the class from something, a class, symbol, string or nil. |
|
3297 | 3880 |
first we are looking in the namespace of the application, |
2099 | 3881 |
then in the current namespace and finally in Smalltalk" |
3882 |
||
1419 | 3883 |
|cls| |
3884 |
||
3885 |
aClass notNil ifTrue:[ |
|
4173 | 3886 |
(cls := Smalltalk resolveName:something inClass:aClass) notNil ifTrue:[ |
3887 |
^ cls |
|
3888 |
]. |
|
3889 |
||
3890 |
masterApplication notNil ifTrue:[ |
|
3891 |
^ masterApplication resolveName:something |
|
3892 |
] |
|
1419 | 3893 |
]. |
3894 |
^ nil |
|
3895 |
! |
|
3896 |
||
2380 | 3897 |
selfResponsibleFor:aKey |
3898 |
"internal: return true, if I am to provide a value for some aspect." |
|
3899 |
||
2586
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
3900 |
<resource: #obsolete> |
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
3901 |
|
023716eba50a
code cleanup: responsibleFor
Claus Gittinger <cg@exept.de>
parents:
2581
diff
changeset
|
3902 |
self obsoleteMethodWarning:'obsoleted for de-obfuscation'. |
2380 | 3903 |
^ (aKey isNil or:[masterApplication isNil or:[self respondsTo:aKey]]) |
3904 |
! |
|
3905 |
||
3192 | 3906 |
shouldRememberLastExtent |
3907 |
"to be redefined by concrete applications: |
|
3908 |
if true is answered, the application's extent is remembered on close |
|
3909 |
and used as a default when opened the next time" |
|
3910 |
||
3911 |
^ self class shouldRememberLastExtent |
|
3912 |
! |
|
3913 |
||
1419 | 3914 |
topApplication |
3915 |
"return the top-master application" |
|
3916 |
||
3917 |
masterApplication isNil ifTrue:[ |
|
4173 | 3918 |
^ self |
1419 | 3919 |
]. |
3920 |
^ masterApplication topApplication |
|
3921 |
||
3922 |
"Created: / 6.6.1998 / 19:40:42 / cg" |
|
3923 |
! ! |
|
3924 |
||
1766 | 3925 |
!ApplicationModel methodsFor:'startup & release'! |
1419 | 3926 |
|
4256 | 3927 |
activate |
3928 |
"Activate my top window (i.e. deiconify & raise and assign focus)" |
|
3929 |
||
3930 |
self topView |
|
3931 |
raiseDeiconified; |
|
3932 |
activate |
|
3933 |
||
3934 |
" |
|
3935 |
|app| |
|
3936 |
app := WorkspaceApplication new. |
|
3937 |
app openAndWaitUntilVisible. |
|
3938 |
app window collapse. |
|
3939 |
Delay waitForSeconds:3. |
|
3940 |
app activate. |
|
3941 |
" |
|
3942 |
||
3943 |
"Created: / 20-04-2019 / 09:01:46 / Claus Gittinger" |
|
3944 |
! |
|
3945 |
||
1419 | 3946 |
applicationWindowClass |
1431 | 3947 |
"return the class used for my (top-) windows" |
3948 |
||
1419 | 3949 |
^ ApplicationWindow |
3950 |
! |
|
3951 |
||
3952 |
close |
|
3953 |
"this is sent by my topView when about to be closed |
|
3954 |
by the program (not by the windowManager). |
|
3955 |
Notice, that we get a closeRequest message if closed by the windowManager, |
|
3956 |
which can be rejected by the app (or confirmed via a dialog) |
|
3957 |
Could be redefined in subclasses." |
|
3958 |
||
3959 |
self closeDownViews |
|
1132
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
3960 |
! |
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
3961 |
|
1419 | 3962 |
closeDownViews |
3203 | 3963 |
"close down the application's view(s)" |
1419 | 3964 |
|
3864 | 3965 |
<modifier: #super> "must be called if redefined" |
3966 |
||
2893 | 3967 |
|wg wgProcess window| |
1419 | 3968 |
|
3969 |
self release. |
|
3970 |
ActiveHelp stopFor:self. |
|
3971 |
||
3193 | 3972 |
self shouldRememberLastExtent ifTrue:[ |
3864 | 3973 |
self rememberLastExtent. |
3193 | 3974 |
]. |
3938 | 3975 |
wg := self windowGroup. |
3976 |
(wg notNil and:[wg isModal not]) ifTrue:[ |
|
3864 | 3977 |
wgProcess := wg process. |
3938 | 3978 |
(wgProcess notNil and:[Processor activeProcess ~~ wgProcess]) ifTrue:[ |
3864 | 3979 |
wgProcess terminate |
3980 |
] ifFalse:[ |
|
3981 |
wg closeDownViews. |
|
3938 | 3982 |
]. |
3983 |
^ self. |
|
3984 |
]. |
|
3985 |
||
3986 |
window := self window. |
|
3987 |
window notNil ifTrue:[ |
|
3988 |
window destroy. |
|
2890 | 3989 |
]. |
3990 |
||
3864 | 3991 |
"Modified: / 08-02-2017 / 00:24:14 / cg" |
3938 | 3992 |
"Modified: / 03-03-2017 / 12:00:22 / stefan" |
1419 | 3993 |
! |
3994 |
||
3995 |
closeRequest |
|
3996 |
"this is sent by my topView when about to be closed by the windowManager. |
|
3997 |
Could be redefined in subclasses to suppress close or confirm." |
|
3998 |
||
3864 | 3999 |
<modifier: #super> "must be called if redefined" |
4000 |
||
1528 | 4001 |
|sav window| |
4002 |
||
4003 |
window := self window. |
|
4004 |
window isNil ifTrue:[ |
|
3864 | 4005 |
'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR. |
4006 |
^ self |
|
1461
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
4007 |
]. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
4008 |
|
1831 | 4009 |
window isTopView ifFalse:[ |
3864 | 4010 |
window topView isModal ifTrue:[ |
4011 |
WindowGroup leaveSignal raise. |
|
4012 |
]. |
|
4013 |
||
4014 |
'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR. |
|
4015 |
^ self |
|
1419 | 4016 |
]. |
4017 |
||
4018 |
"/ In multiView apps, tell my master. |
|
4019 |
"/ (but not if I am a modal reincarnation) |
|
3297 | 4020 |
(masterApplication notNil |
1528 | 4021 |
and:[window isModal not]) ifTrue:[ |
1419 | 4022 |
|
3864 | 4023 |
"/ temporary clear my masterApplication to prevent |
4024 |
"/ endless recursion, in case the master sends me |
|
4025 |
"/ a closeRequest (although, it is supposed to |
|
4026 |
"/ send me a closeDownViews ...) |
|
4027 |
||
4028 |
sav := masterApplication. |
|
4029 |
masterApplication := nil. |
|
4030 |
sav closeRequestFor:window. |
|
4031 |
||
4032 |
"/ restore - in case master did not want me to close ... |
|
4033 |
masterApplication := sav. |
|
1419 | 4034 |
] ifFalse:[ |
3864 | 4035 |
"/ ST/X does close-check by redefining this message without |
4036 |
"/ a supersend; |
|
4037 |
"/ VW does it by returning false from requestForWindowClose |
|
4038 |
"/ sigh. |
|
4039 |
||
4040 |
self requestForWindowClose ifTrue:[ |
|
4041 |
window isSlave ifTrue:[ |
|
4042 |
window destroy |
|
4043 |
] ifFalse:[ |
|
4044 |
self closeDownViews |
|
4045 |
] |
|
4046 |
] |
|
1419 | 4047 |
]. |
4048 |
||
3864 | 4049 |
"Modified: / 08-02-2017 / 00:25:11 / cg" |
1419 | 4050 |
! |
4051 |
||
4052 |
closeRequestFor:aTopView |
|
4053 |
"this is sent by any of my topViews when about to be closed by the |
|
4054 |
windowmanager. For backward compatibility with single-view applications, |
|
4055 |
this is forwarded here to a simple (non topView-specific) closeRequest, |
|
4056 |
effectively closing all of my views. |
|
4057 |
MultiView applications should redefine this method if closing of individual |
|
4058 |
views closing is to be caught and/or should not close all of them." |
|
4059 |
||
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4060 |
|savedMaster myWindow| |
1565
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
4061 |
|
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
4062 |
myWindow := self window. |
1419 | 4063 |
|
4064 |
"/ In multiView apps, tell my master. |
|
4065 |
"/ (but not if I am a modal reincarnation) |
|
3297 | 4066 |
(masterApplication notNil |
1565
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
4067 |
and:[myWindow topView isModal not]) ifTrue:[ |
1419 | 4068 |
|
4173 | 4069 |
"/ temporary clear my masterApplication to prevent |
4070 |
"/ endless recursion, in case the master sends me |
|
4071 |
"/ a closeRequest (although, it is supposed to |
|
4072 |
"/ send me a closeDownViews ...) |
|
4073 |
||
4074 |
savedMaster := masterApplication. |
|
4075 |
masterApplication := nil. |
|
4076 |
aTopView isSlave ifTrue:[ |
|
4077 |
savedMaster closeRequestFor:aTopView. |
|
4078 |
] ifFalse:[ |
|
4079 |
savedMaster closeRequestFor:myWindow. |
|
4080 |
]. |
|
4081 |
||
4082 |
"/ restore - in case master did not want me to close ... |
|
4083 |
masterApplication := savedMaster. |
|
4084 |
^ self |
|
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4085 |
]. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4086 |
|
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4087 |
(aTopView == myWindow) ifTrue:[ |
4173 | 4088 |
self closeRequest. |
4089 |
^ self |
|
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4090 |
]. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4091 |
|
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4092 |
(aTopView isPartner or:[aTopView isMaster]) ifTrue:[ |
4173 | 4093 |
aTopView application closeRequest. |
4094 |
self closeRequest. |
|
4095 |
^ self. |
|
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4096 |
]. |
1924 | 4097 |
aTopView isSlave ifTrue:[ |
4173 | 4098 |
aTopView closeRequest |
1924 | 4099 |
] ifFalse:[ |
4173 | 4100 |
aTopView application closeRequest. |
1924 | 4101 |
] |
1419 | 4102 |
! |
4103 |
||
4104 |
doAccept |
|
4105 |
"this is invoked by the Return-Key (if returnIsOK) or |
|
4106 |
the ok-button (if any), IFF the application has been |
|
4107 |
opened modal (i.e. as a dialog)." |
|
4108 |
||
4109 |
"/ the following is a bad kludge - |
|
4110 |
"/ actually, modal apps should inherit from SimpleDialog |
|
4111 |
"/ (then, things would be clean) |
|
4112 |
"/ However, it may be useful, to open some app (which is normally |
|
4113 |
"/ modeless) as a modal one as well. |
|
4114 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
4115 |
"/ to remember the accept vs. cancel case. |
|
4116 |
"/ |
|
4117 |
self window isModal ifTrue:[ |
|
4173 | 4118 |
masterApplication notNil ifTrue:[ |
4119 |
masterApplication window topView == self window topView ifTrue:[ |
|
4120 |
masterApplication window isModal ifTrue:[ |
|
4121 |
masterApplication doAccept. |
|
4122 |
^ self. |
|
4123 |
]. |
|
4124 |
]. |
|
4125 |
]. |
|
4126 |
||
4127 |
"/ mhmh - is this a good idea ? |
|
4128 |
self perform:#accept ifNotUnderstood:[self closeRequest]. |
|
4129 |
^ self |
|
1419 | 4130 |
]. |
4131 |
||
4132 |
^ self "/ nothing done here ... |
|
4133 |
! |
|
4134 |
||
4135 |
doCancel |
|
4136 |
"this is invoked by the Escape-Key (if escapeIsCancel) or |
|
4137 |
the cancel-button (if any), IFF the application has been |
|
4138 |
opened modal (i.e. as a dialog)." |
|
4139 |
||
4140 |
"/ the following is a bad kludge - |
|
4141 |
"/ actually, modal apps should inherit from SimpleDialog |
|
4142 |
"/ (then, things would be clean) |
|
4143 |
"/ However, it may be useful, to open some app (which is normally |
|
4144 |
"/ modeless) as a modal one as well. |
|
4145 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
4146 |
"/ to remember the accept vs. cancel case. |
|
1417 | 4147 |
"/ |
1419 | 4148 |
self window isModal ifTrue:[ |
4173 | 4149 |
"/ mhmh - is this a good idea ? |
4150 |
self perform:#cancel ifNotUnderstood:[self closeRequest]. |
|
4151 |
^ self |
|
1419 | 4152 |
]. |
4153 |
^ self "/ nothing done here ... |
|
4154 |
! |
|
4155 |
||
4156 |
releaseAsSubCanvas |
|
4157 |
"a subcanvas is closed or switching to a new application. |
|
4158 |
Can be redefined to perform a self release in this case." |
|
4159 |
||
4160 |
"/ used to self release here, |
|
4161 |
"/ but that is incompatible to VW (RefactoryBrowser). |
|
4162 |
"/ Therefore, if you need it, you MUST now redefine |
|
4163 |
"/ this method. |
|
4164 |
! |
|
4165 |
||
3203 | 4166 |
rememberLastExtent |
4239 | 4167 |
"remember my window's current extent for the next open. |
4168 |
This is sent when closing the window, |
|
4169 |
so that it will open with that extent as default the next time" |
|
3203 | 4170 |
|
4171 |
|window| |
|
4172 |
||
4173 |
window := self window. |
|
4174 |
(window notNil and:[window isTopView]) ifTrue:[ |
|
4240 | 4175 |
self class rememberLastExtentOf:window |
3203 | 4176 |
]. |
4177 |
||
4178 |
"Created: / 31-07-2013 / 14:41:33 / cg" |
|
4240 | 4179 |
"Modified: / 02-03-2019 / 13:09:12 / Claus Gittinger" |
3203 | 4180 |
! |
4181 |
||
1419 | 4182 |
restarted |
4183 |
"sent by my topWindow, when restarted from an image. |
|
4184 |
Nothing done here, but can be redefined to perform any actions |
|
4185 |
required to reset the application after an image-restart. |
|
4186 |
(for example: check if application files are still around, restart |
|
4187 |
subprocesses etc.)." |
|
4188 |
||
4189 |
"Modified: 1.6.1996 / 16:55:50 / cg" |
|
4190 |
! |
|
4191 |
||
4192 |
saveAndTerminateRequest |
|
4193 |
"some windowManagers send this to shut down an application |
|
4194 |
and have it save its state for restart. |
|
4195 |
Can be redefined in subclasses" |
|
4196 |
||
4197 |
self closeRequest |
|
4198 |
! |
|
4199 |
||
4200 |
saveAndTerminateRequestFor:aTopView |
|
4201 |
"some windowManagers send this to shut down an application |
|
4202 |
and have it save its state for restart. |
|
4203 |
Can be redefined in subclasses" |
|
4204 |
||
4205 |
self saveAndTerminateRequest |
|
4206 |
! ! |
|
4207 |
||
4076 | 4208 |
!ApplicationModel methodsFor:'testing'! |
4209 |
||
4210 |
isApplicationModel |
|
4211 |
^ true |
|
4212 |
! ! |
|
4213 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4214 |
!ApplicationModel methodsFor:'translating'! |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4215 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4216 |
translateString:aString |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4217 |
"translate aString to the current language. |
3754 | 4218 |
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
|
4219 |
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
|
4220 |
|
4169 | 4221 |
aString size == 0 ifTrue:[^ '']. |
4164 | 4222 |
^ self resources stringWithCRs:aString asString |
3799 | 4223 |
|
3936 | 4224 |
"Modified: / 27-02-2017 / 13:50:46 / cg" |
4164 | 4225 |
"Modified: / 09-08-2018 / 18:08:56 / Claus Gittinger" |
3799 | 4226 |
! |
4227 |
||
4228 |
translateString:aString with:anArgument |
|
4229 |
"translate aString to the current language. |
|
4230 |
We use the resources as default. |
|
4231 |
Subclasses may redefine this to use another mechanism" |
|
4232 |
||
4164 | 4233 |
^ self resources stringWithCRs:aString asString with:anArgument |
3799 | 4234 |
|
4235 |
"Created: / 25-11-2016 / 09:54:32 / cg" |
|
4164 | 4236 |
"Modified: / 09-08-2018 / 18:09:26 / Claus Gittinger" |
4155 | 4237 |
! |
4238 |
||
4239 |
translateString:aString with:argument1 with:argument2 |
|
4240 |
"translate aString to the current language. |
|
4241 |
We use the resources as default. |
|
4242 |
Subclasses may redefine this to use another mechanism" |
|
4243 |
||
4164 | 4244 |
^ self resources stringWithCRs:aString asString with:argument1 with:argument2 |
4155 | 4245 |
|
4246 |
"Created: / 09-08-2018 / 15:08:11 / Claus Gittinger" |
|
4164 | 4247 |
"Modified: / 09-08-2018 / 18:09:30 / Claus Gittinger" |
4155 | 4248 |
! |
4249 |
||
4171 | 4250 |
translateString:aString with:argument1 with:argument2 with:argument3 |
4251 |
"translate aString to the current language. |
|
4252 |
We use the resources as default. |
|
4253 |
Subclasses may redefine this to use another mechanism" |
|
4254 |
||
4255 |
^ self resources stringWithCRs:aString asString with:argument1 with:argument2 with:argument3 |
|
4256 |
||
4257 |
"Created: / 16-08-2018 / 21:16:40 / Claus Gittinger" |
|
4258 |
! |
|
4259 |
||
4155 | 4260 |
translateString:aString withArguments:anArgumentVector |
4261 |
"translate aString to the current language. |
|
4262 |
We use the resources as default. |
|
4263 |
Subclasses may redefine this to use another mechanism" |
|
4264 |
||
4164 | 4265 |
^ self resources stringWithCRs:aString asString withArguments:anArgumentVector |
4155 | 4266 |
|
4267 |
"Created: / 09-08-2018 / 14:53:55 / Claus Gittinger" |
|
4164 | 4268 |
"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
|
4269 |
! ! |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
4270 |
|
2869 | 4271 |
!ApplicationModel methodsFor:'user interaction & notifications'! |
4272 |
||
4273 |
beep |
|
3442 | 4274 |
"output an audible beep or bell on my screen device" |
4275 |
||
4276 |
device notNil ifTrue:[ |
|
4277 |
device beep. |
|
4278 |
]. |
|
2869 | 4279 |
! |
4280 |
||
4049 | 4281 |
beepInEditor |
4050 | 4282 |
"output an audible beep or bell on my screen device. |
4283 |
||
4284 |
beep to wakeup the user after some error/not found condition in an editor. |
|
4285 |
Use this ONLY to beep in response to a bad user operation (not system failure beeps). |
|
4286 |
Can be disabled via the settings if too annoying" |
|
4287 |
||
4049 | 4288 |
|
4289 |
device notNil ifTrue:[ |
|
4290 |
device beepInEditor. |
|
4291 |
]. |
|
4292 |
! |
|
4293 |
||
2869 | 4294 |
information:aString |
3799 | 4295 |
"like Object's information, but translates the string via the |
4296 |
resourcePack, thus giving a translated string automatically" |
|
4297 |
||
4155 | 4298 |
self informationTranslated:aString |
3799 | 4299 |
|
4300 |
"Created: / 20-05-1998 / 03:48:43 / cg" |
|
4301 |
"Modified: / 25-11-2016 / 09:55:53 / cg" |
|
4155 | 4302 |
"Modified: / 09-08-2018 / 14:51:32 / Claus Gittinger" |
4098 | 4303 |
! |
4304 |
||
4305 |
information:aString translate:aBoolean |
|
4306 |
"like Object's information, but translates the string via the |
|
4307 |
resourcePack, thus giving a translated string automatically" |
|
4308 |
||
4155 | 4309 |
self informationUntranslated:(aBoolean |
4310 |
ifTrue:[ self translateString:(aString?'') ] |
|
4098 | 4311 |
ifFalse:[ aString ]) |
4312 |
||
4313 |
"Created: / 01-06-2018 / 12:51:06 / Claus Gittinger" |
|
4155 | 4314 |
"Modified: / 09-08-2018 / 14:47:38 / Claus Gittinger" |
4315 |
! |
|
4316 |
||
4317 |
information:aString with:anArgument |
|
4318 |
"like Object's information, but translates the string via the |
|
4319 |
resourcePack, thus giving a translated string automatically" |
|
4320 |
||
4321 |
self informationTranslated:aString with:anArgument |
|
4322 |
||
4323 |
"Created: / 09-08-2018 / 14:50:55 / Claus Gittinger" |
|
4324 |
! |
|
4325 |
||
4326 |
information:aString with:anArgument translate:aBoolean |
|
4327 |
"like Object's information, but translates the string via the |
|
4328 |
resourcePack, thus giving a translated string automatically" |
|
4329 |
||
4330 |
self informationUntranslated: |
|
4331 |
(aBoolean |
|
4332 |
ifTrue:[ self translateString:(aString?'') with:anArgument ] |
|
4333 |
ifFalse:[ aString ]) |
|
4334 |
||
4335 |
"Created: / 09-08-2018 / 14:51:06 / Claus Gittinger" |
|
4336 |
! |
|
4337 |
||
4338 |
information:aString with:argument1 with:argument2 |
|
4339 |
"like Object's information, but translates the string via the |
|
4340 |
resourcePack, thus giving a translated string automatically" |
|
4341 |
||
4342 |
self informationTranslated:aString with:argument1 with:argument2 |
|
4343 |
||
4344 |
"Created: / 09-08-2018 / 15:07:28 / Claus Gittinger" |
|
4345 |
! |
|
4346 |
||
4170 | 4347 |
information:aString with:argument1 with:argument2 with:argument3 |
4348 |
"like Object's information, but translates the string via the |
|
4349 |
resourcePack, thus giving a translated string automatically" |
|
4350 |
||
4351 |
self informationTranslated:aString with:argument1 with:argument2 with:argument3 |
|
4352 |
||
4353 |
"Created: / 16-08-2018 / 21:15:19 / Claus Gittinger" |
|
4354 |
! |
|
4355 |
||
4356 |
information:aString withArguments:arguments |
|
4357 |
"like Object's information, but translates the string via the |
|
4358 |
resourcePack, thus giving a translated string automatically" |
|
4359 |
||
4360 |
self informationTranslated:aString withArguments:arguments |
|
4361 |
||
4362 |
"Created: / 16-08-2018 / 21:15:30 / Claus Gittinger" |
|
4363 |
! |
|
4364 |
||
4155 | 4365 |
informationHolder |
4366 |
"applications which want to show this in some info-area at the bottom |
|
4367 |
should redefine this to return a value holder or action-block" |
|
4368 |
||
4369 |
^ [:infoUntranslated | super information:infoUntranslated] |
|
4370 |
||
4371 |
"Created: / 09-08-2018 / 14:48:45 / Claus Gittinger" |
|
3799 | 4372 |
! |
4373 |
||
4374 |
informationTranslated:aString |
|
4375 |
"like Object's information, but translates the string via the |
|
2869 | 4376 |
resourcePack, thus giving a translated string automatically" |
4377 |
||
4155 | 4378 |
self informationUntranslated:(self translateString:aString) |
3799 | 4379 |
|
4380 |
"Created: / 25-11-2016 / 09:59:47 / cg" |
|
4155 | 4381 |
"Modified: / 09-08-2018 / 14:47:41 / Claus Gittinger" |
3799 | 4382 |
! |
4383 |
||
4384 |
informationTranslated:aString with:anArgument |
|
4385 |
"like Object's information, but translates the string via the |
|
4386 |
resourcePack, thus giving a translated string automatically" |
|
4387 |
||
4155 | 4388 |
self informationUntranslated:(self translateString:aString with:anArgument) |
3799 | 4389 |
|
4390 |
"Created: / 25-11-2016 / 10:01:32 / cg" |
|
4155 | 4391 |
"Modified: / 09-08-2018 / 14:47:45 / Claus Gittinger" |
4392 |
! |
|
4393 |
||
4394 |
informationTranslated:aString with:argument1 with:argument2 |
|
4395 |
"like Object's information, but translates the string via the |
|
4396 |
resourcePack, thus giving a translated string automatically" |
|
4397 |
||
4398 |
self informationUntranslated:(self translateString:aString with:argument1 with:argument2) |
|
4399 |
||
4400 |
"Created: / 09-08-2018 / 15:07:50 / Claus Gittinger" |
|
4401 |
! |
|
4402 |
||
4170 | 4403 |
informationTranslated:aString with:argument1 with:argument2 with:argument3 |
4404 |
"like Object's information, but translates the string via the |
|
4405 |
resourcePack, thus giving a translated string automatically" |
|
4406 |
||
4407 |
self informationUntranslated: |
|
4408 |
(self translateString:aString with:argument1 with:argument2 with:argument3) |
|
4409 |
||
4410 |
"Created: / 16-08-2018 / 21:15:47 / Claus Gittinger" |
|
4411 |
! |
|
4412 |
||
4413 |
informationTranslated:aString withArguments:arguments |
|
4414 |
"like Object's information, but translates the string via the |
|
4415 |
resourcePack, thus giving a translated string automatically" |
|
4416 |
||
4417 |
self informationUntranslated: |
|
4418 |
(self translateString:aString withArguments:arguments) |
|
4419 |
||
4420 |
"Created: / 16-08-2018 / 21:16:05 / Claus Gittinger" |
|
4421 |
! |
|
4422 |
||
4172 | 4423 |
informationUntranslated:aStringOrNil |
4155 | 4424 |
"applications which want to show this in some info-area at the bottom |
4425 |
may redefine this or the informationHolder message." |
|
4426 |
||
4172 | 4427 |
self informationHolder value:aStringOrNil |
4155 | 4428 |
|
4429 |
"Created: / 09-08-2018 / 14:47:06 / Claus Gittinger" |
|
4172 | 4430 |
"Modified (format): / 18-08-2018 / 11:12:21 / Claus Gittinger" |
2869 | 4431 |
! |
4432 |
||
4433 |
notify:aString |
|
4091 | 4434 |
"like Object's notify, but translates the string via the |
2869 | 4435 |
resourcePack, thus giving a translated string automatically" |
4436 |
||
4155 | 4437 |
super notify:(self translateString:aString) |
4438 |
||
4439 |
"Created: / 20-05-1998 / 01:14:52 / cg" |
|
4440 |
"Modified: / 13-11-2001 / 20:10:12 / cg" |
|
4441 |
"Modified: / 09-08-2018 / 14:52:27 / Claus Gittinger" |
|
2869 | 4442 |
! |
4443 |
||
4444 |
openDocumentationFile:aFilename |
|
4445 |
HTMLDocumentView notNil ifTrue:[ |
|
4063 | 4446 |
HTMLDocumentView |
4447 |
openFullOnDocumentationFile:aFilename |
|
4448 |
searchIn:{ (self class packageDirectory / 'doc/online') }. |
|
2869 | 4449 |
]. |
4450 |
! |
|
4451 |
||
4452 |
restoreCursors |
|
4453 |
"restore the original cursors in all of my views" |
|
4454 |
||
4143 | 4455 |
^ self windowGroup restoreCursors |
4456 |
||
4457 |
"Created: / 01-06-1996 / 17:01:24 / cg" |
|
4458 |
"Modified: / 04-07-2018 / 11:11:17 / stefan" |
|
2869 | 4459 |
! |
4460 |
||
4461 |
showCursor:aCursor |
|
4462 |
"set all of my views cursor to aCursor. |
|
4463 |
It can be restored with #restoreCursor." |
|
4464 |
||
4143 | 4465 |
^ self windowGroup showCursor:aCursor |
4466 |
||
4467 |
"Created: / 01-06-1996 / 17:01:09 / cg" |
|
4468 |
"Modified: / 04-07-2018 / 11:11:26 / stefan" |
|
2869 | 4469 |
! |
4470 |
||
4471 |
warn:aString |
|
3179 | 4472 |
"like Object's warn, but translates the string via the |
2869 | 4473 |
resourcePack, thus giving a translated string automatically" |
4474 |
||
4157 | 4475 |
self warnUntranslated:(self translateString:aString) |
4476 |
||
4477 |
"Created: / 20-05-1998 / 01:14:52 / cg" |
|
4478 |
"Modified: / 13-11-2001 / 20:10:12 / cg" |
|
4479 |
"Modified: / 09-08-2018 / 15:37:12 / Claus Gittinger" |
|
2869 | 4480 |
! |
4481 |
||
4482 |
warn:aString translate:aBoolean |
|
4091 | 4483 |
"like Object's warn, but optionally translates the string via the |
2869 | 4484 |
resourcePack, thus giving a translated string automatically" |
4485 |
||
4157 | 4486 |
self warnUntranslated: |
4487 |
(aBoolean |
|
4155 | 4488 |
ifTrue:[ (self translateString:aString) ] |
4091 | 4489 |
ifFalse:[ aString ]). |
4155 | 4490 |
|
4157 | 4491 |
"Modified (format): / 09-08-2018 / 15:37:28 / Claus Gittinger" |
2869 | 4492 |
! |
4493 |
||
4494 |
warn:aString with:arg |
|
4091 | 4495 |
"like Object's warn, but translates the string via the |
2869 | 4496 |
resourcePack, thus giving a translated string automatically" |
4497 |
||
4498 |
self warn:aString withArguments:(Array with:arg) |
|
4499 |
! |
|
4500 |
||
4501 |
warn:aString with:arg1 with:arg2 |
|
4091 | 4502 |
"like Object's warn, but translates the string via the |
2869 | 4503 |
resourcePack, thus giving a translated string automatically" |
4504 |
||
4505 |
self warn:aString withArguments:(Array with:arg1 with:arg2) |
|
4506 |
! |
|
4507 |
||
4508 |
warn:aString with:arg1 with:arg2 with:arg3 |
|
4091 | 4509 |
"like Object's warn, but translates the string via the |
2869 | 4510 |
resourcePack, thus giving a translated string automatically" |
4511 |
||
4512 |
self warn:aString withArguments:(Array with:arg1 with:arg2 with:arg3) |
|
4513 |
! |
|
4514 |
||
4515 |
warn:aString with:arg1 with:arg2 with:arg3 with:arg4 |
|
4091 | 4516 |
"like Object's warn, but translates the string via the |
2869 | 4517 |
resourcePack, thus giving a translated string automatically" |
4518 |
||
4519 |
self warn:aString withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) |
|
4520 |
||
4521 |
"Created: / 23.2.2000 / 09:43:04 / cg" |
|
4522 |
! |
|
4523 |
||
4524 |
warn:aString withArguments:argArray |
|
4091 | 4525 |
"like Object's warn, but translates the string via the |
2869 | 4526 |
resourcePack, thus giving a translated string automatically. |
4527 |
Also translates \'s to newLine." |
|
4528 |
||
4157 | 4529 |
self warnUntranslated:(self translateString:aString withArguments:argArray). |
4530 |
||
4531 |
"Modified: / 09-08-2018 / 15:38:12 / Claus Gittinger" |
|
4532 |
! |
|
4533 |
||
4534 |
warnUntranslated:aString |
|
4180 | 4535 |
"do not translate the string via the resourcePack" |
4157 | 4536 |
|
4537 |
super warn:aString. |
|
4538 |
||
4539 |
"Created: / 09-08-2018 / 15:33:29 / Claus Gittinger" |
|
4180 | 4540 |
"Modified (comment): / 20-09-2018 / 09:46:26 / Stefan Vogel" |
2869 | 4541 |
! |
4542 |
||
4543 |
withCursor:aCursor do:aBlock |
|
4544 |
"evaluate aBlock, showing aCursor in my topView and all of its subviews. |
|
4545 |
Return the value of aBlock." |
|
4546 |
||
3317 | 4547 |
|w| |
2869 | 4548 |
|
4549 |
w := self window. |
|
4550 |
w notNil ifTrue:[ |
|
3317 | 4551 |
^ w topView withCursor:aCursor do:aBlock |
2869 | 4552 |
]. |
3317 | 4553 |
^ aCursor showWhile:aBlock. |
2869 | 4554 |
|
4555 |
"Modified: / 23.9.1998 / 17:00:25 / cg" |
|
4556 |
! |
|
4557 |
||
4558 |
withExecuteCursorDo:aBlock |
|
4559 |
"evaluate aBlock, showing an executeCursor in my topView and all of its subviews. |
|
4560 |
Return the value of aBlock." |
|
4561 |
||
4562 |
^ self withCursor:(Cursor execute) do:aBlock |
|
4563 |
||
4564 |
"Created: 14.12.1995 / 20:57:03 / cg" |
|
4565 |
! |
|
4566 |
||
4567 |
withReadCursorDo:aBlock |
|
4568 |
"evaluate aBlock, showing a readCursor in my topView and all of its subviews. |
|
4569 |
Return the value of aBlock." |
|
4570 |
||
4571 |
^ self withCursor:(Cursor read) do:aBlock |
|
4572 |
||
4573 |
"Created: 14.12.1995 / 20:56:47 / cg" |
|
4574 |
"Modified: 14.12.1995 / 20:57:36 / cg" |
|
4575 |
! |
|
4576 |
||
3297 | 4577 |
withVisibleCursor:aCursor do:aBlock |
2869 | 4578 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
4579 |
Return the value of aBlock. |
|
2940
4d8f61704b4a
comment/format in: #withVisibleCursor:do:
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
4580 |
Ensure, that the cursor is visible by the user for a minimal amount of time." |
3297 | 4581 |
|
2869 | 4582 |
|ret| |
4583 |
||
3297 | 4584 |
self |
4173 | 4585 |
withCursor:aCursor do:[ |
4586 |
|time| |
|
4587 |
||
4588 |
time := Time millisecondsToRun:[ ret := aBlock value]. |
|
4589 |
time := UserPreferences current waitCursorVisibleTime - time. |
|
4590 |
time > 0 ifTrue:[ |
|
4591 |
Delay waitForMilliseconds:time. |
|
4592 |
]. |
|
4593 |
]. |
|
2869 | 4594 |
^ ret. |
2940
4d8f61704b4a
comment/format in: #withVisibleCursor:do:
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
4595 |
|
4d8f61704b4a
comment/format in: #withVisibleCursor:do:
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
4596 |
"Modified (comment): / 12-09-2011 / 12:14:31 / cg" |
2869 | 4597 |
! |
4598 |
||
4599 |
withWaitCursorDo:aBlock |
|
4600 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
|
4601 |
Return the value of aBlock." |
|
4602 |
||
4603 |
^ self withCursor:(Cursor wait) do:aBlock |
|
4604 |
! |
|
4605 |
||
3297 | 4606 |
withWaitCursorVisibleDo:aBlock |
2869 | 4607 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
4608 |
Return the value of aBlock. |
|
4609 |
Guarantee, that the cursor is visible by the user for a minimal amount of time." |
|
4610 |
||
4611 |
^ self withVisibleCursor:(Cursor wait) do:aBlock |
|
3013 | 4612 |
! |
4613 |
||
4614 |
withWriteCursorDo:aBlock |
|
4615 |
"evaluate aBlock, showing a writeCursor in my topView and all of its subviews. |
|
4616 |
Return the value of aBlock." |
|
4617 |
||
4618 |
^ self withCursor:(Cursor write) do:aBlock |
|
4619 |
||
4620 |
"Created: / 27-07-2012 / 09:42:53 / cg" |
|
2869 | 4621 |
! ! |
4622 |
||
1419 | 4623 |
!ApplicationModel methodsFor:'window events'! |
4624 |
||
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4625 |
clientMessage:msgType format:msgFormat eventData:msgData |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4626 |
"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
|
4627 |
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
|
4628 |
! |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4629 |
|
2526
d2be37e49195
changed #copyDataEvent:eventData:
Claus Gittinger <cg@exept.de>
parents:
2522
diff
changeset
|
4630 |
copyDataEvent:parameter eventData:msgData |
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4631 |
"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
|
4632 |
Subclasses prepared to receive them should redefine this method" |
2527 | 4633 |
|
4634 |
|messageStream command argument| |
|
4635 |
||
4636 |
messageStream := msgData asString readStream. |
|
4637 |
command := messageStream upTo: $:. |
|
4638 |
argument := messageStream upTo: Character null. |
|
4639 |
self processApplicationCommand:command with:argument |
|
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4640 |
! |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4641 |
|
3416 | 4642 |
delayedAutoRaiseEventFor:oneOfMyViews |
4643 |
"called with a delay by the focusIn code, iff the userPref setting is active. |
|
4644 |
Some (a small number only) may want to prevent autoraise in certain situations |
|
4645 |
- for example, if one view is controlling another. |
|
4646 |
These get a chance to redefine this method" |
|
4647 |
||
4648 |
oneOfMyViews raise. |
|
4649 |
! |
|
4650 |
||
1419 | 4651 |
dispatchEvent:event |
4652 |
"dispatch a user-pushed event. |
|
4653 |
This allows for events for an appModel to be pushed into the event queue |
|
4654 |
the same way as events for a view are pushable." |
|
4655 |
||
3297 | 4656 |
^ self |
4173 | 4657 |
dispatchEvent:event |
4658 |
withFocusOn:nil |
|
4659 |
delegate:true |
|
1419 | 4660 |
|
4661 |
! |
|
4662 |
||
4663 |
dispatchEvent:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
|
4664 |
"dispatch a user-pushed event. |
|
4665 |
This allows for events for an appModel to be pushed into the event queue |
|
4666 |
the same way as events for a view are pushable." |
|
4667 |
||
4668 |
self perform:evType withArguments:evArgs |
|
4669 |
||
4670 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
4671 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
1290 | 4672 |
! |
4673 |
||
1419 | 4674 |
dispatchEvent:ev type:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
4675 |
"dispatch a user-pushed event. |
|
4676 |
This allows for events for an appModel to be pushed into the event queue |
|
4677 |
the same way as events for a view are pushable." |
|
4678 |
||
4679 |
self perform:evType withArguments:evArgs |
|
4680 |
||
4681 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
4682 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
4683 |
! |
|
4684 |
||
3297 | 4685 |
dispatchEvent:event withFocusOn:focusViewOrNil |
1419 | 4686 |
"dispatch a user-pushed event. |
4687 |
This allows for events for an appModel to be pushed into the event queue |
|
4688 |
the same way as events for a view are pushable." |
|
4689 |
||
3297 | 4690 |
^ self |
4173 | 4691 |
dispatchEvent:event |
4692 |
withFocusOn:focusViewOrNil |
|
4693 |
delegate:true |
|
1419 | 4694 |
|
4695 |
||
4696 |
! |
|
4697 |
||
4698 |
dispatchEvent:event withFocusOn:focusViewOrNil delegate:doDelegate |
|
4699 |
"dispatch a user-pushed event. |
|
4700 |
This allows for events for an appModel to be pushed into the event queue |
|
4701 |
the same way as events for a view are pushable." |
|
4702 |
||
3297 | 4703 |
^ self |
4173 | 4704 |
dispatchEvent:event |
4705 |
type:event type |
|
4706 |
arguments:(event arguments) |
|
4707 |
withFocusOn:focusViewOrNil |
|
4708 |
delegate:doDelegate |
|
1419 | 4709 |
|
4710 |
||
4711 |
! |
|
4712 |
||
4713 |
noticeOfWindowClose:aWindow |
|
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4714 |
"sent when a topView or applicationSubView has been closed. |
1419 | 4715 |
Can be redefined in subclasses for cleanup." |
4716 |
||
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4717 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4718 |
self windowEvent:(#close -> aWindow) from:aWindow. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4719 |
^ self |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4720 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4721 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4722 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4723 |
! |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4724 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4725 |
noticeOfWindowOpen:aWindow |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4726 |
"sent when a topView or applicationSubView has been opened. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4727 |
Can be redefined in subclasses." |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4728 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4729 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
4730 |
self windowEvent:(#open -> aWindow) from:aWindow. |
1419 | 4731 |
^ self |
4732 |
||
4733 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
|
4734 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
4735 |
! |
|
4736 |
||
2527 | 4737 |
processApplicationCommand:command with:argument |
4738 |
"a message from a secondary application instance (the exe has been started again). |
|
4739 |
Typically, the command is one like 'openPath:', as generated in StandaloneStartup." |
|
4740 |
||
4741 |
command = 'openPath' ifTrue:[ |
|
4173 | 4742 |
self processOpenPathCommand:argument. |
4743 |
^ self. |
|
2527 | 4744 |
]. |
4745 |
||
4746 |
Transcript showCR: 'Invalid command received: ', command. |
|
4747 |
! |
|
4748 |
||
4749 |
processOpenPathCommand:argument |
|
4750 |
"a message from a secondary application instance (the exe has been started again) |
|
4751 |
to open another window on document as found in the pathName argument. |
|
4752 |
Left blank (i.e. ignored) here, but can be redefined to open up another application |
|
4753 |
editor window if supported." |
|
4754 |
! |
|
4755 |
||
3200
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4756 |
processShortcut:aKeyEvent |
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4757 |
"a shortcut key event as forwarded from the keyboardProcessor - if there is the |
3297 | 4758 |
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
|
4759 |
|
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4760 |
^false |
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4761 |
|
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4762 |
"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
|
4763 |
! |
009ddfb1e69a
Added ApplicationModel>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3195
diff
changeset
|
4764 |
|
1419 | 4765 |
requestForWindowClose |
4766 |
"the applicationWindow wants to know, if a close |
|
4767 |
is ok. Return false if not." |
|
4768 |
||
4769 |
|w k| |
|
4770 |
||
4771 |
builder notNil ifTrue:[ |
|
4173 | 4772 |
(w := builder window) notNil ifTrue:[ |
4773 |
(k := w keyboardProcessor) notNil ifTrue:[ |
|
4774 |
^ k requestForWindowClose |
|
4775 |
] |
|
4776 |
] |
|
1419 | 4777 |
]. |
4778 |
^ true |
|
4779 |
||
4780 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
4781 |
"Created: / 19.6.1998 / 01:34:58 / cg" |
|
4782 |
! |
|
4783 |
||
4784 |
showActivity:someMessage |
|
4785 |
"some activityNotification shalt be communicated to |
|
4786 |
the user. Forwarded from the topView and ignored here. |
|
4787 |
Can be redefined in concrete applications to show the |
|
4788 |
message either in some infoView (infoLabel as in Windows) |
|
4789 |
or in the title area (as done in the browsers)" |
|
4790 |
||
4272 | 4791 |
"/ should be redefined in concrete appModels to display this in an info area |
4792 |
"/ at the bottom of the main window. (see implementors on how to do this) |
|
4793 |
||
4794 |
Logger debug:'activity: %1' with:someMessage. |
|
1419 | 4795 |
^ self |
4796 |
||
4272 | 4797 |
"Created: / 16-12-1995 / 18:41:04 / cg" |
4798 |
"Modified: / 24-04-1996 / 09:34:22 / cg" |
|
4799 |
"Modified: / 28-05-2019 / 15:57:55 / Claus Gittinger" |
|
1419 | 4800 |
! |
4801 |
||
4802 |
windowEvent:anEvent from:anApplicationWindow |
|
4803 |
"dummy: windowEvent forwarding is not yet implemented" |
|
4804 |
||
4805 |
^ self |
|
4806 |
||
4807 |
"Modified: 24.4.1996 / 09:32:50 / cg" |
|
4808 |
! ! |
|
4809 |
||
4810 |
!ApplicationModel class methodsFor:'documentation'! |
|
4811 |
||
2753
f8c6eadde7bb
changed: #flyByHelpTextForKey:
Claus Gittinger <cg@exept.de>
parents:
2747
diff
changeset
|
4812 |
version_CVS |
3484 | 4813 |
^ '$Header$' |
85 | 4814 |
! ! |
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
4815 |
|
3108 | 4816 |
|
1419 | 4817 |
ApplicationModel initialize! |