private void populateTreatmentGrd(RespiratoryTreatmentDetailVoCollection voResTreatDetailColl) { if(voResTreatDetailColl == null) return; GenForm.grdTreatmentRow row; if(voResTreatDetailColl != null) { for (int i=0; i<voResTreatDetailColl.size(); i++) { RespiratoryTreatmentDetailVo voTreatmentDetail = voResTreatDetailColl.get(i); // We have to find the row on the grid int j = 0; for (j=0; j<form.grdTreatment().getRows().size(); j++) { row = form.grdTreatment().getRows().get(j); if (row.getColTreatment().equals(voTreatmentDetail.getTreatment())) { row.setValue(voTreatmentDetail); row.setColComments(voTreatmentDetail.getDetails()); row.setColSelected(voTreatmentDetail.getStatus()); break; } } if(j == form.grdTreatment().getRows().size()) { row = form.grdTreatment().getRows().newRow(); row.setColTreatment(voTreatmentDetail.getTreatment()); row.setColComments(voTreatmentDetail.getDetails()); row.setColSelected(voTreatmentDetail.getStatus()); row.setValue(voTreatmentDetail); } } } }