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