/** * WDEV-13136 * Function used to retrieve records (PatientTransfers) from grid */ private PendingTransfersVoCollection populatePendingTransferRecordsFromGrid() { // Create collection to return PendingTransfersVoCollection records = new PendingTransfersVoCollection(); // Add each record from grid to collection for (int i = 0; i < form.dyngrdPatients().getRows().size(); i++) { DynamicGridRow row = form.dyngrdPatients().getRows().get(i); if (row.getValue() instanceof PendingTransfersVo) records.add((PendingTransfersVo) row.getValue()); } // Return populated records return records; }
/** * WDEV-13136 * Function used to populate pending transfers to grid */ private void populatePendingTransferRecordsToGrid(PendingTransfersVoCollection records) { // Clear grid form.dyngrdPatients().getRows().clear(); // Check records collection if (records == null) return; // Populate records to grid for (int i = 0; i < records.size(); i++) { addNewPendingTransfersDynamicGridRow(records.get(i)); } }
/** * WDEV-13136 * Function used to sort records (PendingTransfers) after values on column which header was clicked */ private void sortPendingTansferRecords(Object columnIdentifier) { // Get records from grid PendingTransfersVoCollection records = populatePendingTransferRecordsFromGrid(); // Toggle sort order for column sortOrderToggle(columnIdentifier); // Sort records by column if (COLDATETIME.equals(columnIdentifier)) { records.sort(new PendingTransferRequestDateTimeCompartor(form.getLocalContext().getSortOrderRequestDate())); } else if (COLALERT.equals(columnIdentifier)) { records.sort(new AlertCompartor(form.getLocalContext().getSortOrderAlerts())); } // Get current selection Object selectedRecord = form.dyngrdPatients().getValue(); // Populate records to grid populatePendingTransferRecordsToGrid(records); // Reselect record form.dyngrdPatients().setValue(selectedRecord); // Call code for new selection updateGlobalContextPatientSelection(form.dyngrdPatients().getValue()); }
/** * WDEV-13136 * Function used to sort records (PendingTransfers) after values on column which header was clicked */ private void sortPendingTansferRecords(Object columnIdentifier) { // Get records from grid PendingTransfersVoCollection records = populatePendingTransferRecordsFromGrid(); if (records.size() < 2) return; // Toggle sort order for column sortOrderToggle(columnIdentifier); // Sort records by column if (COLDATETIME.equals(columnIdentifier)) { records.sort(new PendingTransferRequestDateTimeCompartor(form.getLocalContext().getSortOrderRequestDate())); } else if (COLALERT.equals(columnIdentifier)) { records.sort(new AlertCompartor(form.getLocalContext().getSortOrderAlerts())); } //WDEV-20305 else if (COLCOMMENTS.equals(columnIdentifier)) { records.sort(new CommentsComparator(form.getLocalContext().getSortOrderComments())); } // Get current selection Object selectedRecord = form.dyngrdPatients().getValue(); // Populate records to grid populatePendingTransferRecordsToGrid(records); // Reselect record form.dyngrdPatients().setValue(selectedRecord); // Call code for new selection updateGlobalContextPatientSelection(form.dyngrdPatients().getValue()); }