Package org.web3d.x3d.jsail
Class X3DConcreteElement
java.lang.Object
org.web3d.x3d.jsail.X3DConcreteElement
- Direct Known Subclasses:
X3DConcreteNode
,X3DConcreteStatement
Topmost abstract parent class for concrete X3D nodes and statements, containing common methods and member variables.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
SFString field named class for CSS has default value equal to an empty string.static final String
SFString field named id for html has default value equal to an empty string.protected static final String
String constant NAME provides name of this element; overridden by implementing class.static final String
SFString field named style for CSS has default value equal to an empty string.protected StringBuilder
Results log of local validation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDebug support: adding empty comment as CommentsBlock to children field has no effect.abstract X3DConcreteElement
addComments
(String newComment) Add comment as String to contained commentsList.abstract X3DConcreteElement
addComments
(String[] newComments) Add comments as String[] array to contained commentsList.abstract X3DConcreteElement
addComments
(CommentsBlock newCommentsBlock) Add CommentsBlock to elementvoid
Package-protected internal method to clear local reference to parent object, if any.findAncestorElementByName
(String ancestorElementName) Find object reference to ancestor element (i.e. node or statement), if this object is an attached child.Find object reference to ancestor ProtoBody, if this node or statement is a child.Find object reference to ancestor Scene element, assumes this object is an attached child.Find object reference to ancestor X3D element, if this node or statement is part of an X3D object.abstract X3DConcreteElement
findElementByNameValue
(String nameValue) Recursive method to provide object reference to node or statement by name attribute, if found as part of this element or in a contained element.abstract X3DConcreteElement
findElementByNameValue
(String nameValue, String elementName) Recursive method to provide object reference to node or statement by name attribute, if found as part of this element or in a contained element.abstract X3DConcreteNode
findNodeByDEF
(String DEFvalue) Recursive method to provide object reference to node by DEF, if found as this node or in a contained node.abstract String
getAccessType
(String fieldName) Indicate accessType corresponding to given fieldName.abstract String
Defines X3D component for this element.abstract int
Provides default X3D component level for this elementProvide String value from inputOutput SFString field named class.Provide String value from inputOutput SFString field named style.abstract String
Provides name of this element.abstract String
getFieldType
(String fieldName) Indicate type corresponding to given fieldName.Provide String value from inputOutput SFString field named id.static String
getPackageName
(String className) Provide fully qualified package for a given element object, including className.Provide object reference to parent X3D node or statement, if any.Get output of results from prior validation, if anyboolean
hasAncestorElementByName
(String ancestorElementName) Determine whether ancestor element (i.e. node or statement) is found, meaning this object is an attached child.boolean
Determine whether ancestor ProtoBody element is found, meaning this object is an attached child.boolean
Determine whether ancestor Scene element is found, meaning this object is an attached child.boolean
Determine whether ancestor X3D element is found, meaning this object is an attached child.boolean
Whether parent object exists.void
Initialize all member variables to default values.boolean
isValid()
Recursive method to determine whether this element is valid.protected void
setConcreteCssClass
(String newValue) Protected internal superclass method to keep cssClass private, scene authors should use method setCssClass(newValue) instead.protected void
setConcreteCssStyle
(String newValue) Protected internal superclass method to keep cssStyles private, scene authors should use method setCssStyle(newValue) instead.protected void
setConcreteHtmlID
(String newValue) Protected internal superclass method to keep HTML id private, scene authors should use method setHtmlID(newValue) instead.void
setParent
(X3DConcreteElement newParentObject) Package-internal method to set parent object reference.Recursive method to provide ClassicVRML string serialization.abstract String
toStringClassicVRML
(int indentLevel) Recursive method to provide ClassicVRML string serialization.Recursive method to provide VRML97 string serialization.abstract String
toStringVRML97
(int indentLevel) Recursive method to provide VRML97 string serialization.Recursive method to provide X3D string serialization of this model subgraph, utilizing XML encoding and conforming to X3D Canonical Form.abstract String
toStringX3D
(int indentLevel) Recursive method to provide X3D string serialization of this model subgraph, utilizing XML encoding and conforming to X3D Canonical Form.abstract String
validate()
Recursive method to validate this element plus all contained nodes and statements, using both datatype-specification value checks and regular expression (regex) checking of corresponding string values.
-
Field Details
-
NAME
String constant NAME provides name of this element; overridden by implementing class.- See Also:
-
ID_DEFAULT_VALUE
SFString field named id for html has default value equal to an empty string.- See Also:
-
CLASS_DEFAULT_VALUE
SFString field named class for CSS has default value equal to an empty string.- See Also:
-
STYLE_DEFAULT_VALUE
SFString field named style for CSS has default value equal to an empty string.- See Also:
-
validationResult
Results log of local validation.
-
-
Constructor Details
-
X3DConcreteElement
public X3DConcreteElement()
-
-
Method Details
-
getParent
Provide object reference to parent X3D node or statement, if any. This reference is named "parentObject" rather than "parent" to avoid potential name collision with any X3D field named "parent".- Returns:
- object reference to parent X3D node or statement, otherwise null if none
-
hasParent
public boolean hasParent()Whether parent object exists. This reference is named "parentObject" rather than "parent" to avoid potential name collision with any X3D field named "parent".- Returns:
- true if found
-
setParent
Package-internal method to set parent object reference.- Parameters:
newParentObject
- object reference to parent node or X3D statement that contains this node
-
clearParent
public void clearParent()Package-protected internal method to clear local reference to parent object, if any. -
findAncestorScene
Find object reference to ancestor Scene element, assumes this object is an attached child.- Returns:
- ancestor Scene child reference if attached, otherwise null
- See Also:
-
hasAncestorScene
public boolean hasAncestorScene()Determine whether ancestor Scene element is found, meaning this object is an attached child.- Returns:
- whether ancestor Scene node is found
- See Also:
-
findAncestorElementByName
Find object reference to ancestor element (i.e. node or statement), if this object is an attached child.- Parameters:
ancestorElementName
- elementName of ancestor of interest (e.g. first Transform)- Returns:
- ancestor node reference if attached and found, otherwise null
-
hasAncestorElementByName
Determine whether ancestor element (i.e. node or statement) is found, meaning this object is an attached child.- Parameters:
ancestorElementName
- elementName of ancestor of interest (e.g. first Transform)- Returns:
- whether ancestor element is found
- See Also:
-
findAncestorProtoBody
Find object reference to ancestor ProtoBody, if this node or statement is a child.- Returns:
- ancestor ProtoBody reference if attached and found, otherwise null
- See Also:
-
hasAncestorProtoBody
public boolean hasAncestorProtoBody()Determine whether ancestor ProtoBody element is found, meaning this object is an attached child.- Returns:
- whether ancestor ProtoBody element is found
- See Also:
-
findAncestorX3D
Find object reference to ancestor X3D element, if this node or statement is part of an X3D object.- Returns:
- ancestor X3D reference if attached, otherwise null
- See Also:
-
hasAncestorX3D
public boolean hasAncestorX3D()Determine whether ancestor X3D element is found, meaning this object is an attached child.- Returns:
- whether ancestor X3D element is found
- See Also:
-
getElementName
Provides name of this element.- Returns:
- name of this element
-
getComponent
Defines X3D component for this element.- Returns:
- X3D component for this element
-
getComponentLevel
public abstract int getComponentLevel()Provides default X3D component level for this element- Returns:
- default X3D component level for this element
-
getFieldType
-
getAccessType
-
findElementByNameValue
Recursive method to provide object reference to node or statement by name attribute, if found as part of this element or in a contained element. Elements with name fields include meta, Metadata* nodes, field/fieldValue, ProtoDeclare/ExternProtoDeclare/ProtoInstance, CAD and HAnim nodes.
Warning: first start with findAncestorScene() to check entire scene graph, or findAncestorX3D() to check entire model document.- Parameters:
nameValue
- is value of the name field being searched for in this element and child elements(if any)elementName
- identifies the element of interest (meta MetadataString ProtoDeclare CADassembly ProtoInstance HAnimHumanoid etc.)- Returns:
- object reference to found element, null otherwise
- See Also:
-
findElementByNameValue
Recursive method to provide object reference to node or statement by name attribute, if found as part of this element or in a contained element. Elements with name fields include meta, Metadata* nodes, field/fieldValue, ProtoDeclare/ExternProtoDeclare/ProtoInstance, CAD and HAnim nodes.
Warning: first start with findAncestorScene() to check entire scene graph, or findAncestorX3D() to check entire model document.
Warning: more than one element may be found that has the same name, this method does not handle that case.- Parameters:
nameValue
- is value of the name field being searched for in this element and child elements(if any)- Returns:
- object reference to found element, null otherwise
- See Also:
-
findNodeByDEF
Recursive method to provide object reference to node by DEF, if found as this node or in a contained node.
Warning: first start with findAncestorScene() to check entire scene graph, or findAncestorX3D() to check entire model document.
Warning: more than one element may be found that has the same DEF, this method does not handle that case.- Parameters:
DEFvalue
- is value of the name field being searched for in this element and child elements(if any)- Returns:
- object reference to found node, null otherwise
- See Also:
-
getPackageName
-
initialize
public void initialize()Initialize all member variables to default values. -
setConcreteCssClass
Protected internal superclass method to keep cssClass private, scene authors should use method setCssClass(newValue) instead. This attribute is only functional if the X3D model is loaded within an HTML page. Tooltip: The class attribute is a space-separated list of classes, reserved for use by CSS cascading stylesheets.- Parameters:
newValue
- is new value for the class field.- See Also:
-
setConcreteHtmlID
Protected internal superclass method to keep HTML id private, scene authors should use method setHtmlID(newValue) instead. This attribute is only functional if the X3D model is loaded within an HTML page. Tooltip: the id attribute on each X3D node is considered a unique identifier when used as part of an encompassing HTML/DOM context.- Parameters:
newValue
- is new value for the id field.- See Also:
-
setConcreteCssStyle
Protected internal superclass method to keep cssStyles private, scene authors should use method setCssStyle(newValue) instead. This attribute is only functional if the X3D model is loaded within an HTML page. Tooltip: The style attribute is a space-separated list of classes, reserved for use by CSS cascading stylesheets.- Parameters:
newValue
- is new value for the style field.- See Also:
-
getHtmlID
Provide String value from inputOutput SFString field named id.
Tooltip: the id attribute on each X3D node is considered a unique identifier when used as part of an encompassing HTML/DOM context.The class field is a space-separated list of classes, reserved for use by CSS cascading stylesheets.- Returns:
- value of class field
- See Also:
-
getCssClass
Provide String value from inputOutput SFString field named class.
Tooltip: The class field is a space-separated list of classes, reserved for use by CSS cascading stylesheets.- Returns:
- value of class field
- See Also:
-
getCssStyle
Provide String value from inputOutput SFString field named style.
Tooltip: The style field provides an inline block of CSS for element styling, reserved for use by CSS cascading stylesheets.- Returns:
- value of style field
- See Also:
-
addComments
Add comment as String to contained commentsList.- Parameters:
newComment
- initial value- Returns:
- this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
addComments
Debug support: adding empty comment as CommentsBlock to children field has no effect.- Returns:
- this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
addComments
Add comments as String[] array to contained commentsList.- Parameters:
newComments
- array of comments- Returns:
- this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
addComments
Add CommentsBlock to element- Parameters:
newCommentsBlock
- block of comments to add- Returns:
- this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
getValidationResult
Get output of results from prior validation, if any- Returns:
- validation results (if any)
-
toStringX3D
Recursive method to provide X3D string serialization of this model subgraph, utilizing XML encoding and conforming to X3D Canonical Form.- Returns:
- X3D string
- See Also:
-
toStringX3D
Recursive method to provide X3D string serialization of this model subgraph, utilizing XML encoding and conforming to X3D Canonical Form.- Parameters:
indentLevel
- number of levels of indentation for this element- Returns:
- X3D string
- See Also:
-
toStringClassicVRML
Recursive method to provide ClassicVRML string serialization.- Returns:
- ClassicVRML string
- See Also:
-
toStringClassicVRML
Recursive method to provide ClassicVRML string serialization.- Parameters:
indentLevel
- number of levels of indentation for this element- Returns:
- ClassicVRML string
- See Also:
-
toStringVRML97
Recursive method to provide VRML97 string serialization.- Returns:
- VRML97 string
- See Also:
-
toStringVRML97
Recursive method to provide VRML97 string serialization.- Parameters:
indentLevel
- number of levels of indentation for this element- Returns:
- VRML97 string
- See Also:
-
isValid
public boolean isValid()Recursive method to determine whether this element is valid.- Returns:
- true if validate() has no results
-
validate
Recursive method to validate this element plus all contained nodes and statements, using both datatype-specification value checks and regular expression (regex) checking of corresponding string values. This method must be overridden, ensuring that a concrete method is provided for each class.- Returns:
- validation results (if any)
-