解决方式如下:
修改CommonDao.java,找到
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in) {
List<ComboTree> trees = new ArrayList<ComboTree>();
for (Object obj : all) {
trees.add(comboTree(obj, comboTreeModel, in));
}
return trees;
}
修改为:
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in) {
List<ComboTree> trees = new ArrayList<ComboTree>();
for (Object obj : all) {
trees.add(comboTree(obj, comboTreeModel, in,true));
}
return trees;
}
开启递归验证,找到如下方法,
private ComboTree comboTree(Object obj, ComboTreeModel comboTreeModel, List in, boolean recursive)
在reflectHelper.getMethodValue(comboTreeModel.getChildField());修改为:
List<?> childList = (List<?>) reflectHelper.getMethodValue(comboTreeModel.getChildField());
if (childList != null && childList.size() > 0) {
tree.setState("closed");
tree.setChecked(false);
if (recursive) {// 递归查询子节点
List<Object> list = new ArrayList<Object>(childList);
//Collections.sort(functionList, new SetListSort());// 排序
List<ComboTree> children = new ArrayList<ComboTree>();
for (Object f : list) {
ComboTree t = comboTree(f,comboTreeModel,in, true);
children.add(t);
}
tree.setChildren(children);
}
}
请注意:这样修改完成后,树数据绑定功能正常,但会导致comboTree树的refresh面板的功能失效,具体原因没有查,不过只要做一个判断,过滤此递归即可。
最终的效果如下:
|