|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.web3d.vrml.scripting.ecmascript.JavascriptBrowser
public class JavascriptBrowser
Browser object within an Javascript VRML97 script.
The current implementation ignores any parameter values provided by the world when requesting a loadURL.
The standard Java interface does not allow us to print output. The way that
all VRML vendors seem to have gotten around this is to add
println methods to the Browser object. We've done this as
well. The current implementation just calls System.out directly, but a
later revision will probably use a callback for a listener provided
instance to send the output to. In addition, this class has to be made
public so that Rhino can access the various print methods. Note that the
constructor is not private because you should never directly be creating
instances of this class.
| Method Summary | |
|---|---|
void |
addRoute(org.web3d.vrml.scripting.ecmascript.builtin.SFNode fromNode,
java.lang.String fromEventOut,
org.web3d.vrml.scripting.ecmascript.builtin.SFNode toNode,
java.lang.String toEventIn)
Add a route between two nodes, from an eventOut to an eventIn. |
org.web3d.vrml.scripting.ecmascript.builtin.MFNode |
createVrmlFromString(java.lang.String vrmlSyntax)
Parse the given string and turn this into a list of VRML nodes. |
void |
createVrmlFromURL(org.web3d.vrml.scripting.ecmascript.builtin.MFString url,
org.web3d.vrml.scripting.ecmascript.builtin.SFNode node,
java.lang.String eventIn)
Create and load VRML from the given URL and place the returned values as nodes into the given VRML node in the scene. |
void |
deleteRoute(org.web3d.vrml.scripting.ecmascript.builtin.SFNode fromNode,
java.lang.String fromEventOut,
org.web3d.vrml.scripting.ecmascript.builtin.SFNode toNode,
java.lang.String toEventIn)
Delete a route between two nodes. |
float |
getCurrentFrameRate()
Get the current frame rate of the browser in frames per second. |
float |
getCurrentSpeed()
Get the current velocity of the bound viewpoint in meters per second. |
java.lang.String |
getDescription()
Get the description string currently used by the world. |
java.lang.String |
getName()
Get the name of the browser. |
java.lang.String |
getVersion()
Get the version of the browser. |
java.lang.String |
getWorldURL()
Get the fully qualified URL of the currently loaded world. |
void |
loadURL(org.web3d.vrml.scripting.ecmascript.builtin.MFString url,
org.web3d.vrml.scripting.ecmascript.builtin.MFString parameters)
Load the URL as the new root of the scene. |
VRMLNodeType[] |
parseVrmlString(java.lang.String vrmlSyntax)
Convenience version of createVrmlFromString so that the caller can be returned the raw nodes rather than the JavascriptScript versions. |
void |
print(java.lang.Object obj)
Print an object instance to the output. |
void |
print(java.lang.String str)
Print a string to the output. |
void |
println(java.lang.Object obj)
Print an object instance to the output. |
void |
println(java.lang.String str)
Print a string to the output. |
void |
replaceWorld(org.web3d.vrml.scripting.ecmascript.builtin.MFNode nodes)
Replace the current world with the given nodes. |
void |
setDescription(java.lang.String desc)
Set the description of the current world. |
void |
setErrorReporter(ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the script code can be reported in a nice, pretty fashion. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public java.lang.String getDescription()
public void setDescription(java.lang.String desc)
desc - The description string to set.public java.lang.String getName()
public java.lang.String getVersion()
public float getCurrentSpeed()
public float getCurrentFrameRate()
public java.lang.String getWorldURL()
loadURL then the string will reflect the new URL. If
replaceWorld is called then the URL still represents the
original world.
replaceWorld(MFNode)public void replaceWorld(org.web3d.vrml.scripting.ecmascript.builtin.MFNode nodes)
Calling this method causes a SHUTDOWN event followed by an INITIALIZED event to be generated.
nodes - The list of nodes to use as the new root of the worldpublic org.web3d.vrml.scripting.ecmascript.builtin.MFNode createVrmlFromString(java.lang.String vrmlSyntax)
At the point that this method returns, external files such as textures, sounds and inlines may not have been loaded.
The string may contain all legal VRML syntax. The VRML header line is not required to be present in the string.
vrmlSyntax - The string containing VRML string syntax
InvalidVRMLSyntaxException - If the string does not contain legal
VRML syntax or no node instantiations
public void createVrmlFromURL(org.web3d.vrml.scripting.ecmascript.builtin.MFString url,
org.web3d.vrml.scripting.ecmascript.builtin.SFNode node,
java.lang.String eventIn)
url - The list of URLs in decreasing order of preference as defined
in the VRML97 specification.node - The destination node for the VRML code to be sent to.eventIn - The name of the MFNode eventIn to send the nodes to.
public void addRoute(org.web3d.vrml.scripting.ecmascript.builtin.SFNode fromNode,
java.lang.String fromEventOut,
org.web3d.vrml.scripting.ecmascript.builtin.SFNode toNode,
java.lang.String toEventIn)
fromNode - The source node for the routefromEventOut - The eventOut source of the routetoNode - The destination node of the routetoEventIn - The eventIn destination of the route
InvalidEventInException - the eventIn name is not a field of
the destination node
InvalidEventOutException - the eventOut name is not a field of
the source node
public void deleteRoute(org.web3d.vrml.scripting.ecmascript.builtin.SFNode fromNode,
java.lang.String fromEventOut,
org.web3d.vrml.scripting.ecmascript.builtin.SFNode toNode,
java.lang.String toEventIn)
fromNode - The source node for the routefromEventOut - The eventOut source of the routetoNode - The destination node of the routetoEventIn - The eventIn destination of the route
InvalidEventInException - the eventIn name is not a field of
the destination node
InvalidEventOutException - the eventOut name is not a field of
the source node
public void loadURL(org.web3d.vrml.scripting.ecmascript.builtin.MFString url,
org.web3d.vrml.scripting.ecmascript.builtin.MFString parameters)
Generates an immediate SHUTDOWN event and then when the new contents are ready to be loaded, sends an INITIALIZED event.
url - The list of URLs in decreasing order of preference as defined
in the VRML97 specification.parameters - The list of parameters to accompany the load call as
defined in the Anchor node specification of VRML97public void println(java.lang.String str)
str - The string to printpublic void println(java.lang.Object obj)
obj - The object to printpublic void print(java.lang.String str)
str - The string to printpublic void print(java.lang.Object obj)
obj - The object to printpublic void setErrorReporter(ErrorReporter reporter)
reporter - The instance to use or null
public VRMLNodeType[] parseVrmlString(java.lang.String vrmlSyntax)
throws VRMLParseException,
VRMLException
VRMLParseException
VRMLException
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||