The adapter

The adapter is an object that acts like a bridge between a data source and a graphic component. It converts the business objects of the data source ( IlpObject instances), which are component-independent, to representation objects which are suitable for a given representation model, that is, for a given graphic component. For information about the representation model and representation objects, see The representation model.
The use of adapters is optional as you can directly instantiate and insert representation objects into a representation model. However, they are highly recommended as they hide the complexity of creating representation objects relationships. Using adapters, you do not need to care about representation objects. All you have to do is create the business model in the data source and customize the view and objects using CSS to obtain an attractive graphic representation.
By default, adapters are meant to work in conjunction with a data source. By default, they are used in all JViews TGO graphic components.
Adapters also handle synchronization.
JViews TGO supplies four kinds of adapter, each corresponding to a specific type of representation model:
  • The table adapter creates representation objects of type table row. See section Table component for the specific features of the table adapter.
  • The tree adapter creates representation objects of type tree node. See section Tree component for the specific features of the tree adapter.
  • The network adapter creates representation objects of type network node and link. See section Network component for the specific features of the network adapter.
  • The equipment adapter creates representation objects of type equipment node. See section Equipment component for the specific features of the equipment adapter.
These adapters are all based on an abstract adapter, defined by the interface IlpAbstractAdapter.
The following figure shows interfaces that are directly related to adapters.
tgo_adapter.png
Adapter interfaces
This diagram shows that an adapter knows a data source. The adapter listens to the data source, which notifies it whenever a new IlpObject instance is created. Once a new object is added to the data source, the adapter creates the corresponding IlpRepresentationObject instance if the adapter configuration allows it.
In some cases, adapters can also contain temporary representation objects that are created independently of the corresponding business object (before it is created and retrieved from the data source). These temporary objects are stored in the adapter along with a means to determine whether the corresponding business object has been created. For more information, see Creating a temporary representation object.
All adapters support filtering of business objects. When a filter is set to an adapter, only IlpObject instances in the data source that satisfy specified conditions are represented in the representation model. This filter is defined by the interface IlpFilter. For more information, see the information on each graphic component.