@Override protected void onImbSearchClick() throws ims.framework.exceptions.PresentationLogicException { String[] errors = validateSearchCriteria(); if (errors != null && errors.length > 0) { engine.showErrors(errors); return; } clearResultScreen(); SurgicalOPNotesFilterVo searchFilter = populateSearchDataFromScreen(); form.getGlobalContext().Clinical.setSurgicalOpNotesFilter(searchFilter); SurgicalOperationNotesListVoCollection listResults = domain.listSurgicalOpNotes(searchFilter); if (listResults == null || listResults.size() == 0) { engine.showMessage( "No results were found. Please alter your search criteria", "No results", MessageButtons.OK, MessageIcon.INFORMATION); return; } populateResultScreenFromData(listResults); if (searchFilter != null && searchFilter.getColumnSortOrder() != null) { setSortOrderForColumn( searchFilter.getColumnSortOrder().getColumnId(), searchFilter.getColumnSortOrder().getSortOrder()); } updateControlState(); }
private void populateResultScreenFromData(SurgicalOperationNotesListVoCollection listResults) { clearResultScreen(); if (listResults == null || listResults.size() == 0) { return; } for (int i = 0; i < listResults.size(); i++) { addRowToGrid(listResults.get(i)); } form.lblTotal().setValue(Integer.toString(listResults.size())); }
private void sortColumn(int column) { if (column == PATIENT_COLUMN_ID) { if (form.getLocalContext().getSortOrderPatient() == null) form.getLocalContext().setSortOrderPatient(SortOrder.ASCENDING); SurgicalOperationNotesListVoCollection collectionToSort = form.grdSurgicalOPs().getValues(); collectionToSort.sort(new PatientComparator(form.getLocalContext().getSortOrderPatient())); if (SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderPatient())) { form.getLocalContext().setSortOrderPatient(SortOrder.DESCENDING); } else form.getLocalContext().setSortOrderPatient(SortOrder.ASCENDING); addColumnSortToSearchCriteriaGC( PATIENT_COLUMN_ID, form.getLocalContext().getSortOrderPatient()); form.grdSurgicalOPs().getRows().clear(); populateResultScreenFromData(collectionToSort); } else if (column == CONSULTANT_COLUMN_ID) { if (form.getLocalContext().getSortOrderConsultant() == null) form.getLocalContext().setSortOrderConsultant(SortOrder.ASCENDING); SurgicalOperationNotesListVoCollection collectionToSort = form.grdSurgicalOPs().getValues(); collectionToSort.sort( new ConsultantComparator(form.getLocalContext().getSortOrderConsultant())); if (SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderConsultant())) { form.getLocalContext().setSortOrderConsultant(SortOrder.DESCENDING); } else form.getLocalContext().setSortOrderConsultant(SortOrder.ASCENDING); addColumnSortToSearchCriteriaGC( CONSULTANT_COLUMN_ID, form.getLocalContext().getSortOrderConsultant()); form.grdSurgicalOPs().getRows().clear(); populateResultScreenFromData(collectionToSort); } else if (column == SURGEON_COLUMN_ID) { if (form.getLocalContext().getSortOrderSurgeon() == null) form.getLocalContext().setSortOrderSurgeon(SortOrder.ASCENDING); SurgicalOperationNotesListVoCollection collectionToSort = form.grdSurgicalOPs().getValues(); collectionToSort.sort(new SurgeonComparator(form.getLocalContext().getSortOrderSurgeon())); if (SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderSurgeon())) { form.getLocalContext().setSortOrderSurgeon(SortOrder.DESCENDING); } else form.getLocalContext().setSortOrderSurgeon(SortOrder.ASCENDING); addColumnSortToSearchCriteriaGC( SURGEON_COLUMN_ID, form.getLocalContext().getSortOrderSurgeon()); form.grdSurgicalOPs().getRows().clear(); populateResultScreenFromData(collectionToSort); } else if (column == PROCEDURE_COLUMN_ID) { if (form.getLocalContext().getSortOrderProcedure() == null) form.getLocalContext().setSortOrderProcedure(SortOrder.ASCENDING); SurgicalOperationNotesListVoCollection collectionToSort = form.grdSurgicalOPs().getValues(); collectionToSort.sort( new ProcedureComparator(form.getLocalContext().getSortOrderProcedure())); if (SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderProcedure())) { form.getLocalContext().setSortOrderProcedure(SortOrder.DESCENDING); } else form.getLocalContext().setSortOrderProcedure(SortOrder.ASCENDING); addColumnSortToSearchCriteriaGC( PROCEDURE_COLUMN_ID, form.getLocalContext().getSortOrderProcedure()); form.grdSurgicalOPs().getRows().clear(); populateResultScreenFromData(collectionToSort); } else if (column == DATE_COLUMN_ID) { if (form.getLocalContext().getSortOrderDate() == null) form.getLocalContext().setSortOrderDate(SortOrder.ASCENDING); SurgicalOperationNotesListVoCollection collectionToSort = form.grdSurgicalOPs().getValues(); collectionToSort.sort(new DateComparator(form.getLocalContext().getSortOrderDate())); if (SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderDate())) { form.getLocalContext().setSortOrderDate(SortOrder.DESCENDING); } else form.getLocalContext().setSortOrderDate(SortOrder.ASCENDING); addColumnSortToSearchCriteriaGC(DATE_COLUMN_ID, form.getLocalContext().getSortOrderDate()); form.grdSurgicalOPs().getRows().clear(); populateResultScreenFromData(collectionToSort); } else if (column == HCP_COLUMN_ID) { if (form.getLocalContext().getSortOrderHcp() == null) form.getLocalContext().setSortOrderHcp(SortOrder.ASCENDING); SurgicalOperationNotesListVoCollection collectionToSort = form.grdSurgicalOPs().getValues(); collectionToSort.sort(new HcpComparator(form.getLocalContext().getSortOrderHcp())); if (SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderHcp())) { form.getLocalContext().setSortOrderHcp(SortOrder.DESCENDING); } else form.getLocalContext().setSortOrderHcp(SortOrder.ASCENDING); addColumnSortToSearchCriteriaGC(HCP_COLUMN_ID, form.getLocalContext().getSortOrderHcp()); form.grdSurgicalOPs().getRows().clear(); populateResultScreenFromData(collectionToSort); } }