Exemplo n.º 1
0
  /** {@inheritDoc} */
  public TreeNode getNode(TreePath path) {
    TreeNode node = this.getModel().getRoot();
    if (!node.getText().equals(path.get(0))) // Test root node
    return null;

    Iterator<String> iterator = path.iterator();
    iterator.next(); // Skip root node, we already tested it above
    while (iterator.hasNext()) {
      String nodeText = iterator.next();
      boolean foundMatch = false;
      for (TreeNode child : node.getChildren()) {
        if (child.getText().equals(nodeText)) {
          node = child;
          foundMatch = true;
          break;
        }
      }
      if (!foundMatch) return null;
    }
    return node;
  }
Exemplo n.º 2
0
 /** {@inheritDoc} */
 public boolean isNodeExpanded(TreeNode node) {
   return this.expandedNodes.contains(node.getPath());
 }