private void updateTreeNodes(StatsProviderRegistryElement spre, boolean enable) {
   // Enable/Disable the child TreeNodes
   String parentNodePath = spre.getParentTreeNodePath();
   List<String> childNodeNames = spre.getChildTreeNodeNames();
   TreeNode rootNode = mrdr.get(instanceName);
   if (rootNode != null) {
     // This has to return one node
     List<TreeNode> nodeList = rootNode.getNodes(parentNodePath, false, true);
     TreeNode parentNode = nodeList.get(0);
     // For each child Node, enable it
     Collection<TreeNode> childNodes = parentNode.getChildNodes();
     boolean hasUpdatedNode = false;
     for (TreeNode childNode : childNodes) {
       if (childNodeNames.contains(childNode.getName())) {
         // Enabling or Disabling the child node (based on enable flag)
         if (childNode.isEnabled() != enable) {
           childNode.setEnabled(enable);
           hasUpdatedNode = true;
         }
       }
     }
     if (!hasUpdatedNode) return;
     // Make sure the tree path is affected with the changes.
     if (enable) {
       enableTreeNode(parentNode);
     } else {
       disableTreeNode(parentNode);
     }
   }
 }
 private void enableTreeNode(TreeNode treeNode) {
   if (!treeNode.isEnabled()) {
     treeNode.setEnabled(true);
     // recursevely call the enable on parent nodes, until the whole path is enabled
     if (treeNode.getParent() != null) {
       enableTreeNode(treeNode.getParent());
     }
   }
 }
  private TreeNode constructServerPP() {
    TreeNode srvrNode = mrdr.get(instanceName);
    if (srvrNode != null) {
      return srvrNode;
    }

    srvrNode = TreeNodeFactory.createTreeNode(instanceName, null, instanceName);
    srvrNode.setEnabled(false);
    mrdr.add(instanceName, srvrNode);
    return srvrNode;
  }
 private void disableTreeNode(TreeNode treeNode) {
   if (treeNode.isEnabled()) {
     boolean isAnyChildEnabled = false;
     Collection<TreeNode> childNodes = treeNode.getChildNodes();
     if (childNodes != null) {
       for (TreeNode childNode : childNodes) {
         if (childNode.isEnabled()) {
           isAnyChildEnabled = true;
           break;
         }
       }
     }
     // if none of the childs are enabled, disable the parent
     if (!isAnyChildEnabled) {
       treeNode.setEnabled(false);
       // recursevely call the disable on parent nodes
       if (treeNode.getParent() != null) {
         disableTreeNode(treeNode.getParent());
       }
     }
   }
 }