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