}
// 构建ComboTree
private ComboTree comboTree(Object obj, ComboTreeModel comboTreeModel, List in, boolean recursive) {
ComboTree tree = new ComboTree();
Map<String, Object> attributes = new HashMap<String, Object>();
ReflectHelper reflectHelper = new ReflectHelper(obj);
String id = oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getIdField()));
tree.setId(id);
tree.setText(oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getTextField())));
if (comboTreeModel.getSrcField() != null) {
attributes.put("href", oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getSrcField())));
tree.setAttributes(attributes);
}
if (in == null) {
} else {
if (in.size() > 0) {
for (Object inobj : in) {
ReflectHelper reflectHelper2 = new ReflectHelper(inobj);
String inId = oConvertUtils.getString(reflectHelper2.getMethodValue(comboTreeModel.getIdField()));
if (inId == id) {
tree.setChecked(true);
}
}
}
}
List tsFunctions = (List) reflectHelper.getMethodValue(comboTreeModel.getChildField());
if (tsFunctions != null && tsFunctions.size() > 0) {
tree.setState("closed");
tree.setChecked(false);
/*
* if (recursive) {// 递归查询子节点 List<TSFunction> functionList = new ArrayList<TSFunction>(tsFunctions); Collections.sort(functionList, new SetListSort());// 排序 List<ComboTree> children = new ArrayList<ComboTree>(); for (TSFunction f : functionList) { ComboTree t = comboTree(f,comboTreeModel,in, true); children.add(t); } tree.setChildren(children); }
*/
}
return tree;