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