Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

 
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

...


データ フレームワーク - 概要

Nexaweb 4.2.x には、基本的なデータフレームワークプラグインライブラリが付属しています。

データフレームワークは、データアクセスのためのプログラムと宣言のメカニズムを提供するクライアントプラグインです。データ フレームワークにより、開発者はビジネスデータを UI プレゼンテーションから明確に分離することができます。

データ フレームワーク プラグインの主な目的は、以下を実現する手段を提供することです。
  • プレゼンテーション層 (ユーザー インターフェイス XML マークアップ) とデータの分離
  • 一般的なデータ統合ニーズに対応するエンド ツー エンド データ フレームワークの実装
アプリケーションは、概念的には次の 3 つの要素で構成されます。
ユーザー インターフェイス
ユーザーに対して表示するものです。Nexaweb では、NXML マークアップで指定します。
動作
アプリケーションの実行内容です。Nexaweb では、通常は Java でコーディングしたイベント ハンドラとしてビジネス ロジックをサーバーに配置できますが、この形式に限らず、MOC の形式でクライアントに配置することも可能です。
データ
アプリケーションが使用するデータです。データは、ユーザー インターフェイス XML やビジネス ロジック アプリケーション コードに埋め込むのではなく、データ フレームワークを通じて管理できます。
メモ: データフレームワークは NFC Model/View/Controller フレームワークの一部ではありません。NFC を使用して記述したアプリケーションからデータフレームワークに直接アクセスすることはできません。

データフレームワークは、データを画面へのデータの取り込みに使用される、宣言型 (XMLのみ) のプログラマチックなフレームワークです。このフレームワークを使用すると、次のことを実行できます。
  • データ ソースを定義する
  • データ ソースを、テーブルやラベルなどのユーザー インターフェイス要素にバインドする
  • 出力をフォーマット設定する
  • データ ソースが変更されるたびにインターフェイスを更新するかどうかを指定する
データ フレームワークを使用すると、簡単な XML 文をユーザー インターフェイスに配置することにより、アプリケーション以外のコードをまったく記述せずに、複雑なデータを自動的にロード、表示、および更新することができます。たとえば、ビルド済みの ObjectDataSource データソースコンポーネントを使用すると、複雑な Java オブジェクトツリーをトラバースし、ユーザーインターフェイスにデータを自動的に表示することができます。さらに、Java メソッドを直接呼び出して、その出力を表示することもできます。これらの処理についても、コードを記述する必要はまったくありません。

デー タ ソースとフォーマッタを使用すると、新しいコンポーネントを簡単に記述し、プラグインとして使用することができます。これにより、特定のバックオフィス環 境用に設計されたデータソースを 1 回記述すると、それを複数のアプリケーションで再利用することが可能になります。Nexaweb では、新しいコンポーネントの基盤となる複数の多機能の組み込みコンポーネントを作成しています。


次の表に、データ フレームワークのコンポーネントの 4 つの基本的な種類を示します。
コンポーネント説明
データ ソース
ユーザー インターフェイスにデータを提供する Java オブジェクトです。データ ソースは、クエリに対応したデータ ストアへのアクセス ポイントを定義します。
データソースへのアクセスと、データソースの作成の詳細については、「データソース」を参照してください。
フォーマッタ
データを表示用にフォーマット設定するための、スクリプトに対応した手段です。フォーマッタは、データをプレゼンテーション目的で修正するために使用するデータ操作およびデータ変換の手順を定義します。
フォーマッタへのアクセスと、フォーマッタの作成の詳細については、「フォーマッタ」を参照してください。
バインディング
ユーザー インターフェイス コンポーネントをデータ ソースに関連付けるための、宣言型 XML マークアップです。バインディングは、データ オブジェクトを取得するためにデータ ソースに対して実行されるクエリを定義します。
バインディングの宣言の詳細については、「バインディングおよび反復子のタグ」を参照してください。
 
 
反復子
リスト ボックスやテーブルなどの複雑なアイテムを表示するために、ユーザー インターフェイス オブジェクトへの反復的なバインディングを可能にします。また、反復子を入れ子にし、ツリーやツリー テーブルなどのさらに複雑なユーザー インターフェイス要素を構築することもできます。
反復子の使用の詳細については、「バインディングおよび反復子のタグ」を参照してください。

DataService オブジェクト


データフレームワークプラグインは、システムサービス DataServiceを登録します。

DataService インターフェイスは、以下を実行するために呼び出すことができるバインディングメソッドを提供します。
  • テキスト ノード値を解決する
  • 属性値を解決する
  • マクロまたはクライアント オブジェクトの呼び出しにデータを提供する
DataServiceインターフェイスは、フォーマッタおよびデータソースの定義にアクセスするために必要なメソッドを含んでいます。また、データ名前空間http://nexaweb.com/data

...

の一連のタグも定義します。

Usage

...


使用方法

このシステム オブジェクトは、すべての登録済みシステムサービスを使用するときと同じように、宣言的に使用することができます。このシステムオブジェクトは DataService として登録されるため、次のように呼び出しを実行することによってメソッドを使用できます。

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:

...


ショートカット シンタックス

開発を簡素化するために、Nexaweb では DataService を呼び出すための次のショートカットを用意しています。
ショートカット シンタックス意味
bind
DataService.bind
*
DataService.relativeBind

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

...

Full 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.

...


詳細については、DataService インターフェイスの API ドキュメントと、このドキュメントのデータ サービス - bind シンタックスのセクションを参照してください。