private void populateChildCollectionFromGrid(ElectrotherapyUltrasoundVo voElectrotherapyUltrasound) { if (form.grdHierarchy().getValue() == null) return; if (voElectrotherapyUltrasound.getUltrasoundTreatments() == null) voElectrotherapyUltrasound.setUltrasoundTreatments(new ElectrotherapyUltrasoundTreatmentVoCollection()); GenForm.grdHierarchyRow parentRow = form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundShortVo ? form.grdHierarchy().getSelectedRow() : form.grdHierarchy().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voElectrotherapyUltrasound.getUltrasoundTreatments().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voElectrotherapyUltrasound.getUltrasoundTreatments().add((ElectrotherapyUltrasoundTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private void newParentInstance() { ElectrotherapyUltrasoundVo voNewParent = new ElectrotherapyUltrasoundVo(); voNewParent.setAuthoringCP(form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare().getResponsibleHCP()); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setUltrasoundTreatments(new ElectrotherapyUltrasoundTreatmentVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }
/** * Given a row in the hierarchy row get the collection of treatments associated * with that ultrasound and and create a child treenode for each. Use a Red * text colour to denote any as yes unsaved treatments. * @param voCollTreatments * @param parRow */ private void populateChildNodes(GenForm.grdHierarchyRow parRow, ElectrotherapyUltrasoundTreatmentVoCollection voCollTreatments) { if (voCollTreatments == null || voCollTreatments.size()<=0) return; voCollTreatments.sort(); for(int i=0; i<voCollTreatments.size(); i++) { if (parRow != null) { GenForm.grdHierarchyRow childRow = parRow.getRows().newRow(); populateChildNode(childRow, voCollTreatments.get(i)); } } }