private void expandParentNode(gridNotesRow selectedRow) { AreaOfNeedsNotingVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { if(voParentInstance.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) { // If this is the Golden Node then we'll colour it golden. form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } } if (voParentInstance.getNotingDetails() != null) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getNotingDetails()); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(AreaOfNeedsNotingVo voAreaOfNeedsNoting) { if(form.gridNotes().getValue() == null) return; if(voAreaOfNeedsNoting.getNotingDetails() == null) voAreaOfNeedsNoting.setNotingDetails(new AreaOfNeedsNotingDetailVoCollection()); GenForm.gridNotesRow parentRow = form.gridNotes().getValue() instanceof AreaOfNeedsNotingVo ? form.gridNotes().getSelectedRow() : form.gridNotes().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voAreaOfNeedsNoting.getNotingDetails().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voAreaOfNeedsNoting.getNotingDetails().add((AreaOfNeedsNotingDetailVo) parentRow.getRows().get(i).getValue()); } }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.gridNotes().getValue() instanceof AreaOfNeedsNotingVo) form.ctnTherapy().lyrTherapy().showtabHeader(); else if (form.gridNotes().getValue() instanceof AreaOfNeedsNotingVo) form.ctnTherapy().lyrTherapy().showtabHeader(); else if (form.gridNotes().getValue() instanceof AreaOfNeedsNotingDetailVo) form.ctnTherapy().lyrTherapy().showtabDetails(); else form.ctnTherapy().lyrTherapy().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnTherapy().lyrTherapy().showtabHeader(); else form.ctnTherapy().lyrTherapy().showtabDetails(); } }
private void getSelectedInstance() { if(form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } if(form.gridNotes().getValue() instanceof AreaOfNeedsNotingVo) { form.getLocalContext().setSelectedParentInstance((AreaOfNeedsNotingVo) form.gridNotes().getValue()); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); } else if(form.gridNotes().getValue() instanceof AreaOfNeedsNotingDetailVo) { form.getLocalContext().setSelectedChildInstance((AreaOfNeedsNotingDetailVo) form.gridNotes().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(AreaOfNeedsNotingVo voAreaOfNeed) { GenForm.gridNotesRow parRow = form.gridNotes().getRows().newRow(); parRow.setColAreaofNeed(voAreaOfNeed.getClinicalContact().getStartDateTime().toString()+ " - " + voAreaOfNeed.getClinicalContact().getSeenBy().toString()); parRow.setValue(voAreaOfNeed); form.gridNotes().setValue(voAreaOfNeed); form.getLocalContext().setSelectedParentInstance(voAreaOfNeed); expandParentNode(parRow); }
private boolean save() { if(checkForUnsavedChild()) return false; AreaOfNeedsNotingVo voAreaOfNeedsNoting = populateInstanceData(form.getLocalContext().getSelectedParentInstance()); ClinicalNotesVo voClinicalNotes = populateClinicalNote(); if(voClinicalNotes == null) return false; if (voClinicalNotes.getCareContext() == null) voClinicalNotes.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if(voClinicalNotes.getClinicalContact() == null) voClinicalNotes.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voAreaOfNeedsNoting.setClinicalNote(voClinicalNotes); String[] errors = voAreaOfNeedsNoting.validate(); if(errors != null) { engine.showErrors(errors); return false; } try { form.getLocalContext().setSelectedParentInstance(domain.save(voAreaOfNeedsNoting)); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } setUpdatedChild(); return true; }
private void removeChild() { AreaOfNeedsNotingVo voParent = (AreaOfNeedsNotingVo) form.gridNotes().getSelectedRow().getParentRow().getValue(); form.gridNotes().removeSelectedRow(); form.gridNotes().setValue(voParent); updateContextMenusState(); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.gridNotes().getValue() instanceof AreaOfNeedsNotingVo)); if (form.gridNotes().getValue() instanceof AreaOfNeedsNotingDetailVo) { AreaOfNeedsNotingDetailVo voCachedChild = (AreaOfNeedsNotingDetailVo) form.gridNotes().getValue(); if ( voCachedChild.getID_AreaofNeedsNotingDetail() == null) { populateChildInstanceControls(voCachedChild); } } form.setMode(FormMode.EDIT); }
private void newParentInstance() { form.ctnTherapy().lyrTherapy().tabHeader().customControlAuth().initializeComponent(); AreaOfNeedsNotingVo voAreaOfNeeds = new AreaOfNeedsNotingVo(); voAreaOfNeeds.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voAreaOfNeeds.setNotingDetails(new AreaOfNeedsNotingDetailVoCollection()); //populateParentInstanceControls(voAreaOfNeeds); form.getLocalContext().setSelectedParentInstance(voAreaOfNeeds); form.ctnTherapy().setCollapsed(false); enableParentControls(); }
private void populateParentInstanceControls(AreaOfNeedsNotingVo vo) { if(vo != null) { if (vo.getClinicalNoteIsNotNull()) form.ctnTherapy().lyrTherapy().tabHeader().customControlAuth().setValue(vo.getClinicalNote().getAuthoringInfo()); } }
private void updateContextMenusState() { form.getContextMenus().hideAllGenericGridMenuItems(); if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { if(form.getLocalContext().getGoldenInstanceSelected().booleanValue()) { if (form.gridNotes().getValue() instanceof AreaOfNeedsNotingDetailVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Area of Need Detail"); form.getContextMenus().getGenericGridAddItem().setText("Add Area of Need Detail"); form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW)&& form.gridNotes().getSelectedRowIndex()>=0) || (form.getMode().equals(FormMode.EDIT) && form.gridNotes().getValue() instanceof AreaOfNeedsNotingDetailVo && ((AreaOfNeedsNotingDetailVo)form.gridNotes().getValue()).getID_AreaofNeedsNotingDetail() == null)); if (form.gridNotes().getValue() instanceof AreaOfNeedsNotingVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } else { form.getContextMenus().getGenericGridAddItem().setText("New Area of Need"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.gridNotes().getValue() instanceof AreaOfNeedsNotingDetailVo && ((AreaOfNeedsNotingDetailVo)form.gridNotes().getValue()).getID_AreaofNeedsNotingDetail() == null); } }
public AreaOfNeedsNotingVo save(AreaOfNeedsNotingVo voAreaOfNeedsNoting) throws StaleObjectException { if(!voAreaOfNeedsNoting.isValidated()) throw new DomainRuntimeException("This Area Of Needs record has not been validated"); DomainFactory factory = getDomainFactory(); AreaofNeedsNoting doAreaOfNeeds = AreaOfNeedsNotingVoAssembler.extractAreaofNeedsNoting(factory, voAreaOfNeedsNoting); factory.save(doAreaOfNeeds); return AreaOfNeedsNotingVoAssembler.create(doAreaOfNeeds); }