private void populateChildNodes(grdPneumaticRow parRow, ElectrotherapyPneumaticTreatmentVoCollection voPneumaticTreatmentColl) { parRow.getRows().clear(); if (voPneumaticTreatmentColl == null || voPneumaticTreatmentColl.size()<=0) return; voPneumaticTreatmentColl.sort(); for(int i=0; i<voPneumaticTreatmentColl.size(); i++) { if (parRow != null) { GenForm.grdPneumaticRow childRow = parRow.getRows().newRow(); populateChildNode(childRow, voPneumaticTreatmentColl.get(i)); } } //reselect parent parRow.setValue(form.getLocalContext().getSelectedParentInstance()); form.grdPneumatic().setValue(parRow.getValue()); parRow.setExpanded(true); }
private void populateChildCollectionFromGrid(ElectrotherapyPneumaticVo voElectrotherapyPneumatic) { if (form.grdPneumatic().getValue() == null) return; if (voElectrotherapyPneumatic.getPneumaticTreatment() == null) voElectrotherapyPneumatic.setPneumaticTreatment(new ElectrotherapyPneumaticTreatmentVoCollection()); GenForm.grdPneumaticRow parentRow = form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo || form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticVo ? form.grdPneumatic().getSelectedRow() : form.grdPneumatic().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voElectrotherapyPneumatic.getPneumaticTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voElectrotherapyPneumatic.getPneumaticTreatment().add((ElectrotherapyPneumaticTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private void newParentInstance() { ElectrotherapyPneumaticVo voNewParent = new ElectrotherapyPneumaticVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); if(voHcp != null) voNewParent.setAuthoringCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setPneumaticTreatment(new ElectrotherapyPneumaticTreatmentVoCollection()); populateParentInstanceControls(voNewParent); clearChildInstanceControls(); form.getLocalContext().setSelectedParentInstance(voNewParent); form.getLocalContext().setSelectedChildInstance(null); }