author | Claus Gittinger <cg@exept.de> |
Fri, 21 May 1999 18:26:11 +0200 | |
changeset 1383 | 1c0ffdda1a92 |
parent 1216 | c9f8253a9e7c |
child 1412 | b426fae6edcf |
permissions | -rw-r--r-- |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
1 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
2 |
COPYRIGHT (c) 1998 by eXept Software AG |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
3 |
All Rights Reserved |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
4 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
5 |
This software is furnished under a license and may be used |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
10 |
hereby transferred. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
11 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
12 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
13 |
|
455 | 14 |
ScrollableView subclass:#SubCanvas |
503 | 15 |
instanceVariableNames:'builder spec client clientHolder specHolder' |
455 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Views-Basic' |
|
19 |
! |
|
20 |
||
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
21 |
!SubCanvas class methodsFor:'documentation'! |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
22 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
23 |
copyright |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
24 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
25 |
COPYRIGHT (c) 1998 by eXept Software AG |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
26 |
All Rights Reserved |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
27 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
28 |
This software is furnished under a license and may be used |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
29 |
only in accordance with the terms of that license and with the |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
30 |
inclusion of the above copyright notice. This software may not |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
31 |
be provided or otherwise made available to, or used by, any |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
32 |
other person. No title to or ownership of the software is |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
33 |
hereby transferred. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
34 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
35 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
36 |
! |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
37 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
38 |
documentation |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
39 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
40 |
a view for a subApplication. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
41 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
42 |
[author:] |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
43 |
Claus Atzkern |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
44 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
45 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
46 |
! ! |
455 | 47 |
|
48 |
!SubCanvas methodsFor:'accessing'! |
|
49 |
||
503 | 50 |
builder |
51 |
"return the value of the instance variable 'builder' (automatically generated)" |
|
455 | 52 |
|
503 | 53 |
^ builder! |
455 | 54 |
|
503 | 55 |
client |
56 |
"return the value of the instance variable 'client' (automatically generated)" |
|
455 | 57 |
|
503 | 58 |
^ client! |
455 | 59 |
|
60 |
client:anApplicationModel |
|
61 |
"release existing components and generate new components from |
|
62 |
the applications windowSpec." |
|
63 |
||
64 |
^ self client:anApplicationModel spec:#windowSpec |
|
65 |
! |
|
66 |
||
503 | 67 |
client:anApplication spec:aWindowSpecOrSelector |
455 | 68 |
"release existing components and generate new components from |
69 |
the applications windowSpec." |
|
70 |
||
503 | 71 |
|aBuilder| |
455 | 72 |
|
503 | 73 |
(anApplication notNil and:[anApplication respondsTo:#builder]) ifTrue:[ |
74 |
aBuilder := anApplication builder |
|
455 | 75 |
] ifFalse:[ |
503 | 76 |
aBuilder := UIBuilder new |
455 | 77 |
]. |
503 | 78 |
^ self client:anApplication spec:aWindowSpecOrSelector builder:aBuilder |
455 | 79 |
! |
80 |
||
503 | 81 |
client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder |
455 | 82 |
"release existing components and generate new components from |
83 |
the given windowSpec, using the given builder." |
|
84 |
||
503 | 85 |
builder := aBuilder. |
86 |
spec := aWindowSpecOrSpecSymbol. |
|
87 |
||
88 |
"/ check for master application |
|
89 |
(anApplication notNil and:[anApplication masterApplication isNil]) ifTrue:[ |
|
90 |
client := nil. |
|
91 |
client := self application. |
|
92 |
client ~~ anApplication ifTrue:[ |
|
93 |
anApplication masterApplication:client |
|
94 |
] |
|
95 |
]. |
|
96 |
client := anApplication. |
|
97 |
self rebuild. |
|
98 |
^ builder |
|
99 |
! |
|
100 |
||
101 |
spec |
|
102 |
"return the value of the instance variable 'spec' (automatically generated)" |
|
103 |
||
104 |
^ spec! |
|
105 |
||
106 |
spec:something |
|
107 |
"set the value of the instance variable 'spec' (automatically generated)" |
|
108 |
||
109 |
spec := something. |
|
110 |
self rebuild. |
|
819 | 111 |
! |
112 |
||
113 |
widget |
|
114 |
"ST80 compatibility. |
|
115 |
I am my own widget" |
|
116 |
||
117 |
^ self |
|
118 |
||
119 |
"Created: / 10.3.1998 / 16:20:52 / stefan" |
|
503 | 120 |
! ! |
121 |
||
122 |
!SubCanvas methodsFor:'accessing channels'! |
|
123 |
||
124 |
clientHolder |
|
125 |
^ clientHolder |
|
126 |
! |
|
127 |
||
128 |
clientHolder:aValueHolder |
|
129 |
||
130 |
clientHolder notNil ifTrue:[ |
|
131 |
clientHolder removeDependent:self |
|
132 |
]. |
|
133 |
(clientHolder := aValueHolder) notNil ifTrue:[ |
|
134 |
clientHolder addDependent:self |
|
135 |
]. |
|
557 | 136 |
self updateFromChannels |
503 | 137 |
! |
138 |
||
139 |
specHolder |
|
140 |
^ specHolder |
|
141 |
! |
|
142 |
||
143 |
specHolder:aValueHolder |
|
144 |
||
145 |
specHolder notNil ifTrue:[ |
|
146 |
specHolder removeDependent:self |
|
147 |
]. |
|
148 |
(specHolder := aValueHolder) notNil ifTrue:[ |
|
149 |
specHolder addDependent:self |
|
150 |
]. |
|
557 | 151 |
self updateFromChannels |
503 | 152 |
! ! |
153 |
||
154 |
!SubCanvas methodsFor:'building'! |
|
155 |
||
156 |
rebuild |
|
157 |
"rebuild |
|
158 |
" |
|
1383 | 159 |
|subSpec savedView builderClass| |
455 | 160 |
|
161 |
scrolledView notNil ifTrue:[ |
|
162 |
scrolledView destroySubViews |
|
163 |
]. |
|
164 |
||
165 |
spec notNil ifTrue:[ |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
166 |
(subSpec := spec) isSymbol ifTrue:[ |
554 | 167 |
client isNil ifTrue:[ |
1216
c9f8253a9e7c
give a warning with nil client
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
168 |
'SubCanvas [warning]: no client - cannot build spec' infoPrintCR. |
554 | 169 |
^ self |
553 | 170 |
]. |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
171 |
(subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[ |
1216
c9f8253a9e7c
give a warning with nil client
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
172 |
"/ Transcript showCR:'SubCanvas: nil spec'. |
503 | 173 |
^ self |
174 |
] |
|
175 |
]. |
|
973 | 176 |
|
554 | 177 |
builder isNil ifTrue:[ |
1383 | 178 |
client isNil ifTrue:[ |
179 |
builderClass := UIBuilder |
|
180 |
] ifFalse:[ |
|
181 |
builderClass := client builderClass |
|
182 |
]. |
|
183 |
builder := builderClass new. |
|
554 | 184 |
]. |
973 | 185 |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
186 |
"/ old: |
973 | 187 |
"/ builder buildFromSpec:subSpec in:scrolledView. |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
188 |
|
973 | 189 |
"/ new (let app know (somehow) that this is a build |
190 |
"/ for a subcanvas (i.e. it can redefine the buildSubCanvase-method |
|
191 |
"/: |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
192 |
savedView := builder window. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
193 |
builder window:scrolledView. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
194 |
client buildSubCanvas:subSpec withBuilder:builder. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
195 |
builder window:savedView. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
196 |
|
503 | 197 |
self realized ifTrue:[ |
198 |
scrolledView realizeAllSubViews |
|
199 |
] |
|
200 |
] |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
201 |
|
973 | 202 |
"Modified: / 20.6.1998 / 14:29:00 / cg" |
503 | 203 |
! |
204 |
||
205 |
releaseAllComponents |
|
206 |
scrolledView destroySubViews. |
|
207 |
builder := nil. |
|
208 |
spec := nil. |
|
209 |
client := nil. |
|
210 |
! ! |
|
211 |
||
212 |
!SubCanvas methodsFor:'change & update'! |
|
213 |
||
214 |
update:something with:aParameter from:changedObject |
|
215 |
"one of my models changed its value |
|
216 |
" |
|
557 | 217 |
(changedObject == clientHolder or:[changedObject == specHolder]) ifTrue:[ |
218 |
self updateFromChannels |
|
219 |
] ifFalse:[ |
|
220 |
super update:something with:aParameter from:changedObject. |
|
221 |
] |
|
222 |
||
223 |
! |
|
224 |
||
225 |
updateFromChannels |
|
226 |
"update canvas from channel |
|
227 |
" |
|
228 |
|client spec| |
|
229 |
||
230 |
clientHolder isNil ifTrue:[ |
|
231 |
client := self application |
|
232 |
] ifFalse:[ |
|
233 |
client := clientHolder value |
|
554 | 234 |
]. |
503 | 235 |
|
557 | 236 |
specHolder isNil ifTrue:[ |
237 |
spec := #windowSpec |
|
238 |
] ifFalse:[ |
|
239 |
spec := specHolder value |
|
240 |
]. |
|
241 |
(client notNil and:[spec notNil]) ifTrue:[ |
|
242 |
self client:client spec:spec |
|
243 |
] ifFalse:[ |
|
244 |
self client:nil |
|
245 |
] |
|
503 | 246 |
|
247 |
||
248 |
! ! |
|
249 |
||
250 |
!SubCanvas methodsFor:'initialization'! |
|
251 |
||
609 | 252 |
destroy |
253 |
clientHolder notNil ifTrue:[ |
|
254 |
clientHolder removeDependent:self. |
|
255 |
clientHolder := nil. |
|
256 |
]. |
|
257 |
specHolder notNil ifTrue:[ |
|
258 |
specHolder removeDependent:self. |
|
259 |
specHolder := nil. |
|
260 |
]. |
|
261 |
super destroy. |
|
262 |
! |
|
263 |
||
503 | 264 |
initialize |
265 |
super initialize. |
|
266 |
self scrolledView:View new. |
|
267 |
spec := #windowSpec. |
|
268 |
! ! |
|
269 |
||
270 |
!SubCanvas methodsFor:'queries'! |
|
271 |
||
272 |
application |
|
273 |
"return the application, under which this view was opened, |
|
274 |
" |
|
275 |
||
276 |
client notNil ifTrue:[ |
|
277 |
^ client |
|
455 | 278 |
]. |
503 | 279 |
^ super application |
280 |
||
455 | 281 |
! ! |
282 |
||
283 |
!SubCanvas class methodsFor:'documentation'! |
|
284 |
||
285 |
version |
|
1383 | 286 |
^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.11 1999-05-21 16:26:11 cg Exp $' |
455 | 287 |
! ! |