The adapter

The network adapter converts business objects into representation objects of type network node and network link. It is defined by the class IlpNetworkAdapter.
Network adapters retrieve structural information (that is, parent/child relationship) about business objects from the associated data source and determine whether an object should appear as a root representation object by examining a list of origins. See Setting a list of origins for details.
Like the tree adapter, the network adapter supports load on demand.
The following figure shows network adapter classes:
tgo_network_adapter.png
Network adapter classes
The network adapter creates either a node or a link representation object depending on the value returned by the method getLinkInterface. If the return value is not null, then a link is created; otherwise, a node is created.
Nodes are created with an IlpNetworkNodeFactory. By default, this factory is an instance of the class IlpDefaultNetworkNodeFactory, which creates IlpDefaultNetworkNode instances.
Similarly, links are created with an IlpNetworkLinkFactory. By default, this factory is an instance of the class IlpDefaultNetworkLinkFactory, which creates IlpDefaultNetworkLink instances.
The network adapter handles the position or shape of objects. By default, it interprets every object attribute with the name position as denoting the position of the object. You can use the method setPositionAttribute in IlpAbstractNodeAdapter to specify any other attribute to be used instead for all instances of a given IlpClass.
You can create a network adapter implicitly by instantiating the IlpNetwork component as shown in the following example.

How to create a network adapter by instantiating a network component

IlpNetwork ilpNetwork = new IlpNetwork();
IlpDataSource dataSource = new IlpDefaultDataSource();
ilpNetwork.setDataSource(dataSource);
If you want to configure the adapter, to set its origin for example, you must first retrieve it from the network component and then set it to the data source.

How to configure a network adapter

IlpNetwork ilpNetwork = new IlpNetwork();
IlpDataSource dataSource = new IlpDefaultDataSource();
// configure the adapter, for example set an origin
IlpNetworkAdapter adapter = ilpNetwork.getAdapter();
adapter.setOrigins(Collections.singletonList("origin"),false);
adapter.setDataSource(dataSource);
For information on how to configure the adapter in CSS, see The Adapter rule.

Controlling the display of objects as containers

Unlike the tree adapter, the network adapter considers by default that objects are not containers. There are two conditions for an object to be a container: its getContainerInterface method should not return null and the property expansion applying to that object should be set to ExpansionType.IN_PLACE . By default, this property is set to ExpansionType.NO_EXPANSION . For information on how to set a property value, see Introducing cascading style sheets.
Note
There is no way to represent an object in a network component as a container, if its getContainerInterface returns null .

Creating a temporary representation object

The network adapter supports temporary representation objects. These objects are placeholders that can be used in place of permanent representation objects for editing purposes and, more specifically, when new objects are created in the network view. When a business object corresponding to the temporary representation object is added to the data source, this temporary representation object is removed and replaced by the permanent representation of the business object. A filter, defined by IlpFilter, is used to determine when the representation object of a business object added to the data source is a candidate to replace the temporary representation object. Filtering criteria can be of any kind.
The following example shows how to add a temporary representation object to a network adapter.

How to add a temporary representation object to a network adapter

First you create the temporary representation object, like this:
IlpDefaultNetworkNode temp=
          new IlpDefaultNetworkNode(new IlpDefaultAttributeGroup());
Then you add it to the adapter along with the filtering criteria using the method storeTemporaryRepresentationObject:
adapter.storeTemporaryRepresentationObject(temp, null, new IlpFilter() {
  public boolean accept(Object o) {
   IlpObject ilpO = (IlpObject)o;
   return ilpO.getIdentifier().equals("right one");
   }
};
The temporary representation object will be replaced by a permanent representation object as soon as a business object satisfying the filtering criteria is added to the data source.