cancel
Showing results for 
Search instead for 
Did you mean: 

Create singleton node elements dynamically

Former Member
0 Kudos

Hi,

Need to create singleton node elements at runtime. At design time I have defined NodeB as child of NodeA. NodeB is singleton, and as such I dont get the typed access code to create elements of NodeB using code as shown below.

IPrivateProjectManagerView.IPlantsElement plantsElement = wdContext.createPlantsElement();

plantsElement.setName(currentPlant);

wdContext.nodePlants().addElement(plantsElement);

//Add current plant to the Plants node

IPrivateProjectManagerView.IPlantNode plantNode = plantsElement.nodePlant();

IPrivateProjectManagerView.IPlantElement plantElement = plantNode.createPlantElement();

//plantElement.setName(currentPlant);

plantNode.addElement(plantElement);

//add Avail Check field to current plant

IPrivateProjectManagerView.IAvailCheckNode availCheckNode = plantElement.nodeAvailCheck();

IPrivateProjectManagerView.IAvailCheckElement availCheckElement = availCheckNode.createAvailCheckElement();

availCheckNode.addElement(availCheckElement);

IPrivateProjectManagerView.IAvailCheckSetNode availCheckSetNode = availCheckElement.nodeAvailCheckSet();

IPrivateProjectManagerView.IAvailCheckSetElement availCheckSetElement = availCheckSetNode.createAvailCheckSetElement();

availCheckSetNode.addElement(availCheckSetElement);

In the above case AvailCheck is non-singleton child node.

Do let me know what the code is for creating node element NodeB, and its child node element say NodeB1.

Thanks !

Sri

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

> Hi,

>

> Need to create singleton node elements at runtime. At

> design time I have defined NodeB as child of NodeA.

> NodeB is singleton, and as such I dont get the typed

> access code to create elements of NodeB using code as

> shown below.

Generation of the typed context interface has nothing to do with the singleton property of a node.

For a singleton child node, there does not exist a separate node instance per parent <b>element</b>, so you do not get methods of the form parentElement.node.createElement() but only wdContext.createElement().

Armin

Message was edited by: Armin Reichert

Former Member
0 Kudos

Armin,

I understand that there is not connection between typed context interface and singleton property of nodee.

The scenario I am trying to resolve is as follows.

The context structure at design is as follows.

NodePlants (singleton, 0:n)

-


NodePlant (non-singleton,0:n)

****---NodeField1 (non-singleton,0:n)

****---NodeField2 (singleton,0:n)

Application can have multiple elements of NodePlant ( 1000,1001 etc.), and each plant element has its own set of NodeField1, NodeField2 elements. I can create NodeField1 elements at runtime, for each plant, using the typed access code parentElement.node.createElement(). But, not for NodeField2 as its a singleton node.

Reason NodeField2 is singleton, is because, thats the only way I have been able to bind dropdown lists to

Former Member
0 Kudos

Armin,

I understand that there is not connection between typed context interface and singleton property of nodee.

The scenario I am trying to resolve is as follows.

The context structure at design is as follows.

NodePlants (singleton, 0:n)

-


NodePlant (non-singleton,0:n)

****---NodeField1 (non-singleton,0:n)

****---NodeField2 (singleton,0:n)

Application can have multiple elements of NodePlant ( 1000,1001 etc.), and each plant element has its own set of NodeField1, NodeField2 elements. I can create NodeField1 elements at runtime, for each plant, using the typed access code parentElement.node.createElement(). But, not for NodeField2 as its a singleton node.

Reason NodeField2 is singleton, is because, thats the only way I have been able to bind dropdown lists to context nodes or else code will error out.

Do let me know the best approach to resolve this.

Thanks !

SP

Former Member
0 Kudos

What purpose has the node "NodePlants"?

Can you describe your data model without context terminology? This way, we can find an appropriate context structure more easily.

Additionally, how shall the context be used by UI elements, e.g. drop-down lists?

Armin

Former Member
0 Kudos

I tried working on your scenario and found that inorder to create an element for the NodeField2 node you need to create an element for all its parent nodes.

IPrivate<viewname>.INodePlantsElement testElem=wdContext.createNodePlantsElement();

wdContext.nodeNodePlants().bind(testElem);

IPrivate<viewname>.INodePlantElement elem=wdContext.createNodePlantElement();

wdContext.nodeNodePlant().bind(elem);

IPrivateNodeAppView.INodeField2Element ele=wdContext.createNodeField2Element();

wdContext.nodeNodeField2().bind(ele);

Regards

Noufal

Former Member
0 Kudos

IPrivateSdnAppView.IVnNodeElement neEmp =wdContext.createVnNodeElement();

neEmp.set....

wdContext.nodeVnNode().addElement(neEmp);

IPrivateSdnAppView.IVnChildElement neDet = wdContext.createVnChildElement();

neDet.setVaName("Text"+i);

neEmp.nodeVnChild().bind(neDet);

Here NodeVnChild is the Child Node of VNNode and VnChild is Singleton False

Here i am adding the element to the child node with the help pf object of parent node. This is POssible incaso of only the child node is made as singleton false

Is this what u were asking

Former Member
0 Kudos

Thanks Krish !

I am looking for a way to add singleton child node. You code is for non-singleton case.

Let me know if you know of a way to creating singleton child nodes (elements) dynamically.