Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DataSourceSummaryDialog.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 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.casemodule.datasourcesummary;
20 
21 import java.awt.Frame;
22 import java.beans.PropertyChangeEvent;
23 import java.util.EnumSet;
24 import java.util.Map;
25 import java.util.Observable;
26 import java.util.Observer;
27 import java.util.Set;
28 import javax.swing.event.ListSelectionEvent;
29 import org.openide.util.NbBundle.Messages;
34 import org.sleuthkit.datamodel.DataSource;
35 import org.sleuthkit.datamodel.IngestJobInfo;
36 
40 final class DataSourceSummaryDialog extends javax.swing.JDialog implements Observer {
41 
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;
48 
54  @Messages({
55  "DataSourceSummaryDialog.window.title=Data Sources Summary",
56  "DataSourceSummaryDialog.countsTab.title=Counts",
57  "DataSourceSummaryDialog.detailsTab.title=Details",
58  "DataSourceSummaryDialog.ingestHistoryTab.title=Ingest History"
59  })
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();
68  initComponents();
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);
79  this.repaint();
80  }
81  });
82  //add listener to refresh jobs with Started status when they complete
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);
90  }
91  }
92  });
93  this.pack();
94  }
95 
99  void enableObserver() {
100  dataSourcesPanel.addObserver(this);
101  }
102 
103  @Override
104  public void update(Observable o, Object arg) {
105  this.dispose();
106  }
107 
113  @SuppressWarnings("unchecked")
114  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
115  private void initComponents() {
116 
117  closeButton = new javax.swing.JButton();
118  dataSourceSummarySplitPane = new javax.swing.JSplitPane();
119  dataSourceTabbedPane = new javax.swing.JTabbedPane();
120 
121  org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(DataSourceSummaryDialog.class, "DataSourceSummaryDialog.closeButton.text")); // NOI18N
122  closeButton.addActionListener(new java.awt.event.ActionListener() {
123  public void actionPerformed(java.awt.event.ActionEvent evt) {
124  closeButtonActionPerformed(evt);
125  }
126  });
127 
128  dataSourceSummarySplitPane.setDividerLocation(130);
129  dataSourceSummarySplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
130  dataSourceSummarySplitPane.setRightComponent(dataSourceTabbedPane);
131 
132  dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
133 
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()
139  .addContainerGap()
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)))
145  .addContainerGap())
146  );
147  layout.setVerticalGroup(
148  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
149  .addGroup(layout.createSequentialGroup()
150  .addContainerGap()
151  .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
152  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
153  .addComponent(closeButton)
154  .addContainerGap())
155  );
156  }// </editor-fold>//GEN-END:initComponents
157 
158  private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
159  this.dispose();
160  }//GEN-LAST:event_closeButtonActionPerformed
161 
169  void selectDataSource(Long dataSourceId) {
170  dataSourcesPanel.selectDataSource(dataSourceId);
171  }
172 
173  // Variables declaration - do not modify//GEN-BEGIN:variables
174  private javax.swing.JButton closeButton;
175  private javax.swing.JSplitPane dataSourceSummarySplitPane;
176  private javax.swing.JTabbedPane dataSourceTabbedPane;
177  // End of variables declaration//GEN-END:variables
178 }

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.