示例#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;
  }
示例#2
0
  public WebTreeNode appendChild(WebTreeNode wtn) {
    wtn.removeFromParent();

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

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

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

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

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

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

    return parentTN.getLastChild() == this;
  }