Processing...

Suggested case list:

Using timer to refresh a grid

383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlink

user model to move item to another listbox

120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlink

Disabled list item row passed to VM-1981

296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlink

Disabled list item row passed to VM-1981

295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlink

Disabled list item row passed to VM-1981

294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlink

grid sample with ListModel/RowRenderer

816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlink

grid sample with ListModel/RowRenderer

809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlink

grid sample with ListModel/RowRenderer

196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlink

grid sample with ListModel/RowRenderer

195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlink

grid sample with ListModel/RowRenderer

194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlink

grid sample with ListModel/RowRenderer

193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlink

grid sample with ListModel/RowRenderer

192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlink

grid sample with ListModel/RowRenderer

191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlink

Hierarchy table without using ZK PE/EE

1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlink

grid sample with ListModel/RowRenderer

128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlink

user model to move item to another listbox

1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlink

Using timer to refresh a grid

1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlink

Fire a event from child iframe

1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlink

Textbox input restriction sample

1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlink

Test web core taglib in ZUL

1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlink

Latest 10 Fiddles :

constraint binding textbox

3guest172.68.151.16220peldaDec 5, 2025 5:08:19 PMlink

Another new ZK fiddle

2guest172.68.151.16320peldaDec 5, 2025 5:07:51 PMlink

Another new ZK fiddle

1guest172.68.151.16220peldaDec 5, 2025 5:07:32 PMlink

Another new ZK fiddle

1peggypeng172.71.154.99364f4neDec 5, 2025 9:24:31 AMlink

tooltip example

2guest104.22.23.13rc1ntoDec 4, 2025 2:23:45 PMlink

Another new ZK fiddle

1guest172.69.134.2277t7602Dec 4, 2025 1:40:46 PMlink

Another new ZK fiddle

1peggypeng104.22.17.1802df6e3oDec 4, 2025 8:41:29 AMlink

onClose

1peggypeng172.68.87.248j8kd8aDec 3, 2025 4:10:26 AMlink

Another new ZK fiddle

1peggypeng172.69.134.2271rm7f4eNov 26, 2025 3:31:24 AMlink

ZK-5912-Suggestion

2rebeccalai104.22.20.1442qrmiiuNov 26, 2025 2:07:15 AMlink

Tree MVVM crud

2guest172.69.35.1152ki6etnJan 6, 2021 3:18:52 AMlink

resources

