private AppNavRootGroupVoCollection copyRootGroupColl(AppNavRootGroupVoCollection coll) { if (coll == null) return null; AppNavRootGroupVoCollection ret = new AppNavRootGroupVoCollection(); for (int i = 0; i < coll.size(); i++) { AppNavRootGroupVo src = coll.get(i); AppNavRootGroupVo dst = new AppNavRootGroupVo(); dst.setGroupName(src.getGroupName()); dst.setIsRIE(Boolean.FALSE); dst.setForms(copyAppNavFormVoCollection(src.getForms())); dst.setGroups(copyAppNavSecGrpVoCollection(src.getGroups())); ret.add(dst); } return ret; }
private void setPosIndexes(TreeNode rootNode) { Object val = rootNode.getValue(); if (!(val instanceof AppNavRootGroupVo)) return; for (int i = 0; i < rootNode.getNodes().size(); i++) { val = rootNode.getNodes().get(i).getValue(); if (val instanceof AppNavSecondGroupVo) { AppNavSecondGroupVo secGrp = (AppNavSecondGroupVo)val; secGrp.setPosIndex(new Integer(i)); } else if (val instanceof AppNavFormVo) { AppNavFormVo navForm = (AppNavFormVo)val; navForm.setPosIndex(new Integer(i)); } } }
private void addNewRootGroup() { String rootText = "New Top Group " + (form.treNav().getNodes().size() + 1); form.chkShowImages().setValue(Boolean.TRUE); AppNavRootGroupVo rootGrp = new AppNavRootGroupVo(); rootGrp.setGroupName(rootText); rootGrp.setGroups(new AppNavSecondGroupVoCollection()); rootGrp.setForms(new AppNavFormVoCollection()); form.getGlobalContext().Admin.setNavigationEditedGroup(rootGrp); engine.open(form.getForms().Admin.NavigationImageSelectDialog); }
protected TreeNode getNodeToAddTo() { TreeNode toNode = form.treNav().getSelectedNode(); if (toNode == null || toNode.getValue() == null) return null; if (toNode.getValue() instanceof AppNavRootGroupVo) return toNode; if (toNode.getValue() instanceof AppNavSecondGroupVo) return toNode; if (toNode.getValue() instanceof AppNavFormVo) return toNode.getParent(); return null; }
private AppNavRootGroupVo getClone(AppNavRootGroupVo appNavRootGroupVo) { if (appNavRootGroupVo == null) return null; AppNavRootGroupVo result = (AppNavRootGroupVo) appNavRootGroupVo.clone(); result.clearIDAndVersion(); AppNavSecondGroupVoCollection secondGroupVoCollection = appNavRootGroupVo.getGroups(); if (secondGroupVoCollection != null) { result.setGroups(new AppNavSecondGroupVoCollection()); for (int i = 0; i < secondGroupVoCollection.size(); i++) { result.getGroups().add(getClone(secondGroupVoCollection.get(i))); } } AppNavFormVoCollection appNavFormVoCollection = appNavRootGroupVo.getForms(); if (appNavFormVoCollection != null) { result.setForms(new AppNavFormVoCollection()); for (int i = 0; i < appNavFormVoCollection.size(); i++) { result.getForms().add(getClone(appNavFormVoCollection.get(i))); } } return result; }
private void addNewRootGroup()//WDEV-19366 { String rootText = "New Top Group " + (form.treNav().getNodes().size() + 1); AppNavRootGroupVo rootGrp = new AppNavRootGroupVo(); rootGrp.setGroupName(rootText); rootGrp.setGroups(new AppNavSecondGroupVoCollection()); rootGrp.setForms(new AppNavFormVoCollection()); form.getGlobalContext().Admin.setNavigationEditedGroup(rootGrp); engine.open(form.getForms().Admin.NavigationImageSelectDialog); }
@SuppressWarnings("unchecked") private void populateNavigation(AppNavigationVo nav) { form.treNavView().clear(); if (nav == null) return; for (int i = 0; i < nav.getRootGroups().size(); i++) { AppNavRootGroupVo rg = nav.getRootGroups().get(i); TreeNode rootNode = form.treNavView().getNodes().add(rg, rg.getGroupName()); rootNode.setExpandedImage(form.getImages().Core.CareContext); rootNode.setCollapsedImage(form.getImages().Core.CareContext); rootNode.setSelectedImage(form.getImages().Core.CareContext); ArrayList<Object> children = new ArrayList<Object>(); for (int j = 0; rg.getGroups() != null && j < rg.getGroups().size(); j++) { children.add(rg.getGroups().get(j)); } for (int k = 0; rg.getForms() != null && k < rg.getForms().size(); k++) { children.add(rg.getForms().get(k)); } Collections.sort(children, new NavComparator()); for (int m = 0; m < children.size(); m++) { Object child = children.get(m); if (child instanceof AppNavSecondGroupVo) { addSecondGroup(rootNode, (AppNavSecondGroupVo)child, nav); } else { addNavForm(rootNode, (AppNavFormVo)child, nav); } } } form.treNavView().expandAll(); }
private AppNavFormVo addAppNavFormVo(AppFormVo formVo, Object parentObject) { if (formVo == null) return null; AppNavFormVo navForm = new AppNavFormVo(); navForm.setForm(formVo); navForm.setAccessForEpisEnd(FormReadWrite.WRITE); navForm.setAccessForRip(FormReadWrite.WRITE); navForm.setIsReadOnly(Boolean.FALSE); if(form.treNav().getSelectedNode()!= null && form.treNav().getSelectedNode().getNodes()!= null) { navForm.setPosIndex(new Integer(form.treNav().getSelectedNode().getNodes().size())); } else engine.showMessage("Please select a node to add your selected form to"); if (formVo.isAlias()) navForm.setNodeText(formVo.getAliasName()); else navForm.setNodeText(formVo.getName()); if (parentObject instanceof AppNavRootGroupVo) { AppNavRootGroupVo rootGrp = (AppNavRootGroupVo)parentObject; if (rootGrp.getForms() == null) rootGrp.setForms(new AppNavFormVoCollection()); rootGrp.getForms().add(navForm); } else if (parentObject instanceof AppNavSecondGroupVo) { AppNavSecondGroupVo secGrp = (AppNavSecondGroupVo)parentObject; if (secGrp.getForms() == null) secGrp.setForms(new AppNavFormVoCollection()); secGrp.getForms().add(navForm); } return navForm; }