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