Kanzi Java API
NodeComponent Class Reference

NodeComponent is the base class for all node components. More...

Inheritance diagram for NodeComponent:
[legend]
Collaboration diagram for NodeComponent:
[legend]

Public Member Functions

String getName ()
 Gets the value of #NameProperty. More...
 
Node getNode ()
 Returns the node the node component is attached to or null if node component is not attached to a node. More...
 
NodeComponentState getState ()
 Gets the state of node component indicating if component is attached to a node, detached from any node or in process of attaching/detaching. More...
 
boolean isAttached ()
 Indicates whether node component is attached to a node. More...
 
boolean isAttaching ()
 Indicates whether node component is in the process of attaching to a node. More...
 
boolean isAttachingOrAttached ()
 Indicates whether node component is in the process of attaching to a node or already attached. More...
 
boolean isDetached ()
 Indicates whether node component is detached from any node. More...
 
boolean isDetaching ()
 Indicates whether node component currently detaching from the node. More...
 
boolean isDetachingOrDetached ()
 Indicates whether node component is in the process of detaching from the node or already detached. More...
 
void setName (String value)
 Sets the value of #NameProperty. More...
 
- Public Member Functions inherited from KanziObject
boolean equals (Object object)
 
Domain getDomain ()
 Returns the domain the object belongs to. More...
 
Metaclass getDynamicMetaclass ()
 Returns the metaclass of the dynamic type of the object. More...
 
boolean isStale ()
 Test if the object is stale i.e. More...
 
void releaseOwnership ()
 Release ownership of the backing native object from this object. More...
 
void removeLocalValue (PropertyType propertyType)
 Removes the local value associated with the property. More...
 
boolean takeOwnership ()
 Take ownership of the backing native object in this object. More...
 

Static Public Member Functions

static Metaclass getStaticMetaclass ()
 Returns the metaclass of this class. More...
 
- Static Public Member Functions inherited from KanziObject
static Metaclass getStaticMetaclass ()
 Returns the metaclass of this class. More...
 

Protected Member Functions

 NodeComponent (Domain domain, String name, Metaclass metaclass)
 Creates a new nodeComponent of a type derived from NodeComponent. More...
 
Node.MessageSubscriptionToken addNodeComponentMessageHandler (MessageType messageType, Node.MessageSubscriptionFunction messageHandlerFunction)
 Kanzi calls the message handler that you add using this function when the target name of the incoming message matches the name of the node component, or if the message is broadcast to all node components with an empty target name. More...
 
void attachOverride ()
 Called when the Trigger is attached to a node.
 
void detachOverride ()
 Called when a Trigger is detached from a Node.
 
void dispatchMessage (MessageType messageType, MessageArguments arguments)
 Adds the name of the node component to the message arguments and dispatches the message to the node of the node component. More...
 
void removeNodeComponentMessageFilter (Node.MessageSubscriptionToken token)
 Removes message handler added via NodeComponent#addNodeComponentMessageHandler function. More...
 

Additional Inherited Members

- Public Attributes inherited from NodeComponent
DynamicPropertyType< String > NameProperty
 
AbstractMetaclass NodeComponentMetaclass = new AbstractMetaclass("Kanzi.NodeComponent")
 

Detailed Description

NodeComponent is the base class for all node components.

Node component is an isolated piece of logic which can be attached to any node in order to add additional functionality to it. Examples of node component could be Trigger which performs specific actions when certain conditions are met or AnimationPlayer which animates specific properties of the node it is attached to and its child nodes.

Node component can only be attached to a single node at a time. After node component is detached from one node, it can be attached to any other node.

Node component starts to perform its logic after it is attached to a certain node. After node component is detached from its node it becomes inactive and stops to perform its logic.

Constructor & Destructor Documentation

NodeComponent ( Domain  domain,
String  name,
Metaclass  metaclass 
)
protected

Creates a new nodeComponent of a type derived from NodeComponent.

Call this from constructor of your custom NodeComponent derivation.

Parameters
domainUI Domain where this nodeComponent belongs.
nameName of the nodeComponent.
metaclassMetaclass data for this nodeComponent.

Member Function Documentation

Node.MessageSubscriptionToken addNodeComponentMessageHandler ( MessageType  messageType,
Node.MessageSubscriptionFunction  messageHandlerFunction 
)
protected

Kanzi calls the message handler that you add using this function when the target name of the incoming message matches the name of the node component, or if the message is broadcast to all node components with an empty target name.

Parameters
messageTypeType of message to handle.
messageHandlerFunctionThe function invoked when the node that owns the handler receives a matching message.
Returns
The MessageSubscriptionToken which identifies the added handler.
void dispatchMessage ( MessageType  messageType,
MessageArguments  arguments 
)
protected

Adds the name of the node component to the message arguments and dispatches the message to the node of the node component.

You must derive the message arguments from NodeComponentSourceMessageArguments.

Parameters
messageTypeThe type of the dispatched message.
argumentsThe arguments of the dispatched message.
String getName ( )

Gets the value of #NameProperty.

Returns
Current value.
Node getNode ( )

Returns the node the node component is attached to or null if node component is not attached to a node.

Returns
Node the node component is attached to.
NodeComponentState getState ( )

Gets the state of node component indicating if component is attached to a node, detached from any node or in process of attaching/detaching.

Returns
State of node component.
static Metaclass getStaticMetaclass ( )
static

Returns the metaclass of this class.

Returns
Static instance of metaclass of this node.
boolean isAttached ( )

Indicates whether node component is attached to a node.

Returns
true if node component is attached, false otherwise.
boolean isAttaching ( )

Indicates whether node component is in the process of attaching to a node.

Returns
true if node component is in the process of attaching, false otherwise.
boolean isAttachingOrAttached ( )

Indicates whether node component is in the process of attaching to a node or already attached.

Returns
true if node component is in the process of attaching or already attached, false otherwise.
boolean isDetached ( )

Indicates whether node component is detached from any node.

Returns
true if node component is detached, false otherwise.
boolean isDetaching ( )

Indicates whether node component currently detaching from the node.

Returns
true if node component currently detaching, false otherwise.
boolean isDetachingOrDetached ( )

Indicates whether node component is in the process of detaching from the node or already detached.

Returns
true if node component is in the process of detaching or already detached, false otherwise.
void removeNodeComponentMessageFilter ( Node.MessageSubscriptionToken  token)
protected

Removes message handler added via NodeComponent#addNodeComponentMessageHandler function.

Parameters
tokenSubscription token of message handler to remove.
void setName ( String  value)

Sets the value of #NameProperty.

Parameters
valueNew value.