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