Data Framework

Requires Platform 4.2+

Nexaweb ships with a basic data framework plug-in library.

The data framework is a client plug-in which supplies programmatic and declarative mechanisms for accessing data. This enables developers to better separate business data from UI presentation.

The primary goals of the data framework plug-in include providing a means for:

  • Separating presentation layer (User Interface XML markup) from data
  • Implementing an end to end data framework that addresses common data integration needs
 Applications conceptually consist of three elements: 
 

 

User Interface
What users see - in Nexaweb specified with XAL markup.
Behavior
What the application does - in Nexaweb you can locate business logic on the server, usually as Java coded event handlers, but is not limited to this; and you locate it on the client in the form of MCOs.
Data
What data the application uses. You can now manage data through the data framework, rather than having to embed data into your user interface XML or business logic application code.
Note:  The data framework is not a part of the NFC model/view/controller framework; applications written using NFC cannot access the data framework directly.

 

The Data Framework is a declarative –XML only– and programmatic framework for getting data into the display. This framework allows you to:

  • Define a data source
  • Bind it to user interface elements such as tables and labels
  • Format the output
  • Specify whether to update the interface whenever the data source changes. 
With the data framework, you can now place some simple XML statements in your user interface to automatically load, display and update complex data – all without requiring any code to be written (aside from the application itself). For example, using the pre-built ObjectDataSource data source component, you can traverse a complex Java object tree to automatically display data in the user interface, and even directly invoke Java methods and display the output – all without code.

Data sources and formatters allow you to easily write and plug-in new components. This provides you with the ability to write a data source designed for your specific back-office environment once and then re-use it across multiple applications. Nexaweb has created several feature-rich built-in components to serve as a starting point.


The following table describes the four basic types of components in the data framework:
 
ComponentDescription
Data sources
Java objects that serve data to the user interface. Data sources define access points into query capable data stores. 

See Data Sources for more information on accessing and creating data sources.

Formatters

A scriptable means of formatting the data for display. Formatters define data manipulation and transformation steps used to modify data for presentation purposes.

See Formatters for more information on accessing and creating formatters.

Bindings

Declarative XML markup for associating user interface components with the data sources. A binding defines a query to be made to a data source to retrieve a data object.

See Binding and Iterator Tags for more information on declaring a binding.

 Iterator

Allows iterative binding of user interface objects to display complex items such as listboxs and tables. In addition, you can nest iterators to build even more complex user interface elements such as trees and tree tables.

See Binding and Iterator Tags for more information on using iterators.

The DataService Object

The data framework plugin registers a system service, DataService.

The DataService interface exposes binding methods that you can call to:

  • Resolve a text node value
  • Resolve an attribute value
  • Supply data to a macro or client object call

The DataService interface contains methods necessary for accessing formatter and data source definitions. It also defines a collection of tags in the data namespace http://nexaweb.com/data.

Usage

You can use this system object declaratively, as you can use all registered system services. Since it is registered as DataService, you can use these methods by making calls as follows:

DataService.bind(binding://binding-id)

DataService.bind('bind-statement')

DataService.relativeBind('select-statement')

DataService.relativeBind('iterator-name', 'select-statement')

Shortcut Syntax

For ease of development, Nexaweb provides the following shortcuts for DataService calls:

Shortcut SyntaxRepresents
bind

DataService.bind

*

DataService.relativeBind

 Using this shortcut syntax, you can shorten the preceding calls as follows:

Full Syntax

Shortcut Syntax

DataService.bind(binding://binding-id)

bind(binding://binding-id)

DataService.bind('bind-statement')

bind('bind-statement')

DataService.relativeBind('select-statement')

*('select-statement')

DataService.relativeBind('iterator-name', 'select-statement')

*('iterator-name', 'select-statement')

See the API documentation for the DataService interface and the Data Service - bind syntax section of this documentation for more information.