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 void setFormMode(FormMode mode) { form.setMode(mode); setContextMenuItems(mode); if (mode.equals(FormMode.VIEW)) { form.btnUpdate().setVisible(true); form.btnUpdate().setEnabled(form.grdList().getValue() != null); form.treNav().setAllowDragDrop(false); form.grdForms().setEnabled(false); form.grdAssessments().setEnabled(false); } else { form.treNav().setAllowDragDrop(true); form.grdForms().setEnabled(form.treNav().getValue() != null && form.treNav().getValue() instanceof AppNavFormVo); form.grdAssessments().setEnabled(false); } }
protected void onTreNavTreeViewSelectionChanged(ims.framework.controls.TreeNode node) throws ims.framework.exceptions.PresentationLogicException { setFormMode(form.getMode()); Object val = node.getValue(); if (val instanceof AppNavFormVo) { form.grdForms().setEnabled(false); AppNavFormVo navForm = (AppNavFormVo)val; AppFormVo formVo = navForm.getForm(); if (formVo.equals(this.getAssessmentForm()) && form.getMode().equals(FormMode.EDIT)) { form.grdAssessments().setEnabled(true); } } else { if (form.getMode().equals(FormMode.EDIT)) { form.grdForms().setEnabled(true); } } form.getLocalContext().setSelectedTreeValue(node.getValue()); }
private AppNavFormVoCollection copyAppNavFormVoCollection(AppNavFormVoCollection coll) { if (coll == null) return null; AppNavFormVoCollection ret = new AppNavFormVoCollection(); for (int i = 0; i < coll.size(); i++) { AppNavFormVo src = coll.get(i); AppNavFormVo dst = new AppNavFormVo(); dst.setAccessForEpisEnd(src.getAccessForEpisEnd()); dst.setAccessForRip(src.getAccessForRip()); dst.setForm(src.getForm()); dst.setIsReadOnly(src.getIsReadOnly()); dst.setIsRIE(Boolean.FALSE); dst.setNodeText(src.getNodeText()); dst.setPosIndex(src.getPosIndex()); dst.setLinkedClasses(copyGenericVoCollection(src.getLinkedClasses())); 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)); } } }
protected void onGrdAssessmentsSelectionChanged() throws PresentationLogicException { Object val; if (form.treNav().getSelectedNode() != null) { val = form.treNav().getSelectedNode().getValue(); if (val instanceof AppNavFormVo) { AppNavFormVo navForm = (AppNavFormVo)val; GenericIdentifierVoCollection coll = new GenericIdentifierVoCollection(); ValueObjectRef refVo = form.grdAssessments().getValue(); GenericIdentifierVo genVo = new GenericIdentifierVo(); genVo.setInstanceId(refVo.getBoId()); genVo.setClassName(refVo.getClass().getName()); coll.add(genVo); navForm.setLinkedClasses(coll); navForm.setNodeText(form.grdAssessments().getSelectedRow().getAssessmentName()); populateNavigation(form.getLocalContext().getSelectedNav()); } } form.grdAssessments().setEnabled(false); }
@Override protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if(formName.equals(form.getForms().Core.ReportTemplate) && result.equals(DialogResult.OK)) { Object val = form.treNav().getValue(); AppNavFormVo navForm = addAppNavFormVo(getReportViewerForm(), val); if (navForm != null) { GenericIdentifierVoCollection coll = new GenericIdentifierVoCollection(); ValueObjectRef refVo = form.getGlobalContext().Core.getReportTemplateRef(); GenericIdentifierVo genVo = new GenericIdentifierVo(); genVo.setInstanceId(refVo.getBoId()); genVo.setClassName(refVo.getClass().getName()); coll.add(genVo); navForm.setLinkedClasses(coll); navForm.setNodeText(form.getGlobalContext().Core.getTemplate()); populateNavigation(form.getLocalContext().getSelectedNav()); navForm.setNodeText(form.getGlobalContext().Core.getTemplate()); } populateNavigation(form.getLocalContext().getSelectedNav()); } }
private void verifyFormInTree(AppFormVo form, TreeNodeCollection tree, BooleanWraper result) { if (result.isValue() && tree == null) return; for (int i = 0; i < tree.size(); i++) { if (tree.get(i).getValue() instanceof AppNavFormVo) { if (((AppNavFormVo) tree.get(i).getValue()).getForm().getFormId() == form.getFormId()) { result.setValue(true); return; } } else { verifyFormInTree(form, tree.get(i).getNodes(), result); } } }
private void verifyFormNameInTree(String name, TreeNodeCollection tree, BooleanWraper result) { if (result.isValue() && tree == null) return; for (int i = 0; i < tree.size(); i++) { if (tree.get(i).getValue() instanceof AppNavFormVo) { if (((AppNavFormVo) tree.get(i).getValue()).getForm().getName().toLowerCase().equals(name.toLowerCase())) { result.setValue(true); return; } } else { verifyFormNameInTree(name, tree.get(i).getNodes(), result); } } }
private AppNavFormVo createFormForAssessment(ValueObjectRef refVo, AppFormVo assesmentForm) { AppNavFormVo newForm = new AppNavFormVo(); newForm.setForm(assesmentForm); GenericIdentifierVoCollection coll = new GenericIdentifierVoCollection(); GenericIdentifierVo genVo = new GenericIdentifierVo(); genVo.setInstanceId(refVo.getBoId()); genVo.setClassName(refVo.getClass().getName()); coll.add(genVo); newForm.setLinkedClasses(coll); newForm.setAccessForEpisEnd(FormReadWrite.WRITE); newForm.setAccessForRip(FormReadWrite.WRITE); newForm.setIsReadOnly(false); newForm.setNodeText((refVo instanceof GraphicAssessmentShortVo) ? ((GraphicAssessmentShortVo) refVo).getName() : (refVo instanceof UserAssessmentLiteVo) ? ((UserAssessmentLiteVo) refVo).getName() : null); return newForm; }
private AppNavFormVo createFormForReport(ReportTemplateLiteVo rep, AppFormVo reportForm) { AppNavFormVo newForm = new AppNavFormVo(); newForm.setForm(reportForm); newForm.setLinkedClasses(null); GenericIdentifierVoCollection coll = new GenericIdentifierVoCollection(); GenericIdentifierVo genVo = new GenericIdentifierVo(); genVo.setInstanceId(rep.getBoId()); genVo.setClassName(rep.getClass().getName()); coll.add(genVo); newForm.setLinkedClasses(coll); newForm.setNodeText(rep.getName()); newForm.setAccessForEpisEnd(FormReadWrite.WRITE); newForm.setAccessForRip(FormReadWrite.WRITE); newForm.setIsReadOnly(false); return newForm; }