Adding business objects from JavaBeans

The default implementation of the IlpDataSource interface provides an API that directly supports JavaBeans™ objects. This API transforms JavaBeans objects into IlpObject instances of type IlpBeansObject.
The example below shows how to add JavaBeans objects to a data source. It reuses the MO class defined in Defining the business model from JavaBeans classes. Objects are created as regular Java™ objects, inserted in a data source, and modified by means of their set methods.

How to add JavaBeans objects to a data source

MO mo1 = new MO("mo1");
dataSource.addBean(mo1,"mo1");
mo1.setState(2);
Once in the data source, these objects can be displayed in the various JViews TGO graphic components. Bound property updates are dynamically reflected in these components.
The figure below shows an MO object displayed in a tree component.
beansintree.gif
JavaBeans object displayed in a Tree component
Note
The graphical result depends also on the style information associated with the object. Here, the state attribute is mapped to a color. For details, see Introducing cascading style sheets.