private void removeUnsavedNodes() { for (int i=0; i < form.grdHierarchy().getRows().size(); i++) { ValueObject vo = form.grdHierarchy().getRows().get(i).getValue(); if ( vo instanceof ClinicalTeamVo) { ClinicalTeamVo voClinicalTeam = (ClinicalTeamVo) vo; if (voClinicalTeam.getID_ClinicalTeam() == null) form.grdHierarchy().getRows().remove(i); } } }
private boolean inTeam(HcpLiteVo voHcp) { if (form.getLocalContext().getSelectedParentInstance() == null) return false; ClinicalTeamVo voClinicalTeam = form.getLocalContext().getSelectedParentInstance(); boolean boolReturn = false; if (voHcp.equals(getTeamLead(voClinicalTeam))) boolReturn = true; else { for (int i=0; i < voClinicalTeam.getTeamMembers().size(); i++) { if (voClinicalTeam.getTeamMembers().get(i).getHCP().equals(voHcp)) { boolReturn = true; break; } } } return boolReturn; }
private void newParentInstance() { //form.getLocalContext().setUpdatingParent(new Boolean(true)); ClinicalTeamVo voNewParent = new ClinicalTeamVo(); voNewParent.setTeamMembers(new ClinicalTeamMemberVoCollection()); form.getLocalContext().setSelectedParentInstance(voNewParent); newParentNode(voNewParent); clearParentInstanceControls(); // Box the selected node offside if (form.grdHierarchy().getValue() instanceof ClinicalTeamVo ) form.getLocalContext().setUpdatedParent((ClinicalTeamVo) form.grdHierarchy().getValue()); else if (form.grdHierarchy().getValue() instanceof ClinicalTeamMemberVo ) form.getLocalContext().setUpdatedChild((ClinicalTeamMemberVo) form.grdHierarchy().getValue()); form.getLocalContext().setSelectedChildInstance(new ClinicalTeamMemberVo()); form.ctnDetails().setCollapsed(false); form.setMode(FormMode.EDIT); }
private void populateChildCollectionFromGrid(ClinicalTeamVo voClinicalTeam) { if (form.grdHierarchy().getValue() == null) return; if (voClinicalTeam.getTeamMembers() == null) voClinicalTeam.setTeamMembers(new ClinicalTeamMemberVoCollection()); GenForm.grdHierarchyRow parentRow = form.grdHierarchy().getValue() instanceof ClinicalTeamVo ? form.grdHierarchy().getSelectedRow() : form.grdHierarchy().getSelectedRow().getParentRow(); if (parentRow.getRows().size() >= 0 ) voClinicalTeam.getTeamMembers().clear(); for (int i=0; i < parentRow.getRows().size(); i++) voClinicalTeam.getTeamMembers().add((ClinicalTeamMemberVo) parentRow.getRows().get(i).getValue()); }
HcpLiteVo getTeamLead(ClinicalTeamVo voClinicalTeam) { HcpLiteVo voHcpLite = null; if (voClinicalTeam != null && voClinicalTeam.getLeadHCP() != null) voHcpLite = voClinicalTeam.getLeadHCP(); return voHcpLite; }
private void selectionChanged() { // In update mode we can select nodes without displaying anything but the context // menus can change based on what's selected so we need to update them if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } //expand the selected parent if(form.grdHierarchy().getValue() instanceof ClinicalTeamVo) { form.getLocalContext().setSelectedParentInstance((ClinicalTeamVo) form.grdHierarchy().getValue()); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(true); } else if(form.grdHierarchy().getValue() instanceof ClinicalTeamMemberVo) { form.getLocalContext().setSelectedChildInstance((ClinicalTeamMemberVo) form.grdHierarchy().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); form.getLocalContext().setSelectedParentInstance((ClinicalTeamVo) form.grdHierarchy().getSelectedRow().getParentRow().getValue()); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); } updateControlsState(); }
private void removeChild() { form.getLocalContext().setUpdatingParent(new Boolean(false)); ClinicalTeamVo voParent = (ClinicalTeamVo) form.grdHierarchy().getSelectedRow().getParentRow().getValue(); form.grdHierarchy().removeSelectedRow(); form.getLocalContext().setSelectedChildInstance(null); form.grdHierarchy().setValue(voParent); form.setMode(FormMode.EDIT); updateContextMenusState(); }
private void newParentNode(ClinicalTeamVo voClinicalTeam) { GenForm.grdHierarchyRow parRow = form.grdHierarchy().getRows().newRow(); parRow.setcolTeam(voClinicalTeam.getTeamName()); parRow.setValue(voClinicalTeam); parRow.setExpandedImage(form.getImages().Admin.ClinicalTeam); parRow.setCollapsedImage(form.getImages().Admin.ClinicalTeam); form.grdHierarchy().setValue(voClinicalTeam); form.getLocalContext().setSelectedParentInstance(voClinicalTeam); populateChildNodes(voClinicalTeam, parRow); }
private void populateChildNodes(ClinicalTeamVo voClinicalTeam, grdHierarchyRow parRow) { if (voClinicalTeam == null || parRow == null || voClinicalTeam.getTeamMembers() == null) return; if (voClinicalTeam.getTeamMembers().size() > 0) parRow.setExpanded(true); voClinicalTeam.getTeamMembers().sort(); for (int i=0; i < voClinicalTeam.getTeamMembers().size(); i++) { GenForm.grdHierarchyRow childRow = parRow.getRows().newRow(); populateChildNode(childRow, voClinicalTeam.getTeamMembers().get(i)); } }
private void populateParentInstanceControls(ClinicalTeamVo voClinicalTeam) { form.ctnDetails().lyrDetails().tabDetailsTeam().txtTeamName().setValue(voClinicalTeam.getTeamName()); form.ctnDetails().lyrDetails().tabDetailsTeam().cmbTeamType().setValue(voClinicalTeam.getTeamType()); if (voClinicalTeam.getLeadHCP() != null) { form.ctnDetails().lyrDetails().tabDetailsTeam().qmbTeamLead().newRow(voClinicalTeam.getLeadHCP(), voClinicalTeam.getLeadHCP().getMos().getName().toShortForm()); form.ctnDetails().lyrDetails().tabDetailsTeam().qmbTeamLead().setValue(voClinicalTeam.getLeadHCP()); } form.ctnDetails().lyrDetails().tabDetailsTeam().chkTeamIsActive().setValue(voClinicalTeam.getIsActive().booleanValue()); }
private void populateParentInstanceData(ClinicalTeamVo voClinicalTeam) { voClinicalTeam.setTeamName(form.ctnDetails().lyrDetails().tabDetailsTeam().txtTeamName().getValue()); voClinicalTeam.setTeamType(form.ctnDetails().lyrDetails().tabDetailsTeam().cmbTeamType().getValue()); voClinicalTeam.setLeadHCP(form.ctnDetails().lyrDetails().tabDetailsTeam().qmbTeamLead().getValue()); voClinicalTeam.setIsActive(new Boolean(form.ctnDetails().lyrDetails().tabDetailsTeam().chkTeamIsActive().getValue())); }
private void setUpdatedItem() { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) { if (form.getLocalContext().getSelectedParentInstance() != null && form.getLocalContext().getSelectedParentInstance().getID_ClinicalTeam() != null) { form.getLocalContext().setUpdatedParent(form.getLocalContext().getSelectedParentInstance()); return; } } if (form.grdHierarchy().getValue() instanceof ClinicalTeamVo) { form.getLocalContext().setUpdatedParent((ClinicalTeamVo) form.grdHierarchy().getValue()); } else if (form.grdHierarchy().getValue() instanceof ClinicalTeamMemberVo) { form.getLocalContext().setUpdatedChild((ClinicalTeamMemberVo) form.grdHierarchy().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { if (form.getLocalContext().getSelectedParentInstance() != null && form.getLocalContext().getSelectedParentInstance().getTeamMembers() != null && form.getLocalContext().getSelectedParentInstance().getTeamMembers().size() > 0) { form.getLocalContext().getSelectedParentInstance().getTeamMembers().sort(); form.getLocalContext().setUpdatedChild(form.getLocalContext().getSelectedParentInstance().getTeamMembers().get( form.getLocalContext().getSelectedParentInstance().getTeamMembers().size() - 1)); } } } }
private void chooseTab() { if (form.getMode().equals(FormMode.VIEW)) { if (form.getLocalContext().getSelectedParentInstance() == null) form.ctnDetails().lyrDetails().showtabNoDetailSelected(); // In view mode just show the selected node if (form.grdHierarchy().getValue() instanceof ClinicalTeamVo) form.ctnDetails().lyrDetails().showtabDetailsTeam(); else if (form.grdHierarchy().getValue() instanceof ClinicalTeamMemberVo) form.ctnDetails().lyrDetails().showtabMemberDisplay(); } else { boolean bNewParent = form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getSelectedParentInstance().getID_ClinicalTeam() == null; if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE) || bNewParent) form.ctnDetails().lyrDetails().showtabDetailsTeam(); else { if (form.getLocalContext().getSelectedChildInstance() == null || form.getLocalContext().getSelectedChildInstance().getID_ClinicalTeamMember() == null) form.ctnDetails().lyrDetails().showtabDetailsMembers(); else form.ctnDetails().lyrDetails().showtabMemberDisplay(); } } }
private void populateScreen(ClinicalTeamVoCollection collClinicalTeamVo) { form.cmbTeamLead().newRow(form.getLocalContext().getIHcp(), form.getLocalContext().getIHcp().toString()); form.cmbTeamLead().setValue(form.getLocalContext().getIHcp()); ClinicalTeamMemberVoCollection voTeamMemberColl = new ClinicalTeamMemberVoCollection(); if (collClinicalTeamVo != null) { form.grdTeamMember().getRows().clear(); GenForm.grdTeamMemberRow tempRow; for (int i=0; i < collClinicalTeamVo.size(); i++) { ClinicalTeamVo voClinicalTeam = collClinicalTeamVo.get(i); voTeamMemberColl = voClinicalTeam.getTeamMembers(); for (int x=0; x < voTeamMemberColl.size(); x++) { ClinicalTeamMemberVo voTeamMember = voTeamMemberColl.get(x); tempRow = form.grdTeamMember().getRows().newRow(); tempRow.setValue(voTeamMember); if(voTeamMember.getHCPIsNotNull()) tempRow.setcolTeamMember(voTeamMember.getHCP().toString()); } } } }