|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.web3d.x3d.sai.BrowserFactory
The factory class for obtaining references to browser instances.
An implementation independent representation of the class used to access and create browsers. The model follows that used by java.net.Socket. A setImpl method is provided for browser writers to provide the internal implementations of the browser.
An alternative way of doing this is through a properties file. The class,
when it loads looks for the file vrml.properties in the class path. (For
more information on how this works read
java.lang.ClassLoader.getSystemResourceAsStream()). From this
file this class then uses the following properties:
x3d.sai.factory.class
Class factory_class = Class.forName(factory_class_name); factory = (BrowserFactoryImpl)factory_class.newInstance();If a class cast exception is raised at the end, then an error is printed but nothing is done about it. The result would be NullPointerExceptions later in the code. Also, this may cause some security errors in some web browsers.
To provide a custom implementation of the factory (which all
implementations must do) the user has the choice of the above two options
of either calling setImpl or by making sure that the x3d.properties
file appears in the classpath before the sample implementation
that comes with the classes from the VRMLC. If
setBrowserFactoryImpl has not been called at the time that
any of the other methods have been, then the class will attempt to load
the implementation defined in the properties file. Attempting to call the
set implementation method after this point shall result in a X3DException
being generated. Otherwise, it shall use the set implementation.
If for some reason the properties file does not contain the property for
the name of the factory class or the properties file does not exist, then
the default class name is org.web3d.x3d.sai.DefaultBrowserImpl
| Method Summary | |
static X3DComponent |
createX3DComponent(java.util.Map params)
Create a VRML browser that can be used as an AWT component. |
static ExternalBrowser |
getBrowser(java.applet.Applet applet)
Get a browser from the given java applet reference as a base in the current HTML page. |
static ExternalBrowser |
getBrowser(java.applet.Applet applet,
java.lang.String frameName,
int index)
Get a browser from the given java applet reference one some named page and at some embbed location. |
static ExternalBrowser |
getBrowser(java.net.InetAddress address,
int port)
Get a reference to a browser that is located on a remote machine. |
static void |
setBrowserFactoryImpl(BrowserFactoryImpl fac)
set the factory implementation to use. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void setBrowserFactoryImpl(BrowserFactoryImpl fac)
throws java.lang.IllegalArgumentException,
X3DException,
java.lang.SecurityException
fac - The new implementation to use
java.lang.SecurityException - The environment does not allow a factory
to be set
java.lang.IllegalArgumentException - The factory instance is null
X3DException - The factors is already defined.
public static X3DComponent createX3DComponent(java.util.Map params)
throws NotSupportedException
params - Parameters to control the look and feel.
NotSupportedException - The implementation does not support this
type of VRML browser.X3DComponent
public static ExternalBrowser getBrowser(java.applet.Applet applet)
throws NotSupportedException,
NoSuchBrowserException,
ConnectionException
applet - The applet reference to use
NotSupportedException - The implementation does not support this
type of VRML browser
NoSuchBrowserException - Could not locate a VRML browser on the
same page as the applet.
ConnectionException - An error occurred during the connecting
process
public static ExternalBrowser getBrowser(java.applet.Applet applet,
java.lang.String frameName,
int index)
throws NotSupportedException,
NoSuchBrowserException,
ConnectionException
If the frame name is a zero length string or null then it is assumed to be located on the same HTML page as the applet. The index is the number of the embbed VRML browser starting from the top of the page. If there are other non-VRML plugins embedded in the page these are not taken into account in calculating the embed index.
applet - The applet reference to useframeName - The name of the frame to look into for the browserindex - The embed index of the VRML browser in the page
NotSupportedException - The implementation does not support this
type of VRML browser.
NoSuchBrowserException - Could not locate a VRML browser on the
same page as the applet.
ConnectionException - An error occurred during the connecting
process
public static ExternalBrowser getBrowser(java.net.InetAddress address,
int port)
throws NotSupportedException,
NoSuchBrowserException,
java.net.UnknownHostException,
ConnectionException
There is no default port number for VRML browsers.
address - The address of the machine to connect toport - The port number on that machine to connect to.
NotSupportedException - The implementation does not support this
type of VRML browser.
NoSuchBrowserException - Could not locate a VRML browser on the
same page as the applet.
java.net.UnknownHostException - Could not find the machine named in the
address.
ConnectionException - An error occurred during the connecting
process
|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||