Merge branch '5369-DedupingCodeChanges' of https://github.com/wschaeferB/autopsy into 5372-VideoThumbnailViewer

This commit is contained in:
William Schaefer 2019-08-14 11:29:29 -04:00
commit d25d9f8ab6
2 changed files with 7 additions and 4 deletions

View File

@ -205,7 +205,8 @@ class FileSearchData {
}
/**
* Enum representing the file type. We don't simply use
* Enum representing the file type.
* We don't simply use
* FileTypeUtils.FileTypeCategory because: - Some file types categories
* overlap - It is convenient to have the "OTHER" option for files that
* don't match the given types

View File

@ -182,7 +182,9 @@ public class ResultsPanel extends javax.swing.JPanel {
private void updateControls() {
previousPageSize = (int) pageSizeSpinner.getValue();
int pageSize = (int) pageSizeSpinner.getValue();
currentPageLabel.setText(Bundle.ResultsPanel_currentPage_displayValue(currentPage + 1, (groupSize / pageSize) + 1));
//handle edge case where group size is 0 and we want the empty results to be labeled paged 1 of 1 not page 1 of 0
double maxPageDouble = groupSize == 0 ? 1 : Math.ceil((double) groupSize / pageSize);
currentPageLabel.setText(Bundle.ResultsPanel_currentPage_displayValue(currentPage + 1, maxPageDouble));
previousPageButton.setEnabled(currentPage != 0);
nextPageButton.setEnabled(groupSize > ((currentPage + 1) * pageSize));
gotoPageField.setEnabled(groupSize > pageSize);
@ -378,9 +380,9 @@ public class ResultsPanel extends javax.swing.JPanel {
return;
}
int pageSize = (int) pageSizeSpinner.getValue();
if ((newPage - 1) < 0 || groupSize < ((newPage - 1) * pageSize)) {
if ((newPage - 1) < 0 || groupSize <= ((newPage - 1) * pageSize)) {
JOptionPane.showMessageDialog(this,
Bundle.ResultsPanel_invalidPageNumber_message(newPage, ((groupSize / pageSize) + 1)),
Bundle.ResultsPanel_invalidPageNumber_message(newPage, Math.ceil((double) groupSize / pageSize)),
Bundle.ResultsPanel_invalidPageNumber_title(),
JOptionPane.WARNING_MESSAGE);
return;