Kanzi  3.9.5
Java API
DataSource Class Reference

Use data sources to separate the user interface from the application data and to remove the dependencies between a Kanzi Studio project and the application code which define the Kanzi application. More...

Inheritance diagram for DataSource:
[legend]

Public Member Functions

void close ()
 Close the object, and release native resources.
 
DataObject getData ()
 Retrieves the root object of the underlying data tree. More...
 
DataContext lookupDataContext (String relativePath)
 Performs object look-up by path. More...
 
- Public Member Functions inherited from DataContext
ModifiedSubscriptionToken addModifiedNotificationHandler (ModifiedSubscriptionFunction modifiedHandlerFunction)
 Allows to subscribe to modifications in this data context. More...
 
DataObject getData ()
 Retrieves the root object of the underlying data tree. More...
 
DataContext lookupDataContext (String relativePath)
 Performs object look up by path. More...
 
void notifyModified ()
 Triggers modification procedure in this data context, which invokes the subscriptions.
 
void removeModifiedNotificationHandler (DataContext.ModifiedSubscriptionToken token)
 Removes a modification subscription. More...
 
- Public Member Functions inherited from Resource
String getName ()
 Gets the resource name. More...
 
String getUrl ()
 Gets the resource URL. More...
 
void setKeepAlive (boolean keepAlive)
 Sets the keep alive flag. 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...
 
EnumType getProperty (PropertyType< Integer > propertyType, Class< EnumType > enumClass)
 Returns the current value of an integer property type converted to a matching constant from specified enumeration. 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...
 
void setProperty (PropertyType< Integer > propertyType, EnumType value)
 Sets the local value of an integer property type using a constant from an enumeration. More...
 

Static Public Attributes

static final Metaclass metaclass
 The Metaclass for the class. More...
 
- Static Public Attributes inherited from DataContext
static final Metaclass metaclass
 The Metaclass for the class. More...
 
- Static Public Attributes inherited from Resource
static final Metaclass metaclass = com.rightware.kanzi.metadata.ResourceMetadata.metaclass
 The Metaclass for the class.
 
- Static Public Attributes inherited from KanziObject
static final Metaclass metaclass = new AbstractMetaclass("Kanzi.Object")
 The Metaclass for the class.
 

Protected Member Functions

 DataSource (Domain domain, long nativeObject, Metaclass metaclass)
 Wraps a given native DataSource Called by KanziObject.connectResource(long) when connecting to a native DataSource. More...
 
void initialize ()
 Initializes the DataSource.
 
void onLoaded ()
 Override function called after loadFromKZB.
 

Static Protected Member Functions

static< Derived extends DataSource > ObjectRef< Derived > createDerived (Domain domain, String name, Metaclass metaclass)
 Creates a derived class instance. More...
 

Additional Inherited Members

- Public Attributes inherited from ResourceMetadata
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.Resource")
 Metaclass for Resource.
 
- Public Attributes inherited from DataContextMetadata
DynamicPropertyType< ResourceDataContextProperty
 Source of data for this node and its descendants. More...
 
DynamicPropertyType< ResourceItemsSourceProperty
 Data object which provides data sources for list items. More...
 
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.DataContext")
 Metaclass for DataContext.
 
- Public Attributes inherited from DataSourceMetadata
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.DataSource")
 Metaclass for DataSource.
 

Detailed Description

Use data sources to separate the user interface from the application data and to remove the dependencies between a Kanzi Studio project and the application code which define the Kanzi application.

Kanzi allows you to define the format and structure of your data source by defining a Kanzi Engine data source plugin.

When you use a data source in a Kanzi application you bind the values of properties and property fields to data that comes from a data source. This binding establishes a connection between a node or a resource and the application data. When data in the data source changes, the nodes and resources which are bound to the data reflect the change in the data.

To set a node to use a data source, use the DataContext.DataContext property. When you set the Data Context property for a node, all its child nodes inherit the value of the Data Context property. After you set a node to use a data source, you can use bindings to access the data.

Constructor & Destructor Documentation

◆ DataSource()

DataSource ( Domain  domain,
long  nativeObject,
Metaclass  metaclass 
)
protected

Wraps a given native DataSource Called by KanziObject.connectResource(long) when connecting to a native DataSource.

Parameters
domainUI Domain where this DataSource belongs
nativeObjectNative object that is backing this DataSource
metaclassMetaclass data for this DataSource

Member Function Documentation

◆ createDerived()

static <Derived extends DataSource> 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 data source belongs.
nameName of the data source
metaclassMetaclass data of the data source.
Returns
An ObjectRef that holds the created instance.

◆ getData()

DataObject getData ( )

Retrieves the root object of the underlying data tree.

Returns
Returns data object that is the root of the data tree.

◆ lookupDataContext()

DataContext lookupDataContext ( String  relativePath)

Performs object look-up by path.

Parameters
relativePathPath of the object where to look at, separated by '.'.
Returns
Data object that was found, or empty pointer if there was no such object.

Member Data Documentation

◆ metaclass

final Metaclass metaclass
static
Initial value:

The Metaclass for the class.