Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.scripting.browser
Class VRML97CommonBrowser

java.lang.Object
  extended by org.web3d.vrml.scripting.browser.CommonBrowser
      extended by org.web3d.vrml.scripting.browser.VRML97CommonBrowser

public class VRML97CommonBrowser
extends CommonBrowser

The common parts of a browser implementation suitable for VRML97 scripting.

This class is a full implementation because the external and scripting interfaces will use it differently. External use can just subclass and add the EAI Browser interface. For scripting, the need to extend the Browser base class means that this class will need to be delegated to.

The current implementation ignores any parameter values provided by the world.

Version:
$Revision: 1.21 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.web3d.vrml.scripting.browser.CommonBrowser
core, errorReporter, loaderManager, routeManager, stateManager
 
Constructor Summary
VRML97CommonBrowser(BrowserCore browser, RouteManager rm, FrameStateManager fsm, WorldLoaderManager wlm, VRMLNodeFactory nodeFac)
          Create a browser instance that represents the given universe details.
 
Method Summary
 VRMLNodeType[] createVrmlFromString(java.lang.String vrmlSyntax, VRMLExecutionSpace parentSpace)
          Parse the given string and turn this into a list of VRML nodes.
 void createVrmlFromURL(java.lang.String[] url, VRMLNodeType 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 replaceWorld(VRMLNodeType[] nodes)
          Replace the current world with the given nodes.
 
Methods inherited from class org.web3d.vrml.scripting.browser.CommonBrowser
addRoute, completeUrl, deleteRoute, getCurrentFrameRate, getCurrentSpeed, getDescription, getName, getVersion, getWorldURL, loadURL, setDescription, setErrorReporter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VRML97CommonBrowser

public VRML97CommonBrowser(BrowserCore browser,
                           RouteManager rm,
                           FrameStateManager fsm,
                           WorldLoaderManager wlm,
                           VRMLNodeFactory nodeFac)
Create a browser instance that represents the given universe details. If the scene builder or factory is null, then it will find one from the global pool defined for the renderer used by the browser core.

Parameters:
browser - The core representation of the browser
rm - A route manager for users creating/removing routes
wlm - Loader manager for doing async calls
fsm - State manager for coordinating inter-frame processing
nodeFac - Factory to create nodes with for this renderer
Throws:
java.lang.IllegalArgumentException - A paramter is null
Method Detail

replaceWorld

public void replaceWorld(VRMLNodeType[] nodes)
Replace the current world with the given nodes. Replaces the entire contents of the VRML world with the new nodes. Any node references that belonged to the previous world are still valid but no longer form part of the scene graph (unless it is these nodes passed to this method). The URL of the world still represents the just unloaded world.

Calling this method causes a SHUTDOWN event followed by an INITIALIZED event to be generated.

Parameters:
nodes - The list of nodes to use as the new root of the world

createVrmlFromString

public VRMLNodeType[] createVrmlFromString(java.lang.String vrmlSyntax,
                                           VRMLExecutionSpace parentSpace)
                                    throws VRMLException,
                                           VRMLParseException,
                                           java.io.IOException
Parse the given string and turn this into a list of VRML nodes. Method is a blocking call that won't return until all of the top level nodes defined in the string have been returned.

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.

Parameters:
vrmlSyntax - The string containing VRML string syntax
parentSpace - The parent space for these nodes or null for top-level
Returns:
A list of the top level nodes in VRML representation as defined in the parameter
Throws:
VRMLException - General error during processing
VRMLParseException - If the string does not contain legal VRML syntax or no node instantiations
java.io.IOException

createVrmlFromURL

public void createVrmlFromURL(java.lang.String[] url,
                              VRMLNodeType node,
                              java.lang.String eventIn)
                       throws InvalidFieldException
Create and load VRML from the given URL and place the returned values as nodes into the given VRML node in the scene. The difference between this and loadURL is that this method does not replace the entire scene with the contents from the URL. Instead, it places the return values as events in the nominated node and MFNode eventIn.

Parameters:
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.
Throws:
InvalidFieldException - the eventIn or node is not a valid destination for the URL information

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium