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