Autopsy  4.11.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.Map;
24 import java.util.Observable;
25 import java.util.Observer;
26 import javax.swing.event.ListSelectionEvent;
27 import org.openide.util.NbBundle.Messages;
32 import org.sleuthkit.datamodel.DataSource;
33 import org.sleuthkit.datamodel.IngestJobInfo;
34 
38 final class DataSourceSummaryDialog extends javax.swing.JDialog implements Observer {
39 
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;
45 
51  @Messages({
52  "DataSourceSummaryDialog.window.title=Data Sources Summary",
53  "DataSourceSummaryDialog.countsTab.title=Counts",
54  "DataSourceSummaryDialog.detailsTab.title=Details",
55  "DataSourceSummaryDialog.ingestHistoryTab.title=Ingest History"
56  })
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();
65  initComponents();
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);
76  this.repaint();
77  }
78  });
79  //add listener to refresh jobs with Started status when they complete
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);
87  }
88  }
89  });
90  this.pack();
91  }
92 
96  void enableObserver() {
97  dataSourcesPanel.addObserver(this);
98  }
99 
100  @Override
101  public void update(Observable o, Object arg) {
102  this.dispose();
103  }
104 
110  @SuppressWarnings("unchecked")
111  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
112  private void initComponents() {
113 
114  closeButton = new javax.swing.JButton();
115  dataSourceSummarySplitPane = new javax.swing.JSplitPane();
116  dataSourceTabbedPane = new javax.swing.JTabbedPane();
117 
118  org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(DataSourceSummaryDialog.class, "DataSourceSummaryDialog.closeButton.text")); // NOI18N
119  closeButton.addActionListener(new java.awt.event.ActionListener() {
120  public void actionPerformed(java.awt.event.ActionEvent evt) {
121  closeButtonActionPerformed(evt);
122  }
123  });
124 
125  dataSourceSummarySplitPane.setDividerLocation(130);
126  dataSourceSummarySplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
127  dataSourceSummarySplitPane.setRightComponent(dataSourceTabbedPane);
128 
129  dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
130 
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()
136  .addContainerGap()
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)))
142  .addContainerGap())
143  );
144  layout.setVerticalGroup(
145  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
146  .addGroup(layout.createSequentialGroup()
147  .addContainerGap()
148  .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
149  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
150  .addComponent(closeButton)
151  .addContainerGap())
152  );
153  }// </editor-fold>//GEN-END:initComponents
154 
155  private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
156  this.dispose();
157  }//GEN-LAST:event_closeButtonActionPerformed
158 
166  void selectDataSource(Long dataSourceId) {
167  dataSourcesPanel.selectDataSource(dataSourceId);
168  }
169 
170  // Variables declaration - do not modify//GEN-BEGIN:variables
171  private javax.swing.JButton closeButton;
172  private javax.swing.JSplitPane dataSourceSummarySplitPane;
173  private javax.swing.JTabbedPane dataSourceTabbedPane;
174  // End of variables declaration//GEN-END:variables
175 }

Copyright © 2012-2018 Basis Technology. Generated on: Fri Jun 21 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.