author | fm |
Tue, 02 Dec 2008 12:01:02 +0100 | |
changeset 2569 | 4ea35689e2df |
parent 2568 | 0fa3e0207594 |
child 2579 | 85e611561864 |
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 |
||
14 |
Model subclass:#ApplicationModel |
|
2396 | 15 |
instanceVariableNames:'builder resources device masterApplication' |
16 |
classVariableNames:'DefaultLabels DefaultVisuals' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Framework' |
|
138 | 19 |
! |
20 |
||
1419 | 21 |
ApplicationModel class instanceVariableNames:'ClassResources' |
22 |
||
23 |
" |
|
24 |
No other class instance variables are inherited by this class. |
|
25 |
" |
|
1350 | 26 |
! |
27 |
||
1419 | 28 |
!ApplicationModel class methodsFor:'documentation'! |
29 |
||
1417 | 30 |
copyright |
1419 | 31 |
" |
32 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
2396 | 33 |
All Rights Reserved |
1419 | 34 |
|
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
Since many ST-80 classes are subclasses of ApplicationModel, this class |
|
47 |
is provided here to allow easier porting of ST-80 code. |
|
48 |
||
49 |
It does not (currently) provide all functionality and is NOT |
|
50 |
compatible to the corresponding ST80 class; therefore, manual |
|
51 |
changes have to be made to get those applications to run under ST/X. |
|
52 |
(but at least, this enables you to fileIn that code and have a superclass |
|
53 |
for them) |
|
54 |
||
55 |
As time goes by, ST/X applications are going to be converted to |
|
56 |
become subclasses of this abstract class - see Launcher for a |
|
57 |
first concrete example. |
|
58 |
||
59 |
||
60 |
ApplicationModel is prepared to build a view from a windowSpec, as |
|
61 |
created by the windowBuilder. If your subclass does not provide such |
|
62 |
a spec, you should at least redefine: |
|
63 |
||
64 |
#openInterface - to create a topview and open it |
|
65 |
||
66 |
you may want to redefine: |
|
67 |
||
68 |
#closeRequest - to catch window closing |
|
69 |
#focusSequence - to define a sequence for focus-stepping |
|
70 |
||
71 |
||
72 |
Once the interfaceBuilder is finished & released, subclasses can |
|
73 |
alternatively provide the spec via a #windowSpec method. |
|
74 |
||
75 |
The classResources have been put into this class to allow ST/X |
|
76 |
applications (which used to be subclasses of StandardSystemView) |
|
77 |
to migrate smoothly into ApplicationModels (which is better design ...). |
|
78 |
||
79 |
||
80 |
[Instance variables:] |
|
81 |
resources ResourcePack language string translation |
|
82 |
||
83 |
builder WindowBuilder a builder who knows how to create |
|
84 |
a window hierarchy from a specification |
|
85 |
||
86 |
||
87 |
Notice: this class was implemented using protocol information |
|
88 |
from alpha testers and PD code - it may not be complete or compatible to |
|
89 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
90 |
please forward a note to the ST/X team. |
|
91 |
||
92 |
||
93 |
[author:] |
|
94 |
Claus Gittinger |
|
95 |
||
96 |
[see also:] |
|
97 |
StandardSystemView |
|
98 |
WindowGroup DeviceWorkstation |
|
99 |
" |
|
2527 | 100 |
! |
101 |
||
102 |
howToDealWithMultipleApplicationInstances |
|
103 |
" |
|
104 |
The following relates to StandAlone applications (i.e. compiled exe's) only. |
|
105 |
If the user attempts to open another of the applications documents (after the first instance |
|
106 |
of the application has already been opened), it is sometimes required to notify the first |
|
107 |
application about this and to ask it to open an extra window on the second-clicked document. |
|
108 |
In other words: to get another of the first instances' windows instead of opening a window |
|
109 |
by the second application. |
|
110 |
||
111 |
This is implemented via the following mechanism (see StandaloneStartup): |
|
112 |
the first application instance leaves the information about its existence somewhere |
|
113 |
(under win32: in the registry, the window-ID of its main window is remembered; |
|
114 |
under unix, its stored into a locked file). |
|
115 |
a mutex is created to prevent a race on this informationduring startup |
|
116 |
(under win32: a mutex proper; under unix, the above locked file will do) |
|
117 |
||
118 |
when the app is started the second time, it will not be able to aquire the mutex (and therefore |
|
119 |
knows, that its the second instance). It will then send an event-message (win32: via copyData; |
|
120 |
unix. via sendClientEvent), to the first instance and pass the fileName of the document which |
|
121 |
is to be opened. The first instance receives this event and opens another window for it. |
|
122 |
The second instance simply exits and stops execution. |
|
123 |
This guarantees that only one instance of an application is executing (if desired). |
|
124 |
||
125 |
The implementation is found in: |
|
126 |
StandaloneStartup: |
|
127 |
checkForAndExitIfAnotherApplicationInstanceIsRunning |
|
128 |
||
129 |
here: |
|
130 |
processOpenPathCommand:aFilename |
|
131 |
||
132 |
By default, the event is ignored - subclasses which want to support that behavior MUST |
|
133 |
redefine processOpenPathCommand: in ApplicationModel and also make sure that |
|
134 |
checkForAndExitIfAnotherApplicationInstanceIsRunning is called for in StandaloneStartup. |
|
135 |
||
136 |
" |
|
1419 | 137 |
! ! |
138 |
||
139 |
!ApplicationModel class methodsFor:'initialization'! |
|
140 |
||
141 |
initialize |
|
142 |
self == ApplicationModel ifTrue:[ |
|
143 |
Smalltalk addDependent:self |
|
144 |
]. |
|
145 |
DefaultLabels isNil ifTrue:[ |
|
146 |
DefaultLabels := IdentityDictionary new |
|
147 |
]. |
|
148 |
DefaultVisuals isNil ifTrue:[ |
|
149 |
DefaultVisuals := IdentityDictionary new |
|
150 |
]. |
|
151 |
||
152 |
" |
|
153 |
ApplicationModel initialize |
|
154 |
" |
|
155 |
||
156 |
"Modified: 28.1.1997 / 12:31:38 / cg" |
|
157 |
! ! |
|
158 |
||
159 |
!ApplicationModel class methodsFor:'instance creation'! |
|
160 |
||
161 |
new |
|
162 |
"return a new initialized instance" |
|
163 |
||
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
|
164 |
^ self basicNew basicInitialize; initialize; yourself. |
1419 | 165 |
! |
166 |
||
167 |
onDevice:aDevice |
|
1828 | 168 |
"return a new initialized instance, which shall open its interface on aDevice." |
169 |
||
170 |
^ (super basicNew basicInitialize setDevice:aDevice) initialize |
|
1419 | 171 |
! ! |
172 |
||
173 |
!ApplicationModel class methodsFor:'accessing'! |
|
174 |
||
175 |
application |
|
176 |
^ self |
|
177 |
||
178 |
! ! |
|
179 |
||
180 |
!ApplicationModel class methodsFor:'active help'! |
|
181 |
||
1538 | 182 |
flyByHelpSpec |
183 |
"default is: no help-spec (should be redefined by concrete class if help is wanted)." |
|
184 |
||
2569 | 185 |
^ self helpSpec |
1538 | 186 |
! |
187 |
||
1419 | 188 |
helpSpec |
1431 | 189 |
"default is: no help-spec (should be redefined by concrete class if help is wanted)." |
190 |
||
1419 | 191 |
^ IdentityDictionary new. |
192 |
! ! |
|
193 |
||
194 |
!ApplicationModel class methodsFor:'bindings'! |
|
195 |
||
196 |
actionFor:aKey |
|
197 |
"sent by the builder to ask for an actionBlock for |
|
198 |
a Button. The argument, aKey comes from an UI-spec |
|
199 |
for a buttons #action property. |
|
200 |
Here, a corresponding message is sent to myself, |
|
201 |
which ought to be defined in the application subclass. |
|
202 |
Alternatively, a subclass may redefine this method, to provide |
|
203 |
actionBlocks from a Dictionary or whatever. |
|
204 |
Typically, a block is returned there." |
|
205 |
||
206 |
^ nil |
|
207 |
||
208 |
||
209 |
! |
|
210 |
||
211 |
actionFor:aKey withValue:aValue |
|
212 |
"sent by the builder to ask for an actionBlock for |
|
213 |
a Button which passes a value to the actionMethod. |
|
214 |
The argument, aKey comes from an UI-spec |
|
215 |
for a buttons #action property. |
|
216 |
Here, a corresponding message is sent to myself, |
|
217 |
which ought to be defined in the application subclass. |
|
218 |
Alternatively, a subclass may redefine this method, to provide |
|
219 |
actionBlocks from a Dictionary or whatever. |
|
220 |
Typically, a block is returned there." |
|
221 |
||
222 |
^ nil |
|
223 |
||
224 |
||
225 |
! |
|
226 |
||
227 |
aspectFor:aKey |
|
228 |
"sent by the builder to ask for an aspect (a data model). |
|
229 |
The argument, aKey comes from an UI-spec |
|
230 |
for a components #aspect property. |
|
231 |
Here, a corresponding message is sent to myself, |
|
232 |
which ought to be defined in the application subclass. |
|
233 |
Alternatively, a subclass may redefine this method, to provide |
|
234 |
holders from a Dictionary or whatever. |
|
235 |
Typically, a valueHolder is returned there." |
|
236 |
||
237 |
^ self perform:aKey |
|
238 |
||
239 |
"/ ^ nil |
|
240 |
||
241 |
"Modified: / 27.10.1997 / 13:43:12 / cg" |
|
242 |
! |
|
243 |
||
244 |
clientFor:aKey |
|
245 |
"sent by the builder to ask for an application provided |
|
246 |
subcanvas's application. |
|
247 |
The argument, aKey comes from an UI-spec |
|
248 |
for a subcanvas's #client 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 |
appModels from a Dictionary or whatever. |
|
253 |
Typically, an applicationModel is returned there." |
|
254 |
||
255 |
^ nil |
|
256 |
||
257 |
! |
|
258 |
||
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
259 |
colorFor:aSymbol |
2472 | 260 |
"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
|
261 |
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
|
262 |
for a widgets #*Color property. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
263 |
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
|
264 |
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
|
265 |
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
|
266 |
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
|
267 |
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
|
268 |
|
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
269 |
(self respondsTo:aSymbol) ifTrue:[ |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
270 |
^ self perform:aSymbol. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
271 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
272 |
|
2481
1fc2941fe30e
#colorFor:enhance color name resolution.
Stefan Vogel <sv@exept.de>
parents:
2472
diff
changeset
|
273 |
"fall back to a possibly well defined color name" |
1fc2941fe30e
#colorFor:enhance color name resolution.
Stefan Vogel <sv@exept.de>
parents:
2472
diff
changeset
|
274 |
^ 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
|
275 |
! |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
276 |
|
1419 | 277 |
componentFor:aKey |
278 |
"sent by the builder to ask for an application provided |
|
279 |
component. |
|
280 |
The argument, aKey comes from an UI-spec |
|
281 |
for a viewHolders #view property. |
|
282 |
Here, a corresponding message is sent to myself, |
|
283 |
which ought to be defined in the application subclass. |
|
284 |
Alternatively, a subclass may redefine this method, to provide |
|
285 |
holders from a Dictionary or whatever. |
|
286 |
Typically, a view is returned there." |
|
287 |
||
288 |
(self respondsTo:aKey) ifTrue:[ |
|
289 |
^ self perform:aKey |
|
290 |
]. |
|
291 |
^ nil |
|
292 |
! |
|
293 |
||
2472 | 294 |
fontFor:aSymbol |
295 |
"sent by the builder to ask for an application provided font. |
|
296 |
The argument, aKey comes from an UI-spec |
|
297 |
for a widgets #*Font property. |
|
298 |
Here, a corresponding message is sent to myself, |
|
299 |
which ought to be defined in the application subclass. |
|
300 |
Alternatively, a subclass may redefine this method, to provide |
|
301 |
holders from a Dictionary or whatever. |
|
302 |
Typically, a font is returned there." |
|
303 |
||
304 |
(self respondsTo:aSymbol) ifTrue:[ |
|
305 |
^ self perform:aSymbol. |
|
306 |
]. |
|
307 |
||
308 |
"/ "fall back to a well defined font name" |
|
309 |
"/ (Font respondsTo:aSymbol) ifTrue:[ |
|
310 |
"/ ^ Font perform:aSymbol. |
|
311 |
"/ ]. |
|
312 |
^ nil |
|
313 |
! |
|
314 |
||
1419 | 315 |
labelFor:aKey |
316 |
"sent by the builder to ask for an application provided |
|
317 |
label for a component. |
|
318 |
The argument, aKey comes from an UI-spec |
|
319 |
for a components #label property. |
|
320 |
Here, a corresponding message is sent to myself, |
|
321 |
which ought to be defined in the application subclass. |
|
322 |
Alternatively, a subclass may redefine this method, to provide |
|
323 |
labels from a Dictionary or whatever. |
|
324 |
Typically, a string is returned there." |
|
325 |
||
2058 | 326 |
|app| |
327 |
||
328 |
app := self application. |
|
329 |
app isNil ifTrue:[^ nil]. |
|
330 |
(app respondsTo:aKey) ifTrue:[ |
|
331 |
^ app perform:aKey |
|
1419 | 332 |
]. |
2058 | 333 |
^ app labelAt:aKey ifAbsent:nil |
1419 | 334 |
! |
335 |
||
336 |
listFor:aKey |
|
337 |
"sent by the builder to ask for an application provided |
|
338 |
holder for a list. |
|
339 |
The argument, aKey comes from an UI-spec |
|
340 |
for a listWidgets #list property. |
|
341 |
Here, a corresponding message is sent to myself, |
|
342 |
which ought to be defined in the application subclass. |
|
343 |
Alternatively, a subclass may redefine this method, to provide |
|
344 |
holders from a Dictionary or whatever. |
|
345 |
Typically, a list-holding model (SelectionInList) is returned there." |
|
346 |
||
347 |
|app| |
|
348 |
||
2058 | 349 |
app := self application. |
350 |
app notNil ifTrue:[ |
|
1419 | 351 |
(app respondsTo:aKey) ifTrue:[ |
352 |
^ app perform:aKey |
|
353 |
] |
|
354 |
]. |
|
355 |
^ nil. |
|
356 |
||
357 |
"Modified: 4.3.1997 / 00:53:03 / cg" |
|
358 |
! |
|
359 |
||
360 |
menuFor:aKey |
|
361 |
"sent by the builder to ask for an application provided |
|
362 |
holder for a menu. |
|
363 |
The argument, aKey comes from an UI-spec |
|
364 |
for a widgets #menu property. |
|
365 |
Here, a corresponding message is sent to myself, |
|
366 |
which ought to be defined in the application subclass. |
|
367 |
Alternatively, a subclass may redefine this method, to provide |
|
368 |
holders from a Dictionary or whatever. |
|
369 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
370 |
||
371 |
^ self application perform:aKey |
|
372 |
||
373 |
! |
|
374 |
||
375 |
specificationFor:aKey |
|
376 |
"sent by the builder to ask for an application provided |
|
377 |
specification for a subcanvas or subspecification. |
|
378 |
The argument, aKey comes from an UI-spec |
|
379 |
for a subcanvases #specification property (minorKey). |
|
380 |
Here, a corresponding message is sent to myself, |
|
381 |
which ought to be defined in the application subclass. |
|
382 |
Alternatively, a subclass may redefine this method, to provide |
|
383 |
interfaceSpecifications from a Dictionary or whatever. |
|
384 |
Typically, an interfaceSpecification is returned there." |
|
385 |
||
1584 | 386 |
^ self |
387 |
specificationFor:aKey |
|
388 |
application:self |
|
389 |
onDevice:nil |
|
390 |
! |
|
391 |
||
392 |
specificationFor:aKey application:app onDevice:deviceOrNil |
|
393 |
"sent by the builder to ask for an application provided |
|
394 |
specification for a subcanvas or subspecification. |
|
395 |
The argument, aKey comes from an UI-spec |
|
396 |
for a subcanvases #specification property (minorKey). |
|
397 |
Here, a corresponding message is sent to myself, |
|
398 |
which ought to be defined in the application subclass. |
|
399 |
Alternatively, a subclass may redefine this method, to provide |
|
400 |
interfaceSpecifications from a Dictionary or whatever. |
|
401 |
Typically, an interfaceSpecification is returned there." |
|
402 |
||
403 |
|displayDevice displayDeviceType modifiedKey appClass| |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
404 |
|
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
405 |
"/ this code is so ugly... |
1584 | 406 |
"/ translate the specs name, if the display device type is different |
407 |
"/ for example, if the type is pda, the xxxSpec_pda spec will be used. |
|
408 |
displayDevice := deviceOrNil ? Screen current ? Screen default. |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
409 |
displayDevice notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
410 |
displayDeviceType := displayDevice deviceType. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
411 |
displayDeviceType notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
412 |
modifiedKey := (aKey , '_' , displayDeviceType) asSymbolIfInterned. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
413 |
modifiedKey notNil ifTrue:[ |
1584 | 414 |
(app respondsTo:modifiedKey) ifTrue:[ |
415 |
^ app perform:modifiedKey |
|
416 |
]. |
|
417 |
app isBehavior ifFalse:[ |
|
418 |
appClass := app application. |
|
419 |
(appClass respondsTo:modifiedKey) ifTrue:[ |
|
420 |
^ appClass perform:modifiedKey |
|
421 |
]. |
|
422 |
]. |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
423 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
424 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
425 |
]. |
1584 | 426 |
|
427 |
app isBehavior ifFalse:[ |
|
428 |
(app respondsTo:aKey) ifTrue:[ |
|
429 |
^ app perform:aKey |
|
430 |
]. |
|
431 |
appClass := app application. |
|
432 |
(appClass respondsTo:aKey) ifTrue:[ |
|
433 |
^ appClass perform:aKey |
|
434 |
]. |
|
435 |
^ app masterApplication specificationFor:aKey |
|
436 |
]. |
|
437 |
||
438 |
^ app perform:aKey |
|
1115 | 439 |
! |
440 |
||
2058 | 441 |
subApplicationFor:aKey |
442 |
"sent by subCanvas to ask for an application inside itself. |
|
443 |
The argument, aKey comes from a TabList-specs majorKey. |
|
444 |
Here, a corresponding message is sent to myself, |
|
445 |
which ought to be defined in the application subclass. |
|
446 |
Alternatively, a subclass may redefine this method, to provide |
|
447 |
an application from a Dictionary or whatever. |
|
448 |
Typically, an ApplicationModel subinstance is returned there." |
|
449 |
||
450 |
|app| |
|
451 |
||
452 |
app := self application. |
|
453 |
(app respondsTo:aKey) ifTrue:[ |
|
454 |
^ app perform:aKey |
|
455 |
]. |
|
456 |
^ nil |
|
457 |
! |
|
458 |
||
1419 | 459 |
visualFor:aKey |
460 |
"sent by the builder to ask for an application provided |
|
461 |
image or element for a label. |
|
462 |
The argument, aKey comes from an UI-spec |
|
463 |
for a widgets #label property, if LabelIsImage is turned on. |
|
464 |
Here, a corresponding message is sent to myself, |
|
465 |
which ought to be defined in the application subclass. |
|
466 |
Alternatively, a subclass may redefine this method, to provide |
|
467 |
images from a Dictionary or whatever. |
|
468 |
Typically, an image is returned there." |
|
469 |
||
1781 | 470 |
|app| |
471 |
||
472 |
app := self application. |
|
473 |
(app respondsTo:aKey) ifTrue:[ |
|
474 |
^ app perform:aKey |
|
1419 | 475 |
]. |
1781 | 476 |
^ app visualAt:aKey ifAbsent:nil |
1419 | 477 |
! ! |
478 |
||
479 |
!ApplicationModel class methodsFor:'change & update'! |
|
480 |
||
481 |
update:something with:aParameter from:changedObject |
|
482 |
"flush resources on language changes" |
|
483 |
||
484 |
something == #Language ifTrue:[ |
|
485 |
self flushAllClassResources |
|
486 |
] |
|
487 |
||
488 |
"Created: 15.6.1996 / 15:13:29 / cg" |
|
489 |
! ! |
|
490 |
||
491 |
!ApplicationModel class methodsFor:'defaults'! |
|
492 |
||
2554
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
493 |
defaultHttpServerPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
494 |
^ HTTPServer defaultPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
495 |
! |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
496 |
|
1419 | 497 |
defaultIcon |
1431 | 498 |
"default is: no icon (should be redefined by concrete class if an icon is wanted)." |
499 |
||
1419 | 500 |
^ nil |
501 |
! |
|
502 |
||
2496
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
503 |
defaultIconForAboutBox |
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
504 |
^ self defaultIcon |
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
505 |
! |
133bb0589d18
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
506 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
507 |
defaultServiceLinkName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
508 |
^ '/portal' |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
509 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
510 |
|
1419 | 511 |
labelAt:aKey |
1431 | 512 |
"default is: no label (could be redefined by concrete class )." |
513 |
||
1419 | 514 |
^ nil |
515 |
! |
|
516 |
||
517 |
labelAt:aKey ifAbsent:aBlock |
|
1431 | 518 |
"default is: no label (could be redefined by concrete class )." |
519 |
||
1419 | 520 |
^ aBlock value |
521 |
! |
|
522 |
||
523 |
labelAt:aKey put:aValue |
|
524 |
"/ not yet implemented |
|
525 |
! |
|
526 |
||
527 |
labels |
|
528 |
"/ not yet implemented |
|
529 |
^ nil |
|
530 |
! |
|
531 |
||
532 |
visualAt:aKey |
|
1431 | 533 |
"default is: no visual (could be redefined by concrete class )." |
534 |
||
1419 | 535 |
^ nil |
536 |
! |
|
537 |
||
538 |
visualAt:aKey ifAbsent:aBlock |
|
1431 | 539 |
"default is: no visual (could be redefined by concrete class )." |
540 |
||
1419 | 541 |
^ aBlock value |
542 |
! |
|
543 |
||
544 |
visualAt:aKey put:aValue |
|
545 |
"/ not yet implemented |
|
546 |
! |
|
547 |
||
548 |
visuals |
|
549 |
"/ not yet implemented |
|
550 |
^ nil |
|
551 |
! ! |
|
552 |
||
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
553 |
!ApplicationModel class methodsFor:'help'! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
554 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
555 |
aboutImage |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
556 |
"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
|
557 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
558 |
^ self defaultIcon |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
559 |
! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
560 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
561 |
aboutThisApplicationLabel |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
562 |
"label for an about box for this application." |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
563 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
564 |
^ 'About This Application' |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
565 |
! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
566 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
567 |
aboutThisApplicationText |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
568 |
"text for an about box for this application." |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
569 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
570 |
|rev clsRev msg| |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
571 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
572 |
rev := ''. |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
573 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
574 |
(clsRev := self revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
575 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
576 |
msg := '\' withCRs , self name asBoldText, rev. |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
577 |
^ msg |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
578 |
|
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
579 |
"Created: / 13.11.2001 / 12:28:36 / cg" |
2382 | 580 |
! |
581 |
||
582 |
documentationPath |
|
583 |
|packageDir| |
|
584 |
||
585 |
packageDir := Smalltalk getPackageDirectoryForPackage:(self package). |
|
586 |
packageDir isNil ifTrue:[ |
|
587 |
packageDir := Filename defaultDirectory |
|
588 |
]. |
|
589 |
#( |
|
590 |
'documentation' |
|
591 |
'doc' |
|
592 |
) do:[:subDir | |
|
593 |
(packageDir construct:subDir) exists ifTrue:[ |
|
594 |
^ packageDir construct:subDir |
|
595 |
]. |
|
596 |
]. |
|
597 |
^ packageDir construct:'doc' |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
598 |
! ! |
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
599 |
|
1997 | 600 |
!ApplicationModel class methodsFor:'private'! |
601 |
||
602 |
selfResponsibleFor:aKey |
|
603 |
^ self respondsTo:aKey |
|
604 |
! ! |
|
605 |
||
1419 | 606 |
!ApplicationModel class methodsFor:'queries'! |
607 |
||
608 |
interfaceSpecFor:aSelector |
|
609 |
"return an interface spec" |
|
2287
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
610 |
|
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
611 |
|spec| |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
612 |
|
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
613 |
spec := self application specificationFor:aSelector. |
2355 | 614 |
spec isNil ifTrue:[^ nil]. |
2287
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
615 |
spec class missingClassInLiteralArrayErrorSignal |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
616 |
handle:[:ex | |
2295
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
617 |
|clsInMyNamespace className| |
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
618 |
|
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
619 |
className := ex parameter. |
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
620 |
className isSymbol ifTrue:[ |
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
621 |
"retry with my nameSpace" |
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
622 |
clsInMyNamespace := self nameSpace at:className. |
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
623 |
clsInMyNamespace notNil ifTrue:[ ex proceedWith:clsInMyNamespace]. |
c303807aa17e
Fix exception handling with non-symbol classes
Stefan Vogel <sv@exept.de>
parents:
2289
diff
changeset
|
624 |
]. |
2287
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
625 |
self warn:ex description. |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
626 |
ex proceedWith:nil |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
627 |
] |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
628 |
do:[ |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
629 |
^ UISpecification from:(self application specificationFor:aSelector) |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
630 |
] |
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
631 |
|
fc04b196d28c
care for namespace in a literalspec
Claus Gittinger <cg@exept.de>
parents:
2270
diff
changeset
|
632 |
"Modified: / 26-02-2007 / 18:30:25 / cg" |
1419 | 633 |
! |
634 |
||
635 |
isVisualStartable |
|
1427 | 636 |
"return true, if this application can be started via #open. |
637 |
(to allow start of a change browser via double-click in the browser)" |
|
1419 | 638 |
|
639 |
(self == ApplicationModel) ifTrue:[^ false "I am abstract"]. |
|
1556
388922a9c6eb
implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
640 |
((self respondsTo:#open) or:[self class includesSelector:#openInterface]) ifFalse:[^ false]. |
1419 | 641 |
"/ (self respondsTo:#windowSpec) ifFalse:[^ false]. |
642 |
^ true |
|
643 |
||
644 |
"Created: / 27.10.1997 / 16:38:02 / cg" |
|
645 |
"Modified: / 14.3.1998 / 16:30:50 / cg" |
|
646 |
! ! |
|
647 |
||
648 |
!ApplicationModel class methodsFor:'resources'! |
|
649 |
||
650 |
classResources |
|
1955
257a4acb852b
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
651 |
"if not already loaded, get the classes resourcePack and return it" |
1419 | 652 |
|
653 |
ClassResources isNil ifTrue:[ |
|
1955
257a4acb852b
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
654 |
ClassResources := super classResources. |
1419 | 655 |
]. |
656 |
^ ClassResources |
|
657 |
! |
|
658 |
||
659 |
classResources:aResourcePack |
|
660 |
"allow setting of the classResources" |
|
661 |
||
662 |
ClassResources := aResourcePack |
|
663 |
! |
|
664 |
||
665 |
flushAllClassResources |
|
666 |
"flush all classes resource translations. |
|
667 |
Needed after a resource file / language setting has changed." |
|
668 |
||
669 |
ResourcePack flushCachedResourcePacks. |
|
670 |
self flushClassResources. |
|
671 |
self allSubclassesDo:[:aClass | |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
672 |
aClass flushClassResources. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
673 |
]. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
674 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
675 |
WindowGroup scheduledWindowGroups |
2445 | 676 |
do:[:wg | |
677 |
|app| |
|
678 |
||
679 |
(app := wg application) notNil ifTrue:[ |
|
680 |
app initializeResources |
|
681 |
] |
|
682 |
] |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
683 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
684 |
"Modified: / 13-09-2006 / 12:41:31 / cg" |
1419 | 685 |
! |
686 |
||
687 |
flushClassResources |
|
688 |
"flush classes resource string translations. |
|
689 |
Needed whenever a resource file / language setting has changed" |
|
690 |
||
691 |
ClassResources := nil. |
|
692 |
! |
|
693 |
||
694 |
resources |
|
695 |
"return the applications resources - thats a ResourcePack containing |
|
696 |
language strings" |
|
697 |
||
698 |
^ self classResources |
|
699 |
||
700 |
"Created: / 19.5.1998 / 20:14:00 / cg" |
|
701 |
! |
|
702 |
||
703 |
updateClassResources |
|
704 |
"update my classResources" |
|
705 |
||
706 |
ClassResources := nil. |
|
707 |
self classResources |
|
708 |
! ! |
|
709 |
||
710 |
!ApplicationModel class methodsFor:'startup'! |
|
711 |
||
712 |
open |
|
713 |
"create an instance of the application and open its view" |
|
714 |
||
715 |
^ self new open |
|
716 |
||
717 |
" |
|
718 |
Launcher open |
|
719 |
" |
|
720 |
||
721 |
"Modified: 13.1.1997 / 20:54:50 / cg" |
|
722 |
! |
|
723 |
||
724 |
openAt:aLocation |
|
725 |
"create an instance of the application and open its view |
|
726 |
at some position." |
|
727 |
||
728 |
^ self new openAt:aLocation |
|
729 |
||
730 |
"Modified: 14.2.1997 / 20:28:41 / cg" |
|
731 |
! |
|
732 |
||
733 |
openDialogInterface:anInterfaceSymbol |
|
734 |
"create an instance of the application and open a view as |
|
735 |
specified by anInterfaceSymbol." |
|
736 |
||
737 |
^ self openDialogInterface:anInterfaceSymbol withBindings:nil |
|
738 |
||
739 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
740 |
"Created: 14.2.1997 / 20:33:10 / cg" |
|
741 |
"Modified: 28.2.1997 / 14:07:36 / cg" |
|
742 |
! |
|
743 |
||
744 |
openDialogInterface:anInterfaceSymbol withBindings:bindings |
|
745 |
"create an instance of the application and open a view as |
|
746 |
specified by anInterfaceSymbol." |
|
747 |
||
748 |
^ self new openDialogInterface:anInterfaceSymbol withBindings:bindings |
|
749 |
||
750 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
751 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
752 |
"Created: 28.2.1997 / 14:07:24 / cg" |
|
753 |
! |
|
754 |
||
755 |
openDialogInterfaceSpec:anInterfaceSpec |
|
756 |
"create an instance of the application and open a view as |
|
757 |
specified by the given spec." |
|
758 |
||
759 |
^ self new |
|
760 |
openDialogInterfaceSpec:anInterfaceSpec |
|
761 |
withBindings:nil |
|
762 |
! |
|
763 |
||
764 |
openDialogInterfaceSpec:anInterfaceSpec withBindings:bindings |
|
765 |
"create an instance of the application and open a view as |
|
766 |
specified by the given spec." |
|
767 |
||
768 |
^ self new |
|
769 |
openDialogInterfaceSpec:anInterfaceSpec |
|
770 |
withBindings:bindings |
|
771 |
||
772 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
773 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
774 |
"Created: 28.2.1997 / 14:07:24 / cg" |
|
775 |
! |
|
776 |
||
777 |
openDialogSpec:aSpec |
|
778 |
"create an instance of the application and open a view as |
|
779 |
specified by aSpec." |
|
780 |
||
781 |
^ self openDialogSpec:aSpec withBindings:nil |
|
782 |
||
783 |
"Modified: / 5.9.1995 / 17:54:50 / claus" |
|
784 |
"Modified: / 28.2.1997 / 14:07:36 / cg" |
|
785 |
"Created: / 20.5.1998 / 20:27:08 / cg" |
|
786 |
! |
|
787 |
||
788 |
openDialogSpec:aSpec withBindings:bindings |
|
789 |
"create an instance of the application and open a view as |
|
790 |
specified by the spec." |
|
791 |
||
2071 | 792 |
^ self new |
793 |
openDialogSpec:aSpec |
|
794 |
withBindings:bindings |
|
1419 | 795 |
|
796 |
"Modified: / 5.9.1995 / 17:54:50 / claus" |
|
797 |
"Modified: / 13.1.1997 / 20:55:02 / cg" |
|
798 |
"Created: / 20.5.1998 / 20:26:37 / cg" |
|
799 |
! |
|
800 |
||
801 |
openInterface:anInterfaceSymbol |
|
802 |
"create an instance of the application and open a view as |
|
803 |
specified by anInterfaceSymbol." |
|
804 |
||
805 |
^ self new openInterface:anInterfaceSymbol |
|
806 |
||
807 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
808 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
809 |
! |
|
810 |
||
811 |
openInterface:anInterfaceSymbol at:aPoint |
|
812 |
"create an instance of the application and open a view as |
|
813 |
specified by anInterfaceSymbol." |
|
814 |
||
815 |
^ self new openInterface:anInterfaceSymbol at:aPoint |
|
816 |
||
817 |
"Modified: 14.2.1997 / 20:28:47 / cg" |
|
818 |
! |
|
819 |
||
820 |
openModal |
|
821 |
"create an instance of the application and open its view modal" |
|
822 |
||
823 |
^ self new openModal |
|
824 |
! |
|
825 |
||
826 |
openOn:anApplicationModel |
|
827 |
"send an open message to the argument, anApplicationModel. |
|
828 |
I dont really understand what this method is useful for ..." |
|
829 |
||
830 |
^ anApplicationModel open |
|
831 |
||
832 |
"Modified: 13.1.1997 / 20:55:05 / cg" |
|
833 |
! |
|
834 |
||
835 |
openOnDevice:aDevice |
|
836 |
"create an instance of the application and open its view |
|
837 |
on ANOTHER device. |
|
838 |
For more info, read the document on multiple display |
|
839 |
support and the documentation of the DeviceWorkstation class." |
|
840 |
||
2071 | 841 |
Screen currentScreenQuerySignal |
842 |
answer:aDevice |
|
843 |
do:[ |
|
844 |
^ (self onDevice:aDevice) open |
|
845 |
] |
|
1419 | 846 |
|
847 |
" |
|
848 |
Launcher openOnDevice:Display |
|
849 |
" |
|
850 |
||
851 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
852 |
! |
|
853 |
||
854 |
openOnXScreenNamed:aScreenName |
|
855 |
"create an instance of the application and open its view |
|
856 |
on some X display screen. The argument aScreenName must be |
|
857 |
a valid x-display name (i.e. of the form '<host>:<screenNr>' as in 'foo:0'). |
|
858 |
For more info, read the document on multiple display |
|
859 |
support and the documentation of the DeviceWorkstation class." |
|
860 |
||
1570
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
861 |
|newDevice| |
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
862 |
|
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
863 |
[ |
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
864 |
newDevice := XWorkstation newDispatchingFor:aScreenName. |
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
865 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
866 |
self warn:'Could not open display: ' , aScreenName. |
5ef90b35b7d6
Changed Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
1565
diff
changeset
|
867 |
^ self |
995
63d1b9ce554b
Avoid invoking pre/postBuild twice for subCanvases which
Claus Gittinger <cg@exept.de>
parents:
983
diff
changeset
|
868 |
]. |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
869 |
^ self openOnDevice:newDevice. |
1419 | 870 |
|
871 |
" |
|
872 |
Launcher openOnXScreenNamed:'sgi:0' |
|
873 |
Launcher openOnXScreenNamed:'foo:0' |
|
874 |
NewLauncher openOnXScreenNamed:'dawn:0' |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
875 |
NewLauncher openOnXScreenNamed:'bitsy:0' |
1419 | 876 |
SystemBrowser openOnXScreenNamed:'dawn:0' |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
877 |
SystemBrowser openOnXScreenNamed:'bitsy:0' |
1419 | 878 |
" |
879 |
||
880 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
881 |
! |
|
882 |
||
883 |
openWithSpec:aSpecSymbol |
|
884 |
"ST80 compatibility: |
|
885 |
mhmh - what is the difference to #openInterface ?" |
|
886 |
||
887 |
^ self openInterface:aSpecSymbol |
|
888 |
||
889 |
"Modified: 29.8.1997 / 01:16:52 / cg" |
|
2542 | 890 |
! ! |
891 |
||
892 |
!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
|
893 |
|
2568 | 894 |
initialPageSpec |
895 |
self subclassResponsibility |
|
896 |
! |
|
897 |
||
898 |
pageSpec |
|
899 |
^ self windowSpec |
|
900 |
! |
|
901 |
||
902 |
pageSpecs |
|
903 |
self subclassResponsibility |
|
904 |
! |
|
905 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
906 |
startAsWebService |
2542 | 907 |
"this is not yet a public interface. For internal exept use only" |
908 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
909 |
|app| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
910 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
911 |
app := self basicNew. |
2547
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
912 |
app initializeAsWebServiceOnWebDevice:(WebApplicationDevice new). |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
913 |
app startAsWebService. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
914 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
915 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
916 |
PortalTests::TestApplication1 startAsWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
917 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
918 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
919 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
920 |
startInPortalService:aPortalService |
2542 | 921 |
"this is not yet a public interface. For internal exept use only" |
922 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
923 |
|app| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
924 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
925 |
app := self basicNew. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
926 |
app setDevice:(WebApplicationDevice new). |
2544
2df3456aa8f7
initialization if I am a webService
Claus Gittinger <cg@exept.de>
parents:
2543
diff
changeset
|
927 |
app initialize. |
2543 | 928 |
app initializeResources. |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
929 |
app startInPortalService:aPortalService. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
930 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
931 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
932 |
PortalTests::TestApplication1 |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
933 |
startInPortalService: |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
934 |
(HTTPPortalService allInstances select:[:s | s httpServer port = 8080]) first |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
935 |
" |
1419 | 936 |
! ! |
937 |
||
938 |
!ApplicationModel methodsFor:'accessing'! |
|
939 |
||
940 |
application |
|
941 |
"application knows about interfaceSpecs, menuSpecs etc. |
|
942 |
Usually this is my class. |
|
943 |
This may be redefined in subclasses" |
|
944 |
||
945 |
^ self class |
|
946 |
||
947 |
"Modified: / 5.2.1998 / 00:45:21 / stefan" |
|
948 |
! |
|
949 |
||
950 |
builder |
|
951 |
"return the applications builder; this one has more information |
|
952 |
about views, components etc." |
|
953 |
||
954 |
^ builder |
|
955 |
! |
|
956 |
||
957 |
builder:aBuilder |
|
958 |
"set the applications builder. Normally, you should not set it |
|
959 |
directly, but depend on the default builder, as created when the application |
|
960 |
was created." |
|
961 |
||
962 |
builder := aBuilder |
|
963 |
! |
|
964 |
||
1602 | 965 |
componentAt:name |
966 |
^ self builder componentAt:name |
|
967 |
! |
|
968 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
969 |
device |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
970 |
device isNil ifTrue:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
971 |
self isWebService ifTrue:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
972 |
device := WebApplicationDevice new |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
973 |
] |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
974 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
975 |
^ device |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
976 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
977 |
|
1419 | 978 |
masterApplication |
979 |
"return the value of the instance variable 'masterApplication' (automatically generated)" |
|
980 |
||
1427 | 981 |
^ masterApplication |
982 |
! |
|
1419 | 983 |
|
984 |
masterApplication:something |
|
985 |
"set the value of the instance variable 'masterApplication' (automatically generated)" |
|
986 |
||
987 |
something == self ifTrue:[ |
|
988 |
self error:'an application cannot be its own masterApplication' mayProceed:true. |
|
989 |
^ self |
|
990 |
]. |
|
991 |
masterApplication := something. |
|
2566 | 992 |
|
993 |
"/ ensure that the device is compatible. |
|
2567 | 994 |
masterApplication notNil ifTrue:[ |
995 |
device := masterApplication device. |
|
996 |
]. |
|
1419 | 997 |
! |
998 |
||
999 |
resources |
|
1000 |
"return the applications resources - thats a ResourcePack containing |
|
1988
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1001 |
national language strings" |
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1002 |
|
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1003 |
resources isNil ifTrue:[ |
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1004 |
masterApplication notNil ifTrue:[ |
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1005 |
^ masterApplication resources |
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1006 |
] |
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1007 |
]. |
1419 | 1008 |
^ resources |
1009 |
! |
|
1010 |
||
1011 |
resources:aResourcePack |
|
1988
7b33c9095fe9
resources via master, if there is one
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
1012 |
"set the applications resources - usually this is done automatically, |
1419 | 1013 |
except for manually built dialogs" |
1014 |
||
1015 |
resources := aResourcePack |
|
1016 |
! |
|
1017 |
||
1018 |
window |
|
1019 |
"return my topWindow - or nil, if I have no window (yet)" |
|
1020 |
||
1021 |
|win| |
|
1022 |
||
1023 |
builder isNil ifTrue:[^ nil]. |
|
1024 |
(win := builder window) notNil ifTrue:[ |
|
1025 |
^ win |
|
1026 |
]. |
|
1027 |
masterApplication notNil ifTrue:[ |
|
1442
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
1028 |
masterApplication ~~ self ifTrue:[ |
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
1029 |
"/ is that true ? |
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
1030 |
^ masterApplication window |
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
1031 |
] |
1419 | 1032 |
]. |
1033 |
^ nil. |
|
1034 |
||
1035 |
"Modified: / 18.9.1998 / 15:18:19 / cg" |
|
1036 |
! |
|
1037 |
||
1038 |
window:aTopView |
|
1039 |
"set my topWindow. |
|
1040 |
As a side effect, this creates a dummy builder if non has yet |
|
1041 |
been built. This prevents non-GUI-Painter apps from failing later, |
|
1042 |
when the builder is accessed." |
|
1043 |
||
1044 |
builder isNil ifTrue:[ |
|
1045 |
self createBuilder |
|
1046 |
]. |
|
1047 |
builder window:aTopView |
|
1048 |
||
1049 |
"Created: 18.4.1996 / 14:55:26 / cg" |
|
1050 |
! |
|
1051 |
||
1052 |
windowGroup |
|
1053 |
"return the applications windowGroup" |
|
1054 |
||
1055 |
|w| |
|
1056 |
||
1057 |
builder notNil ifTrue:[ |
|
1058 |
(w := builder window) notNil ifTrue:[ |
|
1059 |
^ w windowGroup |
|
1060 |
]. |
|
1061 |
]. |
|
1062 |
masterApplication notNil ifTrue:[ |
|
1063 |
^ masterApplication windowGroup |
|
1064 |
]. |
|
1065 |
^ nil |
|
1066 |
||
1067 |
"Modified: / 7.9.1998 / 23:37:00 / cg" |
|
1068 |
! ! |
|
1069 |
||
1070 |
!ApplicationModel methodsFor:'binding access'! |
|
1071 |
||
1072 |
actionFor:aKey |
|
1073 |
"sent by the builder to ask for an actionBlock for |
|
1074 |
a Button. The argument, aKey comes from an UI-spec |
|
1075 |
for a buttons #action property. |
|
1076 |
Here, a corresponding message is sent to myself, |
|
1077 |
which ought to be defined in the application subclass. |
|
1078 |
Alternatively, a subclass may redefine this method, to provide |
|
1079 |
actionBlocks from a Dictionary or whatever. |
|
1080 |
Typically, a block is returned there." |
|
1081 |
||
1082 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1083 |
^ [self perform:aKey] "/ could use: MessageSend receiver:self selector:aKey |
|
1084 |
]. |
|
1085 |
^ masterApplication actionFor:aKey |
|
1086 |
||
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1087 |
"Modified: / 28.10.1997 / 20:34:51 / cg" |
1419 | 1088 |
! |
1089 |
||
1090 |
actionFor:aKey withValue:aValue |
|
1091 |
"sent by the builder to ask for an actionBlock for |
|
1092 |
a Button which passes a value. |
|
1093 |
The argument, aKey comes from an UI-spec for a buttons #action property. |
|
1094 |
Here, a corresponding message is sent to myself, |
|
1095 |
which ought to be defined in the application subclass. |
|
1096 |
Alternatively, a subclass may redefine this method, to provide |
|
1097 |
actionBlocks from a Dictionary or whatever. |
|
1098 |
Typically, a block is returned there." |
|
1099 |
||
1100 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1101 |
^ [self perform:aKey with:aValue] |
|
1102 |
]. |
|
1103 |
^ masterApplication actionFor:aKey withValue:aValue |
|
1104 |
! |
|
1105 |
||
2364 | 1106 |
actionFor:aKey withValue:value1 withValue:value2 |
1107 |
"sent by the builder to ask for an actionBlock for a Button which passes two values. |
|
1108 |
The argument, aKey comes from an UI-spec for a buttons #action property. |
|
1109 |
Here, a corresponding message is sent to myself, |
|
1110 |
which ought to be defined in the application subclass. |
|
1111 |
Alternatively, a subclass may redefine this method, to provide |
|
1112 |
actionBlocks from a Dictionary or whatever. |
|
1113 |
Typically, a block is returned there." |
|
1114 |
||
1115 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1116 |
^ [self perform:aKey with:value1 with:value2] |
|
1117 |
]. |
|
1118 |
^ masterApplication actionFor:aKey withValue:value1 withValue:value2 |
|
1119 |
! |
|
1120 |
||
1419 | 1121 |
aspectFor:aKey |
1122 |
"sent by the builder to ask for an aspect (a data model). |
|
1123 |
The argument, aKey comes from an UI-spec |
|
1124 |
for a components #aspect property. |
|
1125 |
Here, a corresponding message is sent to myself, |
|
1126 |
which ought to be defined in the application subclass. |
|
1127 |
Alternatively, a subclass may redefine this method, to provide |
|
1128 |
holders from a Dictionary or whatever. |
|
1129 |
Typically, a valueHolder is returned there." |
|
1130 |
||
1131 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1132 |
^ self perform:aKey |
|
1133 |
]. |
|
1134 |
^ masterApplication aspectFor:aKey |
|
1135 |
||
1136 |
"Modified: / 18.6.1998 / 20:33:23 / cg" |
|
1137 |
! |
|
1138 |
||
1742
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1139 |
aspectOrNil:aKey forSubApplication:aSubApp |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1140 |
^ nil |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1141 |
! |
e463f28400fd
hook for subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
1741
diff
changeset
|
1142 |
|
1419 | 1143 |
clientFor:aKey |
1144 |
"sent by the builder to ask for an application provided |
|
1145 |
subcanvas's application. |
|
1146 |
The argument, aKey comes from an UI-spec |
|
1147 |
for a subcanvas's #client property. |
|
1148 |
Here, a corresponding message is sent to myself, |
|
1149 |
which ought to be defined in the application subclass. |
|
1150 |
Alternatively, a subclass may redefine this method, to provide |
|
1151 |
appModels from a Dictionary or whatever. |
|
1152 |
Typically, an applicationModel is returned there." |
|
1153 |
||
1154 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1155 |
^ self perform:aKey |
|
1156 |
]. |
|
1157 |
^ masterApplication clientFor:aKey |
|
1158 |
||
1159 |
"Modified: / 18.6.1998 / 20:33:30 / cg" |
|
1160 |
! |
|
1161 |
||
2387
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1162 |
colorFor:aKey |
2472 | 1163 |
"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
|
1164 |
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
|
1165 |
for a widgets #*Color property. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1166 |
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
|
1167 |
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
|
1168 |
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
|
1169 |
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
|
1170 |
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
|
1171 |
|
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1172 |
(self respondsTo:aKey) ifTrue:[ |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1173 |
^ self perform:aKey |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1174 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1175 |
(self class respondsTo:aKey) ifTrue:[ |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1176 |
^ self class perform:aKey |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1177 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1178 |
masterApplication notNil ifTrue:[ |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1179 |
^ masterApplication colorFor:aKey |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1180 |
]. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1181 |
^ self class colorFor:aKey. |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1182 |
! |
ef4a9559c9e6
Changes from Zürich: support symbolic colors in UISpecifications
Stefan Vogel <sv@exept.de>
parents:
2382
diff
changeset
|
1183 |
|
1419 | 1184 |
componentFor:aKey |
1185 |
"sent by the builder to ask for an application provided |
|
1186 |
component. |
|
1187 |
The argument, aKey comes from an UI-spec |
|
1188 |
for a viewHolders #view property. |
|
1189 |
Here, a corresponding message is sent to myself, |
|
1190 |
which ought to be defined in the application subclass. |
|
1191 |
Alternatively, a subclass may redefine this method, to provide |
|
1192 |
holders from a Dictionary or whatever. |
|
1193 |
Typically, a view is returned there." |
|
1194 |
||
1195 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1196 |
^ self perform:aKey |
|
1197 |
]. |
|
1198 |
^ masterApplication componentFor:aKey |
|
1199 |
||
1200 |
"Modified: / 18.6.1998 / 20:33:36 / cg" |
|
1201 |
! |
|
1202 |
||
2472 | 1203 |
fontFor:aKey |
1204 |
"sent by the builder to ask for an application provided font. |
|
1205 |
The argument, aKey comes from an UI-spec |
|
1206 |
for a widgets #*Font property. |
|
1207 |
Here, a corresponding message is sent to myself, |
|
1208 |
which ought to be defined in the application subclass. |
|
1209 |
Alternatively, a subclass may redefine this method, to provide |
|
1210 |
holders from a Dictionary or whatever. |
|
1211 |
Typically, a font is returned there." |
|
1212 |
||
1213 |
(self respondsTo:aKey) ifTrue:[ |
|
1214 |
^ self perform:aKey |
|
1215 |
]. |
|
1216 |
(self class respondsTo:aKey) ifTrue:[ |
|
1217 |
^ self class perform:aKey |
|
1218 |
]. |
|
1219 |
masterApplication notNil ifTrue:[ |
|
1220 |
^ masterApplication fontFor:aKey |
|
1221 |
]. |
|
1222 |
^ self class fontFor:aKey. |
|
1223 |
! |
|
1224 |
||
1419 | 1225 |
labelFor:aKey |
1226 |
"sent by the builder to ask for an application provided |
|
1227 |
label for a component. |
|
1228 |
The argument, aKey comes from an UI-spec |
|
1229 |
for a components #label property. |
|
1230 |
Here, a corresponding message is sent to myself, |
|
1231 |
which ought to be defined in the application subclass. |
|
1232 |
Alternatively, a subclass may redefine this method, to provide |
|
1233 |
labels from a Dictionary or whatever. |
|
1234 |
Typically, a string is returned there." |
|
1235 |
||
1236 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1237 |
^ self perform:aKey |
|
1238 |
]. |
|
1997 | 1239 |
(self class selfResponsibleFor:aKey) ifTrue:[ |
1240 |
^ self class perform:aKey |
|
1241 |
]. |
|
1419 | 1242 |
^ masterApplication labelFor:aKey |
1243 |
||
1244 |
"Modified: / 18.6.1998 / 20:33:42 / cg" |
|
1245 |
! |
|
1246 |
||
1247 |
listFor:aKey |
|
1248 |
"sent by the builder to ask for an application provided |
|
1249 |
holder for a list (for example, a popUpLists list). |
|
1250 |
The argument, aKey comes from an UI-spec |
|
1251 |
for a listWidgets #list property. |
|
1252 |
Here, a corresponding message is sent to myself, |
|
1253 |
which ought to be defined in the application subclass. |
|
1254 |
Alternatively, a subclass may redefine this method, to provide |
|
1255 |
holders from a Dictionary or whatever. |
|
1256 |
Typically, a list-holding model (SelectionInList) is returned there. |
|
1257 |
If the instance does not provide a value, a corresponding aspect |
|
1258 |
is asked for. If that fails as well, the app class is asked as a last |
|
1259 |
chance." |
|
1260 |
||
1261 |
|a| |
|
1262 |
||
1263 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1264 |
^ self perform:aKey |
|
1265 |
]. |
|
1266 |
a := self aspectFor:aKey. |
|
1267 |
a notNil ifTrue:[ |
|
1268 |
^ a |
|
1269 |
]. |
|
1270 |
^ self application listFor:aKey |
|
1271 |
||
1272 |
"Modified: / 18.6.1998 / 20:33:50 / cg" |
|
1273 |
! |
|
1274 |
||
1275 |
menuFor:aKey |
|
1276 |
"sent by the builder to ask for an application provided |
|
1277 |
holder for a menu. |
|
1278 |
The argument, aKey comes from an UI-spec |
|
1279 |
for a widgets #menu property. |
|
1280 |
Here, a corresponding message is sent to myself, |
|
1281 |
which ought to be defined in the application subclass. |
|
1282 |
Alternatively, a subclass may redefine this method, to provide |
|
1283 |
holders from a Dictionary or whatever. |
|
1284 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
1285 |
||
1286 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
1287 |
^ self perform:aKey |
|
1288 |
]. |
|
1997 | 1289 |
(self class selfResponsibleFor:aKey) ifTrue:[ |
1290 |
^ self class perform:aKey |
|
1291 |
]. |
|
1419 | 1292 |
^ masterApplication menuFor:aKey |
1293 |
||
1294 |
"Modified: / 18.6.1998 / 20:33:56 / cg" |
|
1295 |
! |
|
1296 |
||
1297 |
specificationFor:aKey |
|
1298 |
"sent by the builder to ask for an application provided |
|
1299 |
specification for a subcanvas or subspecification. |
|
1300 |
The argument, aKey comes from an UI-spec |
|
1301 |
for a subcanvases #specification property (minorKey). |
|
1302 |
Here, a corresponding message is sent to myself, |
|
1303 |
which ought to be defined in the application subclass. |
|
1304 |
Alternatively, a subclass may redefine this method, to provide |
|
1305 |
interfaceSpecifications from a Dictionary or whatever. |
|
1306 |
Typically, an interfaceSpecification is returned there." |
|
1307 |
||
1584 | 1308 |
^ ApplicationModel |
1309 |
specificationFor:aKey |
|
1310 |
application:self |
|
1311 |
onDevice:(self graphicsDevice) |
|
1419 | 1312 |
! |
1313 |
||
2058 | 1314 |
subApplicationFor:aKey |
1315 |
"sent by subCanvas to ask for an application inside itself. |
|
1316 |
The argument, aKey comes from a TabList-specs majorKey. |
|
1317 |
Here, a corresponding message is sent to myself, |
|
1318 |
which ought to be defined in the application subclass. |
|
1319 |
Alternatively, a subclass may redefine this method, to provide |
|
1320 |
an application from a Dictionary or whatever. |
|
1321 |
Typically, an ApplicationModel subinstance is returned there." |
|
1322 |
||
1323 |
(self respondsTo:aKey) ifTrue:[ |
|
1324 |
^ self perform:aKey |
|
1325 |
]. |
|
1326 |
masterApplication notNil ifTrue:[ |
|
1327 |
^ masterApplication subApplicationFor:aKey |
|
1328 |
]. |
|
1329 |
^ nil. |
|
1330 |
! |
|
1331 |
||
1419 | 1332 |
visualFor:aKey |
1333 |
"sent by the builder to ask for an application provided |
|
1334 |
image or element for a label. |
|
1335 |
The argument, aKey comes from an UI-spec |
|
1336 |
for a widgets #label property, if LabelIsImage is turned on. |
|
1337 |
Here, a corresponding message is sent to myself, |
|
1338 |
which ought to be defined in the application subclass. |
|
1339 |
Alternatively, a subclass may redefine this method, to provide |
|
1340 |
images from a Dictionary or whatever. |
|
1341 |
Typically, an image is returned there." |
|
1342 |
||
1343 |
^ self application visualFor:aKey |
|
1344 |
||
1345 |
! ! |
|
1346 |
||
2086 | 1347 |
!ApplicationModel methodsFor:'binding access-help'! |
1348 |
||
2087 | 1349 |
basicFlyByHelpTextForKey:aKey |
1350 |
"flyByHelp interface: return some short help text for a key |
|
1351 |
key is the symbol associated with some widget or menu item. |
|
1352 |
Return the original (english) text; needs to be translated as per language" |
|
1353 |
||
1354 |
|helpText helpSpec resourceArgs| |
|
1355 |
||
1356 |
helpSpec := self flyByHelpSpec. |
|
1357 |
helpSpec notNil ifTrue:[ |
|
1358 |
helpText := helpSpec at:aKey ifAbsent:nil. |
|
1359 |
]. |
|
1360 |
helpText isNil ifTrue:[ |
|
1361 |
masterApplication notNil ifTrue:[ |
|
1362 |
helpText := masterApplication flyByHelpTextForKey:aKey |
|
1363 |
] |
|
1364 |
]. |
|
1365 |
||
1366 |
"/ new: allow for a collection (resource-key arg1 arg2...) |
|
1367 |
(helpText isCollection and:[helpText isString not]) ifTrue:[ |
|
1368 |
resourceArgs := helpText copyFrom:2. |
|
1369 |
helpText := helpText first. |
|
1370 |
]. |
|
1371 |
^ helpText |
|
1372 |
! |
|
1373 |
||
2086 | 1374 |
basicHelpTextForKey:aKey |
1375 |
"activeHelp interface: return some help text for a key |
|
1376 |
key is the symbol associated with some widget or menu item. |
|
1377 |
Return the original (english) text; needs to be translated as per language" |
|
1378 |
||
1379 |
|helpText| |
|
1380 |
||
1381 |
helpText := (self helpSpec) at:aKey ifAbsent:nil. |
|
1382 |
helpText isNil ifTrue:[ |
|
1383 |
masterApplication notNil ifTrue:[ |
|
1384 |
helpText := masterApplication helpTextForKey:aKey |
|
1385 |
]. |
|
1386 |
]. |
|
1387 |
^ helpText |
|
1388 |
! |
|
1389 |
||
1390 |
flyByHelpSpec |
|
1391 |
"activeHelp interface: return some short help text for a widget component" |
|
1392 |
||
1393 |
^ self class flyByHelpSpec |
|
1394 |
! |
|
1395 |
||
1396 |
flyByHelpTextFor:aComponent |
|
1397 |
"activeHelp interface: return some short help text for a widget component" |
|
1398 |
||
1399 |
|key| |
|
1400 |
||
1401 |
builder notNil ifTrue:[ |
|
1402 |
(key := builder helpKeyFor:aComponent) notNil ifTrue:[ |
|
1403 |
^ self flyByHelpTextForKey:key |
|
1404 |
] |
|
1405 |
]. |
|
1406 |
masterApplication notNil ifTrue:[ |
|
1407 |
^ masterApplication flyByHelpTextFor:aComponent |
|
1408 |
]. |
|
1409 |
^ nil |
|
1410 |
||
1411 |
"Modified: / 31.7.1998 / 23:03:10 / cg" |
|
1412 |
! |
|
1413 |
||
1414 |
flyByHelpTextForKey:aKey |
|
1415 |
"flyByHelp interface: return some short help text for a key |
|
1416 |
key is the symbol associated with some widget or menu item. |
|
1417 |
(from my flyByHelpSpec); return a language variant (if available)" |
|
1418 |
||
2510
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1419 |
|helpText| |
2088 | 1420 |
|
1421 |
helpText := self basicFlyByHelpTextForKey:aKey. |
|
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1422 |
helpText isNil ifTrue:[ |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1423 |
"resolve key from resources" |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1424 |
^ self translateString:aKey. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1425 |
] ifFalse:[ |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1426 |
"/ kludge to allow for dynamic translation by the application itself. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1427 |
helpText isBlock ifTrue:[ |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1428 |
^ helpText value |
2345
3502dcdf4372
allow for a block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
1429 |
]. |
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1430 |
^ (self translateString:helpText) withCRs. |
2086 | 1431 |
]. |
1432 |
||
2345
3502dcdf4372
allow for a block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
1433 |
"Modified: / 03-11-2007 / 12:04:14 / cg" |
2086 | 1434 |
! |
1435 |
||
2510
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1436 |
flyByHelpTextForKey:aKey row:aRowNr |
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1437 |
"Special interface for DataSet - get the active help text for a specific row" |
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1438 |
|
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1439 |
"Default: no row specific help" |
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1440 |
|
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1441 |
^ self flyByHelpTextForKey:aKey. |
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1442 |
! |
491f20d60c08
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
2496
diff
changeset
|
1443 |
|
2086 | 1444 |
helpSpec |
1445 |
"activeHelp interface: return some short help text for a widget component" |
|
1446 |
||
1447 |
^ self class helpSpec |
|
1448 |
! |
|
1449 |
||
1450 |
helpTextFor:aComponent |
|
1451 |
"activeHelp interface: return some help text for a widget component" |
|
1452 |
||
1453 |
|key| |
|
1454 |
||
1455 |
builder notNil ifTrue:[ |
|
1456 |
(key := builder helpKeyFor:aComponent) notNil ifTrue:[ |
|
1457 |
^ self helpTextForKey:key |
|
1458 |
] |
|
1459 |
]. |
|
1460 |
masterApplication notNil ifTrue:[ |
|
1461 |
^ masterApplication helpTextFor:aComponent |
|
1462 |
]. |
|
1463 |
^ nil |
|
1464 |
||
1465 |
"Modified: / 31.7.1998 / 23:03:10 / cg" |
|
1466 |
! |
|
1467 |
||
1468 |
helpTextForKey:aKey |
|
1469 |
"activeHelp interface: return some help text for a key |
|
1470 |
key is the symbol associated with some widget or menu item. |
|
1471 |
(from my helpSpec); return a language variant (if available)" |
|
1472 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1473 |
|helpText| |
2086 | 1474 |
|
1475 |
helpText := self basicHelpTextForKey:aKey. |
|
1476 |
helpText isNil ifTrue:[ |
|
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1477 |
aKey isSymbol ifFalse:[ |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1478 |
^ nil |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1479 |
]. |
2549 | 1480 |
"/ "/ mhmh - is this a good idea ? |
1481 |
"/ "/ if someone already maps the flyByHelpTexts to the helpTexts |
|
1482 |
"/ helpText := self flyByHelpTextForKey:aKey. |
|
1483 |
"/ helpText notNil ifTrue:[ ^ helpText ]. |
|
1484 |
^ self resources string:'Sorry, no help for: %1' with:aKey "/ nil |
|
2086 | 1485 |
]. |
1486 |
||
1487 |
"/ translate. |
|
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1488 |
^ self translateString:helpText. |
2086 | 1489 |
|
1490 |
"Modified: / 4.2.2000 / 15:30:16 / cg" |
|
1491 |
! ! |
|
1492 |
||
2380 | 1493 |
!ApplicationModel methodsFor:'building'! |
1494 |
||
1495 |
allButOpen |
|
1496 |
"create my views from the windowSpec, but do not open the main window." |
|
1497 |
||
1498 |
^ self allButOpenInterface:(self defaultWindowSpecName). |
|
1499 |
||
1500 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
1501 |
! |
|
1502 |
||
1503 |
allButOpenFrom:aSpec |
|
1504 |
"create my views but do not open the main window. |
|
1505 |
The argument is a spec which defines the interface." |
|
1506 |
||
1507 |
|window| |
|
1508 |
||
1509 |
"/ DISABLED; see comment in basicInitialize |
|
1510 |
"/ |
|
1511 |
"/ " |
|
1512 |
"/ here, we kludge a bit: up to now, the builder was an |
|
1513 |
"/ instance of the no-op WindowBuilder. Now, it becomes |
|
1514 |
"/ a UIBuilder .... |
|
1515 |
"/ This allows for ApplicationModels without a UIBuilder |
|
1516 |
"/ if not needed. |
|
1517 |
"/ " |
|
1518 |
"/ realBuilder := UIBuilder new. |
|
1519 |
"/ builder := realBuilder. |
|
1520 |
"/ builder application:self. |
|
1521 |
"/ builder bindings:builder bindings. |
|
1522 |
||
1523 |
builder isNil ifTrue:[ |
|
1524 |
self createBuilder. |
|
1525 |
]. |
|
1526 |
||
1527 |
self preBuildWith:builder. |
|
1528 |
builder buildWindowFromSpec:aSpec. |
|
1529 |
window := builder window. |
|
1530 |
||
1531 |
window model:self. |
|
1532 |
(window respondsTo:#application:) ifTrue:[ |
|
1533 |
window application:self. |
|
1534 |
]. |
|
1535 |
||
1536 |
self showingHelp ifTrue: [ActiveHelp startFor: self]. |
|
1537 |
self postBuildWith:builder. |
|
1538 |
||
1539 |
"Modified: / 19.6.1998 / 03:35:31 / cg" |
|
1540 |
! |
|
1541 |
||
1542 |
allButOpenInterface:aSymbol |
|
1543 |
"create my views but do not open the main window. |
|
1544 |
The argument specifies a selector of a method, |
|
1545 |
which when sent to myself should return a spec. |
|
1546 |
Notice, this returns the windowBuilder." |
|
1547 |
||
1548 |
self allButOpenFrom:(self interfaceSpecFor:aSymbol). |
|
1549 |
^ builder |
|
1550 |
||
1551 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
1552 |
! |
|
1553 |
||
1554 |
buildSpec:specToBuild asSubCanvasWithBuilder:aBuilder |
|
1555 |
"build a subcanvases spec into aSubcanvas" |
|
1556 |
||
1557 |
|sameApp prevSpec prevSource| |
|
1558 |
||
1559 |
aBuilder notNil ifTrue:[ |
|
1560 |
prevSpec := aBuilder spec. |
|
1561 |
prevSource := aBuilder source. |
|
1562 |
]. |
|
1563 |
||
1564 |
builder isNil ifTrue:[ |
|
1565 |
builder := aBuilder. |
|
1566 |
aBuilder isNil ifTrue:[ |
|
1567 |
self createBuilder |
|
1568 |
] |
|
1569 |
]. |
|
1570 |
||
1571 |
aBuilder source:self. |
|
1572 |
||
1573 |
"/ if the subcanvases appModel is NOT the same as |
|
1574 |
"/ the topApp, it must be pre/post-built. |
|
1575 |
"/ Otherwise, we invoke pre/post-builtAsSubcanvas. |
|
1576 |
"/ which provides a hook for redefinition in concrete appModels. |
|
1577 |
"/ This avoids invoking pre/postBuild twice for subCanvases which |
|
1578 |
"/ have the topApp as appModel. |
|
1579 |
||
1580 |
sameApp := aBuilder application == aBuilder window topView application. |
|
1581 |
sameApp ifTrue:[ |
|
1582 |
self preBuildAsSubcanvasWith:aBuilder. |
|
1583 |
] ifFalse:[ |
|
1584 |
self preBuildWith:aBuilder. |
|
1585 |
]. |
|
1586 |
||
1587 |
aBuilder buildFromSpec:specToBuild. |
|
1588 |
||
1589 |
sameApp ifTrue:[ |
|
1590 |
self postBuildAsSubcanvasWith:aBuilder. |
|
1591 |
] ifFalse:[ |
|
1592 |
self postBuildWith:aBuilder. |
|
1593 |
]. |
|
1594 |
||
1595 |
prevSpec notNil ifTrue:[ |
|
1596 |
"/ restore state in builder if original builder was used |
|
1597 |
aBuilder spec:prevSpec. |
|
1598 |
]. |
|
1599 |
prevSource notNil ifTrue:[ |
|
1600 |
"/ restore state in builder if original builder was used |
|
1601 |
aBuilder source:prevSource. |
|
1602 |
]. |
|
1603 |
||
1604 |
^ aBuilder |
|
1605 |
||
1606 |
"Created: / 18-06-1998 / 20:08:45 / cg" |
|
1607 |
"Modified: / 27-10-2006 / 11:45:25 / cg" |
|
1608 |
! |
|
1609 |
||
1610 |
buildSubCanvas:spec withBuilder:aBuilder |
|
1611 |
"build a subcanvases' spec into aSubcanvas" |
|
1612 |
||
1613 |
self buildSubCanvas:spec withMenu:false withBuilder:aBuilder |
|
1614 |
! |
|
1615 |
||
1616 |
buildSubCanvas:spec withMenu:withMenuBoolean withBuilder:aBuilder |
|
1617 |
"build a subcanvases' spec into aSubcanvas" |
|
1618 |
||
1619 |
|specToBuild| |
|
1620 |
||
1621 |
specToBuild := spec. |
|
1622 |
withMenuBoolean ifFalse:[ |
|
1623 |
"/ subapps should not build the menu and other fullSpec stuff. |
|
1624 |
spec class == FullSpec ifTrue:[ |
|
1625 |
specToBuild := spec component. |
|
1626 |
] |
|
1627 |
]. |
|
1628 |
self buildSpec:specToBuild asSubCanvasWithBuilder:aBuilder |
|
1629 |
! ! |
|
1630 |
||
1419 | 1631 |
!ApplicationModel methodsFor:'component manipulations'! |
1632 |
||
1633 |
components:aSymbolOrArray do:aBlock |
|
1634 |
"evaluate aBlock for all components listed aSymbolOrArray." |
|
1635 |
||
1636 |
|coll| |
|
1637 |
||
1638 |
aSymbolOrArray isSymbol ifTrue:[ |
|
1639 |
"/ a single components name |
|
1640 |
coll := Array with:aSymbolOrArray |
|
1641 |
] ifFalse:[ |
|
1642 |
coll := aSymbolOrArray |
|
1643 |
]. |
|
1644 |
coll do:[:aSymbol | |
|
1645 |
|component| |
|
1646 |
||
1647 |
(component := self componentFor:aSymbol) isNil ifFalse:[ |
|
1648 |
aBlock value:component |
|
1649 |
] |
|
1650 |
] |
|
1651 |
||
1652 |
"Modified: 26.3.1997 / 16:23:14 / cg" |
|
1653 |
! |
|
1654 |
||
1655 |
disable:aSymbolOrArray |
|
1656 |
"disable the components whose id's are aSymbolOrArray." |
|
1657 |
||
1658 |
self components:aSymbolOrArray do:[:comp | comp disable] |
|
1659 |
||
1660 |
"Modified: 14.2.1997 / 17:32:09 / cg" |
|
1661 |
! |
|
1662 |
||
1663 |
enable:aSymbolOrArray |
|
1664 |
"enables the component(s) identified by aSymbolOrArray." |
|
1665 |
||
1666 |
self components:aSymbolOrArray do:[:comp | comp enable] |
|
1667 |
||
1668 |
"Modified: 14.2.1997 / 17:32:19 / cg" |
|
1669 |
! |
|
1670 |
||
1671 |
invalidate:aSymbolOrArray |
|
1672 |
"invalidates the component(s) identified by aSymbolOrArray." |
|
1673 |
||
1674 |
self components:aSymbolOrArray do:[:comp | comp invalidate] |
|
1675 |
||
1676 |
"Modified: 14.2.1997 / 17:32:28 / cg" |
|
1677 |
! |
|
1678 |
||
1679 |
makeInvisible:aSymbolOrArray |
|
1680 |
"makes the components whose id's are aSymbolOrArray invisible" |
|
1681 |
||
1682 |
self components:aSymbolOrArray do:[:comp | comp beInvisible] |
|
1683 |
||
1684 |
"Modified: 14.2.1997 / 17:32:42 / cg" |
|
1685 |
! |
|
1686 |
||
1687 |
makeReadOnly:aSymbolOrArray |
|
1688 |
"make all components identified by aSymbolOrArray read only |
|
1689 |
(for editText components)." |
|
1690 |
||
1691 |
self components:aSymbolOrArray do:[:comp | comp readOnly:true] |
|
1692 |
||
1693 |
"Modified: 14.2.1997 / 17:36:22 / cg" |
|
1694 |
! |
|
1695 |
||
1696 |
makeVisible:aSymbolOrArray |
|
1697 |
"makes the components whose id's are aSymbolOrArray visible" |
|
1698 |
||
1699 |
self components:aSymbolOrArray do:[:comp | comp beVisible] |
|
1700 |
||
1701 |
"Modified: 14.2.1997 / 17:32:52 / cg" |
|
1702 |
! |
|
1703 |
||
1704 |
makeWritable:aSymbolOrArray |
|
1705 |
"make all components identified by aSymbolOrArray writable |
|
1706 |
(for editText components)." |
|
1707 |
||
1708 |
self components:aSymbolOrArray do:[:comp | comp readOnly:false] |
|
1709 |
||
1710 |
"Created: 14.2.1997 / 17:36:17 / cg" |
|
1711 |
! ! |
|
1712 |
||
1713 |
!ApplicationModel methodsFor:'copying'! |
|
1714 |
||
1715 |
postCopy |
|
1716 |
builder := device := nil. |
|
1717 |
||
1718 |
"Created: / 19.4.1998 / 11:44:44 / cg" |
|
2053 | 1719 |
! |
1720 |
||
1721 |
postDeepCopy |
|
1722 |
builder := device := nil. |
|
1723 |
||
1724 |
"Created: / 19.4.1998 / 11:44:44 / cg" |
|
1419 | 1725 |
! ! |
1726 |
||
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1727 |
!ApplicationModel methodsFor:'delayed actions (enqueue)'! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1728 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1729 |
delayedUpdate:something with:aParameter from:changedObject |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1730 |
"support for delayed updates - |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1731 |
subclasses which invoke #enqueueDelayedUpdate:with:from: (from #update:with:from:) |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1732 |
must also redefine this method, and perform the actual update there." |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1733 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1734 |
^ self |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1735 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1736 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1737 |
enqueueDelayedAction:aBlock |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1738 |
"This will enqueue a delayed action - the application-process will |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1739 |
eventually execute aBlock. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1740 |
Useful for synchronization" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1741 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1742 |
^ self |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1743 |
enqueueMessage:#value |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1744 |
for:aBlock |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1745 |
arguments:#(). |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1746 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1747 |
"Modified: / 26.2.2000 / 18:01:44 / cg" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1748 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1749 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1750 |
enqueueDelayedUpdate:something with:aParameter from:changedObject |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1751 |
"support for delayed updates - to be invoked from a concrete classes |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1752 |
#update:with:from: method. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1753 |
This will enqueue a delayed update, and resend #delayedUpdate:with:from: |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1754 |
whenever the receiver is handling events. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1755 |
Especially useful, if many updates arrive at high frequency, to avoid |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1756 |
multiple redraws." |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1757 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1758 |
^ self |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1759 |
enqueueMessage:#delayedUpdate:with:from: |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1760 |
for:self |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1761 |
arguments:(Array |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1762 |
with:something |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1763 |
with:aParameter |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1764 |
with:changedObject). |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1765 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1766 |
"Modified: / 26.2.2000 / 18:01:44 / cg" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1767 |
! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1768 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1769 |
enqueueMessage:selector for:someone arguments:argList |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1770 |
"enqueue a message to be sent to myself later, when my process |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1771 |
is back in its eventLoop. Also, filter duplicates. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1772 |
This is useful, to buffer redraws and avoid flicker due to multiple |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1773 |
redraws (especially in browsers, when reacting on changeMessages resulting |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1774 |
from changes made in other browsers)" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1775 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1776 |
|window sensor| |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1777 |
|
2561 | 1778 |
|
1779 |
self isWebService ifTrue:[ |
|
1780 |
self breakPoint:#sr. |
|
1781 |
^ self |
|
1782 |
]. |
|
1783 |
||
2556
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1784 |
(window := self window) notNil ifTrue:[ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1785 |
sensor := window sensor. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1786 |
]. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1787 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1788 |
sensor isNil ifTrue:[ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1789 |
"no window (yet or any longer)" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1790 |
someone perform:selector withArguments:argList. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1791 |
^ self. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1792 |
]. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1793 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1794 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1795 |
"/ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1796 |
"/ if such a message is already in the queue, ignore it. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1797 |
"/ 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
|
1798 |
"/ back in the event loop. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1799 |
"/ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1800 |
sensor synchronized:[ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1801 |
(sensor hasEvent:selector for:someone withArguments:argList) ifFalse:[ |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1802 |
sensor pushUserEvent:selector for:someone withArguments:argList |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1803 |
]. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1804 |
]. |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1805 |
|
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1806 |
"Modified: / 5.2.2000 / 00:01:54 / cg" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1807 |
"Created: / 26.2.2000 / 18:01:31 / cg" |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1808 |
! ! |
7b4fce0b3b2a
changed #enqueueDelayedAction:
Claus Gittinger <cg@exept.de>
parents:
2555
diff
changeset
|
1809 |
|
1419 | 1810 |
!ApplicationModel methodsFor:'drag & drop'! |
1811 |
||
2557 | 1812 |
canDropObjects:aCollectionOfDropObjects |
1419 | 1813 |
"drop manager asked if a drop is possible |
1814 |
- should be redefined by apps which can do it, to return true" |
|
1815 |
||
1816 |
^ false |
|
2557 | 1817 |
! |
1818 |
||
1819 |
canDropObjects:aCollectionOfDropObjects in:aComponent |
|
1820 |
"drop manager asked if a drop is possible |
|
1821 |
- should be redefined by apps which can do it, to return true" |
|
1822 |
||
1823 |
^ self canDropObjects:aCollectionOfDropObjects |
|
1419 | 1824 |
! |
1825 |
||
2261 | 1826 |
canDropObjects:aCollectionOfDropObjects in:aComponent at:position |
2405 | 1827 |
"drop manager asked if a drop is possible. |
1828 |
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
|
1829 |
|
2261 | 1830 |
^ self canDropObjects:aCollectionOfDropObjects in:aComponent |
1831 |
||
1832 |
"Created: / 13-10-2006 / 15:52:20 / cg" |
|
2079 | 1833 |
! |
1834 |
||
2557 | 1835 |
dropObjects:aCollectionOfDropObjects |
2079 | 1836 |
"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
|
1837 |
This is ony sent, if #canDrop: returned true. |
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
1838 |
Must be redefine in order for drop to work." |
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
1839 |
|
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
1840 |
self subclassResponsibility |
c7cf598af103
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
1841 |
|
2262 | 1842 |
"Created: / 13-10-2006 / 18:25:06 / cg" |
2079 | 1843 |
! |
1844 |
||
2557 | 1845 |
dropObjects:aCollectionOfDropObjects in:aComponent |
1846 |
"drop manager wants to drop. |
|
1847 |
This is ony sent, if #canDrop: returned true. |
|
1848 |
Must be redefine in order for drop to work." |
|
1849 |
||
1850 |
^ self dropObjects:aCollectionOfDropObjects |
|
1851 |
||
1852 |
! |
|
1853 |
||
2262 | 1854 |
dropObjects:aCollectionOfDropObjects in:aComponent at:aPoint |
1419 | 1855 |
"drop manager wants to drop. |
1856 |
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
|
1857 |
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
|
1858 |
|
2557 | 1859 |
^ self dropObjects:aCollectionOfDropObjects in:aComponent |
2262 | 1860 |
|
1861 |
"Created: / 13-10-2006 / 18:25:13 / cg" |
|
1419 | 1862 |
! ! |
1863 |
||
1864 |
!ApplicationModel methodsFor:'easy bindings'! |
|
1865 |
||
1866 |
registerInterestIn:aValueModel using:aSelectorOrArray |
|
1867 |
"Register interest in a change in aValueModel using information in aSelectorOrArray. |
|
1868 |
aSelectorOrArray can be one of three things: |
|
1869 |
||
1870 |
1) nil in which case no interest is registered |
|
1871 |
2) a selector in which case the receiver is understood to be self |
|
1872 |
3) an Array in which case the size is two where the first element is the |
|
1873 |
message to be sent and the second element is the receiver." |
|
1874 |
||
1875 |
aSelectorOrArray isNil ifTrue:[^ aValueModel]. |
|
1876 |
||
1877 |
(aSelectorOrArray isArray) ifTrue:[ |
|
1878 |
aValueModel onChangeSend:(aSelectorOrArray at:1) to:(aSelectorOrArray at:2) |
|
1879 |
] ifFalse: [ |
|
1880 |
aValueModel onChangeSend:aSelectorOrArray to:self |
|
1881 |
]. |
|
1882 |
^aValueModel |
|
1883 |
||
1884 |
"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
|
1885 |
! |
3764f680134d
allow subclass to redefine subCanvas-pre/postBuilds;
Claus Gittinger <cg@exept.de>
parents:
978
diff
changeset
|
1886 |
|
1419 | 1887 |
valueHolderFor:aSelector initialValue:anObject |
1888 |
"Return a ValueHolder on anObject." |
|
1889 |
||
1890 |
^ self valueHolderFor:aSelector initialValue:anObject changeMessage:nil |
|
1891 |
||
1892 |
||
1893 |
! |
|
1894 |
||
1895 |
valueHolderFor:aSelector initialValue:anObject changeMessage:aSelectorOrArrayOrNil |
|
1896 |
"Return a ValueHolder on anObject. aSelectorOrArrayOrNil is the change information |
|
1897 |
for the ValueHolder. This argument is either a Symbol or an Array of two elements. |
|
1898 |
If it is a Symbol, then it is the change message and the interested object is understood |
|
1899 |
to be the reciever. If it is an Array, then the first element is the change message and |
|
1900 |
the second element is the interested object. " |
|
1901 |
||
1902 |
|holder| |
|
1903 |
||
1904 |
(builder bindings includesKey:aSelector) ifFalse:[ |
|
1905 |
holder := ValueHolder with:anObject. |
|
1906 |
builder aspectAt:aSelector put:holder. |
|
1907 |
aSelectorOrArrayOrNil notNil ifTrue:[ |
|
1908 |
^ self registerInterestIn:holder using:aSelectorOrArrayOrNil |
|
1909 |
]. |
|
1910 |
^ holder |
|
1911 |
]. |
|
1912 |
^ builder aspectAt:aSelector |
|
1913 |
||
1914 |
"Modified: / 21.5.1998 / 03:31:28 / cg" |
|
1915 |
! ! |
|
1916 |
||
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1917 |
!ApplicationModel methodsFor:'forced actions'! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1918 |
|
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1919 |
doAcceptByReturnKey |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1920 |
|acceptAction| |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1921 |
|
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1922 |
builder notNil ifTrue:[ |
2010 | 1923 |
acceptAction := builder bindingAt:#doAccept. |
2009
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1924 |
]. |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1925 |
acceptAction notNil ifTrue:[ |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1926 |
acceptAction value |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1927 |
] ifFalse:[ |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1928 |
self doAccept |
cb68fe9cdb72
care for accept-binding, when closing via return key
Claus Gittinger <cg@exept.de>
parents:
1997
diff
changeset
|
1929 |
] |
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1930 |
! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1931 |
|
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1932 |
doCancelByEscapeKey |
2010 | 1933 |
|cancelAction| |
1934 |
||
1935 |
builder notNil ifTrue:[ |
|
1936 |
cancelAction := builder bindingAt:#doCancel. |
|
1937 |
]. |
|
1938 |
cancelAction notNil ifTrue:[ |
|
1939 |
cancelAction value |
|
1940 |
] ifFalse:[ |
|
1941 |
self doCancel |
|
1942 |
] |
|
1880
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1943 |
! ! |
064c4f74b8e8
doAcceptByReturnKey and doCancelByEscapeKey pushed up from
james
parents:
1851
diff
changeset
|
1944 |
|
1419 | 1945 |
!ApplicationModel methodsFor:'help'! |
1946 |
||
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1947 |
aboutImage |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1948 |
"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
|
1949 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1950 |
^ self class aboutImage |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1951 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1952 |
"Modified: / 13.11.2001 / 12:32:44 / cg" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1953 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1954 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1955 |
aboutThisApplicationLabel |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1956 |
"label for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1957 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1958 |
^ self class aboutThisApplicationLabel |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1959 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1960 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1961 |
aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1962 |
"text for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1963 |
|
1674
3000bc98f043
about stuff delegated to class
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1964 |
^ self class aboutThisApplicationText |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1965 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1966 |
|
2520
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
1967 |
flyByHelpDependsOnPositionIn:aView |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
1968 |
"subclasses where the help-text depends upon the pointer position might |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
1969 |
want to redefine this" |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
1970 |
|
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
1971 |
^ false |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
1972 |
! |
b4cb0d37c0d4
+ flyByHelpDependsOnPositionIn:
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
1973 |
|
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1974 |
openAboutThisApplication |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1975 |
"opens an about box for this application. |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1976 |
Can be specialized by redefining #aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1977 |
and #aboutThisApplicationLabel" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1978 |
|
1531 | 1979 |
Dialog |
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1980 |
about:(self translateString:self aboutThisApplicationText) |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
1981 |
label:(self translateString:self aboutThisApplicationLabel) |
1531 | 1982 |
icon:self aboutImage |
1983 |
||
1984 |
"Modified: / 17.11.2001 / 23:05:52 / cg" |
|
1419 | 1985 |
! |
1986 |
||
1987 |
openHelpViewOnFile:pathToHelpText |
|
1988 |
"open a help viewer (as opened by the help buttons). |
|
1989 |
The argument is a relative path within the help directory |
|
1990 |
(but a file under the current directory is tried first)" |
|
1991 |
||
1992 |
self withWaitCursorDo:[ |
|
1993 |
HTMLDocumentView openFullOnHelpFile:pathToHelpText |
|
1994 |
] |
|
1995 |
||
1996 |
! |
|
1997 |
||
1998 |
showActiveHelp:aHelpText for:view |
|
1999 |
"This is invoked from the activeHelp event listener, to display some popup-help |
|
2000 |
for a component. If false is returned, the help manager will pop up |
|
2001 |
some active help bubble; if true is returned, it will assume that the |
|
2002 |
help text has been already displayed and will not do any further actions. |
|
2003 |
Here, we accept the help text, and push an event into out own input |
|
2004 |
queue, so that the help text will be displayed asyncronously by myself, |
|
2005 |
vis the #showHelp:for: method. |
|
2006 |
This can be redefined in concrete classes to handle active help differently." |
|
2007 |
||
2008 |
|wg mySensor| |
|
2009 |
||
2010 |
self showingHelp ifFalse: [ |
|
2011 |
^ true |
|
2012 |
]. |
|
2013 |
||
2014 |
"/ masterApplication notNil ifTrue:[ |
|
2015 |
"/ (masterApplication showActiveHelp:aHelpText for:view) ifTrue:[ |
|
2016 |
"/ ^ true |
|
2017 |
"/ ] |
|
2018 |
"/ ]. |
|
2019 |
||
2020 |
"/ NEW: push it into the event queue, to have it displayed |
|
2021 |
"/ syncronously with other events. |
|
2022 |
"/ (also any errors are reported as occurring in my context; |
|
2023 |
"/ instead of occurring in the activeHelp context). |
|
2024 |
||
2025 |
(wg := self windowGroup) notNil ifTrue:[ |
|
2026 |
mySensor := wg sensor. |
|
2027 |
mySensor notNil ifTrue:[ |
|
2028 |
mySensor flushEventsFor:self withType:#showHelp:for:. |
|
2029 |
mySensor |
|
2030 |
pushUserEvent:#showHelp:for: for:self |
|
2031 |
withArguments:(Array with:aHelpText with:view). |
|
2032 |
^ true |
|
2033 |
] |
|
2034 |
]. |
|
2035 |
||
2036 |
"/ mhmh - can this happen ? |
|
2037 |
||
2038 |
^ true |
|
2039 |
||
2040 |
"Modified: / 21.8.1998 / 16:00:37 / cg" |
|
2041 |
! |
|
2042 |
||
2043 |
showHelp:aHelpText for:view |
|
2044 |
"actual method which is supposed to display the help text. |
|
2045 |
Should be redefined in concrete classes, to put the help text |
|
2046 |
into some info label, or the windows title bar. |
|
2047 |
Here, the help text is ignored." |
|
2048 |
||
2049 |
masterApplication notNil ifTrue:[ |
|
2050 |
masterApplication showHelp:aHelpText for:view |
|
2051 |
]. |
|
2052 |
||
2053 |
"Modified: / 31.7.1998 / 19:13:59 / cg" |
|
2054 |
! |
|
2055 |
||
2056 |
showingHelp |
|
2057 |
"return true, if the activeHelp manager should invoke my #showHelp:for: |
|
2058 |
method, when the mouse pointer is moved over my widgets. |
|
2059 |
The default here is true, however, the #showHelp:for: methods are empty. |
|
2060 |
These should be redefined to put the help text into some info label, |
|
2061 |
or into the views title bar. |
|
2062 |
You may also redefine the showingHelp/showingHelp: methods, to |
|
2063 |
remember the flag setting." |
|
2064 |
||
2065 |
^ true |
|
2066 |
||
2067 |
"Modified: / 31.7.1998 / 17:55:31 / cg" |
|
2068 |
! ! |
|
2069 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2070 |
!ApplicationModel methodsFor:'hooks'! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2071 |
|
2185 | 2072 |
aboutToOpen:whichTopView |
2073 |
"the topView is about to be opened. |
|
2074 |
This is sent by whichTopView, right before its really open |
|
2075 |
(i.e. finally visible)" |
|
2076 |
||
2077 |
self preOpenWith:builder |
|
2078 |
! |
|
2079 |
||
1991
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2080 |
commonPostBuild |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2081 |
"a common hook for postBuildWith: and postBuildAsSubcanvasWith:." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2082 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2083 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2084 |
commonPostOpen |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2085 |
"a common hook for postOpenWith: and postOpenAsSubcanvasWith:." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2086 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2087 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2088 |
commonPreBuild |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2089 |
"a common hook for preBuildWith: and preBuildAsSubcanvasWith:." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2090 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2091 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2092 |
postApplicationProcessCreate:newProcess windowGroup:newGroup |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2093 |
"this is sent whenever a new application is launched from this app, |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2094 |
which forks its own windowGroup process. Allows for process group management, |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2095 |
or process-global exception handlers to be installed. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2096 |
Nothing done here - to be redefined in concrete applications" |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2097 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2098 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2099 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2100 |
postBuildAsSubcanvasWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2101 |
"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
|
2102 |
Can be redefined in subclasses for additional setup after |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2103 |
the subcanvas view has been built, but not yet opened." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2104 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2105 |
|sameApp| |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2106 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2107 |
sameApp := aBuilder application == aBuilder window topView application. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2108 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2109 |
"/ If I am opened as subcanvas in another application |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2110 |
"/ then treat this like a regular open. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2111 |
"/ otherwise ignore it. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2112 |
sameApp ifFalse:[ |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2113 |
self postBuildWith:aBuilder. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2114 |
] ifTrue:[ |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2115 |
self commonPostBuild. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2116 |
]. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2117 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2118 |
"Modified: / 8.7.1998 / 18:28:55 / cg" |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2119 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2120 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2121 |
postBuildWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2122 |
"this is sent after an interface is built from a spec. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2123 |
Can be redefined in subclasses for additional setup after |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2124 |
the view has been built, but not yet opened." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2125 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2126 |
self commonPostBuild |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2127 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2128 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2129 |
postOpenAsSubcanvasWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2130 |
"this is sent after the applications window is opened inside another application. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2131 |
Can be redefined in subclasses for actions after opening the view." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2132 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2133 |
self commonPostOpen |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2134 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2135 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2136 |
postOpenWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2137 |
"this is sent after the applications main window is opened. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2138 |
Can be redefined in subclasses for actions after opening the view." |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2139 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2140 |
self commonPostOpen |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2141 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2142 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2143 |
preBuildAsSubcanvasWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2144 |
"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
|
2145 |
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
|
2146 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2147 |
self commonPreBuild |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2148 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2149 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2150 |
preBuildWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2151 |
"this is sent before an interface is built from a spec. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2152 |
Can be redefined in subclasses. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2153 |
mhmh - what should this do here ?" |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2154 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2155 |
self commonPreBuild |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2156 |
! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2157 |
|
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2158 |
preOpenWith:aBuilder |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2159 |
"this is sent before the applications main window is opened. |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2160 |
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
|
2161 |
! ! |
b74357a16333
commonPostBuild and commonPostOpen.
Claus Gittinger <cg@exept.de>
parents:
1988
diff
changeset
|
2162 |
|
1419 | 2163 |
!ApplicationModel methodsFor:'initialization'! |
2164 |
||
2165 |
addTopViewsToCurrentProject |
|
2166 |
"add all of my topViews to the current projects list of views. |
|
2167 |
This allows hiding views on a per-project basis. |
|
2168 |
Applications which do not want to be switched with projects |
|
2169 |
(such as the Launcher), may redefine this to a noop." |
|
2170 |
||
1972 | 2171 |
|wg| |
2172 |
||
2173 |
(wg := self windowGroup) notNil ifTrue:[ |
|
2174 |
(wg topViews ? #()) do:[:aView | |
|
2175 |
aView addToCurrentProject |
|
2176 |
] |
|
1419 | 2177 |
] |
2178 |
||
2179 |
"Modified: 17.1.1997 / 19:43:39 / cg" |
|
2180 |
! |
|
2181 |
||
2182 |
basicInitialize |
|
2183 |
"initialize the application. |
|
2184 |
Since ST-80 applications seem commonly to redefine #initialize |
|
2185 |
without doing a super initialize, the real initialization is |
|
2186 |
done here ..." |
|
2187 |
||
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2188 |
self initializeDevice. |
1419 | 2189 |
|
2190 |
"claus: I wanted to delay the creation & assignment of the |
|
2191 |
builder till later, to allow setting to another builder. |
|
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2192 |
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
|
2193 |
creation, which might lead to trouble. |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2194 |
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
|
2195 |
late. |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2196 |
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
|
2197 |
" |
1419 | 2198 |
|
2199 |
"/ builder := self builderClass new. |
|
2200 |
"/ builder notNil ifTrue:[builder application:self]. |
|
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2201 |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2202 |
self initializeResources. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2203 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2204 |
"Modified: / 13-09-2006 / 12:39:30 / cg" |
1419 | 2205 |
! |
2206 |
||
2207 |
initialize |
|
2208 |
"nothing done here; |
|
2209 |
but can be redefined in concrete applications" |
|
2210 |
! |
|
2211 |
||
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2212 |
initializeDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2213 |
self isWebService ifTrue:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2214 |
self initializeWebServiceDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2215 |
] ifFalse:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2216 |
self initializeScreenDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2217 |
]. |
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2218 |
! |
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2219 |
|
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2220 |
initializeResources |
2365
4050feaebfc2
slightly refactored for subclassability
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
2221 |
"initialize the applications resources (NLS support)." |
2211
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2222 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2223 |
resources := self class classResources. |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2224 |
|
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2225 |
"Created: / 13-09-2006 / 12:39:22 / cg" |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2226 |
! |
66b7109e72e6
better resource flushing support
Claus Gittinger <cg@exept.de>
parents:
2185
diff
changeset
|
2227 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2228 |
initializeScreenDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2229 |
Screen notNil ifTrue:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2230 |
device := Screen current. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2231 |
] |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2232 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2233 |
|
1419 | 2234 |
setDevice:aDevice |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2235 |
"set the device (i.e. some Screen), where the application shall open its view(s). |
1419 | 2236 |
The default device (if not set here) will be the current screen." |
2237 |
||
2238 |
device := aDevice |
|
2239 |
||
2240 |
"Created: 5.7.1996 / 12:01:40 / cg" |
|
2241 |
"Modified: 17.1.1997 / 19:44:09 / cg" |
|
2242 |
! ! |
|
2243 |
||
2244 |
!ApplicationModel methodsFor:'misc'! |
|
2245 |
||
2246 |
information:aString |
|
2247 |
"like Objects information, but translates the string via the |
|
2248 |
resourcePack, thus giving a translated string automatically" |
|
2249 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2250 |
super information:(self translateString:aString) withCRs |
1419 | 2251 |
|
2252 |
"Created: / 20.5.1998 / 03:48:43 / cg" |
|
2253 |
! |
|
2254 |
||
1699
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2255 |
notify:aString |
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2256 |
"like Objects notify, but translates the string via the |
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2257 |
resourcePack, thus giving a translated string automatically" |
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2258 |
|
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2259 |
super notify:(self translateString:aString) withCRs |
1699
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2260 |
|
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2261 |
"Created: / 20.5.1998 / 01:14:52 / cg" |
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2262 |
"Modified: / 13.11.2001 / 20:10:12 / cg" |
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2263 |
! |
f196e6667c23
Add #notify (similar to #information:)
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2264 |
|
1419 | 2265 |
restoreCursors |
2266 |
"restore the original cursors in all of my views" |
|
2267 |
||
2268 |
^ self window windowGroup restoreCursors |
|
2269 |
||
2270 |
"Created: 1.6.1996 / 17:01:24 / cg" |
|
2271 |
! |
|
2272 |
||
2273 |
showCursor:aCursor |
|
2274 |
"set all of my views cursor to aCursor. |
|
2275 |
It can be restored with #restoreCursor." |
|
2276 |
||
2277 |
^ self window windowGroup showCursor:aCursor |
|
2278 |
||
2279 |
"Created: 1.6.1996 / 17:01:09 / cg" |
|
2280 |
! |
|
2281 |
||
2282 |
warn:aString |
|
2283 |
"like Objects warn, but translates the string via the |
|
2284 |
resourcePack, thus giving a translated string automatically" |
|
2285 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2286 |
super warn:(self translateString:aString) withCRs |
1419 | 2287 |
|
2288 |
"Created: / 20.5.1998 / 01:14:52 / cg" |
|
1527 | 2289 |
"Modified: / 13.11.2001 / 20:10:12 / cg" |
1419 | 2290 |
! |
2291 |
||
2292 |
warn:aString with:arg |
|
2293 |
"like Objects warn, but translates the string via the |
|
2294 |
resourcePack, thus giving a translated string automatically" |
|
2295 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2296 |
self warn:aString withArguments:(Array with:arg) |
1419 | 2297 |
! |
2298 |
||
2299 |
warn:aString with:arg1 with:arg2 |
|
2300 |
"like Objects warn, but translates the string via the |
|
2301 |
resourcePack, thus giving a translated string automatically" |
|
2302 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2303 |
self warn:aString withArguments:(Array with:arg1 with:arg2) |
1419 | 2304 |
! |
2305 |
||
2306 |
warn:aString with:arg1 with:arg2 with:arg3 |
|
2307 |
"like Objects warn, but translates the string via the |
|
2308 |
resourcePack, thus giving a translated string automatically" |
|
2309 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2310 |
self warn:aString withArguments:(Array with:arg1 with:arg2 with:arg3) |
1419 | 2311 |
! |
2312 |
||
2313 |
warn:aString with:arg1 with:arg2 with:arg3 with:arg4 |
|
2314 |
"like Objects warn, but translates the string via the |
|
2315 |
resourcePack, thus giving a translated string automatically" |
|
2316 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2317 |
self warn:aString withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) |
1419 | 2318 |
|
2319 |
"Created: / 23.2.2000 / 09:43:04 / cg" |
|
2320 |
! |
|
2321 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2322 |
warn:aString withArguments:argArray |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2323 |
"like Objects warn, but translates the string via the |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2324 |
resourcePack, thus giving a translated string automatically" |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2325 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2326 |
|translatedString stream| |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2327 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2328 |
translatedString := self translateString:aString. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2329 |
stream := TextStream on:(translatedString species new:translatedString size + (argArray size * 10)). |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2330 |
translatedString withCRs expandPlaceholdersWith:argArray on:stream. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2331 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2332 |
super warn:stream contents |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2333 |
! |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
2334 |
|
1419 | 2335 |
withCursor:aCursor do:aBlock |
2336 |
"evaluate aBlock, showing aCursor in my topView and all of its subviews. |
|
2337 |
Return the value of aBlock." |
|
2338 |
||
2339 |
|w ret| |
|
2340 |
||
2341 |
w := self window. |
|
2342 |
w notNil ifTrue:[ |
|
1886 | 2343 |
^ w topView withCursor:aCursor do:aBlock |
1419 | 2344 |
]. |
2345 |
aCursor showWhile:[ret := aBlock value]. |
|
2346 |
^ ret. |
|
2347 |
||
2348 |
"Modified: / 23.9.1998 / 17:00:25 / cg" |
|
969
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
2349 |
! |
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
2350 |
|
1419 | 2351 |
withExecuteCursorDo:aBlock |
2352 |
"evaluate aBlock, showing an executeCursor in my topView and all of its subviews. |
|
2353 |
Return the value of aBlock." |
|
2354 |
||
2355 |
^ self withCursor:(Cursor execute) do:aBlock |
|
2356 |
||
2357 |
"Created: 14.12.1995 / 20:57:03 / cg" |
|
2358 |
! |
|
2359 |
||
2360 |
withReadCursorDo:aBlock |
|
2361 |
"evaluate aBlock, showing a readCursor in my topView and all of its subviews. |
|
2362 |
Return the value of aBlock." |
|
2363 |
||
2364 |
^ self withCursor:(Cursor read) do:aBlock |
|
2365 |
||
2366 |
"Created: 14.12.1995 / 20:56:47 / cg" |
|
2367 |
"Modified: 14.12.1995 / 20:57:36 / cg" |
|
2368 |
! |
|
2369 |
||
2370 |
withWaitCursorDo:aBlock |
|
2371 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
|
2372 |
Return the value of aBlock." |
|
2373 |
||
2374 |
^ self withCursor:Cursor wait do:aBlock |
|
2375 |
! ! |
|
2376 |
||
2377 |
!ApplicationModel methodsFor:'opening'! |
|
2378 |
||
2379 |
open |
|
2380 |
"open a standard interface" |
|
2381 |
||
2382 |
^ self openInterface |
|
2383 |
||
2384 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
2385 |
! |
|
2386 |
||
1592
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
2387 |
openAndWaitUntilVisible |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
2388 |
"open a standard interface, and wait until my window is visible" |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
2389 |
|
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
2390 |
self open. |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
2391 |
self window waitUntilVisible. |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
2392 |
! |
dd8fc50564c0
added #openAndWaitUntilVisible
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
2393 |
|
1634 | 2394 |
openAs:windowType |
2395 |
"open a standard interface as slave, partner, dialog etc." |
|
2396 |
||
2397 |
^ self openInterfaceAs:windowType |
|
2398 |
||
2399 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
2400 |
! |
|
2401 |
||
2402 |
openAsSlave |
|
1726 | 2403 |
"open a standard interface as slave. |
2404 |
Notice: there is still a need to make the current window a master |
|
2405 |
(see code and comments in WindowBuilder >> openAt:withExtent:andType:)" |
|
1634 | 2406 |
|
2407 |
^ self openAs:#slave |
|
1724 | 2408 |
|
2409 |
" |
|
2410 |
WorkspaceApplication new openAsSlave. |
|
2411 |
" |
|
1634 | 2412 |
! |
2413 |
||
1419 | 2414 |
openAt:aPoint |
2415 |
"open a standard interface at some point" |
|
2416 |
||
2417 |
^ self openInterfaceAt:aPoint |
|
2418 |
||
2419 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
2420 |
"Created: 14.2.1997 / 20:17:41 / cg" |
|
2421 |
! |
|
2422 |
||
2423 |
openDialog |
|
2424 |
"open the window - assumes that the builder has already setup |
|
2425 |
the interface." |
|
2426 |
||
2038 | 2427 |
self window beToolDialog. |
1419 | 2428 |
^ builder openDialog. |
2429 |
||
2430 |
"Modified: 14.2.1997 / 20:32:52 / cg" |
|
2431 |
! |
|
2432 |
||
2433 |
openDialogInterface:aSelector |
|
2434 |
"open a dialog" |
|
2435 |
||
2436 |
^ self openDialogInterface:aSelector withBindings:nil |
|
2437 |
||
2438 |
"Modified: 28.2.1997 / 14:08:01 / cg" |
|
2439 |
! |
|
2440 |
||
2441 |
openDialogInterface:aSelector withBindings:bindings |
|
2442 |
"open a dialog, given a spec-selector" |
|
2443 |
||
2444 |
^ SimpleDialog new |
|
2445 |
openFor:self |
|
2446 |
interface:aSelector |
|
2447 |
withBindings:bindings |
|
2448 |
||
2449 |
"Created: / 28.2.1997 / 14:07:45 / cg" |
|
2450 |
"Modified: / 23.1.1998 / 18:18:14 / cg" |
|
2451 |
! |
|
2452 |
||
2453 |
openDialogInterfaceSpec:aSpec withBindings:bindings |
|
2454 |
"open a dialog, given a spec" |
|
2455 |
||
2456 |
^ SimpleDialog new |
|
2457 |
openFor:self |
|
2458 |
interfaceSpec:aSpec |
|
2459 |
withBindings:bindings |
|
2460 |
||
2461 |
"Created: / 28.2.1997 / 14:07:45 / cg" |
|
2462 |
"Modified: / 23.1.1998 / 18:18:14 / cg" |
|
2463 |
! |
|
2464 |
||
2465 |
openDialogSpec:aSpec withBindings:bindings |
|
2466 |
"open a dialog" |
|
2467 |
||
2468 |
^ SimpleDialog new |
|
2469 |
openFor:self |
|
2470 |
spec:aSpec |
|
2471 |
withBindings:bindings |
|
2472 |
||
2473 |
"Modified: / 23.1.1998 / 18:18:14 / cg" |
|
2474 |
"Created: / 20.5.1998 / 20:27:56 / cg" |
|
2475 |
! |
|
2476 |
||
2477 |
openInterface |
|
2478 |
"open a standard interface. |
|
2479 |
||
2480 |
Subclasses which do not have an interfaceSpec |
|
2481 |
should redefine this method and create & open their view(s) there. |
|
2482 |
(see Launcher as an example)." |
|
2483 |
||
1985 | 2484 |
^ self openInterface:(self defaultWindowSpecName) |
1419 | 2485 |
|
2486 |
"Modified: / 9.9.1996 / 22:39:23 / stefan" |
|
2487 |
"Modified: / 23.1.1998 / 18:16:50 / cg" |
|
2488 |
! |
|
2489 |
||
2490 |
openInterface:aSymbol |
|
2491 |
"open a specific interface. |
|
2492 |
The argument, aSymbol specifies which interface. The concrete |
|
2493 |
application subclass must provide a method with that name, |
|
2494 |
which must return an interfaceSpec. This is forwarded to |
|
2495 |
the builder to create the views. |
|
2496 |
Typically, applications only use one interface, |
|
2497 |
returned by the #windowSpec method." |
|
2498 |
||
2499 |
self allButOpenInterface:aSymbol. |
|
2500 |
self openWindow. |
|
2501 |
^ builder |
|
2502 |
||
2503 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
2504 |
! |
|
2505 |
||
1634 | 2506 |
openInterface:aSymbol as:windowType |
2507 |
"open a specific interface. |
|
2508 |
The argument, aSymbol specifies which interface. |
|
2509 |
The concrete application subclass must provide a method with that name, |
|
2510 |
which must return an interfaceSpec. This is forwarded to the builder to create the views. |
|
2511 |
Typically, applications only use one interface, returned by the #windowSpec method. |
|
2512 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc." |
|
2513 |
||
2514 |
self allButOpenInterface:aSymbol. |
|
2515 |
self openWindowAs:windowType. |
|
2516 |
^ builder |
|
2517 |
||
2518 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
2519 |
! |
|
2520 |
||
1419 | 2521 |
openInterface:aSymbol at:aLocation |
2522 |
"open a specific interface. |
|
2523 |
||
2524 |
The argument, aSymbol specifies which interface. The concrete |
|
2525 |
application subclass must provide a method with that name, |
|
2526 |
which must return an interfaceSpec. This is forwarded to |
|
2527 |
the builder to create the views. |
|
2528 |
Typically, applications only use one interface, |
|
2529 |
returned by the #windowSpec method." |
|
2530 |
||
2531 |
self allButOpenInterface:aSymbol. |
|
2532 |
self openWindowAt:aLocation. |
|
2533 |
^ builder |
|
2534 |
||
2535 |
"Created: 14.2.1997 / 20:19:44 / cg" |
|
2536 |
! |
|
2537 |
||
1634 | 2538 |
openInterfaceAs:windowType |
2539 |
"open a standard interface. |
|
2540 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc. |
|
2541 |
Subclasses which do not have an interfaceSpec |
|
2542 |
should redefine this method and create & open their view(s) there. |
|
2543 |
(see Launcher as an example)." |
|
2544 |
||
1985 | 2545 |
^ self openInterface:(self defaultWindowSpecName) as:windowType |
1634 | 2546 |
|
2547 |
"Modified: / 9.9.1996 / 22:39:23 / stefan" |
|
2548 |
"Modified: / 23.1.1998 / 18:16:50 / cg" |
|
2549 |
! |
|
2550 |
||
1419 | 2551 |
openInterfaceAt:aLocation |
2552 |
"open a standard interface." |
|
2553 |
||
1985 | 2554 |
^ self openInterface:(self defaultWindowSpecName) at:aLocation |
1419 | 2555 |
|
2556 |
"Created: / 14.2.1997 / 20:18:20 / cg" |
|
2557 |
"Modified: / 23.1.1998 / 18:17:13 / cg" |
|
2558 |
! |
|
2559 |
||
2560 |
openInterfaceModal |
|
2561 |
"open a standard interface as a modal dialog. |
|
2562 |
||
2563 |
Subclasses which do not have an interfaceSpec |
|
2564 |
should redefine this method and create & open their view(s) there. |
|
2565 |
(see Launcher as an example)." |
|
2566 |
||
1985 | 2567 |
^ self openInterfaceModal:(self defaultWindowSpecName) |
1419 | 2568 |
|
2569 |
"Modified: / 9.9.1996 / 22:39:23 / stefan" |
|
2570 |
"Modified: / 23.1.1998 / 18:17:17 / cg" |
|
2571 |
! |
|
2572 |
||
2573 |
openInterfaceModal:aSymbol |
|
2574 |
"open a specific interface as a modal dialog. |
|
2575 |
The argument, aSymbol specifies which interface. The concrete |
|
2576 |
application subclass must provide a method with that name, |
|
2577 |
which must return an interfaceSpec. This is forwarded to |
|
2578 |
the builder to create the views. |
|
2579 |
Typically, applications only use one interface, |
|
2580 |
returned by the #windowSpec method." |
|
2581 |
||
2582 |
self allButOpenInterface:aSymbol. |
|
2583 |
self openWindowModal. |
|
2584 |
^ builder |
|
2585 |
||
2586 |
"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
|
2587 |
! |
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
2588 |
|
1419 | 2589 |
openInterfaceModal:aSymbol at:location |
2590 |
"open a specific interface modal at some screen location. |
|
2591 |
The argument, aSymbol specifies which interface. The concrete |
|
2592 |
application subclass must provide a method with that name, |
|
2593 |
which must return an interfaceSpec. This is forwarded to |
|
2594 |
the builder to create the views. |
|
2595 |
Typically, applications only use one interface, |
|
2596 |
returned by the #windowSpec method." |
|
2597 |
||
2598 |
self allButOpenInterface:aSymbol. |
|
2599 |
self openWindowModalAt:location. |
|
2600 |
^ builder |
|
2601 |
||
2602 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
2603 |
! |
|
2604 |
||
2605 |
openModal |
|
2606 |
"open a standard interface as a modal dialog" |
|
2607 |
||
2608 |
^ self openInterfaceModal |
|
2609 |
||
2610 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
2611 |
! |
|
2612 |
||
2613 |
openOnDevice:aDevice |
|
2614 |
"open a standard interface on some other device" |
|
2615 |
||
2616 |
self setDevice:aDevice. |
|
1444 | 2617 |
Screen currentScreenQuerySignal answer:aDevice |
2618 |
do:[ |
|
2619 |
^ self open |
|
2620 |
] |
|
1419 | 2621 |
|
2622 |
"Created: 13.1.1997 / 21:24:11 / cg" |
|
2623 |
"Modified: 13.1.1997 / 21:24:30 / cg" |
|
2624 |
! |
|
2625 |
||
2626 |
openSpec:anInterfaceSpec |
|
2627 |
"open a view as specified in anInterfaceSpec." |
|
2628 |
||
2629 |
self allButOpenFrom:anInterfaceSpec. |
|
2630 |
self openWindow. |
|
2631 |
^ builder |
|
2632 |
||
2633 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
2634 |
"Created: / 20.5.1998 / 20:08:51 / cg" |
|
2635 |
! |
|
2636 |
||
2393 | 2637 |
openSpec:anInterfaceSpec withBindings:bindings |
2638 |
"open a view as specified in anInterfaceSpec." |
|
2639 |
||
2640 |
self createBuilder. |
|
2641 |
builder bindings:bindings. |
|
2642 |
self allButOpenFrom:anInterfaceSpec. |
|
2643 |
self openWindow. |
|
2644 |
! |
|
2645 |
||
1419 | 2646 |
openSpecModal:anInterfaceSpec |
2647 |
"open an interface spec modal" |
|
2648 |
||
2649 |
self allButOpenFrom:anInterfaceSpec. |
|
2650 |
self openWindowModal. |
|
2651 |
^ builder |
|
2652 |
||
2653 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
2654 |
"Created: / 20.5.1998 / 20:20:21 / cg" |
|
2655 |
! |
|
2656 |
||
2657 |
openWindow |
|
2658 |
"open the window - assumes that the builder has already setup |
|
2659 |
the interface." |
|
2660 |
||
2661 |
builder openWindow. |
|
2662 |
||
2270
a7c797806d46
correctly restore the application after building a sub-app
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
2663 |
"Created: / 14-02-1997 / 20:20:39 / cg" |
a7c797806d46
correctly restore the application after building a sub-app
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
2664 |
"Modified: / 27-10-2006 / 11:49:00 / cg" |
1419 | 2665 |
! |
2666 |
||
1634 | 2667 |
openWindowAs:windowType |
2668 |
"open the window - assumes that the builder has already setup the interface. |
|
2669 |
The windowType can be any of #slave, #partner, #dialog, #popUp etc." |
|
2670 |
||
2671 |
builder openAt:nil withExtent:nil andType:windowType |
|
2672 |
! |
|
2673 |
||
1419 | 2674 |
openWindowAt:aLocation |
2675 |
"open the window - assumes that the builder has already setup |
|
2676 |
the interface." |
|
2677 |
||
2678 |
builder openWindowAt:aLocation. |
|
2679 |
||
2680 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
2681 |
! |
|
2682 |
||
2683 |
openWindowAtCenter |
|
2684 |
"open the window centered on the screen |
|
2685 |
- assumes that the builder has already setup the interface." |
|
2686 |
||
2687 |
builder openWindowAt:#center |
|
2688 |
||
2689 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
2690 |
! |
|
2691 |
||
2692 |
openWindowModal |
|
2693 |
"open the window - assumes that the builder has already setup |
|
2694 |
the interface." |
|
2695 |
||
2696 |
"/ builder openDialog. |
|
2697 |
builder |
|
2698 |
openAt:nil |
|
2699 |
withExtent:nil |
|
2700 |
andType:#dialog |
|
2701 |
||
2702 |
"Created: 14.2.1997 / 20:20:39 / cg" |
|
2703 |
! |
|
2704 |
||
2705 |
openWindowModalAt:aLocation |
|
2706 |
"open the window modal - assumes that the builder has already setup |
|
2707 |
the interface." |
|
2708 |
||
2709 |
builder openDialogAt:aLocation. |
|
2710 |
||
2711 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
2712 |
! |
|
2713 |
||
1478 | 2714 |
openWithExtent:extPoint |
2715 |
"open a standard interface with given extent" |
|
2716 |
||
2717 |
|bldr| |
|
2718 |
||
2719 |
bldr := self allButOpen. |
|
2720 |
bldr openWithExtent:extPoint. |
|
2721 |
^ bldr |
|
2722 |
||
2723 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
2724 |
! |
|
2725 |
||
1968 | 2726 |
opened:whichTopView |
2727 |
"the topView has been opened. |
|
2728 |
This is sent by whichTopView, when its really open |
|
2729 |
(i.e. finally visible)" |
|
2730 |
||
2731 |
self addTopViewsToCurrentProject. |
|
2732 |
self postOpenWith:builder |
|
1419 | 2733 |
! ! |
2734 |
||
2380 | 2735 |
!ApplicationModel methodsFor:'opening-webInterface'! |
2736 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2737 |
addToService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2738 |
self service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2739 |
addPage:(builder page) |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2740 |
link:(self webLink) |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2741 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2742 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2743 |
createWebBuilder |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2744 |
"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
|
2745 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2746 |
builder isNil ifTrue:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2747 |
builder := self webBuilderClass new. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2748 |
builder application:self. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2749 |
] |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2750 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2751 |
"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
|
2752 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2753 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2754 |
defaultPageSpecName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2755 |
^ #pageSpec |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2756 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2757 |
|
2380 | 2758 |
defineInterface |
2759 |
"define a standard interface. |
|
2760 |
||
2761 |
Subclasses which do not have an interfaceSpec |
|
2762 |
should redefine this method and create their page there." |
|
2763 |
||
2764 |
^ self defineInterface:(self defaultPageSpecName) |
|
2765 |
! |
|
2766 |
||
2767 |
defineInterface:aSpecSymbol |
|
2768 |
"define an interface." |
|
2769 |
||
2770 |
^ self defineInterfaceFrom:(self interfaceSpecFor:aSpecSymbol) |
|
2771 |
! |
|
2772 |
||
2773 |
defineInterfaceFrom:aSpec |
|
2774 |
"define an interface (setup a page), given a spec." |
|
2775 |
||
2776 |
|page| |
|
2777 |
||
2778 |
builder isNil ifTrue:[ |
|
2779 |
self createWebBuilder. |
|
2780 |
]. |
|
2781 |
||
2782 |
self preBuildWith:builder. |
|
2783 |
builder buildPageFromSpec:aSpec. |
|
2784 |
page := builder page. |
|
2785 |
page application:self. |
|
2786 |
||
2787 |
self postBuildWith:builder. |
|
2788 |
||
2789 |
"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
|
2790 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2791 |
|
2554
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
2792 |
httpServerPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
2793 |
"on which port will a HTTP server be started" |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
2794 |
|
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
2795 |
^ self class defaultHttpServerPort |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
2796 |
! |
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
2797 |
|
2547
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
2798 |
initializeAsWebServiceOnWebDevice:webDevice |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
2799 |
self setDevice:(WebApplicationDevice new). |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
2800 |
self initialize. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
2801 |
self initializeWebServiceDevice. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
2802 |
self initializeResources. |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
2803 |
! |
b0896e2b4a9c
changed #initializeAsWebServiceOnWebDevice:
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
2804 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2805 |
initializeWebServiceDevice |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2806 |
"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
|
2807 |
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
|
2808 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2809 |
|server| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2810 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2811 |
self service isNil ifTrue:[ |
2554
d76514961c2f
Rename #port -> #httpServerPort
Stefan Vogel <sv@exept.de>
parents:
2549
diff
changeset
|
2812 |
server := HTTPServer serverOnPort:(self httpServerPort). |
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2813 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2814 |
self service:(server |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2815 |
serviceForLink:(self serviceLinkName) |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2816 |
ifAbsent:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2817 |
|service| |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2818 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2819 |
service := HTTPPortalService new. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2820 |
service linkName:(self serviceLinkName). |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2821 |
service class unRegisterServiceOn:server. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2822 |
service registerServiceOn:server. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2823 |
service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2824 |
]). |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2825 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2826 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2827 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2828 |
pageSpecs |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2829 |
^ self class pageSpecs |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2830 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2831 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2832 |
service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2833 |
device isNil ifTrue:[^ nil]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2834 |
self assert:(device isWebServiceDevice). |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2835 |
^ device service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2836 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2837 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2838 |
service:something |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2839 |
self device service:something. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2840 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2841 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2842 |
serviceLinkName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2843 |
^ self class defaultServiceLinkName |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2844 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2845 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2846 |
startAsWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2847 |
device isNil ifTrue:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2848 |
self initializeDevice. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2849 |
]. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2850 |
self startInPortalService:self service |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2851 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2852 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2853 |
self new startInWebService |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2854 |
" |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2855 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2856 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2857 |
startInPortalService:aPortalServiceOrNil |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2858 |
self service:aPortalServiceOrNil. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2859 |
self defineInterface. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2860 |
self addToService. |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2861 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2862 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2863 |
webBuilderClass |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2864 |
"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
|
2865 |
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
|
2866 |
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
|
2867 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2868 |
^ WebPageBuilder |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2869 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2870 |
"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
|
2871 |
"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
|
2872 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2873 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2874 |
webLink |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2875 |
"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
|
2876 |
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
|
2877 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2878 |
^ self device webLink |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2879 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2880 |
|
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2881 |
webLink:something |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2882 |
self device webLink:something |
2380 | 2883 |
! ! |
2884 |
||
1419 | 2885 |
!ApplicationModel methodsFor:'private'! |
2886 |
||
2887 |
builderClass |
|
2888 |
"return the UIBuilder class for me. |
|
2889 |
This method can be redefined if (eventually) there are |
|
2890 |
spec readers for other UI languages (motif UIL ?)" |
|
2891 |
||
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2892 |
self isWebService ifTrue:[ |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2893 |
^ self webBuilderClass |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2894 |
]. |
1419 | 2895 |
^ UIBuilder |
2896 |
||
2897 |
"Created: / 19.6.1998 / 01:39:26 / cg" |
|
2898 |
"Modified: / 19.6.1998 / 01:45:24 / cg" |
|
2899 |
! |
|
2900 |
||
2901 |
createBuilder |
|
1431 | 2902 |
"create a WindowBuilder if not already present" |
2903 |
||
1419 | 2904 |
builder isNil ifTrue:[ |
2905 |
builder := self builderClass new. |
|
2906 |
builder application:self. |
|
2907 |
] |
|
2908 |
||
2909 |
"Created: / 19.6.1998 / 03:32:37 / cg" |
|
2910 |
! ! |
|
2911 |
||
2912 |
!ApplicationModel methodsFor:'queries'! |
|
2913 |
||
1985 | 2914 |
defaultWindowSpecName |
2915 |
^ #windowSpec |
|
2916 |
! |
|
2917 |
||
1419 | 2918 |
defaultWindowType |
2919 |
"Applications come up non-modal, by default" |
|
2920 |
||
2921 |
^ #normal |
|
2922 |
||
2923 |
"Created: 17.1.1997 / 19:57:34 / cg" |
|
2924 |
! |
|
2925 |
||
2926 |
graphicsDevice |
|
2927 |
"return the device I want to open my views on. |
|
2928 |
The default (if not created with #onDevice:) is the currently |
|
2929 |
active screen." |
|
2930 |
||
2931 |
^ device |
|
2932 |
||
2933 |
"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
|
2934 |
! |
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
2935 |
|
2373 | 2936 |
interfaceSpecFor:aSelectorOrSpec |
1419 | 2937 |
"return an interface spec. |
2938 |
Here, the query is forwarded to my class. |
|
2939 |
Can be refefined in subclasses which want to provide per-instance specs." |
|
2940 |
||
2373 | 2941 |
aSelectorOrSpec isSymbol ifFalse:[ |
2942 |
(aSelectorOrSpec isKindOf:UISpecification) ifTrue:[^ aSelectorOrSpec]. |
|
2943 |
]. |
|
2944 |
^ self class interfaceSpecFor:aSelectorOrSpec |
|
2945 |
||
2946 |
"Created: / 25-01-1998 / 19:45:12 / cg" |
|
2947 |
"Modified: / 14-01-2008 / 17:54:29 / cg" |
|
1419 | 2948 |
! |
2949 |
||
1481
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2950 |
isOpen |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2951 |
"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
|
2952 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2953 |
|win| |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2954 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2955 |
^ (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
|
2956 |
! |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2957 |
|
2541
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2958 |
isWebService |
2545 | 2959 |
^ 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
|
2960 |
! |
08d27acc9fe1
merged in WebAppModel code - to allow for an application
Claus Gittinger <cg@exept.de>
parents:
2528
diff
changeset
|
2961 |
|
1419 | 2962 |
processName |
2963 |
"return a name to be shown for me in the process monitor" |
|
2964 |
||
2965 |
self class == ApplicationModel ifTrue:[ |
|
2966 |
^ 'Application' |
|
2967 |
]. |
|
2968 |
^ self class nameWithoutPrefix |
|
2969 |
||
2970 |
"Modified: / 4.12.1997 / 12:39:14 / cg" |
|
2971 |
! |
|
2972 |
||
2973 |
resolveClassNamed:something inClass:aClass |
|
2974 |
"return the class from something, a class, symbol, string or nil. |
|
1548 | 2975 |
first we are looking in the namespace of the application, then in the |
2976 |
current namespace and finally in Smalltalk |
|
1419 | 2977 |
" |
2978 |
||
2979 |
^ Smalltalk resolveName:something inClass:aClass. |
|
2980 |
! |
|
2981 |
||
2982 |
resolveName:something |
|
2983 |
"return the class from something, a class, symbol, string or nil. |
|
1548 | 2984 |
first we are looking in the namespace of the application, then in the |
2099 | 2985 |
current namespace and finally in Smalltalk" |
2986 |
||
1419 | 2987 |
^ self resolveName:something inClass:self class |
2988 |
! |
|
2989 |
||
2990 |
resolveName:something inClass:aClass |
|
2991 |
"return the class from something, a class, symbol, string or nil. |
|
1548 | 2992 |
first we are looking in the namespace of the application, |
2099 | 2993 |
then in the current namespace and finally in Smalltalk" |
2994 |
||
1419 | 2995 |
|cls| |
2996 |
||
2997 |
aClass notNil ifTrue:[ |
|
2998 |
(cls := Smalltalk resolveName:something inClass:aClass) notNil ifTrue:[ |
|
2999 |
^ cls |
|
3000 |
]. |
|
3001 |
||
3002 |
masterApplication notNil ifTrue:[ |
|
3003 |
^ masterApplication resolveName:something |
|
3004 |
] |
|
3005 |
]. |
|
3006 |
^ nil |
|
3007 |
! |
|
3008 |
||
2380 | 3009 |
selfResponsibleFor:aKey |
3010 |
"internal: return true, if I am to provide a value for some aspect." |
|
3011 |
||
3012 |
^ (aKey isNil or:[masterApplication isNil or:[self respondsTo:aKey]]) |
|
3013 |
! |
|
3014 |
||
1419 | 3015 |
topApplication |
3016 |
"return the top-master application" |
|
3017 |
||
3018 |
masterApplication isNil ifTrue:[ |
|
3019 |
^ self |
|
3020 |
]. |
|
3021 |
^ masterApplication topApplication |
|
3022 |
||
3023 |
"Created: / 6.6.1998 / 19:40:42 / cg" |
|
3024 |
! ! |
|
3025 |
||
1766 | 3026 |
!ApplicationModel methodsFor:'startup & release'! |
1419 | 3027 |
|
3028 |
applicationWindowClass |
|
1431 | 3029 |
"return the class used for my (top-) windows" |
3030 |
||
1419 | 3031 |
^ ApplicationWindow |
3032 |
! |
|
3033 |
||
3034 |
close |
|
3035 |
"this is sent by my topView when about to be closed |
|
3036 |
by the program (not by the windowManager). |
|
3037 |
Notice, that we get a closeRequest message if closed by the windowManager, |
|
3038 |
which can be rejected by the app (or confirmed via a dialog) |
|
3039 |
Could be redefined in subclasses." |
|
3040 |
||
3041 |
self closeDownViews |
|
1132
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
3042 |
! |
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
3043 |
|
1419 | 3044 |
closeDownViews |
3045 |
"close down the applications view(s)" |
|
3046 |
||
1700 | 3047 |
|wg wgProcess| |
1419 | 3048 |
|
3049 |
self release. |
|
3050 |
ActiveHelp stopFor:self. |
|
3051 |
||
3052 |
(wg := self windowGroup) notNil ifTrue:[ |
|
3053 |
wgProcess := wg process. |
|
3054 |
(Processor activeProcess ~~ wgProcess |
|
3055 |
and:[wgProcess notNil]) ifTrue:[ |
|
3056 |
wgProcess terminate |
|
3057 |
] ifFalse:[ |
|
3058 |
wg closeDownViews. |
|
3059 |
] |
|
3060 |
] |
|
3061 |
! |
|
3062 |
||
3063 |
closeRequest |
|
3064 |
"this is sent by my topView when about to be closed by the windowManager. |
|
3065 |
Could be redefined in subclasses to suppress close or confirm." |
|
3066 |
||
1528 | 3067 |
|sav window| |
3068 |
||
3069 |
window := self window. |
|
3070 |
window isNil ifTrue:[ |
|
1461
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
3071 |
'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
3072 |
^ self |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
3073 |
]. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
3074 |
|
1831 | 3075 |
window isTopView ifFalse:[ |
1528 | 3076 |
window topView isModal ifTrue:[ |
1461
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
3077 |
WindowGroup leaveSignal raise. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
3078 |
]. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
3079 |
|
1419 | 3080 |
'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR. |
3081 |
^ self |
|
3082 |
]. |
|
3083 |
||
3084 |
"/ In multiView apps, tell my master. |
|
3085 |
"/ (but not if I am a modal reincarnation) |
|
3086 |
(masterApplication notNil |
|
1528 | 3087 |
and:[window isModal not]) ifTrue:[ |
1419 | 3088 |
|
3089 |
"/ temporary clear my masterApplication to prevent |
|
3090 |
"/ endless recursion, in case the master sends me |
|
3091 |
"/ a closeRequest (although, it is supposed to |
|
3092 |
"/ send me a closeDownViews ...) |
|
3093 |
||
3094 |
sav := masterApplication. |
|
3095 |
masterApplication := nil. |
|
1528 | 3096 |
sav closeRequestFor:window. |
1419 | 3097 |
|
3098 |
"/ restore - in case master did not want me to close ... |
|
3099 |
masterApplication := sav. |
|
3100 |
] ifFalse:[ |
|
3101 |
"/ ST/X does close-check by redefining this message without |
|
3102 |
"/ a supersend; |
|
3103 |
"/ VW does it by returning false from requestForWindowClose |
|
3104 |
"/ sigh. |
|
3105 |
||
3106 |
self requestForWindowClose ifTrue:[ |
|
1565
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3107 |
window isSlave ifTrue:[ |
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3108 |
window destroy |
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3109 |
] ifFalse:[ |
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3110 |
self closeDownViews |
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3111 |
] |
1419 | 3112 |
] |
3113 |
]. |
|
3114 |
||
3115 |
"Modified: / 19.6.1998 / 01:37:17 / cg" |
|
3116 |
! |
|
3117 |
||
3118 |
closeRequestFor:aTopView |
|
3119 |
"this is sent by any of my topViews when about to be closed by the |
|
3120 |
windowmanager. For backward compatibility with single-view applications, |
|
3121 |
this is forwarded here to a simple (non topView-specific) closeRequest, |
|
3122 |
effectively closing all of my views. |
|
3123 |
MultiView applications should redefine this method if closing of individual |
|
3124 |
views closing is to be caught and/or should not close all of them." |
|
3125 |
||
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3126 |
|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
|
3127 |
|
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3128 |
myWindow := self window. |
1419 | 3129 |
|
3130 |
"/ In multiView apps, tell my master. |
|
3131 |
"/ (but not if I am a modal reincarnation) |
|
3132 |
(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
|
3133 |
and:[myWindow topView isModal not]) ifTrue:[ |
1419 | 3134 |
|
3135 |
"/ temporary clear my masterApplication to prevent |
|
3136 |
"/ endless recursion, in case the master sends me |
|
3137 |
"/ a closeRequest (although, it is supposed to |
|
3138 |
"/ send me a closeDownViews ...) |
|
3139 |
||
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3140 |
savedMaster := masterApplication. |
1419 | 3141 |
masterApplication := nil. |
1565
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3142 |
aTopView isSlave ifTrue:[ |
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3143 |
savedMaster closeRequestFor:aTopView. |
1565
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3144 |
] ifFalse:[ |
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3145 |
savedMaster closeRequestFor:myWindow. |
1565
ea35a676f0b1
do not shutDown the whole app, if a slave is closing down.
Claus Gittinger <cg@exept.de>
parents:
1556
diff
changeset
|
3146 |
]. |
1419 | 3147 |
|
3148 |
"/ restore - in case master did not want me to close ... |
|
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3149 |
masterApplication := savedMaster. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3150 |
^ self |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3151 |
]. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3152 |
|
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3153 |
(aTopView == myWindow) ifTrue:[ |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3154 |
self closeRequest. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3155 |
^ self |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3156 |
]. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3157 |
|
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3158 |
(aTopView isPartner or:[aTopView isMaster]) ifTrue:[ |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3159 |
aTopView application closeRequest. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3160 |
self closeRequest. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3161 |
^ self. |
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3162 |
]. |
1924 | 3163 |
aTopView isSlave ifTrue:[ |
3164 |
aTopView closeRequest |
|
3165 |
] ifFalse:[ |
|
3166 |
aTopView application closeRequest. |
|
3167 |
] |
|
1419 | 3168 |
! |
3169 |
||
3170 |
doAccept |
|
3171 |
"this is invoked by the Return-Key (if returnIsOK) or |
|
3172 |
the ok-button (if any), IFF the application has been |
|
3173 |
opened modal (i.e. as a dialog)." |
|
3174 |
||
3175 |
"/ the following is a bad kludge - |
|
3176 |
"/ actually, modal apps should inherit from SimpleDialog |
|
3177 |
"/ (then, things would be clean) |
|
3178 |
"/ However, it may be useful, to open some app (which is normally |
|
3179 |
"/ modeless) as a modal one as well. |
|
3180 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
3181 |
"/ to remember the accept vs. cancel case. |
|
3182 |
"/ |
|
3183 |
self window isModal ifTrue:[ |
|
2128
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3184 |
masterApplication notNil ifTrue:[ |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3185 |
masterApplication window topView == self window topView ifTrue:[ |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3186 |
masterApplication window isModal ifTrue:[ |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3187 |
masterApplication doAccept. |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3188 |
^ self. |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3189 |
]. |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3190 |
]. |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3191 |
]. |
4e5c9e1c12e5
doAccept in a subCanvas of a modal view
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
3192 |
|
1419 | 3193 |
"/ mhmh - is this a good idea ? |
1792 | 3194 |
self perform:#accept ifNotUnderstood:[self closeRequest]. |
1419 | 3195 |
^ self |
3196 |
]. |
|
3197 |
||
3198 |
^ self "/ nothing done here ... |
|
3199 |
! |
|
3200 |
||
3201 |
doCancel |
|
3202 |
"this is invoked by the Escape-Key (if escapeIsCancel) or |
|
3203 |
the cancel-button (if any), IFF the application has been |
|
3204 |
opened modal (i.e. as a dialog)." |
|
3205 |
||
3206 |
"/ the following is a bad kludge - |
|
3207 |
"/ actually, modal apps should inherit from SimpleDialog |
|
3208 |
"/ (then, things would be clean) |
|
3209 |
"/ However, it may be useful, to open some app (which is normally |
|
3210 |
"/ modeless) as a modal one as well. |
|
3211 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
3212 |
"/ to remember the accept vs. cancel case. |
|
1417 | 3213 |
"/ |
1419 | 3214 |
self window isModal ifTrue:[ |
3215 |
"/ mhmh - is this a good idea ? |
|
1792 | 3216 |
self perform:#cancel ifNotUnderstood:[self closeRequest]. |
1419 | 3217 |
^ self |
3218 |
]. |
|
3219 |
^ self "/ nothing done here ... |
|
3220 |
! |
|
3221 |
||
3222 |
releaseAsSubCanvas |
|
3223 |
"a subcanvas is closed or switching to a new application. |
|
3224 |
Can be redefined to perform a self release in this case." |
|
3225 |
||
3226 |
"/ used to self release here, |
|
3227 |
"/ but that is incompatible to VW (RefactoryBrowser). |
|
3228 |
"/ Therefore, if you need it, you MUST now redefine |
|
3229 |
"/ this method. |
|
3230 |
! |
|
3231 |
||
3232 |
restarted |
|
3233 |
"sent by my topWindow, when restarted from an image. |
|
3234 |
Nothing done here, but can be redefined to perform any actions |
|
3235 |
required to reset the application after an image-restart. |
|
3236 |
(for example: check if application files are still around, restart |
|
3237 |
subprocesses etc.)." |
|
3238 |
||
3239 |
"Modified: 1.6.1996 / 16:55:50 / cg" |
|
3240 |
! |
|
3241 |
||
3242 |
saveAndTerminateRequest |
|
3243 |
"some windowManagers send this to shut down an application |
|
3244 |
and have it save its state for restart. |
|
3245 |
Can be redefined in subclasses" |
|
3246 |
||
3247 |
self closeRequest |
|
3248 |
! |
|
3249 |
||
3250 |
saveAndTerminateRequestFor:aTopView |
|
3251 |
"some windowManagers send this to shut down an application |
|
3252 |
and have it save its state for restart. |
|
3253 |
Can be redefined in subclasses" |
|
3254 |
||
3255 |
self saveAndTerminateRequest |
|
3256 |
! ! |
|
3257 |
||
2528
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3258 |
!ApplicationModel methodsFor:'translating'! |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3259 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3260 |
translateString:aString |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3261 |
"translate aString to the current language. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3262 |
We use the resorces as default. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3263 |
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
|
3264 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3265 |
|res| |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3266 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3267 |
res := self resources. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3268 |
res isNil ifTrue:[ |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3269 |
^ aString |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3270 |
]. |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3271 |
|
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3272 |
^ res string:aString |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3273 |
! ! |
abeb2b5c60da
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2527
diff
changeset
|
3274 |
|
1419 | 3275 |
!ApplicationModel methodsFor:'window events'! |
3276 |
||
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3277 |
clientMessage:msgType format:msgFormat eventData:msgData |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3278 |
"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
|
3279 |
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
|
3280 |
! |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3281 |
|
2526
d2be37e49195
changed #copyDataEvent:eventData:
Claus Gittinger <cg@exept.de>
parents:
2522
diff
changeset
|
3282 |
copyDataEvent:parameter eventData:msgData |
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3283 |
"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
|
3284 |
Subclasses prepared to receive them should redefine this method" |
2527 | 3285 |
|
3286 |
|messageStream command argument| |
|
3287 |
||
3288 |
messageStream := msgData asString readStream. |
|
3289 |
command := messageStream upTo: $:. |
|
3290 |
argument := messageStream upTo: Character null. |
|
3291 |
self processApplicationCommand:command with:argument |
|
2522
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3292 |
! |
ff119836dbec
hooks for client and copyData events
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3293 |
|
1419 | 3294 |
dispatchEvent:event |
3295 |
"dispatch a user-pushed event. |
|
3296 |
This allows for events for an appModel to be pushed into the event queue |
|
3297 |
the same way as events for a view are pushable." |
|
3298 |
||
3299 |
^ self |
|
3300 |
dispatchEvent:event |
|
3301 |
withFocusOn:nil |
|
3302 |
delegate:true |
|
3303 |
||
3304 |
! |
|
3305 |
||
3306 |
dispatchEvent:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
|
3307 |
"dispatch a user-pushed event. |
|
3308 |
This allows for events for an appModel to be pushed into the event queue |
|
3309 |
the same way as events for a view are pushable." |
|
3310 |
||
3311 |
self perform:evType withArguments:evArgs |
|
3312 |
||
3313 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
3314 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
1290 | 3315 |
! |
3316 |
||
1419 | 3317 |
dispatchEvent:ev type:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
3318 |
"dispatch a user-pushed event. |
|
3319 |
This allows for events for an appModel to be pushed into the event queue |
|
3320 |
the same way as events for a view are pushable." |
|
3321 |
||
3322 |
self perform:evType withArguments:evArgs |
|
3323 |
||
3324 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
3325 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
3326 |
! |
|
3327 |
||
3328 |
dispatchEvent:event withFocusOn:focusViewOrNil |
|
3329 |
"dispatch a user-pushed event. |
|
3330 |
This allows for events for an appModel to be pushed into the event queue |
|
3331 |
the same way as events for a view are pushable." |
|
3332 |
||
3333 |
^ self |
|
3334 |
dispatchEvent:event |
|
3335 |
withFocusOn:focusViewOrNil |
|
3336 |
delegate:true |
|
3337 |
||
3338 |
||
3339 |
! |
|
3340 |
||
3341 |
dispatchEvent:event withFocusOn:focusViewOrNil delegate:doDelegate |
|
3342 |
"dispatch a user-pushed event. |
|
3343 |
This allows for events for an appModel to be pushed into the event queue |
|
3344 |
the same way as events for a view are pushable." |
|
3345 |
||
3346 |
^ self |
|
3347 |
dispatchEvent:event |
|
3348 |
type:event type |
|
3349 |
arguments:(event arguments) |
|
3350 |
withFocusOn:focusViewOrNil |
|
3351 |
delegate:doDelegate |
|
3352 |
||
3353 |
||
3354 |
! |
|
3355 |
||
3356 |
noticeOfWindowClose:aWindow |
|
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3357 |
"sent when a topView or applicationSubView has been closed. |
1419 | 3358 |
Can be redefined in subclasses for cleanup." |
3359 |
||
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3360 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3361 |
self windowEvent:(#close -> aWindow) from:aWindow. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3362 |
^ self |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3363 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3364 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3365 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3366 |
! |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3367 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3368 |
noticeOfWindowOpen:aWindow |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3369 |
"sent when a topView or applicationSubView has been opened. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3370 |
Can be redefined in subclasses." |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3371 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3372 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
3373 |
self windowEvent:(#open -> aWindow) from:aWindow. |
1419 | 3374 |
^ self |
3375 |
||
3376 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
|
3377 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
3378 |
! |
|
3379 |
||
2527 | 3380 |
processApplicationCommand:command with:argument |
3381 |
"a message from a secondary application instance (the exe has been started again). |
|
3382 |
Typically, the command is one like 'openPath:', as generated in StandaloneStartup." |
|
3383 |
||
3384 |
command = 'openPath' ifTrue:[ |
|
3385 |
self processOpenPathCommand:argument. |
|
3386 |
^ self. |
|
3387 |
]. |
|
3388 |
||
3389 |
Transcript showCR: 'Invalid command received: ', command. |
|
3390 |
! |
|
3391 |
||
3392 |
processOpenPathCommand:argument |
|
3393 |
"a message from a secondary application instance (the exe has been started again) |
|
3394 |
to open another window on document as found in the pathName argument. |
|
3395 |
Left blank (i.e. ignored) here, but can be redefined to open up another application |
|
3396 |
editor window if supported." |
|
3397 |
! |
|
3398 |
||
1419 | 3399 |
requestForWindowClose |
3400 |
"the applicationWindow wants to know, if a close |
|
3401 |
is ok. Return false if not." |
|
3402 |
||
3403 |
|w k| |
|
3404 |
||
3405 |
builder notNil ifTrue:[ |
|
3406 |
(w := builder window) notNil ifTrue:[ |
|
3407 |
(k := w keyboardProcessor) notNil ifTrue:[ |
|
3408 |
^ k requestForWindowClose |
|
3409 |
] |
|
3410 |
] |
|
3411 |
]. |
|
3412 |
^ true |
|
3413 |
||
3414 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
3415 |
"Created: / 19.6.1998 / 01:34:58 / cg" |
|
3416 |
! |
|
3417 |
||
3418 |
showActivity:someMessage |
|
3419 |
"some activityNotification shalt be communicated to |
|
3420 |
the user. Forwarded from the topView and ignored here. |
|
3421 |
Can be redefined in concrete applications to show the |
|
3422 |
message either in some infoView (infoLabel as in Windows) |
|
3423 |
or in the title area (as done in the browsers)" |
|
3424 |
||
3425 |
^ self |
|
3426 |
||
3427 |
"Created: 16.12.1995 / 18:41:04 / cg" |
|
3428 |
"Modified: 24.4.1996 / 09:34:22 / cg" |
|
3429 |
! |
|
3430 |
||
3431 |
windowEvent:anEvent from:anApplicationWindow |
|
3432 |
"dummy: windowEvent forwarding is not yet implemented" |
|
3433 |
||
3434 |
^ self |
|
3435 |
||
3436 |
"Modified: 24.4.1996 / 09:32:50 / cg" |
|
3437 |
! ! |
|
3438 |
||
3439 |
!ApplicationModel class methodsFor:'documentation'! |
|
3440 |
||
1417 | 3441 |
version |
2569 | 3442 |
^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.275 2008-12-02 11:01:02 fm Exp $' |
85 | 3443 |
! ! |
1633
07765ef65021
fix (kludge) for slaveApp, which have a masterApp,
Claus Gittinger <cg@exept.de>
parents:
1622
diff
changeset
|
3444 |
|
1419 | 3445 |
ApplicationModel initialize! |