public void newInstance() throws PresentationLogicException { if (allowNew()) { // initalise the screen for a new record form.getLocalContext().setSelectedRecord(new FamilyHistoryVo()); clearInstanceControls(); form.ctnFamilyHistory().setCollapsed(false); //set the form mode form.setMode(FormMode.EDIT); // Enable Diagnosis and Relationship form.ctnFamilyHistory().cbRelationship().setEnabled(true); //set any control status specific this form form.ctnFamilyHistory().customControlAuthoringInfo().initializeComponent(); form.ctnFamilyHistory().setcustomControlAuthoringInfoEnabled(true); } }
/** * gather screen data into local context vo and save updating the local context vo * returns true for successful save * @return boolean * @throws PresentationLogicException */ public boolean save() throws PresentationLogicException { FamilyHistoryVo voFamHist = populateInstanceData(); //set clinical contact if (!voFamHist.getClinicalContactIsNotNull()) voFamHist.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); //validate Vo String[] arrErrors = voFamHist.validate(validateUIRules()); if(arrErrors != null) { engine.showErrors(arrErrors); return false; } try { form.getLocalContext().setSelectedRecord(domain.save(voFamHist)); } catch(StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } return true; }
/** * called to populate the screen with List and Instance Data in the occurance of opening a form,canceling a new or update and staleobject exception. * @return void */ public void open() throws PresentationLogicException { if (form.getGlobalContext().Core.getPatientShortIsNotNull()) populateListControl(domain.list(null, form.getGlobalContext().Core.getPatientShort())); //set selection back if (form.getLocalContext().getSelectedRecordIsNotNull()) { // Select row kept in local context form.grdList().setValue(form.getLocalContext().getSelectedRecord()); // Update local context form.getLocalContext().setSelectedRecord((FamilyHistoryVo) form.grdList().getValue()); //need to get timestamp from record retrieved from List call. GenForm.grdListRow row = form.grdList().getRowByValue(form.getLocalContext().getSelectedRecord()); if (row != null && row.getValue() != null && row.getValue() instanceof FamilyHistoryVo) { form.getLocalContext().setSelectedRecord((FamilyHistoryVo)row.getValue()); form.grdList().setValue(form.getLocalContext().getSelectedRecord()); populateInstanceControl(form.grdList().getValue()); } else clearInstanceControls(); updateControlsState(); } else form.ctnFamilyHistory().setCollapsed(true); preSelectSavedFamilyHistory(); //WDEV-15463 if(form.grdList().getValue() != null) form.ctnFamilyHistory().setCollapsed(false); else form.ctnFamilyHistory().setCollapsed(true); form.setMode(FormMode.VIEW); }
private void selectionChanged() { //Display Panel and detail form.getLocalContext().setSelectedRecord((FamilyHistoryVo)form.grdList().getValue()); populateInstanceControl(form.grdList().getValue()); updateControlsState(); }
/** * displays the Family History record specified by FamilyHistoryVo * @param voFamHist */ private void populateInstanceControl(ims.vo.ValueObject refVo) { clearInstanceControls(); if (refVo != null) { FamilyHistoryVo voFamHist = (FamilyHistoryVo)refVo; form.ctnFamilyHistory().txtRelativeName().setValue(voFamHist.getRelativeName()); if (voFamHist.getRelationshipIsNotNull()) form.ctnFamilyHistory().cbRelationship().setValue(voFamHist.getRelationship()); form.ctnFamilyHistory().customControlCodingItem().setValue(voFamHist); if(voFamHist.getAuthoringInformationIsNotNull()) form.ctnFamilyHistory().customControlAuthoringInfo().setValue(voFamHist.getAuthoringInformation()); if (voFamHist.getRelativeDOBIsNotNull()) form.ctnFamilyHistory().dateDOB().setValue(voFamHist.getRelativeDOB().toDate()); else form.ctnFamilyHistory().dateDOB().setValue(null); if (voFamHist.getAgeAtOnsetIsNotNull()) form.ctnFamilyHistory().intAgeOnset().setValue(voFamHist.getAgeAtOnset()); else form.ctnFamilyHistory().intAgeOnset().setValue(null); if (voFamHist.getRelativeLivingIsNotNull()) { form.ctnFamilyHistory().cbLiving().setValue(voFamHist.getRelativeLiving()); if((form.ctnFamilyHistory().cbLiving().getValue() != null) && (form.ctnFamilyHistory().cbLiving().getValue().equals(YesNoUnknown.NO))) //wdev-13396) { form.ctnFamilyHistory().intAgeDeath().setRequired(true); //wdev-13396 } else { form.ctnFamilyHistory().intAgeDeath().setRequired(false); //wdev-13396 } } else { form.ctnFamilyHistory().cbLiving().setValue(null); form.ctnFamilyHistory().intAgeDeath().setRequired(false); //wdev-13396 } if (voFamHist.getAgeAtDeathIsNotNull()) form.ctnFamilyHistory().intAgeDeath().setValue(voFamHist.getAgeAtDeath()); else form.ctnFamilyHistory().intAgeDeath().setValue(null); if (voFamHist.getNotesIsNotNull()) form.ctnFamilyHistory().txtNotes().setValue(voFamHist.getNotes()); else form.ctnFamilyHistory().txtNotes().setValue(null); form.ctnFamilyHistory().setCollapsed(false); } }