|
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.nodes.proto.ProtoBuilder
public class ProtoBuilder
A SAV interface for dealing with building a single proto.
The builder is designed to create a single proto. However, that single proto may well have nested protos as part of it, so we must deal with that too.
The proto must be locally resident in this file, not an externproto.
| Constructor Summary | |
|---|---|
ProtoBuilder(VRMLNodeFactory fac)
Create a new default instance of the scene builder. |
|
| Method Summary | |
|---|---|
void |
componentDecl(java.lang.String componentInfo)
A component declaration has been found in the code. |
void |
endDocument()
Declaration of the end of the document. |
void |
endExternProtoDecl()
Notification of the end of an EXTERNPROTO declaration. |
void |
endField()
Notification of the end of a field declaration. |
void |
endNode()
Notification of the end of a node declaration. |
void |
endProtoBody()
Notification of the end of an ordinary proto body. |
void |
endProtoDecl()
Notification of the end of an ordinary proto declaration statement. |
void |
endScriptDecl()
Notification of the end of a script declaration. |
void |
exportDecl(java.lang.String defName,
java.lang.String exported)
An EXPORT declaration has been found in the document. |
void |
externProtoURI(java.lang.String[] values)
Notification of the URI list for an EXTERNPROTO. |
void |
fieldValue(boolean value)
Set the value of the field at the given index as an boolean. |
void |
fieldValue(boolean[] value,
int len)
Set the value of the field at the given index as an array of boolean. |
void |
fieldValue(double value)
Set the value of the field at the given index as an double. |
void |
fieldValue(double[] value,
int len)
Set the value of the field at the given index as an array of doubles. |
void |
fieldValue(float value)
Set the value of the field at the given index as a float. |
void |
fieldValue(float[] value,
int len)
Set the value of the field at the given index as an array of floats. |
void |
fieldValue(int value)
Set the value of the field at the given index as an integer. |
void |
fieldValue(int[] value,
int len)
Set the value of the field at the given index as an array of integers. |
void |
fieldValue(long value)
Set the value of the field at the given index as an long. |
void |
fieldValue(long[] value,
int len)
Set the value of the field at the given index as an array of longs. |
void |
fieldValue(java.lang.String value)
The value of a normal field. |
void |
fieldValue(java.lang.String[] values)
The value of an MFField where the underlying parser knows about how the values are broken up. |
void |
fieldValue(java.lang.String[] value,
int len)
Set the value of the field at the given index as an array of strings. |
AbstractProto |
getPrototype()
Get the scene that was last built by this scene handler. |
void |
importDecl(java.lang.String inline,
java.lang.String exported,
java.lang.String imported)
An IMPORT declaration has been found in the document. |
void |
metaDecl(java.lang.String key,
java.lang.String value)
A META declaration has been found in the code. |
void |
newProto(NodeTemplateToInstanceCreator creator)
Start a new proto definition within the current document context. |
void |
profileDecl(java.lang.String profileName)
A profile declaration has been found in the code. |
void |
protoFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
Notification of a proto's field declaration. |
void |
protoIsDecl(java.lang.String fieldName)
Notification of a field value uses an IS statement. |
void |
reset()
Reset the builder. |
void |
routeDecl(java.lang.String srcNodeName,
java.lang.String srcFieldName,
java.lang.String destNodeName,
java.lang.String destFieldName)
Notification of a ROUTE declaration in the file. |
void |
scriptFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
Notification of a script's field declaration. |
void |
setDocumentLocator(Locator loc)
Set the document locator that can be used by the implementing code to find out information about the current line information. |
void |
setErrorReporter(ErrorReporter reporter)
Set the error handler instance used by this instance of the builder. |
void |
setGlobals(java.util.Map defs,
java.util.Map protos,
java.util.Map externProtos)
Set the global DEF map to be used within fields. |
void |
setLoadRequirements(boolean useVrml97,
boolean useBackgrounds,
boolean useFogs,
boolean useLights,
boolean useAudio,
boolean useViewpoints,
boolean useExternals)
Set the flags about what to load. |
void |
startDocument(java.lang.String uri,
java.lang.String url,
java.lang.String encoding,
java.lang.String type,
java.lang.String version,
java.lang.String comment)
Declaration of the start of the document. |
void |
startExternProtoDecl(java.lang.String name)
Notification of the start of an EXTERNPROTO declaration of the given name. |
void |
startField(java.lang.String name)
Notification of a field declaration. |
void |
startNode(java.lang.String name,
java.lang.String defName)
Notification of the start of a node. |
void |
startProtoBody()
Notification of the start of an ordinary proto body. |
void |
startProtoDecl(java.lang.String name)
Notification of the start of an ordinary (inline) proto declaration. |
void |
startScriptDecl()
Notification of the start of a script declaration. |
void |
useDecl(java.lang.String defName)
The field value is a USE for the given node name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProtoBuilder(VRMLNodeFactory fac)
throws java.lang.NullPointerException
fac - The factory used to create internal nodes representations
with.
java.lang.NullPointerException - The factory reference is null| Method Detail |
|---|
public void setDocumentLocator(Locator loc)
startDocument() has
been called, you can assume that you will not have one available.
setDocumentLocator in interface ContentHandlerloc - The locator instance to use
public void startDocument(java.lang.String uri,
java.lang.String url,
java.lang.String encoding,
java.lang.String type,
java.lang.String version,
java.lang.String comment)
throws SAVException,
VRMLException
# start. The type string contains the representation of
the first few characters of the file after the #. This allows us to
work out if it is VRML97 or the later X3D spec.
Version numbers change from VRML97 to X3D and aren't logical. In the
first, it is #VRML V2.0 and the second is
#X3D V1.0 even though this second header represents a
later spec.
startDocument in interface ContentHandleruri - The URI of the file.url - The base URL of the file for resolving relative URIs
contained in the fileencoding - The encoding of this document - utf8 or binaryversion - The VRML version of this documenttype - The bytes of the first part of the file headercomment - Any trailing text on this line. If there is none, this
is null.
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void profileDecl(java.lang.String profileName)
throws SAVException,
VRMLException
profileDecl in interface ContentHandlerprofileName - The name of the profile to use
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void componentDecl(java.lang.String componentInfo)
throws SAVException,
VRMLException
componentDecl in interface ContentHandlercomponentInfo - The name of the component to use
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void metaDecl(java.lang.String key,
java.lang.String value)
throws SAVException,
VRMLException
metaDecl in interface ContentHandlerkey - The value of the key stringvalue - The value of the value string
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void importDecl(java.lang.String inline,
java.lang.String exported,
java.lang.String imported)
throws SAVException,
VRMLException
importDecl in interface ContentHandlerinline - The name of the inline DEF nodesexported - The exported name from the inlined fileimported - The local name to use for the exported name
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void exportDecl(java.lang.String defName,
java.lang.String exported)
throws SAVException,
VRMLException
exportDecl in interface ContentHandlerdefName - The DEF name of the nodes to be exportedexported - The name to be exported as
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endDocument()
throws SAVException,
VRMLException
endDocument in interface ContentHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void startNode(java.lang.String name,
java.lang.String defName)
throws SAVException,
VRMLException
startNode in interface ContentHandlername - The name of the node that we are about to parsedefName - The string associated with the DEF name. Null if not
given for this node.
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void endNode()
throws SAVException,
VRMLException
endNode in interface ContentHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void startField(java.lang.String name)
throws SAVException,
VRMLException
ScriptHandler or ProtoHandler methods are
used.
startField in interface ContentHandlername - The name of the field declared
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void fieldValue(java.lang.String value)
throws SAVException,
VRMLException
startField() or endNode().
If this field is an SFNode with a USE declaration you will have the
useDecl(String) method called rather than this method.
fieldValue in interface BinaryContentHandlerfieldValue in interface StringContentHandlervalue - The value of this field
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void fieldValue(java.lang.String[] values)
throws SAVException,
VRMLException
fieldValue in interface StringContentHandlervalues - The list of string representing the values
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void useDecl(java.lang.String defName)
throws SAVException,
VRMLException
startField() or endNode().
useDecl in interface ContentHandlerdefName - The name of the DEF string to use
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void endField()
throws SAVException,
VRMLException
useDecl(String) or fieldValue(String).
endField in interface ContentHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void fieldValue(int value)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the node
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(int[] value,
int len)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the nodelen - The number of valid entries in the value array
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(boolean value)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the node
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(boolean[] value,
int len)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the nodelen - The number of valid entries in the value array
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(float value)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the node
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(float[] value,
int len)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the nodelen - The number of valid entries in the value array
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(long value)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the node
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(long[] value,
int len)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the nodelen - The number of valid entries in the value array
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(double value)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the node
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(double[] value,
int len)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the nodelen - The number of valid entries in the value array
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(java.lang.String[] value,
int len)
throws SAVException,
VRMLException
fieldValue in interface BinaryContentHandlervalue - The new value to use for the nodelen - The number of valid entries in the value array
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void startProtoDecl(java.lang.String name)
throws SAVException,
VRMLException
startProtoDecl in interface ProtoHandlername - The name of the proto
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void endProtoDecl()
throws SAVException,
VRMLException
endProtoDecl in interface ProtoHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void protoFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
throws SAVException,
VRMLException
protoFieldDecl in interface ProtoHandleraccess - The access type (eg exposedField, field etc)type - The field type (eg SFInt32, MFVec3d etc)name - The name of the fieldvalue - The default value of the field. Null if not allowed.
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void protoIsDecl(java.lang.String fieldName)
throws SAVException,
VRMLException
protoIsDecl in interface ProtoHandlerfieldName - The name of the field that is being IS'd
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void startProtoBody()
throws SAVException,
VRMLException
endProtoBody() statement form the body and not the normal
scenegraph information.
startProtoBody in interface ProtoHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void endProtoBody()
throws SAVException,
VRMLException
endProtoBody in interface ProtoHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void startExternProtoDecl(java.lang.String name)
throws SAVException,
VRMLException
endExternProtoDecl() call
you should only receive protoFieldDecl(int, java.lang.String, java.lang.String, java.lang.Object) calls.
startExternProtoDecl in interface ProtoHandlername - The node name of the extern proto
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void endExternProtoDecl()
throws SAVException,
VRMLException
endExternProtoDecl in interface ProtoHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void externProtoURI(java.lang.String[] values)
throws SAVException,
VRMLException
externProtoURI in interface ProtoHandlervalues - A list of strings representing all of the URI values
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void startScriptDecl()
throws SAVException,
VRMLException
endScriptDecl() call belong to this
script node. This method will be called after the ContentHandler
startNode() method call. All DEF information is contained
in that method call and this just signifies the start of script
processing so that we know to treat the field parsing callbacks a
little differently.
startScriptDecl in interface ScriptHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void endScriptDecl()
throws SAVException,
VRMLException
endNode() callback.
endScriptDecl in interface ScriptHandlerSAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void scriptFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
throws SAVException,
VRMLException
url, mustEvaluate and
directOutput fields. These fields use the normal field
callbacks of ContentHandler.
scriptFieldDecl in interface ScriptHandleraccess - The access type (eg exposedField, field etc)type - The field type (eg SFInt32, MFVec3d etc)name - The name of the fieldvalue - The default value of the field
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void routeDecl(java.lang.String srcNodeName,
java.lang.String srcFieldName,
java.lang.String destNodeName,
java.lang.String destFieldName)
throws SAVException,
VRMLException
routeDecl in interface RouteHandlersrcNodeName - The name of the DEF of the source nodesrcFieldName - The name of the field to route values fromdestNodeName - The name of the DEF of the destination nodedestFieldName - The name of the field to route values to
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsedpublic void setErrorReporter(ErrorReporter reporter)
reporter - The instance to use or null to clearpublic AbstractProto getPrototype()
public void reset()
VRMLReader.parse() method is called.
The flags set about what to load are not reset by this method.
public void setGlobals(java.util.Map defs,
java.util.Map protos,
java.util.Map externProtos)
defs - The new DEF map to useprotos - The new proto map to useexternProtos - The new externproto map to use
public void setLoadRequirements(boolean useVrml97,
boolean useBackgrounds,
boolean useFogs,
boolean useLights,
boolean useAudio,
boolean useViewpoints,
boolean useExternals)
useVrml97 - true if the semantics should be VRML97 capable rather
than the looser VRML 3.0.useBackgrounds - true if BackgroundNodeTypes should be loadeduseFogs - true if FogNodeTypes should be loadeduseLights - true if LightNodeTypes should be loadeduseAudio - true if AudioClipNodeTypes should be loadeduseViewpoints - true if ViewpointNodeTypes should loadeduseExternals - true if ExternalNodeTypes should be loadedpublic void newProto(NodeTemplateToInstanceCreator creator)
creator - The proto creator to wrap the template with
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||