/** * WDEV-13136 * Function used to retrieve records from grid */ private STHKPendingElectiveAdmissionListVoCollection populateRecordsFromGrid() { // Create collection to return STHKPendingElectiveAdmissionListVoCollection gridValues = new STHKPendingElectiveAdmissionListVoCollection(); // 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 STHKPendingElectiveAdmissionListVo) gridValues.add((STHKPendingElectiveAdmissionListVo) row.getValue()); } // Return collection grid return gridValues; }
/** * WDEV-13136 * Function used to populate values to grid */ private void populateRecordsToGrid(STHKPendingElectiveAdmissionListVoCollection gridValues) { // Clear records from grid form.dyngrdPatients().getRows().clear(); // Terminate function if the collection is null if (gridValues == null) return; // Add each record from collection to grid for (int i = 0; i < gridValues.size(); i++) { addNewDynamicGridRow(gridValues.get(i), null); } }
/** * WDEV-13136 * Function used to sort patients (after Age & Date TCI) */ private void sortPatients(Object columnIdentifer) { // Get records from grid STHKPendingElectiveAdmissionListVoCollection gridValues = populateRecordsFromGrid(); // Toggle sort order for column sortOrderToggle(columnIdentifer); // Determine column, sort records if (COLAGE.equals(columnIdentifer)) { gridValues.sort(new AgeComparator(form.getLocalContext().getSortOrderAge())); } else if (COLTCIDATE.equals(columnIdentifer)) { gridValues.sort(new DateTCIComparator(form.getLocalContext().getSortOrderTCIDate())); } //WDEV-18011 else if (COLALERTS.equals(columnIdentifer)) { gridValues.sort(new AlertComparator(form.getLocalContext().getSortOrderAlerts())); } // Get selected record Object selectedValue = form.dyngrdPatients().getValue(); // Refresh grid populateRecordsToGrid(gridValues); // Reselect value form.dyngrdPatients().setValue(selectedValue); updatePatientGlobalContextOnSelection(form.dyngrdPatients().getValue()); }
/** * WDEV-13136 * Function used to sort patients (after Age & Date TCI) */ private void sortPatients(Object columnIdentifer) { // Get records from grid STHKPendingElectiveAdmissionListVoCollection gridValues = populateRecordsFromGrid(); // Toggle sort order for column sortOrderToggle(columnIdentifer); // Determine column, sort records if (COLAGE.equals(columnIdentifer)) { //gridValues.sort(new AgeComparator(form.getLocalContext().getSortOrderAge())); gridValues.sort(new AgeDOBComparator(form.getLocalContext().getSortOrderAge())); } else if (COLTCIDATE.equals(columnIdentifer)) { gridValues.sort(new DateTCIComparator(form.getLocalContext().getSortOrderTCIDate())); } //WDEV-18011 else if (COLALERTS.equals(columnIdentifer)) { gridValues.sort(new AlertComparator(form.getLocalContext().getSortOrderAlerts())); } //WDEV-20305 else if (COLCOMMENT.equals(columnIdentifer)) { gridValues.sort(new CommentsComparator(form.getLocalContext().getSortOrderComments())); } // Get selected record Object selectedValue = form.dyngrdPatients().getValue(); // Refresh grid populateRecordsToGrid(gridValues); // Reselect value form.dyngrdPatients().setValue(selectedValue); updatePatientGlobalContextOnSelection(form.dyngrdPatients().getValue()); }