您好,欢迎访问三七文档
1ComboTreeDetailListUI左树右表必须实现的方法事件//增加下拉列表选择改变事件处理(会重新生成树)protectedvoidcbxMain_itemStateChanged(java.awt.event.ItemEvente)throwsException{super.cbxMain_itemStateChanged(e);//本超类事件重新生成树if(treeMain.getRowCount()1)treeMain.setSelectionRow(1);//有数据选择第一个节点elsetreeMain.setSelectionRow(0);//无数据选择根节点}//给左树传查询过滤条件(如果需要传参数给左树,需要实现ILNTreeNodeCtrl接口)protectedILNTreeNodeCtrlgetLNTreeNodeCtrl()throwsException{if(cbxMain.getItemCount()0)tateChanged(e);//本超类函数重新生成树if(treeMain.getRowCount()1)treeMain.setSe{returnnewLNCsAccountTypeTreeNodeCtrl(getTreeInterface(),(CsAccountTableInfo)this.cbxMain.getSelectedItem(),acccountTable);}else{returnnewLNCsAccountTypeTreeNodeCtrl(getTreeInterface(),newCsAccountTableInfo(),acccountTable);}}classLNCsAccountTypeTreeNodeCtrlimplementsILNTreeNodeCtrl{privateICsAccountTypeiAccountType=null;privateCsAccountTableInfoaccoutTableInfo=null;privateStringfilterField=null;//查询过滤字段名publicLNCsAccountTypeTreeNodeCtrl(ITreeBasetreeCtrl,IObjectValueaccoutTableInfo,StringfilterField)2{this.iAccountType=(ICsAccountType)treeCtrl;this.accoutTableInfo=(CsAccountTableInfo)accoutTableInfo;this.filterField=filterField;}//获取指定结点的指定级次的子孙结点,若parent==null,则获取从1到指定级次的结点publicAbstractObjectCollectiongetChildren(TreeBaseInfoparentNodeInfo,intlevel)throwsException{StringtableID=null;if(this.accoutTableInfo!=null&&this.accoutTableInfo.getId()!=null){tableID=this.accoutTableInfo.getId().toString();}EntityViewInfoviewInfo=newEntityViewInfo();viewInfo.setFilter(newFilterInfo());if(parentNodeInfo!=null){viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(longNumber,parentNodeInfo.getLongNumber()+!%,CompareType.LIKE));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(level,newInteger(parentNodeInfo.getLevel()),CompareType.GREATER));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(level,newInteger(parentNodeInfo.getLevel()+level),CompareType.LESS_EQUALS));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(filterField,tableID,CompareType.EQUALS));}else{viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(level,newInteger(level),CompareType.LESS_EQUALS));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(filterField,tableID,CompareType.EQUALS));}viewInfo.getSelector().add(newSelectorItemInfo(*));viewInfo.getSorter().add(newSorterItemInfo(longNumber));AbstractObjectCollectionresult=iAccountType.getTreeBaseCollection(viewInfo);returnresult;}//指定过滤条件。如组织类型获取指定结点的指定级次的子孙结点,若parent==null,则获取从1到指定级次的结点publicAbstractObjectCollectiongetChildren(TreeBaseInfoparentNodeInfo,intlevel,FilterInfoinfo)throwsException{StringtableID=null;if(this.accoutTableInfo!=null&&this.accoutTableInfo.getId()!=null){tableID=this.accoutTableInfo.getId().toString();}EntityViewInfoviewInfo=newEntityViewInfo();viewInfo.setFilter(newFilterInfo());if(parentNodeInfo!=null){viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(longNumber,parentNodeInfo.getLongNumber()+!%,CompareType.LIKE));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(level,newInteger(parentNodeInfo.getLevel()),CompareType.GREATER));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(level,newInteger(parentNodeInfo.getLevel()+level),CompareType.LESS_EQUALS));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(filterField,tableID,CompareType.EQUALS));}else{viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(level,newInteger(level),CompareType.LESS_EQUALS));viewInfo.getFilter().getFilterItems().add(newFilterItemInfo(filterField,tableID,CompareType.EQUALS));}viewInfo.getSelector().add(newSelectorItemInfo(*));viewInfo.getSorter().add(newSorterItemInfo(longNumber));AbstractObjectCollectionresult=iAccountType.getTreeBaseCollection(viewInfo);returnresult;}//指定过滤条件。如组织类型获取指定结点的指定级次的子孙结点,若parent==null,则获取从1到指定级次的结点publicAbstractObjectCollectiongetChildren(TreeBaseInfoparentNodeInfo,intlevel,FilterInfofilter,SelectorItemCollectionselector)throwsException{returngetChildren(parentNodeInfo,level,filter);}3}//设置左树选择节点的值@OverrideprotectedIObjectPKgetSelectedTreeKeyValue(){returnnull;}//设置左树选择节点时右表的查询过滤条件字段@OverrideprotectedStringgetQueryFieldName(){returnaccountType.id;}//设置左树类别编辑界面@OverrideprotectedStringgetGroupEditUIName(){returnCsAccountTypeEditUI.class.getName();}//设置左树接口@OverrideprotectedITreeBasegetTreeInterface()throwsException{returnCsAccountTypeFactory.getRemoteInstance();}//设置右表接口@OverrideprotectedICoreBasegetBizInterface()throwsException{returnCsAccountViewFactory.getRemoteInstance();}//设置右表编辑界面@OverrideprotectedStringgetEditUIName(){returnCsAccountViewEditUI.class.getName();}//打开窗口时给ComboBox控件赋值@OverridepublicvoidonLoad()throwsException{super.onLoad();//定义缺省下拉列表框DefaultComboBoxModelmodel=newDefaultComboBoxModel();//根据查询过滤条件定义下拉列表的值ICsAccountTableiAccountTable=CsAccountTableFactory.getRemoteInstance();CsAccountTableCollectiontableInfos=iAccountTable.getCsAccountTableCollection();Iteratorter=tableInfos.iterator();while(ter.hasNext()){CsAccountTableInfotableInfo=(CsAccountTableInfo)ter.next();4model.addE
本文标题:EAS-BOS之ComboTreeDetailListUI左树右表必须实现的方法事件
链接地址:https://www.777doc.com/doc-4397565 .html