Universal Robots Forum

Calling methods when creating child nodes

class ParentNode implements ProgramNodeContribution {   
private void addNodes(){
    TreeNode root = getRoot();
    ProgramNodeFactory nf = getProgramNodeFactory();

    try {
        for (int i = 0; i <; i++) {
             NumberProgramNode numberNode = (NumberProgramNode) nf.createURCapProgramNode(NumberProgramNodeService.class);
             numberNode.setNumber(i); //is this even possible? 

    } catch (TreeStructureException e) {
        // See e.getMessage() for explanation

When I create a child node I wish to be able to specify arguments to my child-node, like the example. Is there a way to do this easily? I have made a static variable which counts every time we create a NumberProgramNode, but the problem comes when we create more than one parent-node which can add a child and can remove a child, this behavior will mess the count variable up. So is there a way to send information from the parent-node to their respected child-nodes?