19 package org.sleuthkit.autopsy.datasourcesummary.ui;
21 import java.awt.Frame;
22 import java.beans.PropertyChangeEvent;
23 import java.beans.PropertyChangeListener;
24 import java.util.EnumSet;
25 import java.util.Observable;
26 import java.util.Observer;
28 import javax.swing.WindowConstants;
29 import javax.swing.event.ListSelectionEvent;
30 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 DataSourceBrowser dataSourcesPanel;
45 private final DataSourceSummaryTabbedPane dataSourceSummaryTabbedPane;
46 private final PropertyChangeListener ingestEventListener;
54 "DataSourceSummaryDialog.window.title=Data Sources Summary"
56 DataSourceSummaryDialog(Frame owner) {
57 super(owner, Bundle.DataSourceSummaryDialog_window_title(),
true);
59 dataSourcesPanel =
new DataSourceBrowser();
60 dataSourceSummaryTabbedPane =
new DataSourceSummaryTabbedPane();
61 dataSourceSummaryTabbedPane.setParentCloseListener(() -> DataSourceSummaryDialog.this.dispose());
63 dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
64 dataSourcesPanel.addListSelectionListener((ListSelectionEvent e) -> {
65 if (!e.getValueIsAdjusting()) {
66 DataSource selectedDataSource = dataSourcesPanel.getSelectedDataSource();
67 dataSourceSummaryTabbedPane.setDataSource(selectedDataSource);
72 ingestEventListener = (PropertyChangeEvent evt) -> {
73 if (evt instanceof DataSourceAnalysisCompletedEvent) {
74 DataSourceAnalysisCompletedEvent dsEvent = (DataSourceAnalysisCompletedEvent) evt;
75 if (dsEvent.getResult() == Reason.ANALYSIS_COMPLETED) {
76 dataSourcesPanel.refresh(dsEvent.getDataSource().getId(), IngestJobInfo.IngestJobStatusType.COMPLETED);
77 }
else if (dsEvent.getResult() == Reason.ANALYSIS_CANCELLED) {
78 dataSourcesPanel.refresh(dsEvent.getDataSource().getId(), null);
84 IngestManager.getInstance().addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, ingestEventListener);
88 setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
93 public void dispose() {
94 IngestManager.getInstance().removeIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, ingestEventListener);
95 this.dataSourceSummaryTabbedPane.close();
100 public void update(Observable o, Object arg) {
109 @SuppressWarnings(
"unchecked")
111 private
void initComponents() {
113 closeButton =
new javax.swing.JButton();
114 dataSourceSummarySplitPane =
new javax.swing.JSplitPane();
115 javax.swing.JPanel dataSourceTabbedPane = dataSourceSummaryTabbedPane;
117 org.openide.awt.Mnemonics.setLocalizedText(closeButton,
org.openide.util.NbBundle.getMessage(DataSourceSummaryDialog.class,
"DataSourceSummaryDialog.closeButton.text"));
118 closeButton.addActionListener(
new java.awt.event.ActionListener() {
119 public void actionPerformed(java.awt.event.ActionEvent evt) {
120 closeButtonActionPerformed(evt);
124 dataSourceSummarySplitPane.setDividerLocation(130);
125 dataSourceSummarySplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
126 dataSourceSummarySplitPane.setRightComponent(dataSourceTabbedPane);
128 dataSourceSummarySplitPane.setLeftComponent(dataSourcesPanel);
130 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
131 getContentPane().setLayout(layout);
132 layout.setHorizontalGroup(
133 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
134 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
136 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
137 .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 860, Short.MAX_VALUE)
138 .addGroup(layout.createSequentialGroup()
139 .addGap(0, 0, Short.MAX_VALUE)
140 .addComponent(closeButton)))
143 layout.setVerticalGroup(
144 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
145 .addGroup(layout.createSequentialGroup()
147 .addComponent(dataSourceSummarySplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 540, Short.MAX_VALUE)
148 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
149 .addComponent(closeButton)
154 private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {
155 dataSourcesPanel.cancel();
160 private javax.swing.JButton closeButton;
161 private javax.swing.JSplitPane dataSourceSummarySplitPane;
169 void populatePanel(Long selectedDataSource) {
170 dataSourcesPanel.populateBrowser(
this, selectedDataSource);