Autopsy  4.5.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CVTTopComponent.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2017 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;
20 
21 import java.util.List;
22 import java.util.stream.Collectors;
23 import org.openide.explorer.ExplorerManager;
24 import org.openide.explorer.ExplorerUtils;
25 import org.openide.util.NbBundle;
26 import org.openide.windows.Mode;
27 import org.openide.windows.RetainLocation;
28 import org.openide.windows.TopComponent;
29 import org.openide.windows.WindowManager;
31 
35 @TopComponent.Description(preferredID = "CVTTopComponent", persistenceType = TopComponent.PERSISTENCE_NEVER)
36 @TopComponent.Registration(mode = "cvt", openAtStartup = false)
37 @RetainLocation("cvt")
38 @NbBundle.Messages("CVTTopComponent.name= Communications Visualization")
39 public final class CVTTopComponent extends TopComponent implements ExplorerManager.Provider {
40 
41  private static final long serialVersionUID = 1L;
42  private final ExplorerManager messagesBrowserExplorerManager;
43  private final ExplorerManager acctsBrowserExplorerManager;
44 
46  public CVTTopComponent() {
48  setName(Bundle.CVTTopComponent_name());
49  /*
50  * Associate an explorer manager with the GlobalActionContext (GAC) for
51  * use by the messages browser so that selections in the messages
52  * browser can be exposed to context-sensitive actions.
53  */
54  messagesBrowserExplorerManager = new ExplorerManager();
55  associateLookup(ExplorerUtils.createLookup(messagesBrowserExplorerManager, getActionMap()));
56  splitPane.setRightComponent(new MessageBrowser(messagesBrowserExplorerManager));
57 
58  /*
59  * Create a second explorer manager to be discovered by the accounts
60  * browser and the message browser so that the browsers can both listen
61  * for explorer manager property events for the outline view of the
62  * accounts browser. This provides a mechanism for pushing selected
63  * Nodes from the accounts browser to the messages browser.
64  */
65  acctsBrowserExplorerManager = new ExplorerManager();
66  }
67 
73  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
74  private void initComponents() {
75 
76  splitPane = new javax.swing.JSplitPane();
77  browseVisualizeTabPane = new javax.swing.JTabbedPane();
80 
81  splitPane.setDividerLocation(400);
82  splitPane.setResizeWeight(0.7);
83 
84  browseVisualizeTabPane.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
85  browseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.accountsBrowser.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/table.png")), accountsBrowser); // NOI18N
86 
87  splitPane.setLeftComponent(browseVisualizeTabPane);
88 
89  filtersPane.setMinimumSize(new java.awt.Dimension(256, 495));
90 
91  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
92  this.setLayout(layout);
93  layout.setHorizontalGroup(
94  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
95  .addGroup(layout.createSequentialGroup()
96  .addGap(6, 6, 6)
97  .addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
98  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
99  .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1339, Short.MAX_VALUE)
100  .addGap(0, 0, 0))
101  );
102  layout.setVerticalGroup(
103  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
104  .addGroup(layout.createSequentialGroup()
105  .addGap(6, 6, 6)
106  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
107  .addComponent(filtersPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
108  .addComponent(splitPane))
109  .addGap(5, 5, 5))
110  );
111  }// </editor-fold>//GEN-END:initComponents
112 
113 
114  // Variables declaration - do not modify//GEN-BEGIN:variables
116  private javax.swing.JTabbedPane browseVisualizeTabPane;
118  private javax.swing.JSplitPane splitPane;
119  // End of variables declaration//GEN-END:variables
120 
121  @Override
122  public void componentOpened() {
123  super.componentOpened();
124  WindowManager.getDefault().setTopComponentFloating(this, true);
125  }
126 
127  @Override
128  public ExplorerManager getExplorerManager() {
130  }
131 
132  @Override
133  public void open() {
134  super.open();
135  /*
136  * when the window is (re)opened make sure the filters and accounts are
137  * in an up to date and consistent state.
138  *
139  * Re-applying the filters means we will lose the selection...
140  */
141  filtersPane.updateAndApplyFilters();
142  }
143 
144  @Override
145  public List<Mode> availableModes(List<Mode> modes) {
146  /*
147  * This looks like the right thing to do, but online discussions seems
148  * to indicate this method is effectively deprecated. A break point
149  * placed here was never hit.
150  */
151  return modes.stream().filter(mode -> mode.getName().equals("cvt"))
152  .collect(Collectors.toList());
153  }
154 }
org.sleuthkit.autopsy.communications.AccountsBrowser accountsBrowser
org.sleuthkit.autopsy.communications.FiltersPanel filtersPane

Copyright © 2012-2016 Basis Technology. Generated on: Tue Feb 20 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.