package com.vci.ubcs.starter.web.pagemodel;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
import java.io.Serializable;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.Iterator;
|
import java.util.List;
|
import java.util.Map;
|
|
public class Tree implements Serializable {
|
private static final long serialVersionUID = 6886695271635257882L;
|
private String oid;
|
private String text;
|
private String count;
|
private String name;
|
private boolean leaf = false;
|
private boolean showCheckbox = false;
|
private boolean checked = false;
|
private List<Tree> children = new ArrayList();
|
private String icon;
|
private String iconCls;
|
private String parentId;
|
private String parentName;
|
private String parentBtmName;
|
private boolean expanded = false;
|
private String href;
|
private String index;
|
private Map<String, String> attributes = new HashMap();
|
|
|
|
public Tree() {
|
}
|
|
public Tree(String oid, String text) {
|
this.setOid(oid);
|
this.setText(text);
|
}
|
|
public String getCount() {
|
return count;
|
}
|
|
public void setCount(String count) {
|
this.count = count;
|
}
|
|
public String getOid() {
|
return this.oid;
|
}
|
|
public void setOid(String oid) {
|
this.oid = oid;
|
}
|
|
public String getName() {
|
return this.name;
|
}
|
|
public void setName(String name) {
|
this.name = name;
|
}
|
|
public String getText() {
|
return this.text;
|
}
|
|
public void setText(String text) {
|
this.text = text;
|
}
|
|
public boolean isLeaf() {
|
return this.leaf;
|
}
|
|
public void setLeaf(boolean leaf) {
|
this.leaf = leaf;
|
}
|
|
public boolean isShowCheckbox() {
|
return this.showCheckbox;
|
}
|
|
public void setShowCheckbox(boolean showCheckbox) {
|
this.showCheckbox = showCheckbox;
|
}
|
|
public boolean isChecked() {
|
return this.checked;
|
}
|
|
public void setChecked(boolean checked) {
|
this.checked = checked;
|
}
|
|
public List<Tree> getChildren() {
|
return this.children;
|
}
|
|
public void setChildren(List<Tree> children) {
|
this.children = children;
|
}
|
|
public String getIcon() {
|
return this.icon;
|
}
|
|
public void setIcon(String icon) {
|
this.icon = icon;
|
}
|
|
public String getIconCls() {
|
return this.iconCls;
|
}
|
|
public void setIconCls(String iconCls) {
|
this.iconCls = iconCls;
|
}
|
|
public String getParentId() {
|
return this.parentId;
|
}
|
|
public void setParentId(String parentId) {
|
this.parentId = parentId;
|
}
|
|
public boolean isExpanded() {
|
return this.expanded;
|
}
|
|
public void setExpanded(boolean expanded) {
|
this.expanded = expanded;
|
}
|
|
public String getHref() {
|
return this.href;
|
}
|
|
public void setHref(String href) {
|
this.href = href;
|
}
|
|
public String getIndex() {
|
return this.index;
|
}
|
|
public void setIndex(String index) {
|
this.index = index;
|
}
|
|
public Map<String, String> getAttributes() {
|
return this.attributes;
|
}
|
|
public void setAttributes(Map<String, String> attributes) {
|
this.attributes = attributes;
|
}
|
|
public String getParentName() {
|
return this.parentName;
|
}
|
|
public void setParentName(String parentName) {
|
this.parentName = parentName;
|
}
|
|
public String getParentBtmName() {
|
return this.parentBtmName;
|
}
|
|
public void setParentBtmName(String parentBtmName) {
|
this.parentBtmName = parentBtmName;
|
}
|
|
public static List<Tree> getChildList(List<Tree> rootTree, List<Tree> children) {
|
if (rootTree == null || rootTree.size() == 0) {
|
if (children == null || children.size() <= 0) {
|
return null;
|
}
|
|
rootTree = children.subList(0, children.size());
|
}
|
|
Tree bt = new Tree();
|
bt.findChild(rootTree, children);
|
return rootTree;
|
}
|
|
public void findChild(List<Tree> treenode, List<Tree> children) {
|
Tree node;
|
for(Iterator var3 = treenode.iterator(); var3.hasNext(); this.getChildren().add(node)) {
|
node = (Tree)var3.next();
|
Iterator var5 = children.iterator();
|
|
while(var5.hasNext()) {
|
Tree childnode = (Tree)var5.next();
|
if (node.getOid().equalsIgnoreCase(childnode.getParentId())) {
|
childnode.setParentName(node.getText());
|
if (StringUtil.isBlank(childnode.getParentBtmName())) {
|
childnode.setParentBtmName((String)node.getAttributes().getOrDefault("btmname", ""));
|
}
|
|
node.getChildren().add(childnode);
|
}
|
}
|
|
if (node.getChildren().size() > 0) {
|
this.findChild(node.getChildren(), children);
|
node.setLeaf(false);
|
} else {
|
node.setLeaf(true);
|
}
|
}
|
|
}
|
|
public void findSystemClassChild(List<Tree> treenode, List<Tree> children) {
|
Tree node;
|
for(Iterator var3 = treenode.iterator(); var3.hasNext(); this.getChildren().add(node)) {
|
node = (Tree)var3.next();
|
Iterator var5 = children.iterator();
|
|
while(var5.hasNext()) {
|
Tree childnode = (Tree)var5.next();
|
if (node.getAttributes().get("classifyOid").equalsIgnoreCase(childnode.getParentId())) {
|
childnode.setParentName(node.getText());
|
if (StringUtil.isBlank(childnode.getParentBtmName())) {
|
childnode.setParentBtmName((String)node.getAttributes().getOrDefault("btmname", ""));
|
}
|
|
node.getChildren().add(childnode);
|
}
|
}
|
|
if (node.getChildren().size() > 0) {
|
this.findSystemClassChild(node.getChildren(), children);
|
node.setLeaf(false);
|
} else {
|
node.setLeaf(true);
|
}
|
}
|
|
}
|
|
@Override
|
public String toString() {
|
return "Tree{oid='" + this.oid + '\'' + ", text='" + this.text + '\'' + ", leaf=" + this.leaf + ", showCheckbox=" + this.showCheckbox + ", checked=" + this.checked + ", children=" + this.children + ", icon='" + this.icon + '\'' + ", iconCls='" + this.iconCls + '\'' + ", parentId='" + this.parentId + '\'' + ", parentName='" + this.parentName + '\'' + ", parentBtmName='" + this.parentBtmName + '\'' + ", expanded=" + this.expanded + ", href='" + this.href + '\'' + ", index='" + this.index + '\'' + ", attributes=" + this.attributes + '}';
|
}
|
}
|