19 package org.sleuthkit.autopsy.casemodule.datasourcesummary;
21 import java.awt.Frame;
22 import java.beans.PropertyChangeEvent;
24 import java.util.Observable;
25 import java.util.Observer;
26 import javax.swing.event.ListSelectionEvent;
27 import org.openide.util.NbBundle.Messages;
38 final class DataSourceSummaryDialog
extends javax.swing.JDialog implements Observer {
40 private static final long serialVersionUID = 1L;
41 private final DataSourceSummaryCountsPanel countsPanel;
42 private final DataSourceSummaryDetailsPanel detailsPanel;
43 private final DataSourceBrowser dataSourcesPanel;
44 private final IngestJobInfoPanel ingestHistoryPanel;
52 "DataSourceSummaryDialog.window.title=Data Sources Summary",
53 "DataSourceSummaryDialog.countsTab.title=Counts",
54 "DataSourceSummaryDialog.detailsTab.title=Details",
55 "DataSourceSummaryDialog.ingestHistoryTab.title=Ingest History"
57 DataSourceSummaryDialog(Frame owner) {
58 super(owner, Bundle.DataSourceSummaryDialog_window_title(),
true);
59 Map<Long, String> usageMap = DataSourceInfoUtilities.getDataSourceTypes();
60 Map<Long, Long> fileCountsMap = DataSourceInfoUtilities.getCountsOfFiles();
61 countsPanel =
new DataSourceSummaryCountsPanel(fileCountsMap);
62 detailsPanel =
new DataSourceSummaryDetailsPanel(usageMap);
63 dataSourcesPanel =
new DataSourceBrowser(usageMap, fileCountsMap);
64 ingestHistoryPanel =
new IngestJobInfoPanel();
66 dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
67 dataSourceTabbedPane.addTab(Bundle.DataSourceSummaryDialog_detailsTab_title(), detailsPanel);
68 dataSourceTabbedPane.addTab(Bundle.DataSourceSummaryDialog_countsTab_title(), countsPanel);
69 dataSourceTabbedPane.addTab(Bundle.DataSourceSummaryDialog_ingestHistoryTab_title(), ingestHistoryPanel);
70 dataSourcesPanel.addListSelectionListener((ListSelectionEvent e) -> {
71 if (!e.getValueIsAdjusting()) {
72 DataSource selectedDataSource = dataSourcesPanel.getSelectedDataSource();
73 countsPanel.updateCountsTableData(selectedDataSource);
74 detailsPanel.updateDetailsPanelData(selectedDataSource);
75 ingestHistoryPanel.setDataSource(selectedDataSource);
80 IngestManager.getInstance().addIngestJobEventListener((PropertyChangeEvent evt) -> {
81 if (evt instanceof DataSourceAnalysisCompletedEvent) {
82 DataSourceAnalysisCompletedEvent dsEvent = (DataSourceAnalysisCompletedEvent) evt;
83 if (dsEvent.getResult() == Reason.ANALYSIS_COMPLETED) {
84 dataSourcesPanel.refresh(dsEvent.getDataSource().getId(), IngestJobInfo.IngestJobStatusType.COMPLETED);
85 }
else if (dsEvent.getResult() == Reason.ANALYSIS_CANCELLED) {
86 dataSourcesPanel.refresh(dsEvent.getDataSource().getId(), null);
96 void enableObserver() {
97 dataSourcesPanel.addObserver(
this);
101 public void update(Observable o, Object arg) {
110 @SuppressWarnings(
"unchecked")
112 private
void initComponents() {
114 closeButton =
new javax.swing.JButton();
115 dataSourceSummarySplitPane =
new javax.swing.JSplitPane();
116 dataSourceTabbedPane =
new javax.swing.JTabbedPane();
118 org.openide.awt.Mnemonics.setLocalizedText(closeButton,
org.openide.util.NbBundle.getMessage(DataSourceSummaryDialog.class,
"DataSourceSummaryDialog.closeButton.text"));
119 closeButton.addActionListener(
new java.awt.event.ActionListener() {
120 public void actionPerformed(java.awt.event.ActionEvent evt) {
121 closeButtonActionPerformed(evt);
125 dataSourceSummarySplitPane.setDividerLocation(130);
126 dataSourceSummarySplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
127 dataSourceSummarySplitPane.setRightComponent(dataSourceTabbedPane);
129 dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
131 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
132 getContentPane().setLayout(layout);
133 layout.setHorizontalGroup(
134 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
135 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
137 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
138 .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 668, Short.MAX_VALUE)
139 .addGroup(layout.createSequentialGroup()
140 .addGap(0, 0, Short.MAX_VALUE)
141 .addComponent(closeButton)))
144 layout.setVerticalGroup(
145 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
146 .addGroup(layout.createSequentialGroup()
148 .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
149 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
150 .addComponent(closeButton)
155 private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {
166 void selectDataSource(Long dataSourceId) {
167 dataSourcesPanel.selectDataSource(dataSourceId);
171 private javax.swing.JButton closeButton;
172 private javax.swing.JSplitPane dataSourceSummarySplitPane;
173 private javax.swing.JTabbedPane dataSourceTabbedPane;