JavaEmbeddedFrameView.st
author cg
Thu, 29 Jan 1998 14:42:33 +0000
changeset 286 da220fe69de3
parent 282 80e840e0139f
child 288 d71bacb73ff7
permissions -rw-r--r--
applet startup & shutDown now all done here; HTMLDocumentPainter no longer needs to know those details.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
233
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
     1
JavaView subclass:#JavaEmbeddedFrameView
282
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
     2
	instanceVariableNames:'codeURL codeBaseURL documentURL archiveURL parameterDictionary
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
     3
		embeddedAppletFrame applet appletID appletThread
286
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
     4
		infoDisplayReceiver autoStartApplet autoDestroyApplet'
282
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
     5
	classVariableNames:'NextSequentialAppletID'
233
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
     6
	poolDictionaries:''
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
     7
	category:'Java-Views-Support'
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
     8
!
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
     9
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
    10
282
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    11
!JavaEmbeddedFrameView methodsFor:'accessing'!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    12
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    13
appletID
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    14
    "return the value of the instance variable 'appletID' (automatically generated)"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    15
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    16
    ^ appletID
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    17
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    18
    "Created: / 28.1.1998 / 21:08:54 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    19
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    20
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    21
appletID:something
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    22
    "set the value of the instance variable 'appletID' (automatically generated)"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    23
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    24
    appletID := something.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    25
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    26
    "Created: / 28.1.1998 / 21:08:54 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    27
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    28
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    29
appletThread
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    30
    ^ appletThread
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    31
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    32
    "Created: / 28.1.1998 / 21:39:42 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    33
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    34
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    35
archiveURL:anArchiveURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    36
    archiveURL := anArchiveURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    37
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    38
    "Created: / 28.1.1998 / 21:00:38 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    39
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    40
286
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    41
autoDestroyApplet:aBoolean
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    42
    "set/clear the autoDestroy flag.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    43
     If set, the applet will be shutDown whenever the I get destroyed.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    44
     if clear, the applet is not automatically shutDown and must be
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    45
     terminated by someone else.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    46
     The default is false."
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    47
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    48
    autoDestroyApplet := aBoolean.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    49
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    50
    "Created: / 29.1.1998 / 15:18:50 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    51
    "Modified: / 29.1.1998 / 15:21:01 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    52
!
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    53
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    54
autoStartApplet:aBoolean
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    55
    "set/clear the autoStart flag.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    56
     If set, the applet will be loaded & started whenever the I get realized
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    57
     for the first time.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    58
     If clear, the applet is not automatically started and must be
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    59
     started by someone else.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    60
     The default is false."
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    61
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    62
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    63
    autoStartApplet := aBoolean.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    64
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    65
    "Created: / 29.1.1998 / 15:18:41 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    66
    "Modified: / 29.1.1998 / 15:20:54 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    67
!
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
    68
282
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    69
codeBaseURL:aCodeBaseURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    70
    codeBaseURL := aCodeBaseURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    71
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    72
    "Created: / 28.1.1998 / 20:59:34 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    73
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    74
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    75
codeURL:aCodeURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    76
    codeURL := aCodeURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    77
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    78
    "Created: / 28.1.1998 / 21:10:11 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    79
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    80
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    81
documentURL:aDocumentURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    82
    documentURL := aDocumentURLString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    83
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    84
    "Created: / 28.1.1998 / 21:00:03 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    85
    "Modified: / 28.1.1998 / 21:00:28 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    86
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    87
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    88
embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    89
    ^ embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    90
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    91
    "Created: / 28.1.1998 / 21:39:35 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    92
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    93
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    94
infoDisplayReceiver
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    95
    "return the value of the instance variable 'infoDisplayReceiver' (automatically generated)"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    96
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    97
    ^ infoDisplayReceiver
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    98
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
    99
    "Created: / 28.1.1998 / 21:43:54 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   100
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   101
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   102
infoDisplayReceiver:something
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   103
    "set the value of the instance variable 'infoDisplayReceiver' (automatically generated)"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   104
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   105
    infoDisplayReceiver := something.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   106
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   107
    "Created: / 28.1.1998 / 21:43:54 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   108
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   109
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   110
parameterDictionary:aParameterDictionary
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   111
    parameterDictionary := aParameterDictionary
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   112
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   113
    "Created: / 28.1.1998 / 21:01:20 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   114
