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