cancel
Showing results for 
Search instead for 
Did you mean: 

Cardinality 0..n

Former Member
0 Kudos

how do i created dynamically node with cardinality 0..n

I wrote this and it seems to be cardinality 1..1 or 1..n:

nodeInfo = wdContext.wdGetAPI().getRootNodeInfo().addChild("ShlpTbs",null,true,true,true,false,false,true,null,null,null);

I try to change some parameter but without success....

Thank you

Joseph

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Javadoc for IWDNode says:

A node may have different cardinalities. At design time they are 0..1, 1..1, 0..n and 1..n. At run time there are the flags mandatory (minimum cardinality is 1) and multiple (maximum cardinality greater than 1).

If mandatory is false, the node is initially empty. Then all UI elements bound to this node are empty and read only. If mandatory is true, the node is guaranteed to be non-empty upon access. This is very convenient for value nodes, but take care with model nodes. Because model node elements require a model instance, the framework can not automatically create an element to achieve this guarantee (without a supply function) and throws an exception if the node is empty and you try to access an element.

For creating a node with cardinality 0:N, use one of the creation methods in IWDNodeInfo and set <b>mandatory=false</b>, <b>multiple=true</b>.

public IWDNodeInfo addChild
(
  java.lang.String name,
  java.lang.Class elementClass,
  boolean singleton,
  boolean mandatory,
  boolean multiple,
  boolean mandatorySelection,
  boolean multipleSelection,
  boolean initializeLeadSelection,
  java.lang.Object dataType,
  IWDNodeCollectionSupplier supplier,
  IWDNodeCollectionDisposer disposer
)

nodeInfo = wdContext.getRootNodeInfo()
.addChild("ShlpTbs",null,true,<b>false</b>,true,false,false,true,null,null,null);

Armin

Answers (0)