Kanzi Framework  3.9.0
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...
 
boolean isStale ()
 Test if the object is stale i.e. More...
 
void removeLocalValue (PropertyType propertyType)
 Removes the local value associated with the property. 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 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 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.