T - ID类型public class TreeMap<T> extends LinkedHashMap<String,Object> implements Node<T>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
TreeMap() |
TreeMap(TreeEntity TreeEntity)
构造
|
| Modifier and Type | Method and Description |
|---|---|
List<TreeMap<T>> |
getChildren() |
T |
getId()
获取ID
|
CharSequence |
getName()
获取节点标签名称
|
TreeMap<T> |
getNode(T id)
获取ID对应的节点,如果有多个ID相同的节点,只返回第一个。
此方法只查找此节点及子节点,采用广度优先遍历。
|
TreeMap<T> |
getParent()
获取父节点
|
T |
getParentId()
获取父节点ID
|
List<CharSequence> |
getParentsName(boolean includeCurrentNode)
获取所有父节点名称列表
比如有员工在研发一部,上级部门为研发部,接着上面有技术中心
返回结果就是:[研发一部, 研发中心, 技术中心]
|
List<CharSequence> |
getParentsName(T id,
boolean includeCurrentNode)
获取所有父节点名称列表
比如有员工在研发一部,上级部门为研发部,接着上面有技术中心
返回结果就是:[研发一部, 研发中心, 技术中心]
|
Comparable<?> |
getWeight()
获取权重
|
void |
putExtra(String key,
Object value)
扩展属性
|
void |
setChildren(List<TreeMap<T>> children) |
TreeMap<T> |
setId(T id)
设置ID
|
TreeMap<T> |
setName(CharSequence name)
设置节点标签名称
|
TreeMap<T> |
setParent(TreeMap<T> parent)
设置父节点
|
TreeMap<T> |
setParentId(T parentId)
设置父节点ID
|
TreeMap<T> |
setWeight(Comparable<?> weight)
设置权重
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic TreeMap()
public TreeMap(TreeEntity TreeEntity)
TreeEntity - TreeNode配置public TreeMap<T> setParent(TreeMap<T> parent)
parent - 父节点public TreeMap<T> getNode(T id)
id - IDpublic List<CharSequence> getParentsName(T id, boolean includeCurrentNode)
id - 节点IDincludeCurrentNode - 是否包含当前节点的名称public List<CharSequence> getParentsName(boolean includeCurrentNode)
includeCurrentNode - 是否包含当前节点的名称public T getParentId()
NodegetParentId in interface Node<T>public TreeMap<T> setParentId(T parentId)
NodesetParentId in interface Node<T>parentId - 父节点IDpublic CharSequence getName()
Nodepublic TreeMap<T> setName(CharSequence name)
Nodepublic Comparable<?> getWeight()
Nodepublic TreeMap<T> setWeight(Comparable<?> weight)
NodeCopyright © 2020. All rights reserved.