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