Xoetrope
HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
XUI 4.0

Bind do Tables


XUI 4.0 enhances the XTable binding mechanism of earlier version which allows to use a different types of model nodes (e.g. POJO's ) as a data source.

The example below shows how to set up a binding of POJO collection/array.

<XPage>

  <Components>
	<Table name="myTable"/>
  </Components>

  <Data>
	<Bind
	  target="myTable"
	  source="pojo/dummyUser/ordersCol"
	  adapter="net.xoetrope.swing.table.XTablePojoModelAdapter"
	  fieldOrder="itemName,date"
	  excludes="id"
	/>
  </Data>

</XPage>


The adapter attribute from the listing above points to a class that will adapt the source POJO collection/array to the XTable component. By default all properties of the underlying collection's/array's elements will be shown, however this behavior can be customized by specifying fieldOrder and excludes attributes. The first one defines an order in which the properties will appear in a table component while the second one specifies properties which shouldn't be shown.

Setting values in the bound XTable component's cells will result in invocation of the relevant POJO setters. If a certain property has no setter then the associated table cell, by default, will be made not editable. This behavior can be easily changed by subclassing the XTablePojoModelAdapter class and pointing to it the adapter attribute of a binding definition.

There are no comments on this page. [Add comment]

Page was generated in 0.4179 seconds