19 package org.sleuthkit.autopsy.datasourcesummary.ui;
21 import java.util.Arrays;
22 import java.util.List;
23 import java.util.function.Function;
24 import java.util.stream.Collectors;
25 import java.util.stream.Stream;
26 import org.apache.commons.lang3.tuple.Pair;
27 import org.openide.util.NbBundle.Messages;
43 "AnalysisPanel_keyColumn_title=Name",
44 "AnalysisPanel_countColumn_title=Count",
45 "AnalysisPanel_keywordSearchModuleName=Keyword Search",
46 "AnalysisPanel_hashsetHits_tabName=Hashset Hits",
47 "AnalysisPanel_keywordHits_tabName=Keyword Hits",
48 "AnalysisPanel_interestingItemHits_tabName=Interesting Item Hits",})
51 private static final long serialVersionUID = 1L;
54 private static final List<ColumnModel<Pair<String, Long>,
DefaultCellModel<?>>> DEFAULT_COLUMNS = Arrays.asList(
56 Bundle.AnalysisPanel_keyColumn_title(),
61 Bundle.AnalysisPanel_countColumn_title(),
68 private static final Function<Pair<String, Long>, String> DEFAULT_KEY_PROVIDER = (pair) -> pair.getKey();
76 .setKeyFunction(DEFAULT_KEY_PROVIDER);
80 .setKeyFunction(DEFAULT_KEY_PROVIDER);
84 .setKeyFunction(DEFAULT_KEY_PROVIDER);
86 private final List<JTablePanel<?>> tables = Arrays.asList(
110 hashsetsFetcher = (dataSource) -> analysisData.
getHashsetCounts(dataSource);
111 keywordsFetcher = (dataSource) -> analysisData.
getKeywordCounts(dataSource);
115 dataFetchComponents = Arrays.asList(
119 (result) -> hashsetHitsTable.showDataFetchResult(result)),
123 (result) -> keywordHitsTable.showDataFetchResult(result)),
126 interestingItemsFetcher,
127 (result) -> interestingItemsTable.showDataFetchResult(result))
141 fetchInformation(dataFetchComponents, dataSource);
146 onNewDataSource(dataFetchComponents, tables, dataSource);
154 @SuppressWarnings(
"unchecked")
156 private
void initComponents() {
158 javax.swing.JScrollPane mainScrollPane =
new javax.swing.JScrollPane();
159 javax.swing.JPanel mainContentPanel =
new javax.swing.JPanel();
160 javax.swing.JPanel ingestRunningPanel = ingestRunningLabel;
161 javax.swing.JLabel hashsetHitsLabel =
new javax.swing.JLabel();
162 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));
163 javax.swing.JPanel hashSetHitsPanel = hashsetHitsTable;
164 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));
165 javax.swing.JLabel keywordHitsLabel =
new javax.swing.JLabel();
166 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));
167 javax.swing.JPanel keywordHitsPanel = keywordHitsTable;
168 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));
169 javax.swing.JLabel interestingItemLabel =
new javax.swing.JLabel();
170 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));
171 javax.swing.JPanel interestingItemPanel = interestingItemsTable;
172 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));
174 mainContentPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
175 mainContentPanel.setMaximumSize(
new java.awt.Dimension(32767, 452));
176 mainContentPanel.setMinimumSize(
new java.awt.Dimension(200, 452));
177 mainContentPanel.setLayout(
new javax.swing.BoxLayout(mainContentPanel, javax.swing.BoxLayout.PAGE_AXIS));
179 ingestRunningPanel.setAlignmentX(0.0F);
180 ingestRunningPanel.setMaximumSize(
new java.awt.Dimension(32767, 25));
181 ingestRunningPanel.setMinimumSize(
new java.awt.Dimension(10, 25));
182 ingestRunningPanel.setPreferredSize(
new java.awt.Dimension(10, 25));
183 mainContentPanel.add(ingestRunningPanel);
185 org.openide.awt.Mnemonics.setLocalizedText(hashsetHitsLabel,
org.openide.util.NbBundle.getMessage(
AnalysisPanel.class,
"AnalysisPanel.hashsetHitsLabel.text"));
186 mainContentPanel.add(hashsetHitsLabel);
187 mainContentPanel.add(filler1);
189 hashSetHitsPanel.setAlignmentX(0.0F);
190 hashSetHitsPanel.setMaximumSize(
new java.awt.Dimension(32767, 106));
191 hashSetHitsPanel.setMinimumSize(
new java.awt.Dimension(10, 106));
192 hashSetHitsPanel.setPreferredSize(
new java.awt.Dimension(10, 106));
193 mainContentPanel.add(hashSetHitsPanel);
194 mainContentPanel.add(filler2);
196 org.openide.awt.Mnemonics.setLocalizedText(keywordHitsLabel,
org.openide.util.NbBundle.getMessage(
AnalysisPanel.class,
"AnalysisPanel.keywordHitsLabel.text"));
197 mainContentPanel.add(keywordHitsLabel);
198 mainContentPanel.add(filler4);
200 keywordHitsPanel.setAlignmentX(0.0F);
201 keywordHitsPanel.setMaximumSize(
new java.awt.Dimension(32767, 106));
202 keywordHitsPanel.setMinimumSize(
new java.awt.Dimension(10, 106));
203 keywordHitsPanel.setPreferredSize(
new java.awt.Dimension(10, 106));
204 mainContentPanel.add(keywordHitsPanel);
205 mainContentPanel.add(filler5);
207 org.openide.awt.Mnemonics.setLocalizedText(interestingItemLabel,
org.openide.util.NbBundle.getMessage(
AnalysisPanel.class,
"AnalysisPanel.interestingItemLabel.text"));
208 mainContentPanel.add(interestingItemLabel);
209 mainContentPanel.add(filler6);
211 interestingItemPanel.setAlignmentX(0.0F);
212 interestingItemPanel.setMaximumSize(
new java.awt.Dimension(32767, 106));
213 interestingItemPanel.setMinimumSize(
new java.awt.Dimension(10, 106));
214 interestingItemPanel.setPreferredSize(
new java.awt.Dimension(10, 106));
215 mainContentPanel.add(interestingItemPanel);
216 mainContentPanel.add(filler3);
218 mainScrollPane.setViewportView(mainContentPanel);
220 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
221 this.setLayout(layout);
222 layout.setHorizontalGroup(
223 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
224 .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 756, Short.MAX_VALUE)
226 layout.setVerticalGroup(
227 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
228 .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
233 List<ExcelSheetExport> getExports(DataSource dataSource) {
235 getTableExport(hashsetsFetcher, DEFAULT_COLUMNS, Bundle.AnalysisPanel_hashsetHits_tabName(), dataSource),
236 getTableExport(keywordsFetcher, DEFAULT_COLUMNS, Bundle.AnalysisPanel_keywordHits_tabName(), dataSource),
237 getTableExport(interestingItemsFetcher, DEFAULT_COLUMNS, Bundle.AnalysisPanel_interestingItemHits_tabName(), dataSource))
238 .filter(sheet -> sheet != null)
239 .collect(Collectors.toList());
void fetchInformation(DataSource dataSource)
final DataFetcher< DataSource, List< Pair< String, Long > > > interestingItemsFetcher
List< Pair< String, Long > > getInterestingItemCounts(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 > > getHashsetCounts(DataSource dataSource)
void onNewDataSource(DataSource dataSource)
List< Pair< String, Long > > getKeywordCounts(DataSource dataSource)
final List< DataFetchWorker.DataFetchComponents< DataSource,?> > dataFetchComponents
AnalysisPanel(AnalysisSummary analysisData)