private void populateChildNodes(gridTherapyRow parRow, ComplementaryTherapyDetailsVoCollection voComplementaryDetailsColl) { parRow.getRows().clear(); if (voComplementaryDetailsColl == null || voComplementaryDetailsColl.size()<=0) return; voComplementaryDetailsColl.sort(); for(int i=0; i<voComplementaryDetailsColl.size(); i++) { if (parRow != null) { GenForm.gridTherapyRow childRow = parRow.getRows().newRow(); populateChildNode(childRow, voComplementaryDetailsColl.get(i)); } } //reselect parent parRow.setValue(form.getLocalContext().getSelectedParentInstance()); form.gridTherapy().setValue(parRow.getValue()); parRow.setExpanded(true); }
private void populateChildCollectionFromGrid(ComplementaryTherapyTreatmentVo voComplementaryTherapy) { if (form.gridTherapy().getValue() == null) return; if (voComplementaryTherapy.getComplementaryTherapy() == null) voComplementaryTherapy.setComplementaryTherapy(new ComplementaryTherapyDetailsVoCollection()); GenForm.gridTherapyRow parentRow = form.gridTherapy().getValue() instanceof ComplementaryTherapyTreatmentShortVo || form.gridTherapy().getValue() instanceof ComplementaryTherapyTreatmentVo ? form.gridTherapy().getSelectedRow() : form.gridTherapy().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voComplementaryTherapy.getComplementaryTherapy().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voComplementaryTherapy.getComplementaryTherapy().add((ComplementaryTherapyDetailsVo) parentRow.getRows().get(i).getValue()); } }
private void newParentInstance() { ComplementaryTherapyTreatmentVo voNewParent = new ComplementaryTherapyTreatmentVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); if(voHcp != null) voNewParent.setAuthoringCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setComplementaryTherapy(new ComplementaryTherapyDetailsVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }