Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TimeLineTopComponent.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-15 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.timeline;
20 
21 import java.awt.BorderLayout;
22 import java.util.Collections;
23 import java.util.List;
24 import javafx.application.Platform;
25 import javafx.beans.Observable;
26 import javafx.embed.swing.JFXPanel;
27 import javafx.scene.Scene;
28 import javafx.scene.control.SplitPane;
29 import javafx.scene.control.Tab;
30 import javafx.scene.control.TabPane;
31 import javafx.scene.image.ImageView;
32 import javafx.scene.input.KeyCode;
33 import javafx.scene.input.KeyCodeCombination;
34 import javafx.scene.input.KeyEvent;
35 import javafx.scene.layout.Priority;
36 import javafx.scene.layout.VBox;
37 import org.openide.explorer.ExplorerManager;
38 import org.openide.explorer.ExplorerUtils;
39 import org.openide.util.NbBundle;
40 import org.openide.windows.Mode;
41 import org.openide.windows.TopComponent;
42 import static org.openide.windows.TopComponent.PROP_UNDOCKING_DISABLED;
43 import org.openide.windows.WindowManager;
56 
60 @TopComponent.Description(
61  preferredID = "TimeLineTopComponent",
62  //iconBase="SET/PATH/TO/ICON/HERE",
63  persistenceType = TopComponent.PERSISTENCE_NEVER)
64 @TopComponent.Registration(mode = "timeline", openAtStartup = false)
65 public final class TimeLineTopComponent extends TopComponent implements ExplorerManager.Provider {
66 
67  private static final Logger LOGGER = Logger.getLogger(TimeLineTopComponent.class.getName());
68 
70 
71  private final TimeLineResultView tlrv;
72 
73  private final ExplorerManager em = new ExplorerManager();
74 
76 
79  this.controller = controller;
80  associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
81 
82  setName(NbBundle.getMessage(TimeLineTopComponent.class, "CTL_TimeLineTopComponent"));
83  setToolTipText(NbBundle.getMessage(TimeLineTopComponent.class, "HINT_TimeLineTopComponent"));
84  setIcon(WindowManager.getDefault().getMainWindow().getIconImage()); //use the same icon as main application
85 
86  dataContentPanel = DataContentPanel.createInstance();
87  this.contentViewerContainerPanel.add(dataContentPanel, BorderLayout.CENTER);
88  tlrv = new TimeLineResultView(controller, dataContentPanel);
89  DataResultPanel dataResultPanel = tlrv.getDataResultPanel();
90  this.resultContainerPanel.add(dataResultPanel, BorderLayout.CENTER);
91  dataResultPanel.open();
92  customizeFXComponents();
93  }
94 
95  @NbBundle.Messages({"TimeLineTopComponent.eventsTab.name=Events",
96  "TimeLineTopComponent.filterTab.name=Filters"})
97  void customizeFXComponents() {
98  Platform.runLater(() -> {
99 
100  //create and wire up jfx componenets that make up the interface
101  final Tab filterTab = new Tab(Bundle.TimeLineTopComponent_filterTab_name(), new FilterSetPanel(controller));
102  filterTab.setClosable(false);
103  filterTab.setGraphic(new ImageView("org/sleuthkit/autopsy/timeline/images/funnel.png")); // NON-NLS
104 
105  final EventsTree eventsTree = new EventsTree(controller);
106  final VisualizationPanel visualizationPanel = new VisualizationPanel(controller, eventsTree);
107  final Tab eventsTreeTab = new Tab(Bundle.TimeLineTopComponent_eventsTab_name(), eventsTree);
108  eventsTreeTab.setClosable(false);
109  eventsTreeTab.setGraphic(new ImageView("org/sleuthkit/autopsy/timeline/images/timeline_marker.png")); // NON-NLS
110  eventsTreeTab.disableProperty().bind(controller.viewModeProperty().isEqualTo(VisualizationMode.COUNTS));
111 
112  final TabPane leftTabPane = new TabPane(filterTab, eventsTreeTab);
113  VBox.setVgrow(leftTabPane, Priority.ALWAYS);
114  controller.viewModeProperty().addListener((Observable observable) -> {
115  if (controller.viewModeProperty().get().equals(VisualizationMode.COUNTS)) {
116  //if view mode is counts, make sure events tabd is not active
117  leftTabPane.getSelectionModel().select(filterTab);
118  }
119  });
120 
121  final TimeZonePanel timeZonePanel = new TimeZonePanel();
122  VBox.setVgrow(timeZonePanel, Priority.SOMETIMES);
123 
124  final ZoomSettingsPane zoomSettingsPane = new ZoomSettingsPane(controller);
125 
126  final VBox leftVBox = new VBox(5, timeZonePanel, zoomSettingsPane, leftTabPane);
127  SplitPane.setResizableWithParent(leftVBox, Boolean.FALSE);
128 
129  final SplitPane mainSplitPane = new SplitPane(leftVBox, visualizationPanel);
130  mainSplitPane.setDividerPositions(0);
131 
132  final Scene scene = new Scene(mainSplitPane);
133  scene.addEventFilter(KeyEvent.KEY_PRESSED,
134  (KeyEvent event) -> {
135  if (new KeyCodeCombination(KeyCode.LEFT, KeyCodeCombination.ALT_DOWN).match(event)) {
136  new Back(controller).handle(null);
137  } else if (new KeyCodeCombination(KeyCode.BACK_SPACE).match(event)) {
138  new Back(controller).handle(null);
139  } else if (new KeyCodeCombination(KeyCode.RIGHT, KeyCodeCombination.ALT_DOWN).match(event)) {
140  new Forward(controller).handle(null);
141  } else if (new KeyCodeCombination(KeyCode.BACK_SPACE, KeyCodeCombination.SHIFT_DOWN).match(event)) {
142  new Forward(controller).handle(null);
143  }
144  });
145 
146  //add ui componenets to JFXPanels
147  jFXVizPanel.setScene(scene);
148  jFXstatusPanel.setScene(new Scene(new StatusBar(controller)));
149 
150  });
151  }
152 
153  @Override
154  public List<Mode> availableModes(List<Mode> modes) {
155  return Collections.emptyList();
156  }
157 
163  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
164  private void initComponents() {
165 
166  jFXstatusPanel = new JFXPanel();
167  splitYPane = new javax.swing.JSplitPane();
168  jFXVizPanel = new JFXPanel();
169  lowerSplitXPane = new javax.swing.JSplitPane();
170  resultContainerPanel = new javax.swing.JPanel();
171  contentViewerContainerPanel = new javax.swing.JPanel();
172 
173  jFXstatusPanel.setPreferredSize(new java.awt.Dimension(100, 16));
174 
175  splitYPane.setDividerLocation(420);
176  splitYPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
177  splitYPane.setResizeWeight(0.9);
178  splitYPane.setPreferredSize(new java.awt.Dimension(1024, 400));
179  splitYPane.setLeftComponent(jFXVizPanel);
180 
181  lowerSplitXPane.setDividerLocation(600);
182  lowerSplitXPane.setResizeWeight(0.5);
183  lowerSplitXPane.setPreferredSize(new java.awt.Dimension(1200, 300));
184  lowerSplitXPane.setRequestFocusEnabled(false);
185 
186  resultContainerPanel.setPreferredSize(new java.awt.Dimension(700, 300));
187  resultContainerPanel.setLayout(new java.awt.BorderLayout());
188  lowerSplitXPane.setLeftComponent(resultContainerPanel);
189 
190  contentViewerContainerPanel.setPreferredSize(new java.awt.Dimension(500, 300));
191  contentViewerContainerPanel.setLayout(new java.awt.BorderLayout());
192  lowerSplitXPane.setRightComponent(contentViewerContainerPanel);
193 
194  splitYPane.setRightComponent(lowerSplitXPane);
195 
196  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
197  this.setLayout(layout);
198  layout.setHorizontalGroup(
199  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
200  .addComponent(splitYPane, javax.swing.GroupLayout.DEFAULT_SIZE, 972, Short.MAX_VALUE)
201  .addGroup(layout.createSequentialGroup()
202  .addGap(0, 0, 0)
203  .addComponent(jFXstatusPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
204  .addGap(0, 0, 0))
205  );
206  layout.setVerticalGroup(
207  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
208  .addGroup(layout.createSequentialGroup()
209  .addComponent(splitYPane, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)
210  .addGap(0, 0, 0)
211  .addComponent(jFXstatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
212  );
213  }// </editor-fold>//GEN-END:initComponents
214 
215  // Variables declaration - do not modify//GEN-BEGIN:variables
216  private javax.swing.JPanel contentViewerContainerPanel;
217  private javafx.embed.swing.JFXPanel jFXVizPanel;
218  private javafx.embed.swing.JFXPanel jFXstatusPanel;
219  private javax.swing.JSplitPane lowerSplitXPane;
220  private javax.swing.JPanel resultContainerPanel;
221  private javax.swing.JSplitPane splitYPane;
222  // End of variables declaration//GEN-END:variables
223 
224  @Override
225  public void componentOpened() {
226  WindowManager.getDefault().setTopComponentFloating(this, true);
227  putClientProperty(PROP_UNDOCKING_DISABLED, true);
228  }
229 
230  @Override
231  public void componentClosed() {
232  // TODO add custom code on component closing
233  }
234 
235  void writeProperties(java.util.Properties p) {
236  // better to version settings since initial version as advocated at
237  // http://wiki.apidesign.org/wiki/PropertyFiles
238  p.setProperty("version", "1.0");
239  // TODO store your settings
240  }
241 
242  void readProperties(java.util.Properties p) {
243  String version = p.getProperty("version");
244  // TODO read your settings according to their version
245  }
246 
247  @Override
248  public ExplorerManager getExplorerManager() {
249  return em;
250  }
251 }
synchronized ReadOnlyObjectProperty< VisualizationMode > viewModeProperty()
synchronized static Logger getLogger(String name)
Definition: Logger.java:166

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.