19 package org.sleuthkit.autopsy.casemodule.datasourcesummary;
21 import java.awt.Frame;
22 import java.beans.PropertyChangeEvent;
23 import java.util.EnumSet;
25 import java.util.Observable;
26 import java.util.Observer;
28 import javax.swing.event.ListSelectionEvent;
29 import org.openide.util.NbBundle.Messages;
40 final class DataSourceSummaryDialog
extends javax.swing.JDialog implements Observer {
42 private static final long serialVersionUID = 1L;
43 private static final Set<IngestManager.IngestJobEvent> INGEST_JOB_EVENTS_OF_INTEREST = EnumSet.of(IngestManager.IngestJobEvent.DATA_SOURCE_ANALYSIS_COMPLETED);
44 private final DataSourceSummaryCountsPanel countsPanel;
45 private final DataSourceSummaryDetailsPanel detailsPanel;
46 private final DataSourceBrowser dataSourcesPanel;
47 private final IngestJobInfoPanel ingestHistoryPanel;
55 "DataSourceSummaryDialog.window.title=Data Sources Summary",
56 "DataSourceSummaryDialog.countsTab.title=Counts",
57 "DataSourceSummaryDialog.detailsTab.title=Details",
58 "DataSourceSummaryDialog.ingestHistoryTab.title=Ingest History"
60 DataSourceSummaryDialog(Frame owner) {
61 super(owner, Bundle.DataSourceSummaryDialog_window_title(),
true);
62 Map<Long, String> usageMap = DataSourceInfoUtilities.getDataSourceTypes();
63 Map<Long, Long> fileCountsMap = DataSourceInfoUtilities.getCountsOfFiles();
64 countsPanel =
new DataSourceSummaryCountsPanel(fileCountsMap);
65 detailsPanel =
new DataSourceSummaryDetailsPanel(usageMap);
66 dataSourcesPanel =
new DataSourceBrowser(usageMap, fileCountsMap);
67 ingestHistoryPanel =
new IngestJobInfoPanel();
69 dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
70 dataSourceTabbedPane.addTab(Bundle.DataSourceSummaryDialog_detailsTab_title(), detailsPanel);
71 dataSourceTabbedPane.addTab(Bundle.DataSourceSummaryDialog_countsTab_title(), countsPanel);
72 dataSourceTabbedPane.addTab(Bundle.DataSourceSummaryDialog_ingestHistoryTab_title(), ingestHistoryPanel);
73 dataSourcesPanel.addListSelectionListener((ListSelectionEvent e) -> {
74 if (!e.getValueIsAdjusting()) {
75 DataSource selectedDataSource = dataSourcesPanel.getSelectedDataSource();
76 countsPanel.updateCountsTableData(selectedDataSource);
77 detailsPanel.updateDetailsPanelData(selectedDataSource);
78 ingestHistoryPanel.setDataSource(selectedDataSource);
83 IngestManager.getInstance().addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, (PropertyChangeEvent evt) -> {
84 if (evt instanceof DataSourceAnalysisCompletedEvent) {
85 DataSourceAnalysisCompletedEvent dsEvent = (DataSourceAnalysisCompletedEvent) evt;
86 if (dsEvent.getResult() == Reason.ANALYSIS_COMPLETED) {
87 dataSourcesPanel.refresh(dsEvent.getDataSource().getId(), IngestJobInfo.IngestJobStatusType.COMPLETED);
88 }
else if (dsEvent.getResult() == Reason.ANALYSIS_CANCELLED) {
89 dataSourcesPanel.refresh(dsEvent.getDataSource().getId(), null);
99 void enableObserver() {
100 dataSourcesPanel.addObserver(
this);
104 public void update(Observable o, Object arg) {
113 @SuppressWarnings(
"unchecked")
115 private
void initComponents() {
117 closeButton =
new javax.swing.JButton();
118 dataSourceSummarySplitPane =
new javax.swing.JSplitPane();
119 dataSourceTabbedPane =
new javax.swing.JTabbedPane();
121 org.openide.awt.Mnemonics.setLocalizedText(closeButton,
org.openide.util.NbBundle.getMessage(DataSourceSummaryDialog.class,
"DataSourceSummaryDialog.closeButton.text"));
122 closeButton.addActionListener(
new java.awt.event.ActionListener() {
123 public void actionPerformed(java.awt.event.ActionEvent evt) {
124 closeButtonActionPerformed(evt);
128 dataSourceSummarySplitPane.setDividerLocation(130);
129 dataSourceSummarySplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
130 dataSourceSummarySplitPane.setRightComponent(dataSourceTabbedPane);
132 dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
134 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
135 getContentPane().setLayout(layout);
136 layout.setHorizontalGroup(
137 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
138 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
140 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
141 .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 668, Short.MAX_VALUE)
142 .addGroup(layout.createSequentialGroup()
143 .addGap(0, 0, Short.MAX_VALUE)
144 .addComponent(closeButton)))
147 layout.setVerticalGroup(
148 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
149 .addGroup(layout.createSequentialGroup()
151 .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
152 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
153 .addComponent(closeButton)
158 private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {
169 void selectDataSource(Long dataSourceId) {
170 dataSourcesPanel.selectDataSource(dataSourceId);
174 private javax.swing.JButton closeButton;
175 private javax.swing.JSplitPane dataSourceSummarySplitPane;
176 private javax.swing.JTabbedPane dataSourceTabbedPane;