예제 #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;
  }