index.zulzul<zk> <borderlayout viewModel="@id('vm') @init('com.luology.web.manage.proj.ProjGoalManage')" height="750px"> <west border="none" width="100%" slidable="true" splittable="true"> <div> <tree model="@init(vm.treeModel)" height="740px" context="toolMenu1" selectedItem="@bind(vm.selectedItem_goal)" nonselectableTags="*" > <treecols sizable="true"> <treecol label="目标名称" width="450px"/> <treecol label=" " width="30px" align="center"/> <treecol label="状态" width="100px" align="center"/> <treecol label="责任人" width="80px" align="center"/> <treecol label="set" width="40px" align="center"/> <treecol label="开始时间" width="100px" align="center"/> <treecol label="结束时间" width="100px" align="center"/> <treecol label="bom" width="60px" align="center"/> <treecol label="doc" width="60px" align="center"/> <treecol label="备注" width=""/> </treecols> <template name="model"> <treeitem open="@load(each.treeNodeStatus)" onOpen="@command('onChangeTreeNodeStatusTrue',target=each)" draggable="true" onClick="@command('onChangeSelectedItem',target=each)" > <treerow onClick="@command('onChangeSelectedItem',target=each)"> <treecell droppable="true" onDrop="@command('onDrop')" style=" line-height: 5px !important; "> <textbox inplace="true" width="70%" value="@bind(each.projGoalName)" tooltiptext="@load(each.projGoalName)" onChange="@command('onChangeProjGoal',target=each)"/> </treecell> <treecell droppable="true" onDrop="@command('onDropSub')" style=" line-height: 5px !important; " onClick="@command('onAddSubGoal',target=each)"> <image src="/static/images/icons/64x64/projGoalTarget.jpg" height="15px" tooltiptext="添加子目标" /> </treecell> <treecell style="@load(each.projGoalStatus) @converter('com.luology.web.manage.proj.converter.ProjGoalStatusStyleConverter')" > <combobox width="80%" model="@load(vm.projGoalStatusSets)" value="@load(each.projGoalStatus) @save(each.projGoalStatus) @converter('com.luology.web.manage.proj.converter.ProjStatusConverter')" onChange="@command('onChangeProjGoal',target=each)" inplace="true"> <template name="model"> <comboitem label="@load(each.value)"/> </template> </combobox> </treecell> <treecell style=" line-height: 5px !important; " > <label value="@load(each.projGoalResponsibleMemberName)" visible="@load(each.projGoalResponsibleMemberName ne null)" onClick="@command('onAdd_goal_responsible_member',target=each)" /> <toolbarbutton visible="@load(each.projGoalResponsibleMemberName eq null)" label="无" onClick="@command('onAdd_goal_responsible_member',target=each)" style="color : #3631318f;padding: 8px 11px; min-height: 10px; border: 0px solid transparent;"/> </treecell> <treecell> <checkbox mold="toggle" checked="@load(each.projGoalTimeStatus ne 0)" onCheck="@command('onChangeProjGoalTimeStatus',target=each)" tooltiptext="设定规则,开始及结束时间取子目标最值"/> </treecell> <treecell style=" line-height: 5px !important; "> <datebox value="@bind(each.projGoalStartTime)" tooltiptext="@load(each.projGoalStartTime)" inplace="true" onChange="@command('onChangeProjGoalTime',target=each)"/> </treecell> <treecell style=" line-height: 5px !important; "> <datebox value="@bind(each.projGoalEndTime)" inplace="true" onChange="@command('onChangeProjGoalTime',target=each)" style="@load(each.projGoalStatus ne 2?each.projGoalEndTime:null) @converter('com.luology.web.manage.proj.converter.ProjGoalEndTimeConverter')" tooltiptext="@load(each.projGoalEndTime)"/> </treecell> <treecell style=" line-height: 5px;"> <toolbarbutton visible="@load(each.projBomStatus eq false)" label="无" onClick="@command('onShowBom',target=each)" style="color : #3631318f;padding: 8px 11px; min-height: 10px; border: 0px solid transparent;"/> <toolbarbutton visible="@load(each.projBomStatus)" label="BOM" onClick="@command('onShowBom',target=each)" style="color : black;padding: 8px 11px; min-height: 10px; border: 0px solid transparent;"/> </treecell> <treecell style=" line-height: 5px; "> <toolbarbutton visible="@load(each.projDocStatus eq false)" label="无" onClick="@command('onShowDoc',target=each)" style="color : #3631318f;padding: 8px 11px; min-height: 10px; border: 0px solid transparent;"/> <toolbarbutton visible="@load(each.projDocStatus)" label="DOC" onClick="@command('onShowDoc',target=each)" style="color : black;padding: 8px 11px; min-height: 10px; border: 0px solid transparent;"/> </treecell> <treecell style=" line-height: 5px !important; "> <hlayout onClick="@command('onShowComment',target= each)"> <div width="10px" align="left" visible="@load(each.remark ne null)" > <label value="@bind(each.projGoalRemarkQuantity)"/> </div> <div width="5px" align="right" visible="@load(each.remark ne null)" > <label value="|"/> </div> <label value="@bind(each.remark)" visible="@load(each.remark ne null)" maxlength="40" tooltiptext="@load(each.remark)"/> <toolbarbutton label="无" visible="@load(each.remark eq null)" onClick="@command('onShowComment',target= each)" style="color : #3631318f;padding: 8px 11px; min-height: 10px; border: 0px solid transparent;"/> </hlayout> </treecell> </treerow> </treeitem> </template> </tree> <menupopup id="toolMenu1" > <menuitem label="刷新" onClick="@command('onRefresh')" /> <menuitem label="添加新目标" onClick="@command('onAddNewGoal')" visible="@load(vm.selectedItem_goal eq null)"/> <menuitem label="添加目标责任人" onClick="@command('onAdd_goal_responsible_member')"/> <menuitem label="新建BOM" onClick="@command('onShowBom')"/> <menuitem label="编辑" onClick="@command('onEdit_goal')"/> <menuitem label="删除" onClick="@command('onDelete_goal')" image="@load('/static/images/icons/100x100/cross_red.png')"/> </menupopup> </div> </west> </borderlayout> </zk>ProjGoalManage.javajavapackage com.luology.web.manage.proj; import com.luology.common.SystemConstant; import com.luology.common.utility.zkoss.BaseViewModel; import com.luology.common.utility.zkoss.ZkUtil; import com.luology.dao.account.model.Account; import com.luology.dao.cg.model.CGRequest; import com.luology.dao.kc.model.KCRequire; import com.luology.dao.kc.model.KCRequireExample; import com.luology.dao.proj.model.*; import com.luology.dao.sys.model.SysMenu; import com.luology.dao.sys.model.SysMenuExample; import com.luology.service.account.AccountService; import com.luology.service.kc.KCRequireService; import com.luology.service.proj.*; import com.luology.service.sys.SysUserService; import com.luology.service.upload.UploadFileService; import com.luology.web.qywx.GenerateAccessTokenTask; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.zkoss.bind.BindUtils; import org.zkoss.bind.annotation.*; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.select.annotation.VariableResolver; import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zul.*; import org.zkoss.zul.event.TreeDataEvent; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.*; import static com.luology.common.utility.zkoss.ZkUtil.sendRedirect; @VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class) public class ProjGoalManage extends BaseViewModel { private static Logger log = LoggerFactory.getLogger(ProjGoalManage.class.getName()); @WireVariable private ProjService projService; @WireVariable private ProjMemberService projMemberService; @WireVariable private ProjGoalService projGoalService; @WireVariable private ProjGoalCommentService projGoalCommentService; @WireVariable private ProjFileService projFileService; @WireVariable private AccountService accountService; @WireVariable private UploadFileService uploadFileService; @WireVariable private SysUserService sysUserService; @WireVariable private KCRequireService kcRequireService; private List<Proj> projList; private List<ProjFile> projGoalReportList; private Proj selectedItem; private ProjGoal selectedItem_goal; private ProjFile selectedItem_goal_report; private ProjGoalTreeModel treeModel; private String projGoalStatusStyle; private Set projGoalStatusSets = ProjConstant.projGoalStatusMap.entrySet(); private Set projGoalTimeStatusSets = ProjConstant.projGoalTimeStatusMap.entrySet(); Proj proj = (Proj) ZkUtil.getRequestAttr("proj"); @Init public void init(){ if(proj==null){ return; } ProjGoal rootGoal = projGoalService.getRootGoalStructure(proj); if(rootGoal!=null){ treeModel = new ProjGoalTreeModel(rootGoal); } BindUtils.postNotifyChange(null,null, this,"treeModel"); } @Command public void buildTree(){ if(proj==null){ return; } ProjGoal rootGoal = projGoalService.getRootGoalStructure(proj); if(rootGoal!=null){ treeModel = new ProjGoalTreeModel(rootGoal); } BindUtils.postNotifyChange(null,null, this,"treeModel"); } /** * 添加子目标 */ @Command public void onAddSubGoal(@BindingParam("target") ProjGoal target ){ // public void onAddSubGoal(@ContextParam(ContextType.TRIGGER_EVENT) Event event){ if (proj==null){ ZkUtil.showInformationbox("请先选择项目!"); return; } selectedItem_goal = target; BindUtils.postNotifyChange(null,null, this,"selectedItem_goal"); ZkUtil.setRequestAttr("proj",proj); Window win = (Window) Executions.createComponents("/manage/proj/proj_goal_edit.zul",null,null); win.doModal(); win.addEventListener(Events.ON_CLOSE, new EventListener<Event>() { @Override public void onEvent(Event event) throws Exception { if (event.getData()!=null){ ProjGoal record = (ProjGoal) event.getData(); record.setProjId(proj.getId()); //如果selectedItem_goal为空 插入0号目标 //不为空插入1号目标 if(selectedItem_goal==null){ //寻找该proj对应的parentId等于0的id ProjGoal rootGoal = projGoalService.getRootGoalStructure(proj); ProjGoalExample example = new ProjGoalExample(); record.setParentId(rootGoal.getId()); } else { record.setParentId(selectedItem_goal.getId()); } if(record.getProjGoalStartTime()!=null&&record.getProjGoalEndTime()!=null&&record.getProjGoalStartTime().compareTo(record.getProjGoalEndTime())>0){ ZkUtil.showInformationbox("添加目标失败!起始日期大于结束日期"); return; } ProjGoalExample example = new ProjGoalExample(); example.createCriteria().andParentIdEqualTo(record.getParentId()).andProjIdEqualTo(proj.getId()); record.setIndexNum(projGoalService.countByExample(example)+1); record.setTreeNodeStatus(true); record.setCreateUserId(loginUser.getId()); projGoalService.insert(record); if(record.getProjGoalTimeStatus()==ProjConstant.PROJ_GOAL_TIME_STATUS_SET){ //如果为设定 projGoalService.updateTimeByPrimaryKeySelective(record); } ProjGoal rootGoal = projGoalService.getRootGoalStructure(proj); ProjGoalTreeModel treeModelNew = new ProjGoalTreeModel(rootGoal); int[] path = treeModel.getPath(selectedItem_goal); int[] parentPath = Arrays.copyOf(path,path.length); int num = record.getIndexNum()-1; treeModel.fireEvent(TreeDataEvent.INTERVAL_ADDED,parentPath,record.getIndexNum()-1,record.getIndexNum()-1,path); } } }); } @Command public void onEdit_goal(){ if (selectedItem_goal==null){ ZkUtil.showInformationbox("请先选择数据!"); return; } ZkUtil.setRequestAttr("proj",proj); Map args = new HashMap(); args.put("projGoal",selectedItem_goal); Window win = (Window) Executions.createComponents("/manage/proj/proj_goal_edit.zul",null,args); win.doModal(); win.addEventListener(Events.ON_CLOSE, new EventListener<Event>() { @Override public void onEvent(Event event) throws Exception { if (event.getData()!=null){ ProjGoal record = (ProjGoal) event.getData(); projGoalService.updateByPrimaryKeySelective(record); treeModel.fireEvent(TreeDataEvent.CONTENTS_CHANGED,treeModel.getPath(record),record.getIndexNum()-1,record.getIndexNum()-1); } } }); } @Command public void onDelete_goal(){ if (selectedItem_goal==null){ ZkUtil.showInformationbox("请先选择数据!"); return; } if (selectedItem_goal.getParentId().equals(0)){ ZkUtil.showInformationbox("一级目标不可删除!"); return; } ZkUtil.setRequestAttr("proj",proj); ZkUtil.showConfirmbox("确认删除目标【"+selectedItem_goal.getProjGoalName()+"】吗?其下子目标及备注也会被删除!", new EventListener<Event>() { @Override public void onEvent(Event event) throws Exception { if (event.getData().equals(Messagebox.OK)){ KCRequireExample kcRequireExample = new KCRequireExample(); kcRequireExample.createCriteria().andProjGoalIdEqualTo(selectedItem_goal.getId()); if(kcRequireService.countByExample(kcRequireExample)>0){ ZkUtil.showErrorbox("含有BOM信息,请先删除BOM信息!"); return; } projGoalService.deleteByPrimaryKey(selectedItem_goal.getId()); // buildTree(); int[] path = treeModel != null ? treeModel.getPath(selectedItem_goal) : null; // ProjGoal parent = projGoalService.selectByPrimaryKey(selectedItem_goal.getParentId()); int[] parentPath = Arrays.copyOf(path,path.length-1); treeModel.fireEvent(TreeDataEvent.INTERVAL_REMOVED, parentPath, selectedItem_goal.getIndexNum()-1,selectedItem_goal.getIndexNum()-1, path); } } }); } @Command public void onDrop(@ContextParam(ContextType.TRIGGER_EVENT)DropEvent event){ ProjGoal record1 = ((Treeitem)event.getDragged()).getValue(); ProjGoal record2 = ((Treeitem)event.getTarget().getParent().getParent()).getValue(); if(record1==record2){ return; } if(onJudge(record1,record2)){ ZkUtil.showErrorbox("不可将该目录拉入子目录中!"); return; } if(record1.getParentId()==record2.getParentId()){ ProjGoalExample projGoalExample = new ProjGoalExample(); projGoalExample.createCriteria().andParentIdEqualTo(record1.getParentId()); projGoalExample.setOrderByClause("INDEX_NUM ASC"); List<ProjGoal> projGoalTempList = projGoalService.selectByExample(projGoalExample); //同级节点 if (record1.getIndexNum() < record2.getIndexNum()) { //从小到大 for (ProjGoal record : projGoalTempList) { if (record.getIndexNum() > record1.getIndexNum() && record.getIndexNum() < record2.getIndexNum()) { record.setIndexNum(record.getIndexNum() - 1); projGoalService.updateByPrimaryKeySelective(record); } } record1.setIndexNum(record2.getIndexNum()); record2.setIndexNum(record2.getIndexNum() - 1); } else { for (ProjGoal record : projGoalTempList) { if (record.getIndexNum() < record1.getIndexNum() && record.getIndexNum() > record2.getIndexNum()) { record.setIndexNum(record.getIndexNum() + 1); projGoalService.updateByPrimaryKeySelective(record); } } record1.setIndexNum(record2.getIndexNum()); record2.setIndexNum(record2.getIndexNum() + 1); } projGoalService.updateByPrimaryKeySelective(record1); projGoalService.updateTimeByPrimaryKeySelective(record1); projGoalService.updateByPrimaryKeySelective(record2); }else { //拉出的之后所有 index_num 会减少 ProjGoalExample projGoalExample = new ProjGoalExample(); projGoalExample.createCriteria().andParentIdEqualTo(record1.getParentId()); projGoalExample.setOrderByClause("INDEX_NUM ASC"); List<ProjGoal> projGoalTempList = projGoalService.selectByExample(projGoalExample); for (ProjGoal record : projGoalTempList) { if (record.getIndexNum() > record1.getIndexNum()) { record.setIndexNum(record.getIndexNum() - 1); projGoalService.updateByPrimaryKeySelective(record); } } record1.setParentId(record2.getParentId()); record1.setIndexNum(record2.getIndexNum()); //拉入的之后所有 index_num 会增加 ProjGoalExample projGoalExample1 = new ProjGoalExample(); projGoalExample1.createCriteria().andParentIdEqualTo(record2.getParentId()); projGoalExample1.setOrderByClause("INDEX_NUM ASC"); List<ProjGoal> projGoalList1 = projGoalService.selectByExample(projGoalExample1); for (ProjGoal r : projGoalList1) { if (r.getIndexNum() >= record2.getIndexNum()) { r.setIndexNum(r.getIndexNum() + 1); projGoalService.updateByPrimaryKeySelective(r); } } projGoalService.updateByPrimaryKeySelective(record1); } buildTree(); } @Command public void onDropSub(@ContextParam(ContextType.TRIGGER_EVENT)DropEvent event){ ProjGoal record1 = ((Treeitem)event.getDragged()).getValue(); ProjGoal record2 = ((Treeitem)event.getTarget().getParent().getParent()).getValue(); if(record1==record2){ return; } if(onJudge(record1,record2)){ ZkUtil.showErrorbox("不可将该目录拉入子目录中!"); return; } //拉出的之后所有 index_num 会减少 ProjGoalExample projGoalExample = new ProjGoalExample(); projGoalExample.createCriteria().andParentIdEqualTo(record1.getParentId()); projGoalExample.setOrderByClause("INDEX_NUM ASC"); List<ProjGoal> projGoalTempList = projGoalService.selectByExample(projGoalExample); for (ProjGoal record : projGoalTempList) { if (record.getIndexNum() > record1.getIndexNum()) { record.setIndexNum(record.getIndexNum() - 1); projGoalService.updateByPrimaryKeySelective(record); } } record1.setParentId(record2.getId()); record1.setIndexNum(1); //拉入的之后所有 index_num 会增加 ProjGoalExample projGoalExample1 = new ProjGoalExample(); projGoalExample1.createCriteria().andParentIdEqualTo(record2.getId()); projGoalExample1.setOrderByClause("INDEX_NUM ASC"); List<ProjGoal> projGoalList1 = projGoalService.selectByExample(projGoalExample1); for (ProjGoal r : projGoalList1) { r.setIndexNum(r.getIndexNum()+1); projGoalService.updateByPrimaryKeySelective(r); } projGoalService.updateByPrimaryKeySelective(record1); buildTree(); } //深度优先遍历树 判断是否为其子 public boolean onJudge(ProjGoal record1,ProjGoal record2){ if(record1!=null){ if(record1==record2){ return true; } if(record1.getChildren()!=null){ for (int i = 0; i < record1.getChildren().size(); i++) { if(onJudge(record1.getChildren().get(i),record2)==true){ return true; } } } } return false; } public List<ProjFile> getProjGoalReportList() { return projGoalReportList; } public void setProjGoalReportList(List<ProjFile> projGoalReportList) { this.projGoalReportList = projGoalReportList; } public ProjFile getSelectedItem_goal_report() { return selectedItem_goal_report; } public void setSelectedItem_goal_report(ProjFile selectedItem_goal_report) { this.selectedItem_goal_report = selectedItem_goal_report; } public List<Proj> getProjList() { return projList; } public void setProjList(List<Proj> projList) { this.projList = projList; } public Proj getSelectedItem() { return selectedItem; } public void setSelectedItem(Proj selectedItem) { this.selectedItem = selectedItem; } public ProjGoalTreeModel getTreeModel() { return treeModel; } public void setTreeModel(ProjGoalTreeModel treeModel) { this.treeModel = treeModel; } public ProjGoal getSelectedItem_goal() { return selectedItem_goal; } public void setSelectedItem_goal(ProjGoal selectedItem_goal) { this.selectedItem_goal = selectedItem_goal; } public Set getProjGoalStatusSets() { return projGoalStatusSets; } public void setProjGoalStatusSets(Set projGoalStatusSets) { this.projGoalStatusSets = projGoalStatusSets; } public Set getProjGoalTimeStatusSets() { return projGoalTimeStatusSets; } public void setProjGoalTimeStatusSets(Set projGoalTimeStatusSets) { this.projGoalTimeStatusSets = projGoalTimeStatusSets; } } ProjGoalTreeModel.javajavapackage com.luology.web.manage.proj; import com.luology.dao.proj.model.ProjGoal; import org.zkoss.zul.AbstractTreeModel; import org.zkoss.zul.TreeModel; import org.zkoss.zul.TreeNode; import org.zkoss.zul.event.TreeDataListener; import java.util.ArrayList; import java.util.List; public class ProjGoalTreeModel extends AbstractTreeModel<ProjGoal> { public ProjGoalTreeModel(ProjGoal root) { super(root); } @Override public boolean isLeaf(ProjGoal projGoal) { return projGoal.getChildren()==null; } @Override public ProjGoal getChild(ProjGoal projGoal, int i) { return projGoal.getChildren().get(i); } @Override public int getChildCount(ProjGoal projGoal) { if(projGoal.getChildren()==null){ return 0; } return projGoal.getChildren().size(); } @Override public int getIndexOfChild(ProjGoal parent, ProjGoal child) { String data = child.getProjGoalName(); int i = data.lastIndexOf('.'); return Integer.parseInt(data.substring(i+1)); } @Override public int[] getPath(ProjGoal child) { return super.getPath(child); } } ProjGoal.javajavapackage com.luology.dao.proj.model; import com.luology.common.utility.mybatis.BaseModel; import java.util.Date; import java.util.List; public class ProjGoal extends BaseModel { private Long id; private Integer indexNum; private Long projId; private String projGoalName; private Long parentId; private Date projGoalStartTime; private Date projGoalEndTime; private Integer projGoalStatus; private Long projGoalResponsibleMemberId; private Integer projGoalTimeStatus; private Date operateTime; private Long operateUserId; private Date createTime; private Long createUserId; private Boolean treeNodeStatus; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getIndexNum() { return indexNum; } public void setIndexNum(Integer indexNum) { this.indexNum = indexNum; } public Long getProjId() { return projId; } public void setProjId(Long projId) { this.projId = projId; } public String getProjGoalName() { return projGoalName; } public void setProjGoalName(String projGoalName) { this.projGoalName = projGoalName; } public Long getParentId() { return parentId; } public void setParentId(Long parentId) { this.parentId = parentId; } public Date getProjGoalStartTime() { return projGoalStartTime; } public void setProjGoalStartTime(Date projGoalStartTime) { this.projGoalStartTime = projGoalStartTime; } public Date getProjGoalEndTime() { return projGoalEndTime; } public void setProjGoalEndTime(Date projGoalEndTime) { this.projGoalEndTime = projGoalEndTime; } public Integer getProjGoalStatus() { return projGoalStatus; } public void setProjGoalStatus(Integer projGoalStatus) { this.projGoalStatus = projGoalStatus; } public Long getProjGoalResponsibleMemberId() { return projGoalResponsibleMemberId; } public void setProjGoalResponsibleMemberId(Long projGoalResponsibleMemberId) { this.projGoalResponsibleMemberId = projGoalResponsibleMemberId; } public Integer getProjGoalTimeStatus() { return projGoalTimeStatus; } public void setProjGoalTimeStatus(Integer projGoalTimeStatus) { this.projGoalTimeStatus = projGoalTimeStatus; } public Date getOperateTime() { return operateTime; } public void setOperateTime(Date operateTime) { this.operateTime = operateTime; } public Long getOperateUserId() { return operateUserId; } public void setOperateUserId(Long operateUserId) { this.operateUserId = operateUserId; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Long getCreateUserId() { return createUserId; } public void setCreateUserId(Long createUserId) { this.createUserId = createUserId; } public Boolean getTreeNodeStatus() { return treeNodeStatus; } public void setTreeNodeStatus(Boolean treeNodeStatus) { this.treeNodeStatus = treeNodeStatus; } /**************************************************************/ private String projGoalResponsibleMemberName; private List<ProjGoal> children; //用于展示是否有bom private Boolean projBomStatus; //用于展示是否有文档 private Boolean projDocStatus; //Remark private String remark; //Remark 数目 private Integer projGoalRemarkQuantity; public Boolean getProjBomStatus() { return projBomStatus; } public void setProjBomStatus(Boolean projBomStatus) { this.projBomStatus = projBomStatus; } public String getProjGoalResponsibleMemberName() { return projGoalResponsibleMemberName; } public void setProjGoalResponsibleMemberName(String projGoalResponsibleMemberName) { this.projGoalResponsibleMemberName = projGoalResponsibleMemberName; } public List<ProjGoal> getChildren() { return children; } public void setChildren(List<ProjGoal> children) { this.children = children; } public Boolean getProjDocStatus() { return projDocStatus; } public void setProjDocStatus(Boolean projDocStatus) { this.projDocStatus = projDocStatus; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public Integer getProjGoalRemarkQuantity() { return projGoalRemarkQuantity; } public void setProjGoalRemarkQuantity(Integer projGoalRemarkQuantity) { this.projGoalRemarkQuantity = projGoalRemarkQuantity; } }