Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AnalysisPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2020-2021 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.datasourcesummary.ui;
20 
21 import java.util.Arrays;
22 import java.util.List;
23 import java.util.function.Function;
24 import org.apache.commons.lang3.tuple.Pair;
25 import org.openide.util.NbBundle.Messages;
32 import org.sleuthkit.datamodel.DataSource;
33 
38 @Messages({
39  "AnalysisPanel_keyColumn_title=Name",
40  "AnalysisPanel_countColumn_title=Count",
41  "AnalysisPanel_keywordSearchModuleName=Keyword Search",
42  "AnalysisPanel_hashsetHits_tabName=Hashset Hits",
43  "AnalysisPanel_keywordHits_tabName=Keyword Hits",
44  "AnalysisPanel_interestingItemHits_tabName=Interesting Item Hits",})
45 public class AnalysisPanel extends BaseDataSourceSummaryPanel {
46 
47  private static final long serialVersionUID = 1L;
48 
49  // Default Column definitions for each table
50  private static final List<ColumnModel<Pair<String, Long>, DefaultCellModel<?>>> DEFAULT_COLUMNS = Arrays.asList(
51  new ColumnModel<>(
52  Bundle.AnalysisPanel_keyColumn_title(),
53  (pair) -> new DefaultCellModel<>(pair.getKey()),
54  300
55  ),
56  new ColumnModel<>(
57  Bundle.AnalysisPanel_countColumn_title(),
58  (pair) -> new DefaultCellModel<>(pair.getValue()),
59  100
60  )
61  );
62 
63  // Identifies the key in the records for the tables.
64  private static final Function<Pair<String, Long>, String> DEFAULT_KEY_PROVIDER = (pair) -> pair.getKey();
65 
69 
70  private final JTablePanel<Pair<String, Long>> hashsetHitsTable
71  = JTablePanel.getJTablePanel(DEFAULT_COLUMNS)
72  .setKeyFunction(DEFAULT_KEY_PROVIDER);
73 
74  private final JTablePanel<Pair<String, Long>> keywordHitsTable
75  = JTablePanel.getJTablePanel(DEFAULT_COLUMNS)
76  .setKeyFunction(DEFAULT_KEY_PROVIDER);
77 
78  private final JTablePanel<Pair<String, Long>> interestingItemsTable
79  = JTablePanel.getJTablePanel(DEFAULT_COLUMNS)
80  .setKeyFunction(DEFAULT_KEY_PROVIDER);
81 
82  private final List<JTablePanel<?>> tables = Arrays.asList(
83  hashsetHitsTable,
84  keywordHitsTable,
85  interestingItemsTable
86  );
87 
88  private final IngestRunningLabel ingestRunningLabel = new IngestRunningLabel();
89 
94  private final List<DataFetchWorker.DataFetchComponents<DataSource, ?>> dataFetchComponents;
95 
99  public AnalysisPanel() {
100  this(new AnalysisSummaryGetter());
101  }
102 
103  public AnalysisPanel(AnalysisSummaryGetter analysisData) {
104  super(analysisData);
105 
106  hashsetsFetcher = (dataSource) -> analysisData.getHashsetCounts(dataSource);
107  keywordsFetcher = (dataSource) -> analysisData.getKeywordCounts(dataSource);
108  interestingItemsFetcher = (dataSource) -> analysisData.getInterestingItemCounts(dataSource);
109 
110  // set up data acquisition methods
111  dataFetchComponents = Arrays.asList(
112  // hashset hits loading components
114  hashsetsFetcher,
115  (result) -> hashsetHitsTable.showDataFetchResult(result)),
116  // keyword hits loading components
118  keywordsFetcher,
119  (result) -> keywordHitsTable.showDataFetchResult(result)),
120  // interesting item hits loading components
122  interestingItemsFetcher,
123  (result) -> interestingItemsTable.showDataFetchResult(result))
124  );
125 
126  initComponents();
127  }
128 
129  @Override
130  public void close() {
131  ingestRunningLabel.unregister();
132  super.close();
133  }
134 
135  @Override
136  protected void fetchInformation(DataSource dataSource) {
137  fetchInformation(dataFetchComponents, dataSource);
138  }
139 
140  @Override
141  protected void onNewDataSource(DataSource dataSource) {
142  onNewDataSource(dataFetchComponents, tables, dataSource);
143  }
144 
150  @SuppressWarnings("unchecked")
151  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
152  private void initComponents() {
153 
154  javax.swing.JScrollPane mainScrollPane = new javax.swing.JScrollPane();
155  javax.swing.JPanel mainContentPanel = new javax.swing.JPanel();
156  javax.swing.JPanel ingestRunningPanel = ingestRunningLabel;
157  javax.swing.JLabel hashsetHitsLabel = new javax.swing.JLabel();
158  javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(32767, 2));
159  javax.swing.JPanel hashSetHitsPanel = hashsetHitsTable;
160  javax.swing.Box.Filler filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 20), new java.awt.Dimension(0, 20), new java.awt.Dimension(32767, 20));
161  javax.swing.JLabel keywordHitsLabel = new javax.swing.JLabel();
162  javax.swing.Box.Filler filler4 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(32767, 2));
163  javax.swing.JPanel keywordHitsPanel = keywordHitsTable;
164  javax.swing.Box.Filler filler5 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 20), new java.awt.Dimension(0, 20), new java.awt.Dimension(32767, 20));
165  javax.swing.JLabel interestingItemLabel = new javax.swing.JLabel();
166  javax.swing.Box.Filler filler6 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(32767, 2));
167  javax.swing.JPanel interestingItemPanel = interestingItemsTable;
168  javax.swing.Box.Filler filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
169 
170  mainContentPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
171  mainContentPanel.setMaximumSize(new java.awt.Dimension(32767, 452));
172  mainContentPanel.setMinimumSize(new java.awt.Dimension(200, 452));
173  mainContentPanel.setLayout(new javax.swing.BoxLayout(mainContentPanel, javax.swing.BoxLayout.PAGE_AXIS));
174 
175  ingestRunningPanel.setAlignmentX(0.0F);
176  ingestRunningPanel.setMaximumSize(new java.awt.Dimension(32767, 25));
177  ingestRunningPanel.setMinimumSize(new java.awt.Dimension(10, 25));
178  ingestRunningPanel.setPreferredSize(new java.awt.Dimension(10, 25));
179  mainContentPanel.add(ingestRunningPanel);
180 
181  org.openide.awt.Mnemonics.setLocalizedText(hashsetHitsLabel, org.openide.util.NbBundle.getMessage(AnalysisPanel.class, "AnalysisPanel.hashsetHitsLabel.text")); // NOI18N
182  mainContentPanel.add(hashsetHitsLabel);
183  mainContentPanel.add(filler1);
184 
185  hashSetHitsPanel.setAlignmentX(0.0F);
186  hashSetHitsPanel.setMaximumSize(new java.awt.Dimension(32767, 106));
187  hashSetHitsPanel.setMinimumSize(new java.awt.Dimension(10, 106));
188  hashSetHitsPanel.setPreferredSize(new java.awt.Dimension(10, 106));
189  mainContentPanel.add(hashSetHitsPanel);
190  mainContentPanel.add(filler2);
191 
192  org.openide.awt.Mnemonics.setLocalizedText(keywordHitsLabel, org.openide.util.NbBundle.getMessage(AnalysisPanel.class, "AnalysisPanel.keywordHitsLabel.text")); // NOI18N
193  mainContentPanel.add(keywordHitsLabel);
194  mainContentPanel.add(filler4);
195 
196  keywordHitsPanel.setAlignmentX(0.0F);
197  keywordHitsPanel.setMaximumSize(new java.awt.Dimension(32767, 106));
198  keywordHitsPanel.setMinimumSize(new java.awt.Dimension(10, 106));
199  keywordHitsPanel.setPreferredSize(new java.awt.Dimension(10, 106));
200  mainContentPanel.add(keywordHitsPanel);
201  mainContentPanel.add(filler5);
202 
203  org.openide.awt.Mnemonics.setLocalizedText(interestingItemLabel, org.openide.util.NbBundle.getMessage(AnalysisPanel.class, "AnalysisPanel.interestingItemLabel.text")); // NOI18N
204  mainContentPanel.add(interestingItemLabel);
205  mainContentPanel.add(filler6);
206 
207  interestingItemPanel.setAlignmentX(0.0F);
208  interestingItemPanel.setMaximumSize(new java.awt.Dimension(32767, 106));
209  interestingItemPanel.setMinimumSize(new java.awt.Dimension(10, 106));
210  interestingItemPanel.setPreferredSize(new java.awt.Dimension(10, 106));
211  mainContentPanel.add(interestingItemPanel);
212  mainContentPanel.add(filler3);
213 
214  mainScrollPane.setViewportView(mainContentPanel);
215 
216  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
217  this.setLayout(layout);
218  layout.setHorizontalGroup(
219  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
220  .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 756, Short.MAX_VALUE)
221  );
222  layout.setVerticalGroup(
223  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
224  .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
225  );
226  }// </editor-fold>//GEN-END:initComponents
227 
228  // Variables declaration - do not modify//GEN-BEGIN:variables
229  // End of variables declaration//GEN-END:variables
230 }
final DataFetcher< DataSource, List< Pair< String, Long > > > interestingItemsFetcher
List< Pair< String, Long > > getHashsetCounts(DataSource dataSource)
final DataFetcher< DataSource, List< Pair< String, Long > > > keywordsFetcher
final DataFetcher< DataSource, List< Pair< String, Long > > > hashsetsFetcher
static< T, CextendsGuiCellModel > JTablePanel< T > getJTablePanel(List< ColumnModel< T, C >> columns)
List< Pair< String, Long > > getInterestingItemCounts(DataSource dataSource)
final List< DataFetchWorker.DataFetchComponents< DataSource,?> > dataFetchComponents
List< Pair< String, Long > > getKeywordCounts(DataSource dataSource)

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.