|
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.renderer.DefaultNodeFactory
public class DefaultNodeFactory
Singleton implementation of the VRMLNodeFactory
that produces implementations of the nodes and can be customised for a
specific renderer.
This implementation serves two purposes - generalised node factory
implementation and the base of a renderer-specific implementation. The
class is a full instance allowing it to be used directly, but the
constructor is marked protected so that you can't create
an instance directly. However, you can use the static factory method to
fetch the singleton instance for that particular renderer type.
Property Files
Yes, there are a lot used by this class. Most of them we don't know until runtime because the loading of one file is used to find the definition of another file to load with further property information. There is a much more in-depth tutorial on how to extend Xj3D one the website, so this is just an overview.
At the top of the pile is xj3d.properties. This file is used
at startup of the factory. In here, is located the list of profiles
supported, components supported and renderers supported. The list of
profiles are then used to load a separate property file for each profile,
with the file name profile_name.properties. The
file name is all lower case, regardless of what the initial formal profile
name is. In the profiile properties file is the title and the list of
each component and level that is required for that profile.
After the profiles, there is a list of the components that may be supported. This list just points to the property file that contains the definition of the component. These files may be placed anywhere, however, for the inbuilt components of Xj3D, you will find the property files in this package (directory). Users wishing to create custom components may place them anywhere, so long as they are findable in the CLASSPATH at runtime. Each file contains a title, name of the implementor and a URL of that implementor. In addition, it contains the definition of the maximum level supported by that component and the list of nodes that are provided at each level.
| Field Summary | |
|---|---|
static java.lang.String |
JAVA3D_RENDERER
Definition of the Java3D renderer |
protected int |
majorVersion
The major version of the spec this file belongs to. |
protected int |
minorVersion
The minor version of the spec this file belongs to. |
static java.lang.String |
MOBILE_RENDERER
Definition of the Mobile renderer |
static java.lang.String |
NULL_RENDERER
Definition of the null renderer |
static java.lang.String |
OPENGL_RENDERER
Definition of the OpenGL renderer |
| Fields inherited from interface org.web3d.vrml.lang.VRMLNodeFactory |
|---|
ANY_LEVEL |
| Constructor Summary | |
|---|---|
protected |
DefaultNodeFactory(java.lang.String rendererID)
Construct an instance of the factory for the given renderer type. |
| Method Summary | |
|---|---|
ComponentInfo |
addComponent(java.lang.String name,
int level)
Add a component level requirement to the factory nodes. |
static void |
clearCachedInfo()
Convenience method to clear all the cached information so that we start again with new information. |
java.lang.Object |
clone()
Create a clone of this factory. |
static VRMLNodeFactory |
createFactory(java.lang.String rendererID)
Factory method to create an instance of the node factory that can be used for a specific renderer. |
VRMLNode |
createVRMLNode(java.lang.String nodeName,
boolean staticNode)
Create a new node instance from the given node name. |
VRMLNode |
createVRMLNode(java.lang.String component,
java.lang.String nodeName,
boolean staticNode)
Create a new node instance of the given node that exists in the given component. |
VRMLNode |
createVRMLNode(VRMLNode node,
boolean staticNode)
Create a new node instance that is a cloned copy of the given node. |
void |
disableComponent(int[] specVersion,
java.lang.String componentName,
int level)
Disable a component. |
ComponentInfo[] |
getAvailableComponents()
List all of the available components that this factory is capable of supporting. |
java.lang.String[] |
getAvailableProfileNames()
Convenience method to get just the names all the available profiles that this factory is capable of supporting. |
ProfileInfo[] |
getAvailableProfiles()
List the all the available profiles that this factory is capable of supporting. |
int[] |
getMaxSupportedSpecVersion()
Get the maximum supported spec version. |
int[] |
getSpecVersion()
Get the spec version that this node factory is currently set to. |
static VRMLNodeFactory |
newInstance(java.lang.String rendererID)
Factory method to create an new instance of the node factory every time the method is called. |
void |
setErrorReporter(ErrorReporter errorReporter)
Register an error errorReporter with the factory instance so that any errors generated by the creation of nodes can be reported in a nice, pretty fashion. |
void |
setProfile(java.lang.String profile)
Set the profile that is to be supported for subsequent node creation calls. |
void |
setSpecVersion(int major,
int minor)
Set the spec version that this node factory should be setting it's profile information for. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String JAVA3D_RENDERER
public static final java.lang.String NULL_RENDERER
public static final java.lang.String OPENGL_RENDERER
public static final java.lang.String MOBILE_RENDERER
protected int majorVersion
protected int minorVersion
| Constructor Detail |
|---|
protected DefaultNodeFactory(java.lang.String rendererID)
rendererID - The ID of the renderer to use for this factory| Method Detail |
|---|
public void setErrorReporter(ErrorReporter errorReporter)
setErrorReporter in interface VRMLNodeFactoryerrorReporter - The instance to use or null
public void setSpecVersion(int major,
int minor)
throws UnsupportedSpecVersionException
setSpecVersion in interface VRMLNodeFactorymajor - The major version of the VRML/X3D spec to useminor - The minor version of the VRML/X3D spec to use
UnsupportedSpecVersionException - The profile is not unsupported by
this implementationpublic int[] getSpecVersion()
getSpecVersion in interface VRMLNodeFactory
public void setProfile(java.lang.String profile)
throws UnsupportedProfileException
setProfile in interface VRMLNodeFactoryprofile - The name of the profile to use
UnsupportedProfileException - The profile is not unsupported by
this implementationpublic int[] getMaxSupportedSpecVersion()
getMaxSupportedSpecVersion in interface VRMLNodeFactory
public void disableComponent(int[] specVersion,
java.lang.String componentName,
int level)
disableComponent in interface VRMLNodeFactoryspecVersion - The spec version. Major, Minor.componentName - The component namelevel - The component level and higher to disable
public ComponentInfo addComponent(java.lang.String name,
int level)
throws UnsupportedComponentException
addComponent in interface VRMLNodeFactoryname - The name of the componentlevel - The level of the component to support
UnsupportedComponentException - The component or level is not
unsupported by this implementationpublic ProfileInfo[] getAvailableProfiles()
getAvailableProfiles in interface VRMLNodeFactorypublic java.lang.String[] getAvailableProfileNames()
getAvailableProfileNames in interface VRMLNodeFactorypublic ComponentInfo[] getAvailableComponents()
getAvailableComponents in interface VRMLNodeFactory
public VRMLNode createVRMLNode(java.lang.String nodeName,
boolean staticNode)
throws UnsupportedNodeException
createVRMLNode in interface VRMLNodeFactorynodeName - The name of the node instance to createstaticNode - Whether this node is will be modified
UnsupportedNodeException - The node is not part of the declared
profile and components
public VRMLNode createVRMLNode(java.lang.String component,
java.lang.String nodeName,
boolean staticNode)
throws UnsupportedComponentException,
UnsupportedNodeException
createVRMLNode in interface VRMLNodeFactorycomponent - The name of the component to create the name fornodeName - The name of the node instance to createstaticNode - Whether this node is will be modified
UnsupportedComponentException - The component is not in the list of
usable profiles currently set
UnsupportedNodeException - The node is not part of the declared
profile and components
public VRMLNode createVRMLNode(VRMLNode node,
boolean staticNode)
The primary use of this method is in generating proto instances from a set of template nodes. The parser of the proto will be responsible for making sure the children scene graphs are correctly built by sucessive calls to this method. Note that this implies the source node may well be from a different renderer implementation to the output form.
createVRMLNode in interface VRMLNodeFactorynode - The node instance to create a copy ofstaticNode - Whether this node is will be modified
public static VRMLNodeFactory createFactory(java.lang.String rendererID)
rendererID - The ID of the renderer to use for this factorypublic static VRMLNodeFactory newInstance(java.lang.String rendererID)
rendererID - The ID of the renderer to use for this factorypublic static void clearCachedInfo()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface VRMLNodeFactoryclone in class java.lang.Objectjava.lang.CloneNotSupportedException - Was not able to clone the object
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||