233
|
1 |
JavaView subclass:#JavaEmbeddedFrameView
|
282
|
2 |
instanceVariableNames:'codeURL codeBaseURL documentURL archiveURL parameterDictionary
|
|
3 |
embeddedAppletFrame applet appletID appletThread
|
|
4 |
infoDisplayReceiver'
|
|
5 |
classVariableNames:'NextSequentialAppletID'
|
233
|
6 |
poolDictionaries:''
|
|
7 |
category:'Java-Views-Support'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
282
|
11 |
!JavaEmbeddedFrameView methodsFor:'accessing'!
|
|
12 |
|
|
13 |
appletID
|
|
14 |
"return the value of the instance variable 'appletID' (automatically generated)"
|
|
15 |
|
|
16 |
^ appletID
|
|
17 |
|
|
18 |
"Created: / 28.1.1998 / 21:08:54 / cg"
|
|
19 |
!
|
|
20 |
|
|
21 |
appletID:something
|
|
22 |
"set the value of the instance variable 'appletID' (automatically generated)"
|
|
23 |
|
|
24 |
appletID := something.
|
|
25 |
|
|
26 |
"Created: / 28.1.1998 / 21:08:54 / cg"
|
|
27 |
!
|
|
28 |
|
|
29 |
appletThread
|
|
30 |
^ appletThread
|
|
31 |
|
|
32 |
"Created: / 28.1.1998 / 21:39:42 / cg"
|
|
33 |
!
|
|
34 |
|
|
35 |
archiveURL:anArchiveURLString
|
|
36 |
archiveURL := anArchiveURLString
|
|
37 |
|
|
38 |
"Created: / 28.1.1998 / 21:00:38 / cg"
|
|
39 |
!
|
|
40 |
|
|
41 |
codeBaseURL:aCodeBaseURLString
|
|
42 |
codeBaseURL := aCodeBaseURLString
|
|
43 |
|
|
44 |
"Created: / 28.1.1998 / 20:59:34 / cg"
|
|
45 |
!
|
|
46 |
|
|
47 |
codeURL:aCodeURLString
|
|
48 |
codeURL := aCodeURLString
|
|
49 |
|
|
50 |
"Created: / 28.1.1998 / 21:10:11 / cg"
|
|
51 |
!
|
|
52 |
|
|
53 |
documentURL:aDocumentURLString
|
|
54 |
documentURL := aDocumentURLString
|
|
55 |
|
|
56 |
"Created: / 28.1.1998 / 21:00:03 / cg"
|
|
57 |
"Modified: / 28.1.1998 / 21:00:28 / cg"
|
|
58 |
!
|
|
59 |
|
|
60 |
embeddedAppletFrame
|
|
61 |
^ embeddedAppletFrame
|
|
62 |
|
|
63 |
"Created: / 28.1.1998 / 21:39:35 / cg"
|
|
64 |
!
|
|
65 |
|
|
66 |
infoDisplayReceiver
|
|
67 |
"return the value of the instance variable 'infoDisplayReceiver' (automatically generated)"
|
|
68 |
|
|
69 |
^ infoDisplayReceiver
|
|
70 |
|
|
71 |
"Created: / 28.1.1998 / 21:43:54 / cg"
|
|
72 |
!
|
|
73 |
|
|
74 |
infoDisplayReceiver:something
|
|
75 |
"set the value of the instance variable 'infoDisplayReceiver' (automatically generated)"
|
|
76 |
|
|
77 |
infoDisplayReceiver := something.
|
|
78 |
|
|
79 |
"Created: / 28.1.1998 / 21:43:54 / cg"
|
|
80 |
!
|
|
81 |
|
|
82 |
parameterDictionary:aParameterDictionary
|
|
83 |
parameterDictionary := aParameterDictionary
|
|
84 |
|
|
85 |
"Created: / 28.1.1998 / 21:01:20 / cg"
|
|
86 |
! !
|
|
87 |
|
|
88 |
!JavaEmbeddedFrameView methodsFor:'applet control'!
|
|
89 |
|
|
90 |
appletDESTROY
|
|
91 |
embeddedAppletFrame
|
|
92 |
perform:#'sendEvent(I)V'
|
|
93 |
with:(embeddedAppletFrame class instVarNamed:'APPLET_DESTROY').
|
|
94 |
|
|
95 |
"Created: / 28.1.1998 / 21:41:45 / cg"
|
|
96 |
!
|
|
97 |
|
|
98 |
appletDISPOSE
|
|
99 |
embeddedAppletFrame
|
|
100 |
perform:#'sendEvent(I)V'
|
|
101 |
with:(embeddedAppletFrame class instVarNamed:'APPLET_DISPOSE').
|
|
102 |
|
|
103 |
"Created: / 28.1.1998 / 21:41:57 / cg"
|
|
104 |
!
|
|
105 |
|
|
106 |
appletINIT
|
|
107 |
embeddedAppletFrame
|
|
108 |
perform:#'sendEvent(I)V'
|
|
109 |
with:(embeddedAppletFrame class instVarNamed:'APPLET_INIT').
|
|
110 |
|
|
111 |
"Created: / 28.1.1998 / 21:17:51 / cg"
|
|
112 |
!
|
|
113 |
|
|
114 |
appletLOAD
|
|
115 |
embeddedAppletFrame
|
|
116 |
perform:#'sendEvent(I)V'
|
|
117 |
with:(embeddedAppletFrame class instVarNamed:'APPLET_LOAD').
|
|
118 |
|
|
119 |
"Created: / 28.1.1998 / 21:17:37 / cg"
|
|
120 |
!
|
|
121 |
|
|
122 |
appletSTART
|
|
123 |
embeddedAppletFrame
|
|
124 |
perform:#'sendEvent(I)V'
|
|
125 |
with:(embeddedAppletFrame class instVarNamed:'APPLET_START').
|
|
126 |
|
|
127 |
"Created: / 28.1.1998 / 21:18:01 / cg"
|
|
128 |
!
|
|
129 |
|
|
130 |
appletSTOP
|
|
131 |
embeddedAppletFrame
|
|
132 |
perform:#'sendEvent(I)V'
|
|
133 |
with:(embeddedAppletFrame class instVarNamed:'APPLET_STOP').
|
|
134 |
|
|
135 |
"Created: / 28.1.1998 / 21:41:33 / cg"
|
|
136 |
!
|
|
137 |
|
|
138 |
startApplet
|
|
139 |
self startAppletThread.
|
|
140 |
|
|
141 |
self appletLOAD.
|
|
142 |
self appletINIT.
|
|
143 |
self appletSTART
|
|
144 |
|
|
145 |
"Modified: / 28.1.1998 / 21:30:24 / cg"
|
|
146 |
!
|
|
147 |
|
|
148 |
startAppletThread
|
|
149 |
|appletName|
|
|
150 |
|
|
151 |
appletThread := JavaProcess
|
|
152 |
for:[
|
|
153 |
"/ passnotifications to the documentFrame ...
|
|
154 |
Object informationSignal handle:[:ex |
|
|
155 |
JavaVM javaConsoleStream showCR:ex errorString.
|
|
156 |
ex proceed.
|
|
157 |
] do:[
|
|
158 |
Object activityNotificationSignal handle:[:ex |
|
|
159 |
infoDisplayReceiver notNil ifTrue:[
|
|
160 |
infoDisplayReceiver infoDisplay:ex errorString.
|
|
161 |
] ifFalse:[
|
|
162 |
Transcript showCR:ex errorString
|
|
163 |
].
|
|
164 |
ex proceed.
|
|
165 |
] do:[
|
|
166 |
[
|
|
167 |
embeddedAppletFrame perform:#'run()V'.
|
|
168 |
] valueNowOrOnUnwindDo:[
|
|
169 |
appletThread terminateAllSubprocesses.
|
|
170 |
Transcript showCR:'JAVA applet startup finished'.
|
|
171 |
]
|
|
172 |
]
|
|
173 |
]
|
|
174 |
]
|
|
175 |
priority:(Processor activePriority - 1).
|
|
176 |
|
|
177 |
appletName := codeURL asFilename withoutSuffix baseName.
|
|
178 |
appletThread name:('JAVA-applet ''' , appletName , ''' [startup]').
|
|
179 |
|
|
180 |
appletThread resume.
|
|
181 |
|
|
182 |
^ appletThread.
|
|
183 |
|
|
184 |
"Created: / 28.1.1998 / 21:30:32 / cg"
|
|
185 |
"Modified: / 28.1.1998 / 21:44:03 / cg"
|
|
186 |
! !
|
|
187 |
|
|
188 |
!JavaEmbeddedFrameView methodsFor:'private'!
|
|
189 |
|
|
190 |
setupAppletFrame
|
|
191 |
|jMozillaAppletContextClass appletContext
|
|
192 |
jEmbeddedAppletFrameClass
|
|
193 |
toolkit peer attribs id
|
|
194 |
jCodeBaseURL jDocumentURL jArchiveURL|
|
|
195 |
|
|
196 |
jCodeBaseURL := Java as_URL:codeBaseURL.
|
|
197 |
jDocumentURL := Java as_URL:documentURL.
|
|
198 |
jArchiveURL := Java as_URL:archiveURL.
|
|
199 |
|
|
200 |
id := appletID.
|
|
201 |
id isNil ifTrue:[
|
|
202 |
NextSequentialAppletID isNil ifTrue:[
|
|
203 |
NextSequentialAppletID := 1.
|
|
204 |
].
|
|
205 |
id := NextSequentialAppletID.
|
|
206 |
NextSequentialAppletID := NextSequentialAppletID + 1
|
|
207 |
].
|
|
208 |
|
|
209 |
attribs := Dictionary new.
|
|
210 |
width notNil ifTrue:[attribs at:'width' put:width printString].
|
|
211 |
height notNil ifTrue:[attribs at:'height' put:height printString].
|
|
212 |
codeURL notNil ifTrue:[attribs at:'code' put:codeURL].
|
|
213 |
parameterDictionary notNil ifTrue:[
|
|
214 |
attribs declareAllFrom:parameterDictionary
|
|
215 |
].
|
|
216 |
attribs := Java as_Hashtable:attribs.
|
|
217 |
|
|
218 |
"/ this makes it a modzilla frame ...
|
|
219 |
jMozillaAppletContextClass := Java classForName:'netscape.applet.MozillaAppletContext'.
|
|
220 |
jMozillaAppletContextClass isNil ifTrue:[
|
|
221 |
self warn:'no netscape.applet.MozillaAppletContext class'.
|
|
222 |
^ false
|
|
223 |
].
|
|
224 |
appletContext := jMozillaAppletContextClass new.
|
|
225 |
|
|
226 |
jEmbeddedAppletFrameClass := Java classForName:'netscape.applet.EmbeddedAppletFrame'.
|
|
227 |
jEmbeddedAppletFrameClass isNil ifTrue:[
|
|
228 |
self warn:'no netscape.applet.EmbeddedAppletFrame class'.
|
|
229 |
^ false
|
|
230 |
].
|
|
231 |
embeddedAppletFrame := jEmbeddedAppletFrameClass new.
|
|
232 |
embeddedAppletFrame instVarNamed:'pData' put:self.
|
|
233 |
|
|
234 |
toolkit := Java classForName:'java.awt.Toolkit'.
|
|
235 |
toolkit := toolkit invoke:#getDefaultToolkit.
|
|
236 |
peer := toolkit
|
|
237 |
perform:#'createFrame(Ljava/awt/Frame;)Ljava/awt/peer/FramePeer;'
|
|
238 |
with:embeddedAppletFrame.
|
|
239 |
|
|
240 |
(embeddedAppletFrame respondsTo:#'<init>(Ljava/net/URL;Ljava/net/URL;Ljava/net/URL;Ljava/util/Hashtable;Lnetscape/applet/MozillaAppletContext;Ljava/lang/Integer;)V')
|
|
241 |
ifTrue:[
|
|
242 |
"/ 3.01 netscape
|
|
243 |
embeddedAppletFrame
|
|
244 |
perform:#'<init>(Ljava/net/URL;Ljava/net/URL;Ljava/net/URL;Ljava/util/Hashtable;Lnetscape/applet/MozillaAppletContext;Ljava/lang/Integer;)V'
|
|
245 |
with:jDocumentURL
|
|
246 |
with:jCodeBaseURL
|
|
247 |
with:jArchiveURL
|
|
248 |
with:attribs
|
|
249 |
with:appletContext
|
|
250 |
with:(Java as_Integer:id).
|
|
251 |
] ifFalse:[
|
|
252 |
"/ oldStyle netscape
|
|
253 |
embeddedAppletFrame
|
|
254 |
perform:#'<init>(Ljava/net/URL;Ljava/net/URL;Ljava/util/Hashtable;Lnetscape/applet/MozillaAppletContext;I)V'
|
|
255 |
with:jDocumentURL
|
|
256 |
with:jCodeBaseURL
|
|
257 |
with:attribs
|
|
258 |
with:appletContext
|
|
259 |
with:id.
|
|
260 |
].
|
|
261 |
|
|
262 |
embeddedAppletFrame instVarNamed:'peer' put:peer.
|
|
263 |
|
|
264 |
self javaPeer:peer.
|
|
265 |
|
|
266 |
jMozillaAppletContextClass instVarNamed:'debug' put:1.
|
|
267 |
|
|
268 |
^ true
|
|
269 |
|
|
270 |
"Created: / 28.1.1998 / 21:23:25 / cg"
|
|
271 |
"Modified: / 28.1.1998 / 21:37:22 / cg"
|
|
272 |
! !
|
|
273 |
|
233
|
274 |
!JavaEmbeddedFrameView class methodsFor:'documentation'!
|
|
275 |
|
|
276 |
version
|
282
|
277 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaEmbeddedFrameView.st,v 1.2 1998/01/28 20:53:53 cg Exp $'
|
233
|
278 |
! !
|