Autopsy  4.13.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
SummaryViewer.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 obt ain 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.communications.relationships;
20 
21 import java.util.Set;
22 import javax.swing.JPanel;
23 import org.netbeans.swing.outline.DefaultOutlineModel;
24 import org.netbeans.swing.outline.Outline;
25 import org.openide.explorer.view.OutlineView;
26 import org.openide.nodes.AbstractNode;
27 import org.openide.nodes.Children;
28 import org.openide.util.Lookup;
29 import org.openide.util.NbBundle.Messages;
31 import org.sleuthkit.datamodel.Account;
32 
39 public class SummaryViewer extends javax.swing.JPanel implements RelationshipsViewer {
40 
41  private final Lookup lookup;
42 
43  @Messages({
44  "SummaryViewer_TabTitle=Summary",
45  "SummaryViewer_FileRefNameColumn_Title=Path",
46  "SummaryViewer_CaseRefNameColumn_Title=Case Name",
47  "SummaryViewer_CentralRepository_Message=<Enable Central Respository to see Other Occurrences>",
48  "SummaryViewer_Creation_Date_Title=Creation Date",
49  "SummaryViewer_FileRef_Message=<Select a single account to see File References>",
50  "SummaryViewer_Device_Account_Description=This account was referenced by a device in the case.",
51  "SummaryViewer_Account_Description=This account represents a device in the case.",
52  "SummaryViewer_Account_Description_MuliSelect=Summary information is not available when multiple accounts are selected.",
53  "SummaryViewer_Country_Code=Country: "
54  })
55 
59  public SummaryViewer() {
60  lookup = Lookup.getDefault();
62 
63  OutlineView outlineView = fileReferencesPanel.getOutlineView();
64  Outline outline = outlineView.getOutline();
65 
66  outline.setRootVisible(false);
67  ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.SummaryViewer_FileRefNameColumn_Title());
68 
69  outlineView = caseReferencesPanel.getOutlineView();
70  outline = outlineView.getOutline();
71  outlineView.setPropertyColumns("creationDate", Bundle.SummaryViewer_Creation_Date_Title()); //NON-NLS
72 
73  outline.setRootVisible(false);
74  ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.SummaryViewer_CaseRefNameColumn_Title());
75 
76  clearControls();
77 
78  caseReferencesPanel.hideOutlineView(Bundle.SummaryViewer_CentralRepository_Message());
79  fileReferencesPanel.hideOutlineView(Bundle.SummaryViewer_FileRef_Message());
80  }
81 
82  @Override
83  public String getDisplayName() {
84  return Bundle.SummaryViewer_TabTitle();
85  }
86 
87  @Override
88  public JPanel getPanel() {
89  return this;
90  }
91 
92  @Override
93  public void setSelectionInfo(SelectionInfo info) {
94 
95  if (!EamDb.isEnabled()) {
96  caseReferencesPanel.hideOutlineView(Bundle.SummaryViewer_CentralRepository_Message());
97  } else {
99  }
100 
101  // Request is that the SummaryViewer only show information if one
102  // account is selected
103  if (info.getAccounts().size() != 1) {
104  setEnabled(false);
105  clearControls();
106 
107  accoutDescriptionLabel.setText(Bundle.SummaryViewer_Account_Description_MuliSelect());
108 
109  fileReferencesPanel.hideOutlineView(Bundle.SummaryViewer_FileRef_Message());
110  } else {
111  Account[] accountArray = info.getAccounts().toArray(new Account[1]);
112  Account account = accountArray[0];
113 
114  if (account.getAccountType().getTypeName().contains("PHONE")) {
115  String countryCode = PhoneNumUtil.getCountryCode(account.getTypeSpecificID());
116  accountLabel.setText(PhoneNumUtil.convertToInternational(account.getTypeSpecificID()));
117  accountCountry.setText(Bundle.SummaryViewer_Country_Code() + countryCode);
118  accountCountry.setEnabled(true);
119  } else {
120  accountLabel.setText(account.getTypeSpecificID());
121  accountCountry.setText("");
122  accountCountry.setEnabled(false);
123  }
124 
125  if (account.getAccountType().equals(Account.Type.DEVICE)) {
126  accoutDescriptionLabel.setText(Bundle.SummaryViewer_Account_Description());
127  } else {
128  accoutDescriptionLabel.setText(Bundle.SummaryViewer_Device_Account_Description());
129  }
130 
131  AccountSummary summaryDetails = new AccountSummary(account, info.getArtifacts());
132 
133  thumbnailsDataLabel.setText(Integer.toString(summaryDetails.getThumbnailCnt()));
134  callLogsDataLabel.setText(Integer.toString(summaryDetails.getCallLogCnt()));
135  contactsDataLabel.setText(Integer.toString(summaryDetails.getContactsCnt()));
136  messagesDataLabel.setText(Integer.toString(summaryDetails.getMessagesCnt() + summaryDetails.getEmailCnt()));
137  attachmentDataLabel.setText(Integer.toString(summaryDetails.getAttachmentCnt()));
138  referencesDataLabel.setText(Integer.toString(summaryDetails.getReferenceCnt()));
139  contactsDataLabel.setText(Integer.toString(summaryDetails.getContactsCnt()));
140 
142 
143  fileReferencesPanel.setNode(new AbstractNode(Children.create(new AccountSourceContentChildNodeFactory(info.getAccounts()), true)));
144  caseReferencesPanel.setNode(new AbstractNode(Children.create(new CorrelationCaseChildNodeFactory(info.getAccounts()), true)));
145 
146  setEnabled(true);
147  }
148  }
149 
150  @Override
151  public Lookup getLookup() {
152  return lookup;
153  }
154 
160  @Override
161  public void setEnabled(boolean enabled) {
162  super.setEnabled(enabled);
163  thumbnailCntLabel.setEnabled(enabled);
164  callLogsLabel.setEnabled(enabled);
165  contactsLabel.setEnabled(enabled);
166  messagesLabel.setEnabled(enabled);
169  countsPanel.setEnabled(enabled);
170  attachmentsLabel.setEnabled(enabled);
171  referencesLabel.setEnabled(enabled);
172  }
173 
177  private void clearControls() {
178  thumbnailsDataLabel.setText("");
179  callLogsDataLabel.setText("");
180  contactsDataLabel.setText("");
181  messagesDataLabel.setText("");
182  attachmentDataLabel.setText("");
183  accountLabel.setText("");
184  accoutDescriptionLabel.setText("");
185  referencesDataLabel.setText("");
186  accountCountry.setText("");
187 
188  fileReferencesPanel.setNode(new AbstractNode(Children.LEAF));
189  caseReferencesPanel.setNode(new AbstractNode(Children.LEAF));
190  }
191 
200  private String createAccountLabel(Set<Account> accounts) {
201  StringBuilder buffer = new StringBuilder();
202  accounts.stream().map((account) -> {
203  buffer.append(account.getTypeSpecificID());
204  return account;
205  }).forEachOrdered((_item) -> {
206  buffer.append(", ");
207  });
208 
209  return buffer.toString().substring(0, buffer.length() - 2);
210  }
211 
217  @SuppressWarnings("unchecked")
218  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
219  private void initComponents() {
220  java.awt.GridBagConstraints gridBagConstraints;
221 
222  summaryPanel = new javax.swing.JPanel();
223  accountLabel = new javax.swing.JLabel();
224  accountCountry = new javax.swing.JLabel();
225  accoutDescriptionLabel = new javax.swing.JLabel();
226  countsPanel = new javax.swing.JPanel();
227  messagesLabel = new javax.swing.JLabel();
228  callLogsLabel = new javax.swing.JLabel();
229  thumbnailCntLabel = new javax.swing.JLabel();
230  thumbnailsDataLabel = new javax.swing.JLabel();
231  messagesDataLabel = new javax.swing.JLabel();
232  callLogsDataLabel = new javax.swing.JLabel();
233  attachmentsLabel = new javax.swing.JLabel();
234  attachmentDataLabel = new javax.swing.JLabel();
235  contanctsPanel = new javax.swing.JPanel();
236  contactsLabel = new javax.swing.JLabel();
237  contactsDataLabel = new javax.swing.JLabel();
238  referencesLabel = new javax.swing.JLabel();
239  referencesDataLabel = new javax.swing.JLabel();
242 
243  setLayout(new java.awt.GridBagLayout());
244 
245  summaryPanel.setLayout(new java.awt.GridBagLayout());
246 
247  org.openide.awt.Mnemonics.setLocalizedText(accountLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.accountLabel.text")); // NOI18N
248  gridBagConstraints = new java.awt.GridBagConstraints();
249  gridBagConstraints.gridx = 0;
250  gridBagConstraints.gridy = 0;
251  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
252  gridBagConstraints.insets = new java.awt.Insets(15, 9, 0, 9);
253  summaryPanel.add(accountLabel, gridBagConstraints);
254 
255  org.openide.awt.Mnemonics.setLocalizedText(accountCountry, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.accountCountry.text")); // NOI18N
256  gridBagConstraints = new java.awt.GridBagConstraints();
257  gridBagConstraints.gridx = 0;
258  gridBagConstraints.gridy = 1;
259  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
260  gridBagConstraints.insets = new java.awt.Insets(0, 9, 0, 9);
261  summaryPanel.add(accountCountry, gridBagConstraints);
262 
263  org.openide.awt.Mnemonics.setLocalizedText(accoutDescriptionLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.accoutDescriptionLabel.text")); // NOI18N
264  gridBagConstraints = new java.awt.GridBagConstraints();
265  gridBagConstraints.gridx = 0;
266  gridBagConstraints.gridy = 2;
267  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
268  gridBagConstraints.weightx = 1.0;
269  gridBagConstraints.insets = new java.awt.Insets(15, 9, 15, 9);
270  summaryPanel.add(accoutDescriptionLabel, gridBagConstraints);
271 
272  gridBagConstraints = new java.awt.GridBagConstraints();
273  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
274  add(summaryPanel, gridBagConstraints);
275 
276  countsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.countsPanel.border.title"))); // NOI18N
277  countsPanel.setLayout(new java.awt.GridBagLayout());
278 
279  org.openide.awt.Mnemonics.setLocalizedText(messagesLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.messagesLabel.text")); // NOI18N
280  gridBagConstraints = new java.awt.GridBagConstraints();
281  gridBagConstraints.gridx = 0;
282  gridBagConstraints.gridy = 0;
283  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
284  gridBagConstraints.insets = new java.awt.Insets(9, 15, 9, 15);
285  countsPanel.add(messagesLabel, gridBagConstraints);
286 
287  org.openide.awt.Mnemonics.setLocalizedText(callLogsLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.callLogsLabel.text")); // NOI18N
288  gridBagConstraints = new java.awt.GridBagConstraints();
289  gridBagConstraints.gridx = 0;
290  gridBagConstraints.gridy = 1;
291  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
292  gridBagConstraints.insets = new java.awt.Insets(0, 15, 9, 15);
293  countsPanel.add(callLogsLabel, gridBagConstraints);
294 
295  org.openide.awt.Mnemonics.setLocalizedText(thumbnailCntLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.thumbnailCntLabel.text")); // NOI18N
296  gridBagConstraints = new java.awt.GridBagConstraints();
297  gridBagConstraints.gridx = 0;
298  gridBagConstraints.gridy = 2;
299  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
300  gridBagConstraints.insets = new java.awt.Insets(0, 15, 9, 15);
301  countsPanel.add(thumbnailCntLabel, gridBagConstraints);
302 
303  org.openide.awt.Mnemonics.setLocalizedText(thumbnailsDataLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.thumbnailsDataLabel.text")); // NOI18N
304  gridBagConstraints = new java.awt.GridBagConstraints();
305  gridBagConstraints.gridx = 1;
306  gridBagConstraints.gridy = 2;
307  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
308  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 15);
309  countsPanel.add(thumbnailsDataLabel, gridBagConstraints);
310 
311  org.openide.awt.Mnemonics.setLocalizedText(messagesDataLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.messagesDataLabel.text")); // NOI18N
312  gridBagConstraints = new java.awt.GridBagConstraints();
313  gridBagConstraints.gridx = 1;
314  gridBagConstraints.gridy = 0;
315  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
316  gridBagConstraints.weightx = 1.0;
317  gridBagConstraints.insets = new java.awt.Insets(9, 0, 9, 15);
318  countsPanel.add(messagesDataLabel, gridBagConstraints);
319 
320  org.openide.awt.Mnemonics.setLocalizedText(callLogsDataLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.callLogsDataLabel.text")); // NOI18N
321  gridBagConstraints = new java.awt.GridBagConstraints();
322  gridBagConstraints.gridx = 1;
323  gridBagConstraints.gridy = 1;
324  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
325  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 15);
326  countsPanel.add(callLogsDataLabel, gridBagConstraints);
327 
328  org.openide.awt.Mnemonics.setLocalizedText(attachmentsLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.attachmentsLabel.text")); // NOI18N
329  gridBagConstraints = new java.awt.GridBagConstraints();
330  gridBagConstraints.gridx = 0;
331  gridBagConstraints.gridy = 3;
332  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
333  gridBagConstraints.insets = new java.awt.Insets(0, 15, 9, 15);
334  countsPanel.add(attachmentsLabel, gridBagConstraints);
335 
336  org.openide.awt.Mnemonics.setLocalizedText(attachmentDataLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.attachmentDataLabel.text")); // NOI18N
337  gridBagConstraints = new java.awt.GridBagConstraints();
338  gridBagConstraints.gridx = 1;
339  gridBagConstraints.gridy = 3;
340  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
341  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 15);
342  countsPanel.add(attachmentDataLabel, gridBagConstraints);
343 
344  gridBagConstraints = new java.awt.GridBagConstraints();
345  gridBagConstraints.gridx = 0;
346  gridBagConstraints.gridy = 1;
347  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
348  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
349  add(countsPanel, gridBagConstraints);
350 
351  contanctsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.contanctsPanel.border.title"))); // NOI18N
352  contanctsPanel.setLayout(new java.awt.GridBagLayout());
353 
354  contactsLabel.setLabelFor(contactsDataLabel);
355  org.openide.awt.Mnemonics.setLocalizedText(contactsLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.contactsLabel.text")); // NOI18N
356  gridBagConstraints = new java.awt.GridBagConstraints();
357  gridBagConstraints.gridx = 0;
358  gridBagConstraints.gridy = 0;
359  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
360  gridBagConstraints.insets = new java.awt.Insets(9, 15, 9, 15);
361  contanctsPanel.add(contactsLabel, gridBagConstraints);
362 
363  org.openide.awt.Mnemonics.setLocalizedText(contactsDataLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.contactsDataLabel.text")); // NOI18N
364  gridBagConstraints = new java.awt.GridBagConstraints();
365  gridBagConstraints.gridx = 1;
366  gridBagConstraints.gridy = 0;
367  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
368  gridBagConstraints.weightx = 1.0;
369  gridBagConstraints.insets = new java.awt.Insets(9, 9, 9, 15);
370  contanctsPanel.add(contactsDataLabel, gridBagConstraints);
371 
373  org.openide.awt.Mnemonics.setLocalizedText(referencesLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.referencesLabel.text")); // NOI18N
374  gridBagConstraints = new java.awt.GridBagConstraints();
375  gridBagConstraints.gridx = 0;
376  gridBagConstraints.gridy = 1;
377  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
378  gridBagConstraints.insets = new java.awt.Insets(0, 15, 9, 0);
379  contanctsPanel.add(referencesLabel, gridBagConstraints);
380 
381  org.openide.awt.Mnemonics.setLocalizedText(referencesDataLabel, org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.referencesDataLabel.text")); // NOI18N
382  gridBagConstraints = new java.awt.GridBagConstraints();
383  gridBagConstraints.gridx = 1;
384  gridBagConstraints.gridy = 1;
385  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
386  gridBagConstraints.insets = new java.awt.Insets(0, 9, 0, 0);
387  contanctsPanel.add(referencesDataLabel, gridBagConstraints);
388 
389  gridBagConstraints = new java.awt.GridBagConstraints();
390  gridBagConstraints.gridx = 0;
391  gridBagConstraints.gridy = 2;
392  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
393  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
394  add(contanctsPanel, gridBagConstraints);
395 
396  fileReferencesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.fileReferencesPanel.border.title"))); // NOI18N
397  gridBagConstraints = new java.awt.GridBagConstraints();
398  gridBagConstraints.gridx = 0;
399  gridBagConstraints.gridy = 3;
400  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
401  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
402  gridBagConstraints.weightx = 1.0;
403  gridBagConstraints.weighty = 1.0;
404  gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 0);
405  add(fileReferencesPanel, gridBagConstraints);
406 
407  caseReferencesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(SummaryViewer.class, "SummaryViewer.caseReferencesPanel.border.title"))); // NOI18N
408  gridBagConstraints = new java.awt.GridBagConstraints();
409  gridBagConstraints.gridx = 0;
410  gridBagConstraints.gridy = 4;
411  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
412  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
413  gridBagConstraints.weightx = 1.0;
414  gridBagConstraints.weighty = 1.0;
415  gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 0);
416  add(caseReferencesPanel, gridBagConstraints);
417  }// </editor-fold>//GEN-END:initComponents
418 
419 
420  // Variables declaration - do not modify//GEN-BEGIN:variables
421  private javax.swing.JLabel accountCountry;
422  private javax.swing.JLabel accountLabel;
423  private javax.swing.JLabel accoutDescriptionLabel;
424  private javax.swing.JLabel attachmentDataLabel;
425  private javax.swing.JLabel attachmentsLabel;
426  private javax.swing.JLabel callLogsDataLabel;
427  private javax.swing.JLabel callLogsLabel;
429  private javax.swing.JLabel contactsDataLabel;
430  private javax.swing.JLabel contactsLabel;
431  private javax.swing.JPanel contanctsPanel;
432  private javax.swing.JPanel countsPanel;
434  private javax.swing.JLabel messagesDataLabel;
435  private javax.swing.JLabel messagesLabel;
436  private javax.swing.JLabel referencesDataLabel;
437  private javax.swing.JLabel referencesLabel;
438  private javax.swing.JPanel summaryPanel;
439  private javax.swing.JLabel thumbnailCntLabel;
440  private javax.swing.JLabel thumbnailsDataLabel;
441  // End of variables declaration//GEN-END:variables
442 
443 }
org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel caseReferencesPanel
org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel fileReferencesPanel

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