Tuesday, June 14, 2005

XP3 whats new part 1 - DataBinding

XP3, the third generation of XPComponents, will be released in a few days and people have been asking what is new in this release so this is the start of taking a look at some of the changes.

XP3 represents an evolutionary rather than revolutionary change although we have taken the opportunity to review the whole architecture and refine it.

DataBinding
A lot of work has been done in the data binding area.
DataSources in XPComponents are somewhat the equivalent of DataProviders and we provide a number of different types.
The basic DataSource which exposes a single data object (think of the equivalent of the data model for an html input form), ListDataSource which encapsulates an array of objects and XMLDataSource which represents an array of XMLNodes.

The XMLDataSource allows you to display and manipulate XML documents in a DataGrid or other controls whilst retaining the data in its orginal native XML format.

However if you wish to translate your source xml into native objects once it has been downloaded, we also provide the RecordsetDecoder and NodeListDecoder, which will automatically convert xml nodes into native objects. Both of these classes generate there own internal schema for a document to enable them to convert objects back into xml at some later point if you wish. These classes are both built on the new ArrayProxy class which provides support for "lazy" decoding.

All datasources provide built in support for inserts, updates and deletes with various validation events to prevent invalid being committed, these work in hand with the XPDataGrid's row based editor to prevent you moving to another row in the grid whilst data is not valid. We also track all changes that are made to the data to enable you to easily update the server appropriately.

An important new feature is the DataRelation, data relations provide built in support for master/detail or parent/child relationships between datasources in the client. So for example if you have a invoice(master) datasource and an invoiceitems(detail) datasource moving the master record will automatically cause the detail records to be filtered to expose only the related records without any code required.
The DataRelation also provides support during editing. It will block any attempt to move the master recordset whilst a child record is being edited unless that record can be sucessfully validated.
This enables you to quickly setup some quite complex and sophisticated structures on the client.

We also provide a number of connectors to handle communication with the server covering CSV, XML, remoting, web services and others.