Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
MiniTimelinePanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 2020 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.discovery.ui;
20 
21 import com.google.common.eventbus.Subscribe;
22 import javax.swing.SwingUtilities;
23 import javax.swing.event.ListSelectionEvent;
24 import javax.swing.event.ListSelectionListener;
25 import org.openide.util.NbBundle;
29 import org.sleuthkit.datamodel.BlackboardArtifact;
30 
34 final class MiniTimelinePanel extends javax.swing.JPanel {
35 
36  private static final long serialVersionUID = 1L;
37 
38  private final MiniTimelineDateListPanel dateListPanel = new MiniTimelineDateListPanel();
39  private final MiniTimelineArtifactListPanel artifactListPanel = new MiniTimelineArtifactListPanel();
40  private DomainArtifactsTabPanel.ArtifactRetrievalStatus status = DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED;
41  private AbstractArtifactDetailsPanel rightPanel = new GeneralPurposeArtifactViewer();
42  private String selectedDomain = null;
43  private final ListSelectionListener artifactListener;
44  private final ListSelectionListener dateListener;
45 
46  @NbBundle.Messages({"MiniTimelinePanel.loadingPanel.details=the Timeline view"})
50  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
51  MiniTimelinePanel() {
52  initComponents();
53  artifactListPanel.addMouseListener(new ArtifactMenuMouseAdapter(artifactListPanel));
54  artifactListener = new ListSelectionListener() {
55  @Override
56  public void valueChanged(ListSelectionEvent event) {
57  if (!event.getValueIsAdjusting()) {
58  BlackboardArtifact artifact = artifactListPanel.getSelectedArtifact();
59  if (artifact != null && (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()
60  || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID())) {
61  rightPanel = new ContentViewerDetailsPanel();
62  } else {
63  rightPanel = new GeneralPurposeArtifactViewer();
64  }
65  mainSplitPane.setRightComponent(rightPanel.getComponent());
66  rightPanel.setArtifact(artifact);
67  validate();
68  repaint();
69  }
70  }
71  };
72  dateListener = new ListSelectionListener() {
73  @Override
74  public void valueChanged(ListSelectionEvent event) {
75  if (!event.getValueIsAdjusting()) {
76  artifactListPanel.removeSelectionListener(artifactListener);
77  artifactListPanel.clearList();
78  artifactListPanel.addArtifacts(dateListPanel.getArtifactsForSelectedDate());
79  artifactListPanel.addSelectionListener(artifactListener);
80  artifactListPanel.selectFirst();
81  validate();
82  repaint();
83  }
84  }
85  };
86  dateListPanel.addSelectionListener(dateListener);
87  artifactListPanel.addSelectionListener(artifactListener);
88  leftSplitPane.setLeftComponent(dateListPanel);
89  leftSplitPane.setRightComponent(artifactListPanel);
90  mainSplitPane.setRightComponent(rightPanel.getComponent());
91  add(mainSplitPane);
92  }
93 
99  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
100  DomainArtifactsTabPanel.ArtifactRetrievalStatus getStatus() {
101  return status;
102  }
103 
110  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
111  void setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus status, String domain) {
112  this.status = status;
113  this.selectedDomain = domain;
114  if (status == DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED) {
115  artifactListPanel.clearList();
116  dateListPanel.clearList();
117  removeAll();
118  add(mainSplitPane);
119  if (rightPanel != null) {
120  rightPanel.setArtifact(null);
121  }
122  } else if (status == DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATING) {
123  removeAll();
124  add(new LoadingPanel(Bundle.MiniTimelinePanel_loadingPanel_details()));
125  }
126  }
127 
134  @Subscribe
135  void handleMiniTimelineResultEvent(DiscoveryEventUtils.MiniTimelineResultEvent miniTimelineResultEvent) {
136  SwingUtilities.invokeLater(() -> {
137  if (miniTimelineResultEvent.getDomain().equals(selectedDomain)) {
138  dateListPanel.removeListSelectionListener(dateListener);
139  artifactListPanel.removeSelectionListener(artifactListener);
140  dateListPanel.addArtifacts(miniTimelineResultEvent.getResultList());
141  status = DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATED;
142  setEnabled(!dateListPanel.isEmpty());
143  dateListPanel.addSelectionListener(dateListener);
144  artifactListPanel.addSelectionListener(artifactListener);
145  dateListPanel.selectFirst();
146  removeAll();
147  add(mainSplitPane);
148  revalidate();
149  repaint();
150  }
151  });
152  }
153 
159  @SuppressWarnings("unchecked")
160  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
161  private void initComponents() {
162 
163  mainSplitPane = new javax.swing.JSplitPane();
164  leftSplitPane = new javax.swing.JSplitPane();
165 
166  mainSplitPane.setDividerLocation(400);
167  mainSplitPane.setResizeWeight(0.1);
168  mainSplitPane.setToolTipText("");
169  mainSplitPane.setMinimumSize(new java.awt.Dimension(0, 0));
170 
171  leftSplitPane.setDividerLocation(198);
172  leftSplitPane.setResizeWeight(0.5);
173  leftSplitPane.setMinimumSize(new java.awt.Dimension(0, 0));
174  mainSplitPane.setLeftComponent(leftSplitPane);
175 
176  setMinimumSize(new java.awt.Dimension(0, 0));
177  setLayout(new java.awt.BorderLayout());
178  }// </editor-fold>//GEN-END:initComponents
179 
180 
181  // Variables declaration - do not modify//GEN-BEGIN:variables
182  private javax.swing.JSplitPane leftSplitPane;
183  private javax.swing.JSplitPane mainSplitPane;
184  // End of variables declaration//GEN-END:variables
185 }

Copyright © 2012-2021 Basis Technology. Generated on: Tue Jan 19 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.