private void populateResultsToScreen(TTAMedicationAndPharmacyShortVoCollection results) { // Clear results grid form.grdWorklist().getRows().clear(); // Terminate function if the results collection is null if (results == null) return; // Add each result to grid for (TTAMedicationAndPharmacyShortVo result : results) { if (result == null) continue; populateResultRow(result, form.grdWorklist().getRows().newRow()); } }
@Override protected void onGrdWorklistGridHeaderClicked(int column) throws PresentationLogicException { switch (column) { case COL_DOB: // Set sort order if (!SortOrder.ASCENDING.equals(form.getLocalContext().getColumnDOBSortOrder())) form.getLocalContext().setColumnDOBSortOrder(SortOrder.ASCENDING); else form.getLocalContext().setColumnDOBSortOrder(SortOrder.DESCENDING); // Get values TTAMedicationAndPharmacyShortVoCollection list = form.grdWorklist().getValues(); // Save selected value TTAMedicationAndPharmacyShortVo selected = form.grdWorklist().getValue(); // Sort values populateResultsToScreen(list.sort(new DoBComparator(form.getLocalContext().getColumnDOBSortOrder()))); // Re-select the saved value form.grdWorklist().setValue(selected); break; } // Update controls state updateControlsState(); }
private void search(boolean manual) throws PresentationLogicException { if (manual) // Get data from screen only when manual searching { // Validate data from screen String errors[] = validateUIRules(); if (errors != null && errors.length > 0) { engine.showErrors(errors); return; } // Get data into global context form.getGlobalContext().Clinical.setPharmacyApprovalSearchCriteria(populateSearchFilterFromScreen()); } // Clear results form.grdWorklist().getRows().clear(); // Retrieve data from domain TTAMedicationAndPharmacyShortVoCollection results = domain.listTTAMedicationAndPharmacy(form.getGlobalContext().Clinical.getPharmacyApprovalSearchCriteria()); // If no results were found display message and exit the function if (results == null || results.size() == 0) { // Display this message only when manual searching if (manual) engine.showMessage("No results matching search criteria were found."); return; } // Display data to screen populateResultsToScreen(results); }