private void initialize(ReportTemplateBoRefVoCollection coll) { form.treBOList().getNodes().clear(); String[] boList = domain.listDomainObjectClasses(); java.util.Arrays.sort(boList); for (int i = 0; i < boList.length; i++) { addBusinessObjectToTree(boList[i], boList[i], null, coll); } for (int i = 0; i < form.treBOList().getNodes().size(); i++) { form.treBOList().getNodes().get(i).setExpanded(true); } form.getLocalContext().setListBO(boList); }
private void open() { ReportTemplateBoRefVoCollection coll = domain.listAssignedTemplates(); initialize(coll); form.setMode(FormMode.VIEW); form.treBOList().setValue(form.getLocalContext().getLastNode()); updateContextMenuStatus(); }
private void addBusinessObjectToTree(String fullBoName, String partialBoName, TreeNode parent, ReportTemplateBoRefVoCollection coll) { TreeNode node = null; String firstNode; String lastNodes; int nPos; if ((nPos = partialBoName.indexOf(".")) < 0) { //leaf if(parent == null) { node = form.treBOList().getNodes().add(fullBoName, partialBoName); } else { node = parent.getNodes().add(fullBoName, partialBoName); } node.setExpandedImage(form.getImages().Core.Object); node.setCollapsedImage(form.getImages().Core.Object); for (int i = 0; i < coll.size(); i++) { if(node.getValue() instanceof String && ((String)node.getValue()).equalsIgnoreCase(coll.get(i).getBusinessObj())) { TreeNode child = node.getNodes().add(coll.get(i), coll.get(i).getTemplate().getName()); child.setExpandedImage(form.getImages().Core.Memo); child.setCollapsedImage(form.getImages().Core.Memo); node.setExpanded(true); node.setTextColor(Color.Blue); break; } } } else { //node firstNode = partialBoName.substring(0, nPos); lastNodes = partialBoName.substring(nPos + 1, partialBoName.length()); TreeNode p = getNodeByText(parent, firstNode); if(p == null) { if(parent == null) { node = form.treBOList().getNodes().add("", firstNode); } else { node = parent.getNodes().add("", firstNode); } node.setExpandedImage(form.getImages().Core.ExpandAll); node.setCollapsedImage(form.getImages().Core.ExpandAll); addBusinessObjectToTree(fullBoName, lastNodes, node, coll); } else { addBusinessObjectToTree(fullBoName, lastNodes, p, coll); } } }
public ReportTemplateBoRefVoCollection listAssignedTemplates() { return ReportTemplateBoRefVoAssembler.createReportTemplateBoRefVoCollectionFromReportTemplateBoRef( getDomainFactory().find("from ReportTemplateBoRef")); }