Secure Global Desktop Administration Guide > Applets > getEmulatorState (X emulator applet)
int getEmulatorState()
The getEmulatorState
method returns the status code
associated with the emulator session's display engine. This allows you
to determine if an emulator session is starting, running or stopped.
This return value... | Indicates... |
---|---|
0
|
The X emulator session is starting, but hasn't yet connected to the application server. |
1
|
The X emulator session is running. |
2
|
The X emulator session has disconnected from the application server. |
3
|
An error has occurred, and the X emulator session has been terminated. |
4
|
The X emulator session has been suspended. |
5
|
The X emulator session has finished. |
<SCRIPT LANGUAGE="JavaScript"> window.onerror = trapError function trapError(message, url, line) { alert("There's no X emulator session currently running"); return true } function getState() { state = top.WebtopFrame.DisplayFrame.document.applets["Tarantella X Emulator"].getEmulatorState(); switch (state) { case 0 : output = "The X emulator session is starting."; break; case 1 : output = "The X emulator session is running."; break; case 2 : output = "The X emulator session has disconnected."; break; case 3 : output = "An error has occurred."; break; case 4 : output = "The X emulator session has been suspended."; break; case 5 : output = "The X emulator session has finished."; break; } alert(output); } </SCRIPT> <FORM> <INPUT TYPE=button VALUE="Get state" onclick="getState()"> </FORM>
This example adds a button beneath the links on users' webtops. When a user clicks this button, Secure Global Desktop displays a short message indicating the current state of the X emulator applet.
Add the code to the HTML document containing the webtop tray applet
(left.html
, in the sco/tta/standard
webtop
theme), after the TTAAPPLET
declaration.
Note This example assumes you are using the sco/tta/standard webtop
theme. If you're using another theme, with different frame names and
layouts, or different applet names, you'll need to modify the lines
that invoke the getEmulatorState
method to access the X
emulator applet used by your new theme.
Copyright © 1997-2005 Sun Microsystems, Inc. All rights reserved.