/** * WDEV-13136 * Function used to populate values to grid */ private void populateRecordsToGrid(STHKCurrentInpatientListVoCollection gridValues) { // Clear records from grid form.dyngrdCurrIP().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)); } }
/** * WDEV-13136 * Function used to retrieve records from grid */ private STHKCurrentInpatientListVoCollection populateRecordsFromGrid() { // Create collection to return STHKCurrentInpatientListVoCollection gridValues = new STHKCurrentInpatientListVoCollection(); // Add each record from grid to collection for (int i = 0; i < form.dyngrdCurrIP().getRows().size(); i++) { DynamicGridRow row = form.dyngrdCurrIP().getRows().get(i); if (row.getValue() instanceof STHKCurrentInpatientListVo) gridValues.add((STHKCurrentInpatientListVo) row.getValue()); } // Return collection grid return gridValues; }
/** * WDEV-13136 * Function used to sort patients (after Age & Estimate Date) */ private void sortPatients(Object columnIdentifer) { // Get records from grid STHKCurrentInpatientListVoCollection 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 (COLESTDISCH.equals(columnIdentifer)) { gridValues.sort(new EstimateDischargeComparator(form.getLocalContext().getSortOrderEstimatedDischage())); } else if (COLALERTS.equals(columnIdentifer)) { gridValues.sort(new AlertsComparator(form.getLocalContext().getSortOrderAlerts())); } // Get selected record Object selectedValue = form.dyngrdCurrIP().getValue(); // Refresh grid populateRecordsToGrid(gridValues); // Reselect value form.dyngrdCurrIP().setValue(selectedValue); updatePatientGlobalContextOnSelection(form.dyngrdCurrIP().getValue()); }
/** * WDEV-13136 * Function used to sort patients (after Age & Estimate Date) */ private void sortPatients(Object columnIdentifer) { // Get records from grid STHKCurrentInpatientListVoCollection gridValues = populateRecordsFromGrid(); if (gridValues.size() < 2) return; // 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())); //wdev-21464 } else if (COLESTDISCH.equals(columnIdentifer)) { gridValues.sort(new EstimateDischargeComparator(form.getLocalContext().getSortOrderEstimatedDischage())); } else if (COLALERTS.equals(columnIdentifer)) { gridValues.sort(new AlertsComparator(form.getLocalContext().getSortOrderAlerts())); } // WDEV-20305 else if (COLCOMMENT.equals(columnIdentifer)) { gridValues.sort(new CommentsComparator(form.getLocalContext().getSortOrderComments())); } else if (COLLODGER.equals(columnIdentifer)) { gridValues.sort(new LodgerComparator(form.getLocalContext().getSortOrderLodger())); } else if (COLHOMELEAVE.equals(columnIdentifer)) { gridValues.sort(new HomeLeaveImageComparator(form.getLocalContext().getSortOrderHomeLeaveIcon())); } // Get selected record Object selectedValue = form.dyngrdCurrIP().getValue(); // Refresh grid populateRecordsToGrid(gridValues); // Reselect value form.dyngrdCurrIP().setValue(selectedValue); updatePatientGlobalContextOnSelection(form.dyngrdCurrIP().getValue()); }