Start of Content Area

Background documentation Node Collection  Locate the document in its SAP Library structure

At runtime, nodes can contain a collection of node elements of the same structure (attributes, nodes), called a node collection. The name collection refers to the Java interface java.util.Collection, for which there are additional subinterfaces such as java.util.List or java.util.Set.

·        List: The data type List describes a sorted group of objects (collection), in which duplicates are allowed. The group enables you to position the objects. The elements in a list can be accessed using their integer index (position).

Until now, node collections in Web Dynpro are based exclusively on the java.util.List-Interface, although future enhancements based on Set or Tree are possible.

The cardinality of a node collection corresponds to the minimum and maximum number of node elements it contains. It is defined at design time using the cardinality node property:

Possible

values

Short description

0..1

The node can be empty or contain a maximum of one node element.

1..1

The node contains exactly one node element.

0..n

The node can be empty or contain any number of node elements.

1..n

The node contains at least one node element. A node element is created automatically by the Web Dynpro runtime environment as soon as possible.

 

A difference is made between multiple and required context nodes:

·        multiple (0..n or 1..n):  If a context node is defined as multiple, it can be filled with a node collection of more than one node element at runtime. This property is checked in the bind and addElement methods. The data records displayed in the table are saved in multiple context nodes, for example.
For multiple nodes, the generated context interface method contains methods such as
get<Knotenname>ElementAt(int), which are missing otherwise.
If a multiple context node does not contain a node element, all UI elements that are bound to the node become inactive, as no context attributes are available to save the data.

·        required (1..1 or 1..n): If a node was defined as required, then at runtime it is ensured that it contains at least one node element. When a value node is created, this is simultaneously connected to an empty node element being added. You cannot bind an empty list of node elements or null to the nodes.

There are several options for filling a node collection with node elements at runtime:

·        Independent context nodes are not dependent on a parent node so they can also contain empty node collections. If the cardinality of their node collection is set to 1..1, or 1..n, this results in a runtime error if the node collection is empty.
An indepedent node can also be filled with node elements by the definition of a supply function. This function is then called if a node element of a node is accessed for the first time.

·        Dependent context nodes have to receive their node elements from supply functions. If they are also of type singleton, their node collection is deleted each time the parent node’s lead selection changes and recalculated using the supply function.
For non-singleton nodes, each node element of the parent node has its own instance of the child node. Each of these node instances is supplied with node elements by a supply function when the data is accessed.

·        In the case of context mapping, mapped nodes reference the contents of those context nodes to which they themselves refer.

Regardless of how the content of a node collection was determined, a node can be invalidated at any time which means that is value is redetermined the next time it is accessed.

  

  

 

End of Content Area