From 017c0a5b461e5cb2090b948a5f397fb66c1747a7 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 20 Aug 2019 14:37:07 -0400 Subject: [PATCH 1/2] 5367 address additional codacy complaints --- .../autopsy/filequery/DiscoveryEvents.java | 18 ++++++++++----- .../autopsy/filequery/PageWorker.java | 6 ----- .../autopsy/filequery/ResultsPanel.form | 12 ++++++++++ .../autopsy/filequery/ResultsPanel.java | 23 ++++++------------- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryEvents.java b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryEvents.java index 26a9ccc25a..86e3c07eb9 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryEvents.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryEvents.java @@ -27,7 +27,7 @@ import org.sleuthkit.autopsy.filequery.FileSearchData.FileType; import org.sleuthkit.datamodel.AbstractFile; /** - * Class to handle envent bus and events for file discovery tool. + * Class to handle event bus and events for file discovery tool. */ final class DiscoveryEvents { @@ -76,7 +76,7 @@ final class DiscoveryEvents { */ static final class SearchCompleteEvent { - private final LinkedHashMap groupMap; + private final Map groupMap; private final List searchFilters; private final FileSearch.AttributeType groupingAttribute; private final FileGroup.GroupSortingAlgorithm groupSort; @@ -93,7 +93,7 @@ final class DiscoveryEvents { * @param groupSort The sorting algorithm used for groups. * @param fileSortMethod The sorting method used for files. */ - SearchCompleteEvent(LinkedHashMap groupMap, List searchfilters, + SearchCompleteEvent(Map groupMap, List searchfilters, FileSearch.AttributeType groupingAttribute, FileGroup.GroupSortingAlgorithm groupSort, FileSorter.SortingMethod fileSortMethod) { this.groupMap = groupMap; @@ -201,13 +201,19 @@ final class DiscoveryEvents { } } + /** + * Event to signal that there were no results for the search. + */ static final class NoResultsEvent { - - NoResultsEvent(){ + + /** + * Construct a new NoResultsEvent. + */ + NoResultsEvent() { //no arg conustructor } } - + /** * Event to signal that a group has been selected. */ diff --git a/Core/src/org/sleuthkit/autopsy/filequery/PageWorker.java b/Core/src/org/sleuthkit/autopsy/filequery/PageWorker.java index 51e3cc8f88..29d335d80f 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/PageWorker.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/PageWorker.java @@ -88,10 +88,4 @@ final class PageWorker extends SwingWorker { } return null; } - - @Override - protected void done() { - - } - } diff --git a/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.form b/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.form index 6720771ade..488e991a1a 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.form @@ -173,6 +173,10 @@ + + + + @@ -189,6 +193,10 @@ + + + + @@ -213,6 +221,10 @@ + + + + diff --git a/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.java b/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.java index 58cf0875ab..86be6d6bd4 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/ResultsPanel.java @@ -181,10 +181,10 @@ public class ResultsPanel extends javax.swing.JPanel { currentPageLabel = new javax.swing.JLabel(); nextPageButton = new javax.swing.JButton(); pageSizeSpinner = new javax.swing.JSpinner(); - pageControlsLabel = new javax.swing.JLabel(); - gotoPageLabel = new javax.swing.JLabel(); + javax.swing.JLabel pageControlsLabel = new javax.swing.JLabel(); + javax.swing.JLabel gotoPageLabel = new javax.swing.JLabel(); gotoPageField = new javax.swing.JTextField(); - pageSizeLabel = new javax.swing.JLabel(); + javax.swing.JLabel pageSizeLabel = new javax.swing.JLabel(); resultsViewerPanel = new javax.swing.JPanel(); pagingPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); @@ -194,9 +194,6 @@ public class ResultsPanel extends javax.swing.JPanel { previousPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png"))); // NOI18N previousPageButton.setEnabled(false); previousPageButton.setFocusable(false); - previousPageButton.setMaximumSize(new java.awt.Dimension(23, 23)); - previousPageButton.setMinimumSize(new java.awt.Dimension(23, 23)); - previousPageButton.setPreferredSize(new java.awt.Dimension(23, 23)); previousPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png"))); // NOI18N previousPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -214,9 +211,6 @@ public class ResultsPanel extends javax.swing.JPanel { nextPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_disabled.png"))); // NOI18N nextPageButton.setEnabled(false); nextPageButton.setFocusable(false); - nextPageButton.setMaximumSize(new java.awt.Dimension(23, 23)); - nextPageButton.setMinimumSize(new java.awt.Dimension(23, 23)); - nextPageButton.setPreferredSize(new java.awt.Dimension(23, 23)); nextPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png"))); // NOI18N nextPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -261,9 +255,9 @@ public class ResultsPanel extends javax.swing.JPanel { .addGap(18, 18, 18) .addComponent(pageControlsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(previousPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(previousPageButton) .addGap(0, 0, 0) - .addComponent(nextPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(nextPageButton) .addGap(18, 18, 18) .addComponent(gotoPageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -279,9 +273,9 @@ public class ResultsPanel extends javax.swing.JPanel { .addGroup(pagingPanelLayout.createSequentialGroup() .addGap(4, 4, 4) .addGroup(pagingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(nextPageButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(nextPageButton, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pagingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(previousPageButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(previousPageButton, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(currentPageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pageControlsLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pagingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -384,10 +378,7 @@ public class ResultsPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel currentPageLabel; private javax.swing.JTextField gotoPageField; - private javax.swing.JLabel gotoPageLabel; private javax.swing.JButton nextPageButton; - private javax.swing.JLabel pageControlsLabel; - private javax.swing.JLabel pageSizeLabel; private javax.swing.JSpinner pageSizeSpinner; private javax.swing.JPanel pagingPanel; private javax.swing.JButton previousPageButton; From 1ef3d2fb47fe3494d16a0b489d817fd229675d32 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 20 Aug 2019 14:40:42 -0400 Subject: [PATCH 2/2] 5367 fix merge error --- Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java index e72c806015..2a3ae77879 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java @@ -23,7 +23,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import org.openide.util.NbBundle; -import org.sleuthkit.autopsy.datamodel.utils.FileTypeUtils; +import org.sleuthkit.autopsy.coreutils.FileTypeUtils; /** * Utility enums for FileSearch