! !
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   115
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   116
!JavaEmbeddedFrameView methodsFor:'applet control'!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   117
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   118
appletDESTROY
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   119
    embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   120
        perform:#'sendEvent(I)V' 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   121
        with:(embeddedAppletFrame class instVarNamed:'APPLET_DESTROY').
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   122
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   123
    "Created: / 28.1.1998 / 21:41:45 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   124
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   125
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   126
appletDISPOSE
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   127
    embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   128
        perform:#'sendEvent(I)V' 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   129
        with:(embeddedAppletFrame class instVarNamed:'APPLET_DISPOSE').
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   130
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   131
    "Created: / 28.1.1998 / 21:41:57 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   132
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   133
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   134
appletINIT
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   135
    embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   136
        perform:#'sendEvent(I)V' 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   137
        with:(embeddedAppletFrame class instVarNamed:'APPLET_INIT').
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   138
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   139
    "Created: / 28.1.1998 / 21:17:51 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   140
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   141
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   142
appletLOAD
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   143
    embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   144
        perform:#'sendEvent(I)V' 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   145
        with:(embeddedAppletFrame class instVarNamed:'APPLET_LOAD').
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   146
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   147
    "Created: / 28.1.1998 / 21:17:37 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   148
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   149
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   150
appletSTART
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   151
    embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   152
        perform:#'sendEvent(I)V' 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   153
        with:(embeddedAppletFrame class instVarNamed:'APPLET_START').
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   154
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   155
    "Created: / 28.1.1998 / 21:18:01 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   156
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   157
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   158
appletSTOP
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   159
    embeddedAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   160
        perform:#'sendEvent(I)V' 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   161
        with:(embeddedAppletFrame class instVarNamed:'APPLET_STOP').
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   162
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   163
    "Created: / 28.1.1998 / 21:41:33 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   164
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   165
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   166
startApplet
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   167
    self startAppletThread.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   168
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   169
    self appletLOAD.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   170
    self appletINIT.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   171
    self appletSTART
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   172
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   173
    "Modified: / 28.1.1998 / 21:30:24 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   174
