Exemplo n.º 1
0
  public void addChild(String child) {

    Item childNode = new Item(child);

    addItemToArrayList(childNode);

    current.add(childNode);
    parent = current;
    current = childNode;

    // Store the parent for the Item object

    childNode.addItemInformation("Parent", parent.getItemName());
  }
Exemplo n.º 2
0
  public void addSibling(String sibling) {

    Item siblingNode = new Item(sibling);

    addItemToArrayList(siblingNode);

    // Adding a child node to the parent Item

    parent.add(siblingNode);
    current = siblingNode;

    // Store the parent for the Item object

    siblingNode.addItemInformation("Parent", parent.getItemName());
  }