Xj3D VRML/X3D Code API

org.web3d.j3d.browser
Class X3DJ3DBrowserFactoryImpl

java.lang.Object
  extended byorg.web3d.j3d.browser.X3DJ3DBrowserFactoryImpl
All Implemented Interfaces:
BrowserFactoryImpl

public class X3DJ3DBrowserFactoryImpl
extends java.lang.Object
implements BrowserFactoryImpl

An implementation of the SAI BrowserFactoryImpl interface that creates a browser that uses Java3D for the renderer.

Supported Actions

Currently the factory implementation only supports creating a new component. We do expect to add other support at a later date, such as fetching an existing instance.

Component Creation

This implementation allows you to create a new component that is ready to place content in. Parameters are supplied in a map of String parameter names to primitive wrapper class values, i.e. BooleanValue.TRUE instead of "TRUE".

When creating a new browser component, the following parameters are supported:

Xj3D_InterfaceType awt|swing. Indication as to whether the UI should be AWT or SWING based. If not supplied the default is to use SWING.
Xj3D_NavbarShown Boolean.TRUE|Boolean.FALSE. Show or hide the navigation bar on the screen. If not provided, the navigation bar will be shown.
Xj3D_NavbarPosition "top"|"bottom". If the navigation bar is shown, it should be placed at the desired location in the panel. If not provided, the navigation bar will be on the bottom.
Xj3D_LocationShown Boolean.TRUE|Boolean.FALSE. Show or hide the panel that describes the current URL and allows the user to enter new URLs. If not provided, the location bar will be shown.
Xj3D_LocationPosition "top"|"bottom". If the URL bar is shown, it should be placed at the desired location in the panel. If not provided, the position will be at the top of the panel.
Xj3D_LocationReadOnly Boolean.TRUE|Boolean.FALSE. If the URL bar is shown, you can make it read-only (ie not allow the user to change the URL). If not provided, the bar will be writable.
Xj3D_ShowConsole Boolean.TRUE|Boolean.FALSE. Indication as to whether the component should automatically show the console on startup. Default is to hide. Xj3D_ShowOpenButton Boolean true|false. Indication as to whether the component should have an Open button to load content. Default is false. Xj3D_ShowReloadButton Boolean true|false. Indication as to whether the component should have a Reload button to reload content. Default is false.

Version:
$Revision: 1.10 $
Author:
Justin Couch

Constructor Summary
X3DJ3DBrowserFactoryImpl()
          Create a new instance of this factory.
 
Method Summary
 X3DComponent createComponent(java.util.Map params)
          Create a VRML browser that can be used as an AWT component.
 ExternalBrowser getBrowser(java.applet.Applet applet)
          Get a browser from the given java applet reference as a base in the current HTML page.
 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.
 ExternalBrowser getBrowser(java.net.InetAddress address, int port)
          Get a reference to a browser that is located on a remote machine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X3DJ3DBrowserFactoryImpl

public X3DJ3DBrowserFactoryImpl()
Create a new instance of this factory. Fills in the browserSkin field using loadBrowserSkin.

Method Detail

createComponent

public X3DComponent createComponent(java.util.Map params)
                             throws NotSupportedException
Create a VRML browser that can be used as an AWT component. The component returned is guaranteed to be an instance of X3DComponent.

Specified by:
createComponent in interface BrowserFactoryImpl
Parameters:
params - Parameters to control the look and feel.
Returns:
The component browser initialised to be empty.
Throws:
NotSupportedException - The implementation does not support this type of VRML browser.
See Also:
X3DComponent

getBrowser

public ExternalBrowser getBrowser(java.applet.Applet applet)
                           throws NotSupportedException,
                                  NoSuchBrowserException,
                                  ConnectionException
Get a browser from the given java applet reference as a base in the current HTML page. Used when attempting to access a browser on the current page as this applet and is the first browser on the page. Generically, the same as calling getBrowser(applet, "", 0);

Specified by:
getBrowser in interface BrowserFactoryImpl
Parameters:
applet - The applet reference to use
Returns:
A reference to the Browser implementation
Throws:
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

getBrowser

public ExternalBrowser getBrowser(java.applet.Applet applet,
                                  java.lang.String frameName,
                                  int index)
                           throws NotSupportedException,
                                  NoSuchBrowserException,
                                  ConnectionException
Get a browser from the given java applet reference one some named page and at some embbed location. Used when attempting to access a browser on another HTML page within a multi-framed environment, or if there are a number of VRML browser instances located on the same page.

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.

Specified by:
getBrowser in interface BrowserFactoryImpl
Parameters:
applet - The applet reference to use
frameName - The name of the frame to look into for the browser
index - The embed index of the VRML browser in the page
Returns:
A reference to the Browser implementation
Throws:
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

getBrowser

public ExternalBrowser getBrowser(java.net.InetAddress address,
                                  int port)
                           throws NotSupportedException,
                                  NoSuchBrowserException,
                                  java.net.UnknownHostException,
                                  ConnectionException
Get a reference to a browser that is located on a remote machine. This a server application to send scene updates to a number of client browsers located on remote machines. If there are a number of browsers running on a remote machine, they can be differentiated by the port number they are listening on.

There is no default port number for VRML browsers.

Specified by:
getBrowser in interface BrowserFactoryImpl
Parameters:
address - The address of the machine to connect to
port - The port number on that machine to connect to.
Returns:
A reference to the Browser implementation
Throws:
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

Copyright © 2001 - 2005 Web3D Consortium