Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CallLogViewer.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.communications.relationships;
20 
21 import javax.swing.JPanel;
22 import org.netbeans.swing.outline.DefaultOutlineModel;
23 import org.netbeans.swing.outline.Outline;
24 import org.openide.nodes.AbstractNode;
25 import org.openide.nodes.Children;
26 import org.openide.nodes.NodeAdapter;
27 import org.openide.nodes.NodeMemberEvent;
28 import org.openide.util.Lookup;
29 import org.openide.util.NbBundle.Messages;
32 import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER;
33 import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START;
34 import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION;
35 
40 final class CallLogViewer extends javax.swing.JPanel implements RelationshipsViewer {
41 
42  private final CallLogsChildNodeFactory nodeFactory;
43 
44  @Messages({
45  "CallLogViewer_title=Call Logs",
46  "CallLogViewer_noCallLogs=<No call logs found for selected account>",
47  "CallLogViewer_recipient_label=To/From",
48  "CallLogViewer_duration_label=Duration(seconds)",
49  "CallLogViewer_device_label=Device"
50  })
51 
55  public CallLogViewer() {
56  initComponents();
57 
58  nodeFactory = new CallLogsChildNodeFactory(null);
59  outlineViewPanel.hideOutlineView(Bundle.CallLogViewer_noCallLogs());
60 
61  outlineViewPanel.getOutlineView().setPropertyColumns(
62  TSK_DIRECTION.getLabel(), TSK_DIRECTION.getDisplayName(),
63  TSK_PHONE_NUMBER.getLabel(), Bundle.CallLogViewer_recipient_label(),
64  TSK_DATETIME_START.getLabel(), TSK_DATETIME_START.getDisplayName(),
65  CallLogNode.DURATION_PROP, Bundle.CallLogViewer_duration_label()
66  );
67 
68  Outline outline = outlineViewPanel.getOutlineView().getOutline();
69  outline.setRootVisible(false);
70  ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.CallLogViewer_device_label());
71 
72  outlineViewPanel.getExplorerManager().setRootContext(
73  new TableFilterNode(
74  new DataResultFilterNode(
75  new AbstractNode(Children.create(nodeFactory, true)), outlineViewPanel.getExplorerManager()), true));
76 
77  outlineViewPanel.getExplorerManager().getRootContext().addNodeListener(new NodeAdapter(){
78  @Override
79  public void childrenAdded(NodeMemberEvent nme) {
80  updateOutlineViewPanel();
81  }
82 
83  @Override
84  public void childrenRemoved(NodeMemberEvent nme) {
85  updateOutlineViewPanel();
86  }
87  });
88 
89  }
90 
96  @SuppressWarnings("unchecked")
97  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
98  private void initComponents() {
99  java.awt.GridBagConstraints gridBagConstraints;
100 
102 
103  setLayout(new java.awt.GridBagLayout());
104  gridBagConstraints = new java.awt.GridBagConstraints();
105  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
106  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
107  gridBagConstraints.weightx = 1.0;
108  gridBagConstraints.weighty = 1.0;
109  gridBagConstraints.insets = new java.awt.Insets(15, 15, 15, 15);
110  add(outlineViewPanel, gridBagConstraints);
111  }// </editor-fold>//GEN-END:initComponents
112 
113  @Override
114  public String getDisplayName() {
115  return Bundle.CallLogViewer_title();
116  }
117 
118  @Override
119  public JPanel getPanel() {
120  return this;
121  }
122 
123  @Override
124  public void setSelectionInfo(SelectionInfo info) {
125  nodeFactory.refresh(info);
126  }
127 
128  @Override
129  public Lookup getLookup() {
130  return outlineViewPanel.getLookup();
131  }
132 
133  private void updateOutlineViewPanel() {
134  int nodeCount = outlineViewPanel.getExplorerManager().getRootContext().getChildren().getNodesCount();
135  if(nodeCount == 0) {
136  outlineViewPanel.hideOutlineView(Bundle.ContactsViewer_noContacts_message());
137  } else {
138  outlineViewPanel.showOutlineView();
139  }
140  }
141 
142 
143  // Variables declaration - do not modify//GEN-BEGIN:variables
145  // End of variables declaration//GEN-END:variables
146 }

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.