19 package org.sleuthkit.autopsy.communications.relationships;
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;
40 final class CallLogViewer
extends javax.swing.JPanel implements RelationshipsViewer {
42 private final CallLogsChildNodeFactory nodeFactory;
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"
55 public CallLogViewer() {
58 nodeFactory =
new CallLogsChildNodeFactory(null);
59 outlineViewPanel.hideOutlineView(Bundle.CallLogViewer_noCallLogs());
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()
68 Outline outline = outlineViewPanel.getOutlineView().getOutline();
69 outline.setRootVisible(
false);
70 ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.CallLogViewer_device_label());
72 outlineViewPanel.getExplorerManager().setRootContext(
74 new DataResultFilterNode(
75 new AbstractNode(Children.create(nodeFactory,
true)), outlineViewPanel.getExplorerManager()),
true));
77 outlineViewPanel.getExplorerManager().getRootContext().addNodeListener(
new NodeAdapter(){
79 public void childrenAdded(NodeMemberEvent nme) {
80 updateOutlineViewPanel();
84 public void childrenRemoved(NodeMemberEvent nme) {
85 updateOutlineViewPanel();
96 @SuppressWarnings(
"unchecked")
98 private
void initComponents() {
99 java.awt.GridBagConstraints gridBagConstraints;
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);
114 public String getDisplayName() {
115 return Bundle.CallLogViewer_title();
119 public JPanel getPanel() {
124 public void setSelectionInfo(SelectionInfo info) {
125 nodeFactory.refresh(info);
129 public Lookup getLookup() {
130 return outlineViewPanel.getLookup();
133 private void updateOutlineViewPanel() {
134 int nodeCount = outlineViewPanel.getExplorerManager().getRootContext().getChildren().getNodesCount();
136 outlineViewPanel.hideOutlineView(Bundle.ContactsViewer_noContacts_message());
138 outlineViewPanel.showOutlineView();