/** * Function used to display the stool scale assessments collection in the grid */ private void displayStoolScaleAssessments(StoolScaleVoCollection stoolScaleList) { // Clear grid form.grdStoolScale().getRows().clear(); // Terminate function if collection is null if (stoolScaleList == null) return; for (int i = 0; i < stoolScaleList.size(); i++) { StoolScaleVo stoolScale = stoolScaleList.get(i); if (stoolScale == null) continue; // Create a new row grdStoolScaleRow stoolScaleRow = form.grdStoolScale().getRows().newRow(); // Set row columns StringBuffer sb = new StringBuffer(); sb.append(stoolScale.getDateTimeInitiatedIsNotNull() ? stoolScale.getDateTimeInitiated().toString() : "" ); if(stoolScale.getHcpInitiatedIsNotNull() && stoolScale.getHcpInitiated().getMosIsNotNull()) sb.append(" " + stoolScale.getHcpInitiated().getMos().toString()); stoolScaleRow.setColDate(sb.toString()); stoolScaleRow.setColNoResult(stoolScale.getResult()); stoolScaleRow.setColStoolType(stoolScale.getStoolType()); stoolScaleRow.setColFrequency(stoolScale.getFrequency()); stoolScaleRow.setTooltipForColFrequency(stoolScale.getFrequency()); stoolScaleRow.setColDetails(stoolScale.getDetails()); stoolScaleRow.setTooltipForColDetails(stoolScale.getDetails()); // Set row value stoolScaleRow.setValue(stoolScale); } }
@Override protected void onGrdStoolScaleGridHeaderClicked(int column) throws PresentationLogicException { StoolScaleVoCollection values = form.grdStoolScale().getValues(); switch(column) { case DATE_HCP_COLUMN: form.getLocalContext().setDateHcpSortOrder(SortOrder.ASCENDING.equals(form.getLocalContext().getDateHcpSortOrder())? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new StoolScaleDateHCPComparator(form.getLocalContext().getDateHcpSortOrder())); break; } displayStoolScaleAssessments(values); }
/** * Function used to list stool scale assessments for given care context */ public StoolScaleVoCollection listStoolScaleAssessments(CareContextRefVo careContext) { if (careContext == null || !careContext.getID_CareContextIsNotNull()) return null; List ss = getDomainFactory().find("from StoolScale stool where stool.careContext.id = " + careContext.getID_CareContext().toString()); return StoolScaleVoAssembler.createStoolScaleVoCollectionFromStoolScale(ss); }
/** * Function used to populate the form with date & refresh the form after save or cancel */ public void open() throws PresentationLogicException { // Clear the screen clearScreen(); // Populate the record browser with care context that have a stool scale // assessment recorded populateCareContextRecords(domain.listStoolScaleCareContexts(form.getGlobalContext().Core.getPatientShort())); // Select current care context form.recbrAssessment().setValue(form.getGlobalContext().Core.getCurrentCareContext()); // Create a new row for current care context if it is not present in the // record browser if (form.recbrAssessment().getValue() == null) { DateTime startDateTime = form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime(); form.recbrAssessment().newRow(form.getGlobalContext().Core.getCurrentCareContext(), "<Currently selected Care Context> " + startDateTime.getDate().toString() + " " + startDateTime.getTime().toString()); form.recbrAssessment().setValue(form.getGlobalContext().Core.getCurrentCareContext()); } // Populate the grid with stool scale assessment for selected Care // Context StoolScaleVoCollection values = domain.listStoolScaleAssessments(form.recbrAssessment().getValue());//WDEV-14975 if(values != null)//WDEV-14975 { form.getLocalContext().setDateHcpSortOrder(SortOrder.DESCENDING); values.sort(new StoolScaleDateHCPComparator(form.getLocalContext().getDateHcpSortOrder())); } displayStoolScaleAssessments(values);//WDEV-14975 // Reselect latest edited stool assessment (if that is the case) & // populate the instance controls form.grdStoolScale().setValue(form.getLocalContext().getStoolScale()); form.getLocalContext().setStoolScale(form.grdStoolScale().getValue()); populateInstanceControlsFromData(form.getLocalContext().getStoolScale()); // Set form in VIEW mode form.setMode(FormMode.VIEW); }