// ===============================================================
 // ===============================================================
 private void createThreadsNodes() {
   for (int i = 0; i < threadsInfo.size(); i++) {
     PollThread thread = threadsInfo.threadAt(i);
     //	Build node for class with all commansdds as leaf
     DefaultMutableTreeNode node = new DefaultMutableTreeNode(thread);
     root.add(node);
     for (Object obj : thread) node.add(new DefaultMutableTreeNode(obj));
   }
 }
  // ===============================================================
  // ===============================================================
  void removeThread() {
    DefaultMutableTreeNode node = getSelectedNode();

    if (node != null) {
      Object obj = node.getUserObject();
      if (obj instanceof PollThread) {
        //	Check if device(s) associated.
        if (node.getChildCount() == 0) {
          //	get future selected node
          DefaultMutableTreeNode next_node = getFutureSelectedNode(node);
          //	Remove selected one
          treeModel.removeNodeFromParent(node);
          PollThread pt = (PollThread) obj;
          threadsInfo.remove(pt);
          //	And select the found node
          TreeNode[] tree_node = next_node.getPath();
          TreePath path = new TreePath(tree_node);
          setSelectionPath(path);
          scrollPathToVisible(path);
        } else Utils.popupError(parent, "Cannot remove a not empty thread !");
      }
    }
  }
 // ===============================================================
 // ===============================================================
 public int getNbThreads() throws DevFailed {
   return threadsInfo.size();
 }