Package vrml.eai

Class BrowserFactory

java.lang.Object
vrml.eai.BrowserFactory

public class BrowserFactory extends Object
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:

  • vrml.eai.factory.class
The value of the factory class is then used as the name of the class to load as the default browser implementation. This name must represent the full package qualified name of the class. This class is then loaded using the following method:
  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 vrml.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 VrmlException 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 vrml.eai.DefaultBrowserImpl

Supported Parameters

The X3D specification allows applications to specify parameters to change how a browser operates. You can also specify browser specific options. The following options are supported by Xj3D.

Param Name Description Type Default Legal Values
AntialiasedWhether to turn on antialiasingBooleanfalsetrue,false
TextureQualityA quality metric for texturing. High turns on all tricks like anisotropicFilteringStringmediumlow,medium,high
PrimitiveQualityA quality metric for primitives. Scales how many polygons to use for primitiveStringmediumlow,medium,high
Xj3D_InterfaceTypeWhether to use NEWT, Swing or AWTStringSwingswing,awt,swing-lightweight,newt
Xj3D_NavbarShownWhether to show the navigation barBooleantruetrue,false
Xj3D_NavbarPositionWhere to position the navigation barStringTopTop,Bottom
Xj3D_LocationShownWhether the current location is shownBooleantruetrue,false
Xj3D_LocationPositionWhere to position the location barStringTopTop,Bottom
Xj3D_LocationReadOnlyWhether the location is read onlyBooleanfalsetrue,false
Xj3D_ShowConsoleWhether to show the consoleBooleanfalsetrue,false
Xj3D_OpenButtonShownWhether to show a content Open buttonBooleanfalsetrue,false
Xj3D_ReloadButtonShownWhether to show a content Reload buttonBooleanfalsetrue,false
Xj3D_StatusBarShownWhether to show a status barBooleanfalsetrue,false
Xj3D_FPSShownWhether to show a Frames Per Second meterBooleanfalsetrue,false
Xj3D_ContentDirectoryThe initial directory to load content fromStringCurrent DirectoryAll
Xj3D_AntialiasingQualityHow many multisamples to use for antialiasing. Must be enabled to matter.Stringlowlow,medium,high
Version:
$Revision: 1.6 $
Author:
Justin Couch