!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   175
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   176
startAppletThread
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   177
    |appletName|
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   178
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   179
    appletThread := JavaProcess 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   180
            for:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   181
                    "/ passnotifications to the documentFrame ...
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   182
                    Object informationSignal handle:[:ex |
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   183
                        JavaVM javaConsoleStream showCR:ex errorString.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   184
                        ex proceed.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   185
                    ] do:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   186
                        Object activityNotificationSignal handle:[:ex |
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   187
                            infoDisplayReceiver notNil ifTrue:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   188
                                infoDisplayReceiver infoDisplay:ex errorString.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   189
                            ] ifFalse:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   190
                                Transcript showCR:ex errorString
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   191
                            ].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   192
                            ex proceed.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   193
                        ] do:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   194
                            [
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   195
                                embeddedAppletFrame perform:#'run()V'.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   196
                            ] valueNowOrOnUnwindDo:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   197
                                appletThread terminateAllSubprocesses.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   198
                                Transcript showCR:'JAVA applet startup finished'.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   199
                            ]
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   200
                        ]
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   201
                    ]
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   202
                ]
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   203
            priority:(Processor activePriority - 1).
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   204
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   205
    appletName := codeURL asFilename withoutSuffix baseName.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   206
    appletThread name:('JAVA-applet ''' , appletName , ''' [startup]').
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   207
    
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   208
    appletThread resume.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   209
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   210
    ^ appletThread.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   211
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   212
    "Created: / 28.1.1998 / 21:30:32 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   213
    "Modified: / 28.1.1998 / 21:44:03 / cg"
286
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   214
!
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   215
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   216
stopApplet
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   217
    |n|
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   218
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   219
    (appletThread notNil 
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   220
    and:[appletThread isDead not])ifTrue:[
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   221
        'EmbeddedAppletFrame [info]: send APPLET_STOP ...' infoPrintCR.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   222
        self appletSTOP.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   223
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   224
        'EmbeddedAppletFrame [info]: send APPLET_DESTROY ...' infoPrintCR.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   225
        self appletDESTROY.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   226
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   227
        'EmbeddedAppletFrame [info]: send APPLET_DISPOSE ...' infoPrintCR.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   228
        self appletDISPOSE.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   229
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   230
        "/
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   231
        "/ give it a chance to stop ...
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   232
        "/
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   233
        Processor yield.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   234
        [appletThread isDead] whileFalse:[
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   235
            n := 0.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   236
            [n < 10 and:[appletThread isDead not]] whileTrue:[
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   237
                Delay waitForSeconds:0.1.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   238
                n := n + 1.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   239
            ].
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   240
            appletThread isDead ifFalse:[
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   241
                Transcript showCR:'EmbeddedAppletFrame [info]: JAVA thread did not stop - shooting down ...'.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   242
                appletThread terminate.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   243
            ].
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   244
        ].
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   245
    ].
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   246
    appletThread := nil
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   247
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   248
    "Modified: / 29.1.1998 / 15:27:30 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   249
! !
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   250
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   251
!JavaEmbeddedFrameView methodsFor:'initialize / release'!
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   252
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   253
destroy
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   254
    autoDestroyApplet == true ifTrue:[
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   255
        self stopApplet
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   256
    ].
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   257
    super destroy.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   258
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   259
    "Created: / 29.1.1998 / 15:21:45 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   260
    "Modified: / 29.1.1998 / 15:28:26 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   261
!
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   262
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   263
realize
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   264
    super realize.
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   265
    autoStartApplet == true ifTrue:[
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   266
        self startApplet
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   267
    ]
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   268
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   269
    "Created: / 29.1.1998 / 15:21:30 / cg"
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   270
    "Modified: / 29.1.1998 / 15:28:33 / cg"
282
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   271
! !
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   272
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   273
!JavaEmbeddedFrameView methodsFor:'private'!
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   274
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   275
setupAppletFrame
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   276
    |jMozillaAppletContextClass appletContext
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   277
     jEmbeddedAppletFrameClass 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   278
     toolkit peer attribs id
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   279
     jCodeBaseURL jDocumentURL jArchiveURL|
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   280
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   281
    jCodeBaseURL := Java as_URL:codeBaseURL.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   282
    jDocumentURL := Java as_URL:documentURL.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   283
    jArchiveURL := Java as_URL:archiveURL.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   284
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   285
    id := appletID.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   286
    id isNil ifTrue:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   287
        NextSequentialAppletID isNil ifTrue:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   288
            NextSequentialAppletID := 1.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   289
        ].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   290
        id := NextSequentialAppletID.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   291
        NextSequentialAppletID := NextSequentialAppletID + 1
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   292
    ].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   293
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   294
    attribs := Dictionary new.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   295
    width notNil ifTrue:[attribs at:'width' put:width printString].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   296
    height notNil ifTrue:[attribs at:'height' put:height printString].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   297
    codeURL notNil ifTrue:[attribs at:'code' put:codeURL].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   298
    parameterDictionary notNil ifTrue:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   299
        attribs declareAllFrom:parameterDictionary
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   300
    ].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   301
    attribs := Java as_Hashtable:attribs.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   302
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   303
    "/ this makes it a modzilla frame ...
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   304
    jMozillaAppletContextClass := Java classForName:'netscape.applet.MozillaAppletContext'.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   305
    jMozillaAppletContextClass isNil ifTrue:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   306
        self warn:'no netscape.applet.MozillaAppletContext class'.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   307
        ^ false
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   308
    ].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   309
    appletContext := jMozillaAppletContextClass new.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   310
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   311
    jEmbeddedAppletFrameClass := Java classForName:'netscape.applet.EmbeddedAppletFrame'.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   312
    jEmbeddedAppletFrameClass isNil ifTrue:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   313
        self warn:'no netscape.applet.EmbeddedAppletFrame class'.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   314
        ^ false
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   315
    ].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   316
    embeddedAppletFrame := jEmbeddedAppletFrameClass new.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   317
    embeddedAppletFrame instVarNamed:'pData' put:self.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   318
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   319
    toolkit := Java classForName:'java.awt.Toolkit'.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   320
    toolkit := toolkit invoke:#getDefaultToolkit.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   321
    peer := toolkit 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   322
                perform:#'createFrame(Ljava/awt/Frame;)Ljava/awt/peer/FramePeer;'
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   323
                with:embeddedAppletFrame.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   324
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   325
    (embeddedAppletFrame respondsTo:#'<init>(Ljava/net/URL;Ljava/net/URL;Ljava/net/URL;Ljava/util/Hashtable;Lnetscape/applet/MozillaAppletContext;Ljava/lang/Integer;)V')
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   326
    ifTrue:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   327
        "/ 3.01 netscape
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   328
        embeddedAppletFrame 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   329
            perform:#'<init>(Ljava/net/URL;Ljava/net/URL;Ljava/net/URL;Ljava/util/Hashtable;Lnetscape/applet/MozillaAppletContext;Ljava/lang/Integer;)V'
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   330
            with:jDocumentURL
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   331
            with:jCodeBaseURL
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   332
            with:jArchiveURL
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   333
            with:attribs
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   334
            with:appletContext
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   335
            with:(Java as_Integer:id).
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   336
    ] ifFalse:[
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   337
        "/ oldStyle netscape
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   338
        embeddedAppletFrame 
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   339
            perform:#'<init>(Ljava/net/URL;Ljava/net/URL;Ljava/util/Hashtable;Lnetscape/applet/MozillaAppletContext;I)V'
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   340
            with:jDocumentURL
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   341
            with:jCodeBaseURL
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   342
            with:attribs
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   343
            with:appletContext
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   344
            with:id.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   345
    ].
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   346
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   347
    embeddedAppletFrame instVarNamed:'peer' put:peer.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   348
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   349
    self javaPeer:peer.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   350
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   351
    jMozillaAppletContextClass instVarNamed:'debug' put:1.
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   352
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   353
    ^ true
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   354
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   355
    "Created: / 28.1.1998 / 21:23:25 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   356
    "Modified: / 28.1.1998 / 21:37:22 / cg"
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   357
! !
80e840e0139f now holds all applet setup code
cg
parents: 233
diff changeset
   358
233
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
   359
!JavaEmbeddedFrameView class methodsFor:'documentation'!
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
   360
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
   361
version
286
da220fe69de3 applet startup & shutDown now all done here;
cg
parents: 282
diff changeset
   362
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaEmbeddedFrameView.st,v 1.3 1998/01/29 14:42:33 cg Exp $'
233
fc91b8aba669 intitial checkin
cg
parents:
diff changeset
   363
! !