private void populateChildCollectionFromGrid(RehabilitationVo voRehab) { if (form.grdActivity().getValue() == null) return; if (voRehab.getRehabActivity() == null) voRehab.setRehabActivity(new RehabilitationActivityVoCollection()); GenForm.grdActivityRow parentRow = form.grdActivity().getValue() instanceof RehabilitationShortVo ? form.grdActivity().getSelectedRow() : form.grdActivity().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voRehab.getRehabActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voRehab.getRehabActivity().add((RehabilitationActivityVo) parentRow.getRows().get(i).getValue()); } }
/** * 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.grdActivityRow parRow, RehabilitationActivityVoCollection voCollRehabActivity) { parRow.getRows().clear(); if (voCollRehabActivity == null || voCollRehabActivity.size()<=0) return; //RehabilitationVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); //if(voParentInstance.getClinicalContact().getID_ClinicalContact().equals // (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) voCollRehabActivity.sort(); for(int i=0; i<voCollRehabActivity.size(); i++) { if (parRow != null) { GenForm.grdActivityRow childRow = parRow.getRows().newRow(); populateChildNode(childRow, voCollRehabActivity.get(i)); } } //reselect parent if (parRow != null) { form.grdActivity().setValue(parRow.getValue()); parRow.setExpanded(true); } }
private void newParentInstance() { RehabilitationVo voNewParent = new RehabilitationVo(); voNewParent.setAuthoringCP((Hcp) domain.getHcpUser()); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setRehabActivity(new RehabilitationActivityVoCollection()); populateParentInstanceControls(voNewParent); loadEquipment(); loadAdaptation(); loadTechnique(); form.getLocalContext().setSelectedParentInstance(voNewParent); form.getLocalContext().setParentInstance(voNewParent); //wdev-13599 }