public final class GNode extends java.lang.Object implements INode
INode model implementation. This class is not meant to be extended, either
implement new functionality via the INode
interface or with
attachments via IAttachment
.
RENDERER_NODE_PROP
Constructor and Description |
---|
GNode() |
Modifier and Type | Method and Description |
---|---|
void |
addChild(INode node)
Adds a node to this node as a child node.
|
void |
attach(IAttachment attachment)
Adds the supplied attachment to this node.
|
void |
detach(IAttachment attachment)
Removes the supplied attachment to this node.
|
java.util.Map<java.lang.Class<?>,java.util.List<IAttachment>> |
getAttachments()
Returns a Map of all the node's attachments.
|
java.util.List<IAttachment> |
getAttachments(java.lang.Class<?> clazz)
Returns a List of the node's attachments that are of the supplied type.
|
java.util.List<INode> |
getChildren(boolean copy)
Returns a List of this node's children, optionally returning a copy of
the List.
|
java.lang.String |
getName()
Returns the human readable name of the node.
|
INode |
getParent()
Returns the parent of the node, or null if the node is not associated
with a parent.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns a Map of the node's current properties.
|
java.lang.Object |
getProperty(java.lang.String key)
Returns the node property of the specified type or null if the property
doesn't exist.
|
boolean |
hasAttachment(java.lang.Class<?> attachmentClazz)
Returns true if this node has an attachment of the supplied class type.
|
boolean |
hasProperty(java.lang.String key)
Returns true if the property has been set on this object, false
otherwise.
|
boolean |
isVisible()
Returns if the node is visible.
|
void |
removeAllChildren()
Removes all children from this node.
|
void |
removeChild(INode node)
Removes the supplied node as a child from this node.
|
void |
setName(java.lang.String name) |
void |
setParent(INode parent)
Sets the parent of the node.
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets the property identified by the key String to the supplied value.
|
void |
setVisible(boolean visible)
Sets the visibility of the node.
|
boolean |
supports(IAttachment attachment)
Returns true if the node supports the supplied attachment.
|
public void addChild(INode node)
INode
Adds a node to this node as a child node. Once the child has been added, the child node will be linked to the parent for transforms and other operations.
public void removeChild(INode node)
INode
Removes the supplied node as a child from this node. If node is not currently a child, this is a no-op.
removeChild
in interface INode
node
- node to remove as childpublic void removeAllChildren()
INode
Removes all children from this node.
removeAllChildren
in interface INode
public java.util.List<INode> getChildren(boolean copy)
INode
Returns a List of this node's children, optionally returning a copy of the List.
getChildren
in interface INode
public void attach(IAttachment attachment)
INode
Adds the supplied attachment to this node. The attachment's functionality will be applied to this node.
public void detach(IAttachment attachment)
INode
Removes the supplied attachment to this node. The attachment's functionality with be removed from this node.
If the attachment is not currently attached, this is a no-op.
public boolean hasAttachment(java.lang.Class<?> attachmentClazz)
INode
Returns true if this node has an attachment of the supplied class type.
hasAttachment
in interface INode
attachmentClazz
- the attachment class to check for.public boolean supports(IAttachment attachment)
INode
Returns true if the node supports the supplied attachment. Some attachments may not be used together.
public java.util.Map<java.lang.Class<?>,java.util.List<IAttachment>> getAttachments()
INode
Returns a Map of all the node's attachments.
getAttachments
in interface INode
public java.util.List<IAttachment> getAttachments(java.lang.Class<?> clazz)
INode
Returns a List of the node's attachments that are of the supplied type.
getAttachments
in interface INode
clazz
- the attachment class type to retrievepublic java.util.Map<java.lang.String,java.lang.Object> getProperties()
INode
Returns a Map of the node's current properties.
getProperties
in interface INode
public java.lang.Object getProperty(java.lang.String key)
INode
Returns the node property of the specified type or null if the property doesn't exist.
getProperty
in interface INode
public void setProperty(java.lang.String key, java.lang.Object value)
INode
Sets the property identified by the key String to the supplied value.
setProperty
in interface INode
key
- the String identifier of the propertyvalue
- the value of the propertypublic boolean hasProperty(java.lang.String key)
INode
Returns true if the property has been set on this object, false otherwise.
hasProperty
in interface INode
key
- the property key to check forpublic boolean isVisible()
INode
Returns if the node is visible.
public void setVisible(boolean visible)
INode
Sets the visibility of the node. If the node is not visible, it will not show up in a viewport.
setVisible
in interface INode
visible
- if true, the node will be rendered in visualizations. if
false, the node will not be rendered.public INode getParent()
INode
Returns the parent of the node, or null if the node is not associated with a parent.
public void setParent(INode parent)
INode
Sets the parent of the node.
public void setName(java.lang.String name)
name
-