private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdActivity().getValue() instanceof RemedialShortVo) form.ctnRemedial().lyrRemedial().showtabHeader(); else if(form.grdActivity().getValue() instanceof RemedialVo) form.ctnRemedial().lyrRemedial().showtabHeader(); else if (form.grdActivity().getValue() instanceof RemedialActivityVo) form.ctnRemedial().lyrRemedial().showtabDetails(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnRemedial().lyrRemedial().showtabHeader(); else form.ctnRemedial().lyrRemedial().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_RemedialIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record } }
private boolean newParentNode(RemedialVo voNewParent) { if (voNewParent == null) return true; if(form.ctnRemedial().lyrRemedial().tabHeader().qmbAuthoringHCP().getValue()==null || form.ctnRemedial().lyrRemedial().tabHeader().dtimAuthoring().getValue()==null) { return false; } RemedialShortVo voParentShort = new RemedialShortVo(); voParentShort.setAuthoringCP(form.ctnRemedial().lyrRemedial().tabHeader().qmbAuthoringHCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnRemedial().lyrRemedial().tabHeader().dtimAuthoring().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdActivityRow parentRow = form.grdActivity().getRows().newRow(); parentRow.setColActivity(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdActivity().setValue(voParentShort); return true; }
private void populateChildCollectionFromGrid(RemedialVo voRemedial) { if (form.grdActivity().getValue() == null) return; if (voRemedial.getRemedialActivity() == null) voRemedial.setRemedialActivity(new RemedialActivityVoCollection()); GenForm.grdActivityRow parentRow = form.grdActivity().getValue() instanceof RemedialShortVo || form.grdActivity().getValue() instanceof RemedialVo ? form.grdActivity().getSelectedRow() : form.grdActivity().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voRemedial.getRemedialActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voRemedial.getRemedialActivity().add((RemedialActivityVo) parentRow.getRows().get(i).getValue()); } }
private void getSelectedInstance() { if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } //expand the selected parent if(form.grdActivity().getValue() instanceof RemedialVo) { populateParentInstanceControls((RemedialVo) form.grdActivity().getValue()); } else if(form.grdActivity().getValue() instanceof RemedialShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((RemedialShortVo)form.grdActivity().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdActivity().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getRemedialActivity()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdActivity().getValue() instanceof RemedialActivityVo) { GenForm.grdActivityRow parentRow = form.grdActivity().getSelectedRow().getParentRow(); populateParentInstanceControls((RemedialVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((RemedialVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((RemedialActivityVo) form.grdActivity().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))); updateControlsState(); }
private void populateParentNode(RemedialShortVo voRemedial) { GenForm.grdActivityRow parRow = form.grdActivity().getRows().newRow(); parRow.setColActivity(voRemedial.getAuthoringDateTime().toString()+ " - " + voRemedial.getAuthoringCP().toString()); parRow.setValue(voRemedial); if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && voRemedial.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) { form.grdActivity().setValue(voRemedial); expandParentNode(parRow); } }
private void expandParentNode(grdActivityRow selectedRow) { if (selectedRow.getValue() instanceof RemedialShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((RemedialShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; //RemedialVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); //WDEV-15078 RemedialVo voParentInstance = domain.getRemedial((RemedialShortVo)selectedRow.getValue()); if(voParentInstance.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) { // If this is the Golden Node then we'll colour it golden (ok then beige). form.getLocalContext().setGoldenInstanceFound(new Boolean(true)); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getRemedialActivity() != null) { selectedRow.setValue(voParentInstance); selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getRemedialActivity()); } populateParentInstanceControls(voParentInstance); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdActivity().getValue() instanceof RemedialShortVo)); form.setMode(FormMode.EDIT); if (form.grdActivity().getValue() instanceof RemedialActivityVo) { RemedialActivityVo voCachedChild = (RemedialActivityVo) form.grdActivity().getValue(); if ( voCachedChild.getID_RemedialActivity() == null) { populateChildInstanceControls(voCachedChild); } } }
private RemedialVo getParentFromDomain(RemedialShortVo voRemedialShort) { return domain.getRemedialVoByClinicalContact(voRemedialShort.getClinicalContact()); }
private void updateContextMenusState() { if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { if(form.getLocalContext().getGoldenInstanceSelected().booleanValue()) { if (form.grdActivity().getValue() instanceof RemedialShortVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); else if (form.grdActivity().getValue() instanceof RemedialActivityVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Remedial Detail"); form.getContextMenus().getGenericGridAddItem().setText("Add Remedial Detail"); form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW)&& form.grdActivity().getSelectedRowIndex()>=0 && form.grdActivity().getValue() instanceof RemedialActivityVo) || (form.getMode().equals(FormMode.EDIT) && form.grdActivity().getValue() instanceof RemedialActivityVo && ((RemedialActivityVo)form.grdActivity().getValue()).getID_RemedialActivity() == null)); } else { // If the golden instance has been found but NOT selected hide the context menu's if (form.getLocalContext().getGoldenInstanceFound().booleanValue() == true) { form.getContextMenus().hideAllGenericGridMenuItems(); return; } else { form.getContextMenus().getGenericGridAddItem().setText("New Remedial Therapy"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getHcpGridADDItem().setVisible(form.getMode().equals(FormMode.EDIT)); form.getContextMenus().getHcpGridREMOVEItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.ctnRemedial().lyrRemedial().tabDetails().grdMaterial().getSelectedRowIndex() >=0); form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.grdActivity().getValue() instanceof RemedialActivityVo && ((RemedialActivityVo)form.grdActivity().getValue()).getID_RemedialActivity() == null); } else { form.getContextMenus().hideAllGenericGridMenuItems(); } }