-
* 当前的级别
-
*/
-
private int level;
-
/**
-
* 是否展开
-
*/
-
private boolean isExpand = false;
-
private int icon;
-
/**
-
* 下一级的子Node
-
*/
-
private List children = new ArrayList();
-
/**
-
* 父Node
-
*/
-
private Node parent;
-
public Node()
-
{
-
}
-
public Node(int id, int pId, String name)
-
{
-
super();
-
this.id = id;
-
this.pId = pId;
-
this.name = name;
-
}
-
public int getIcon()
-
{
-
return icon;
-
}
-
public void setIcon(int icon)
-
{
-
this.icon = icon;
-
}
-
public int getId()
-
{
-
return id;
-
}
-
public void setId(int id)
-
{
-
this.id = id;
-
}
-
public int getpId()
-
{
-
return pId;
-
}
-
public void setpId(int pId)
-
{
-
this.pId = pId;
-
}
-
public String getName()
-
{
-
return name;
-
}
-
public void setName(String name)
-
{
-
this.name = name;
-
}
-
public void setLevel(int level)
-
{
-
this.level = level;
-
}
-
public boolean isExpand()
-
{
-
return isExpand;
-
}
-
public List getChildren()
-
{
-
return children;
-
}
-
public void setChildren(List children)
-
{
-
this.children = children;
-
}
-
public Node getParent()
-
{
-
return parent;
-
}
-
public void setParent(Node parent)
-
{
-
this.parent = parent;
-
}
-
/**
-
* 是否为跟节点
-
*
-
* @return
-
*/
-
public boolean isRoot()
-
{
-
return parent == null;
-
}
-
/**
-
* 判断父节点是否展开
-
*
-
* @return
-
*/
-
public boolean isParentExpand()
-
{
-
if (parent == null)
-
return false;
-
return parent.isExpand();
-
}
-
/**
-
* 是否是叶子界点
-
*
-
* @return
-
*/
-
public boolean isLeaf()
-
{
-
return children.size() == 0;
-
}
-
/**
-
* 获取level
-
*/
-
public int getLevel()
-
{
-
return parent == null ? 0 : parent.getLevel() + 1;
-
}
-
/**
-
* 设置展开
-
*
-
* @param isExpand
-
*/
-
public void setExpand(boolean isExpand)
-
{
-
this.isExpand = isExpand;
-
if (!isExpand)
-
{
-
for (Node node : children)
-
{
-
node.setExpand(isExpand);
-
}
-
}
-
}
-
}
包含了树节点一些常见的属性,一些常见的方法;对于getLeve