Universal Robots Forum

Can I acces to the ProgramNodeContribution of a FolderNode?

Hello, I’m working in a URCap that has a main node with 2 children, both are FolderNode.

	// Nodes
	FolderNode folder1;
	FolderNode folder2;
		
	// Constructor
	public ToolFunctionsProgramNodeContribution(final ProgramAPIProvider apiProvider, ToolFunctionsProgramNodeView view, final DataModel model, CreationContext context) {
		this.programAPI = apiProvider.getProgramAPI();
		this.model = model;
		this.view = view;
		this.undoRedoManager = apiProvider.getProgramAPI().getUndoRedoManager();
		
		if (context.getNodeCreationType() == CreationContext.NodeCreationType.NEW) {
			initialize();
		}
	}
	
	/**
	 * Initialize program node contribution
	 */
	private void initialize() {
		try {
			ProgramNodeFactory nf = programModel.getProgramNodeFactory();
			TreeNode root = programModel.getRootTreeNode(this);
			root.setChildSequenceLocked(true);
			
			folder1 = nf.createFolderNode();
			folder1.setName("Name1");
			folder2 = nf.createFolderNode();
			folder2.setName("Name2");
			root.addChild(folder1);
			root.addChild(folder2);

		} catch (Exception e) {
			throw new IllegalStateException("Could not add nodes to program tree --> " + e.getMessage(), e);
		}
	}

And I want main node isDefined() to be ‘true’ if both children have them function isDefined() equal to true. FolderNode isDefined() is true when all his children are ‘true’ too.

So, how can I acces to isDefined() function of FolderNode?

Well, it’s already solved, it isn’t necessary to access the isDefined() function of the child nodes because it seems to be already implemented. A node is defined when his isDefined() function and that of his children are true.