95 lines
3.5 KiB
Plaintext
95 lines
3.5 KiB
Plaintext
<%@page import="com.amarsoft.are.util.json.JSONEncoder"%>
|
||
<%@page import="com.amarsoft.are.jbo.*"%>
|
||
<%@page import="com.amarsoft.asquery.JBORelatedObjCache"%>
|
||
<%@page import="com.amarsoft.asquery.ClassRelation"%>
|
||
<%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBegin.jsp"%><%
|
||
String DefaultNode = CurPage.getParameter("DefaultNode");
|
||
String queryClass = CurPage.getParameter("QueryClass");
|
||
if(queryClass == null) queryClass="";
|
||
|
||
String sButtons[][] = {
|
||
{"true","","Button","选择","返回选择项","doConfig()","","","",""},
|
||
};
|
||
%><%@include file="/Resources/CodeParts/View07.jsp"%>
|
||
<script type="text/javascript">
|
||
setWindowTitle("增加查询条件");
|
||
var relatedClasses = new Array();
|
||
var lRequiredId = new Array(); // 必输项ID
|
||
function doConfig(){
|
||
for(var i = 0; i < lRequiredId.length; i++){
|
||
setCheckTVItem(lRequiredId[i], true);
|
||
}
|
||
|
||
var folders = new Array();
|
||
var pages = new Array();
|
||
var nodes = getMarkedTVItems();
|
||
for(var i = 0; i < nodes.length; i++){
|
||
if(nodes[i].type == "folder"){
|
||
folders.push(nodes[i]);
|
||
}else{
|
||
pages.push(nodes[i]);
|
||
}
|
||
}
|
||
|
||
for(var i = 0; i < folders.length; i++){
|
||
var clazz = folders[i].value;
|
||
var className = folders[i].id;
|
||
var attrs = new Array();
|
||
for(var j = 0; j < pages.length; j++){
|
||
if(pages[j].parentID == className){
|
||
attrs.push(pages[j].value);
|
||
}
|
||
}
|
||
relatedClasses.push({"clazz":clazz,"attrs":attrs.join(",")});
|
||
}
|
||
parent.AsDialog.ClosePage(relatedClasses);
|
||
}
|
||
<%/*~[Describe=生成treeview;]~*/%>
|
||
function initTreeView(){
|
||
<%//定义Treeview
|
||
HTMLTreeView tviTemp = new HTMLTreeView("JBO类","right");
|
||
tviTemp.MultiSelect = true;
|
||
|
||
// 获取主对象的关联对象,包括class、alias、relation等属性
|
||
System.out.println(queryClass);
|
||
List<ClassRelation> cacheMapList = (List<ClassRelation>)JBORelatedObjCache.getInstance().getCacheMap().get(queryClass);
|
||
List<ClassRelation> objList = new ArrayList<ClassRelation>();
|
||
objList.add(new ClassRelation(queryClass, "O", "false", "", ""));
|
||
if(cacheMapList != null) objList.addAll(cacheMapList);
|
||
|
||
List<String> lRequiredId = new ArrayList<String>();
|
||
List<String> checkedNodes = new ArrayList<String>();
|
||
for(int i = 0;i<objList.size();i++){
|
||
ClassRelation cr = objList.get(i);
|
||
BizObjectClass clazz = JBOFactory.getBizObjectClass(cr.getAbsoluteName());
|
||
String clsName = clazz.getName();
|
||
String clsLabel = clazz.getLabel();
|
||
String clsAlias = cr.getAlias();
|
||
if(clsAlias == null) clsAlias = clsName;
|
||
String isDefault = cr.getIsDefault();//是否是默认条件
|
||
String nodeJSONValue = cr.getAbsoluteName(); //节点值: jbo类全名
|
||
if("false".equals(isDefault)){//默认添加的查询关联对象在关联对象中不显示
|
||
String sFolder = tviTemp.insertFolder(clsName, "root", clsLabel, nodeJSONValue, "", i); //class节点
|
||
for (int j = 0; j < clazz.getAttributes().length; j++) {
|
||
DataElement de = clazz.getAttributes()[j];
|
||
AttributeUIHints h = clazz.getAttributeUIHint(de.getName());
|
||
if(!h.isFilterSuitable()) continue;
|
||
if(h.isRequired()) lRequiredId.add(clsAlias+"_"+de.getName());
|
||
checkedNodes.add(clsAlias+"_"+de.getName());
|
||
tviTemp.insertPage(clsAlias+"_"+de.getName(), clsName, de.getLabel(), de.getName(), "", j+1);
|
||
}
|
||
}
|
||
}
|
||
out.println("lRequiredId = "+JSONEncoder.encode(lRequiredId));
|
||
out.println(tviTemp.generateHTMLTreeView());
|
||
|
||
for(String nodeID : checkedNodes){%>
|
||
setCheckTVItem('<%=nodeID%>', true);
|
||
<%
|
||
}
|
||
%>
|
||
expandNode('root');
|
||
}
|
||
initTreeView();
|
||
</script>
|
||
<%@ include file="/IncludeEnd.jsp"%> |