Example #1
0
  public WebTreeNode getChildNodeById(String id) {
    if (id == null) return null;

    for (WebTreeNode wtn : childs) {
      if (wtn.getIdName().equals(id)) return wtn;
    }
    return null;
  }
Example #2
0
  public WebTreeNode appendChild(WebTreeNode wtn) {
    wtn.removeFromParent();

    wtn.parentTN = this;
    childs.add(wtn);

    return this;
  }
Example #3
0
  public int getLevel() {
    if (parentTN == null) return 0;

    return parentTN.getLevel() + 1;
  }
Example #4
0
  private void getPathIdNames(ArrayList<String> pins) {
    if (parentTN != null) parentTN.getPathIdNames(pins);

    pins.add(this.id_name);
  }
Example #5
0
  private void getNodePaths(ArrayList<WebTreeNode> ans) {
    if (parentTN != null) parentTN.getNodePaths(ans);

    ans.add(this);
  }
Example #6
0
  /**
   * 获得从根开始到本节点的父节点所经过的所有节点
   *
   * @return
   */
  public ArrayList<WebTreeNode> getAncestors() {
    if (parentTN == null) return null;

    return parentTN.getNodePath();
  }
Example #7
0
  public boolean isLastInParent() {
    if (parentTN == null) return true;

    return parentTN.getLastChild() == this;
  }