private void open() { clearGrid(form.grdSymptoms().getRows()); // Check the global context var got the clinical contacts if (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContactIsNotNull()) { SystemReviewVo voSystemReview = domain.getSystemReview(form.getGlobalContext().Core.getCurrentClinicalContact()); form.getLocalContext().setSystemReview(voSystemReview); populateScreenFromData(voSystemReview); } form.setMode(FormMode.VIEW); updateControlsState(); }
/** * Gets the collection of symptom vo's from the local context. * Looks at each row in the grid that has a parent and compares the lookup element of the vo with the lookup * column in the grid. If a match is found the other columns are populated with their corresponding vo fields. */ protected void populateScreenFromData(SystemReviewVo voSystemReview) { if(voSystemReview == null) return; SystemReviewSymptomVoCollection voCollSymptoms = voSystemReview.getSymptomsIsNotNull() ? voSystemReview.getSymptoms() : null; if(voCollSymptoms != null) { for(int i = 0; i < voCollSymptoms.size(); i++) { nextSymptomVo: for (int j=0; j < form.grdSymptoms().getRows().size(); j++) { for (int k=0; k < form.grdSymptoms().getRows().get(j).getRows().size(); k++) { GenForm.grdSymptomsRow childRow = form.grdSymptoms().getRows().get(j).getRows().get(k); if (voCollSymptoms.get(i).getSymptom().equals(childRow.getcolSymptom())) { childRow.setValue(voCollSymptoms.get(i)); childRow.setcolSymptom(voCollSymptoms.get(i).getSymptom()); childRow.setcolSelect(voCollSymptoms.get(i).getAbsentPresent()); childRow.setcolDuration(voCollSymptoms.get(i).getDurationValue()); childRow.setcolUnitOfDuration(voCollSymptoms.get(i).getDurationUnit()); break nextSymptomVo; } } } } } }