Kanzi  3.9.9
Kanzi Engine Java API
CodeBehind Class Referenceabstract

Code Behind is a workflow where you associate code with an instance of a node instead of a type. More...

Inheritance diagram for CodeBehind:
[legend]

Classes

interface  CommandHandler
 CommandHandler implements a handler for a command. More...
 
interface  DirectorInterface
 

Public Member Functions

void close ()
 Close the object, and release native resources.
 
Iterable< String > iterateCommands ()
 Gets an Iterable used to iterate commands handled by this code behind object. More...
 
- Public Member Functions inherited from NodeComponent
void close ()
 Close the object, and release native resources.
 
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...
 
long getNative ()
 Gets a pointer to the backing C++ instance. More...
 
TDataType getOptionalProperty (PropertyType< TDataType > propertyType)
 Returns the current value of a property type, but does not use the default value if there are no inputs to the property value. More...
 
TDataType getProperty (PropertyType< TDataType > propertyType)
 Returns the current value of a property type. More...
 
int hashCode ()
 
boolean hasValue (PropertyType< TDataType > propertyType)
 Evaluates whether there are any inputs into the property value. More...
 
boolean isStale ()
 Test if the object is stale i.e. More...
 
void removeLocalValue (PropertyType< TDataType > propertyType)
 Removes the local value associated with the property. More...
 
void setProperty (PropertyType< TDataType > propertyType, TDataType value)
 Sets the local value of a property type. More...
 
ObjectRef< TType > tryCreateObjectRef (Class< TType > clazz)
 Tries to create an owning ObjectRef instance to this KanziObject. More...
 

Static Public Attributes

static final Metaclass metaclass = CodeBehindMetadata.metaclass
 The Metaclass for the class.
 
- Static Public Attributes inherited from NodeComponent
static final Metaclass metaclass
 The Metaclass for the class. More...
 
- Static Public Attributes inherited from KanziObject
static final Metaclass metaclass = new AbstractMetaclass("Kanzi.Object")
 The Metaclass for the class.
 

Protected Member Functions

 CodeBehind (Domain domain, long handle, Metaclass metaclass)
 Wraps a given native CodeBehind. More...
 
void initialize ()
 Initializes the CodeBehind.
 
void registerCommand (String commandName, CodeBehind.CommandHandler handler)
 Registers a new command handler. More...
 
abstract void registerCommandsOverride ()
 Override this method to register commands. More...
 
void unregisterCommand (String commandName)
 Unregisters a command handler. More...
 
abstract void unregisterCommandsOverride ()
 Override this method to unregister the registered commands. More...
 
- Protected Member Functions inherited from NodeComponent
 NodeComponent (Domain domain, long handle, Metaclass metaclass)
 Wraps a given native Node Component. More...
 
void attachOverride ()
 Called when the Trigger is attached to a node.
 
void detachOverride ()
 Called when a Trigger is detached from a Node.
 
void initialize ()
 Initializes the Node Component.
 
void removeNodeComponentMessageFilter (Node.MessageSubscriptionToken token)
 Removes message handler added via NodeComponent#addNodeComponentMessageHandler function. More...
 

Static Protected Member Functions

static< Derived extends NodeComponent > ObjectRef< Derived > createDerived (Domain domain, String name, Metaclass metaclass)
 Creates a derived class instance. More...
 
- Static Protected Member Functions inherited from NodeComponent
static< Derived extends NodeComponent > ObjectRef< Derived > createDerived (Domain domain, String name, Metaclass metaclass)
 Creates a derived class instance. More...
 

Additional Inherited Members

- Public Attributes inherited from NodeComponentMetadata
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.NodeComponent")
 Metaclass for NodeComponent.
 
DynamicPropertyType< String > NameProperty
 Name. More...
 
- Public Attributes inherited from CodeBehindMetadata
DynamicPropertyType< String > CodeBehindSourceProperty
 Sets the metaclass name of the code behind class for this node. More...
 
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.CodeBehind")
 Metaclass for CodeBehind.
 

Detailed Description

Code Behind is a workflow where you associate code with an instance of a node instead of a type.

In Code Behind you write code that you want to associate with the view or controller parts of the model-view-controller pattern.

All Activity Host code behind classes inherit from this class.

See also
ActivityCodeBehind, ExclusiveActivityHost2D, ExclusiveActivityHost3D, ParallelActivityHost2D, ParallelActivityHost3D.

Constructor & Destructor Documentation

CodeBehind ( Domain  domain,
long  handle,
Metaclass  metaclass 
)
protected

Wraps a given native CodeBehind.

Called by KanziObject#connectObject(long) when connecting to a native CodeBehind.

Parameters
domainUI Domain where the object belongs.
handleNative object that is backing the object.
metaclassMetaclass data for the object.

Member Function Documentation

static <Derived extends NodeComponent> ObjectRef<Derived> createDerived ( Domain  domain,
String  name,
Metaclass  metaclass 
)
staticprotected

Creates a derived class instance.

Call this method as part of the create method for a derived class.

Parameters
domainUI Domain where this object belongs.
nameName of the object
metaclassMetaclass data of the object.
Returns
An ObjectRef that holds the created instance.
Iterable<String> iterateCommands ( )

Gets an Iterable used to iterate commands handled by this code behind object.

Returns
An Iterable of commands handled by this code behind object.
void registerCommand ( String  commandName,
CodeBehind.CommandHandler  handler 
)
protected

Registers a new command handler.

A command is a form of user input. The code behind class of a node can register a handler for a command and perform an operation in the handler. You must call this method in CodeBehind#registerCommandsOverride.

Parameters
commandNameThe name of the command that you want to handle.
handlerThe handler functor for the command.
See also
Command, CodeBehind#unregisterCommandsOverride
abstract void registerCommandsOverride ( )
abstractprotected

Override this method to register commands.

You must register every command using CodeBehind#registerCommand. Kanzi registers commands when it attaches the node that uses this code behind.

void unregisterCommand ( String  commandName)
protected

Unregisters a command handler.

You must call this method in CodeBehind#unregisterCommandsOverride.

Parameters
commandNameThe name of the command for which you previously registered a handler.
See also
Command, CodeBehind#registerCommand
abstract void unregisterCommandsOverride ( )
abstractprotected

Override this method to unregister the registered commands.

You must unregister every registered command using CodeBehind#unregisterCommand. Kanzi changes the status of a command to unregistered when it detaches the node that uses this code behind.