public int compare(Object obj1, Object obj2) { int int1 = 0; int int2 = 0; if (obj1 instanceof AppNavSecondGroupVo) int1 = ((AppNavSecondGroupVo)obj1).getPositionIndex(); else if (obj1 instanceof AppNavFormVo) int1 = ((AppNavFormVo)obj1).getPositionIndex(); if (obj2 instanceof AppNavSecondGroupVo) int2 = ((AppNavSecondGroupVo)obj2).getPositionIndex(); else if (obj2 instanceof AppNavFormVo) int2 = ((AppNavFormVo)obj2).getPositionIndex(); if (int1 < int2) return -1; else if (int1 == int2) return 0; else return 1; }
private AppNavSecondGroupVoCollection copyAppNavSecGrpVoCollection(AppNavSecondGroupVoCollection coll) { if (coll == null) return null; AppNavSecondGroupVoCollection ret = new AppNavSecondGroupVoCollection(); for (int i = 0; i < coll.size(); i++) { AppNavSecondGroupVo src = coll.get(i); AppNavSecondGroupVo dst = new AppNavSecondGroupVo(); dst.setIsRIE(Boolean.FALSE); dst.setGroupName(src.getGroupName()); dst.setPosIndex(src.getPosIndex()); dst.setForms(copyAppNavFormVoCollection(src.getForms())); 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 AppNavSecondGroupVo getClone(AppNavSecondGroupVo appGroupVo) { if (appGroupVo == null) return null; AppNavSecondGroupVo result = (AppNavSecondGroupVo) appGroupVo.clone(); result.clearIDAndVersion(); AppNavFormVoCollection forms = appGroupVo.getForms(); if (forms != null) { result.setForms(new AppNavFormVoCollection()); for (int i = 0; i < forms.size(); i++) { result.getForms().add(getClone(forms.get(i))); } } return result; }
private void addSecondGroup(TreeNode rootNode, AppNavSecondGroupVo sg, AppNavigationVo nav) { TreeNode secNode = rootNode.getNodes().add(sg, sg.getGroupName()); secNode.setExpandedImage(form.getImages().Core.CareSpell); secNode.setCollapsedImage(form.getImages().Core.CareSpell); secNode.setSelectedImage(form.getImages().Core.CareSpell); for (int k = 0; k < sg.getForms().size(); k++) { addNavForm(secNode, sg.getForms().get(k), nav); } }
private AppNavSecondGroupVo getSecGrpClone(AppNavSecondGroupVo secGrp) { AppNavSecondGroupVo ret = new AppNavSecondGroupVo(); ret.setForms(new AppNavFormVoCollection()); for (int i = 0; i < secGrp.getForms().size(); i++) { ret.getForms().add(this.getNavFormClone(secGrp.getForms().get(i))); } ret.setGroupName(secGrp.getGroupName()); ret.setPosIndex(secGrp.getPosIndex()); return ret; }
private void addSecondGroup(TreeNode rootNode, AppNavSecondGroupVo sg, AppNavigationVo nav) { TreeNode secNode = rootNode.getNodes().add(sg, sg.getGroupName(), SEC_NODE, new int[]{ROOT_NODE}, true); secNode.setExpandedImage(form.getImages().Core.CareSpell); secNode.setCollapsedImage(form.getImages().Core.CareSpell); secNode.setSelectedImage(form.getImages().Core.CareSpell); for (int k = 0; sg.getForms() != null && k < sg.getForms().size(); k++) { addNavForm(secNode, sg.getForms().get(k), nav); } }
private void addNewSecondGroup() { TreeNode rootNode = form.treNav().getSelectedNode(); form.chkShowImages().setValue(Boolean.TRUE); String secText = "New Second Group " + String.valueOf(rootNode.getNodes().size() + 1); AppNavSecondGroupVo secGrp = new AppNavSecondGroupVo(); secGrp.setTextNode(secText); secGrp.setForms(new AppNavFormVoCollection()); secGrp.setPosIndex(new Integer(form.treNav().getSelectedNode().getNodes().size())); form.getGlobalContext().Admin.setNavigationEditedGroup(secGrp); 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; }
public int compare(Object o1, Object o2) { if (o1 == null || o2 == null) return 1; int indexO1 = 0; int indexO2 = 0; if (o1 instanceof AppNavSecondGroupVo) { indexO1 = ((AppNavSecondGroupVo) o1).getPosIndexIsNotNull() ? ((AppNavSecondGroupVo) o1).getPosIndex() : 0; } else { if (o1 instanceof AppNavFormVo) { indexO1 = ((AppNavFormVo) o1).getPosIndexIsNotNull() ? ((AppNavFormVo) o1).getPosIndex() : 0; } else { return 0; } } if (o2 instanceof AppNavSecondGroupVo) { indexO2 = ((AppNavSecondGroupVo) o2).getPosIndexIsNotNull() ? ((AppNavSecondGroupVo) o2).getPosIndex() : 0; } else { if (o2 instanceof AppNavFormVo) { indexO2 = ((AppNavFormVo) o2).getPosIndexIsNotNull() ? ((AppNavFormVo) o2).getPosIndex() : 0; } else { return 0; } } return indexO1 - indexO2; }
private void addNewSecondGroup()//WDEV-19366 { TreeNode rootNode = form.treNav().getSelectedNode(); String secText = "New Second Group " + String.valueOf(rootNode.getNodes().size() + 1); AppNavSecondGroupVo secGrp = new AppNavSecondGroupVo(); secGrp.setTextNode(secText); secGrp.setForms(new AppNavFormVoCollection()); secGrp.setPosIndex(new Integer(form.treNav().getSelectedNode().getNodes().size())); form.getGlobalContext().Admin.setNavigationEditedGroup(secGrp); engine.open(form.getForms().Admin.NavigationImageSelectDialog); }