Autopsy  3.1
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 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.event.ActionEvent;
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.netbeans.api.settings.ConvertAsProperties;
38 import org.openide.explorer.ExplorerManager;
39 import org.openide.explorer.ExplorerUtils;
40 import org.openide.util.NbBundle;
41 import org.openide.windows.Mode;
42 import org.openide.windows.TopComponent;
43 import static org.openide.windows.TopComponent.PROP_UNDOCKING_DISABLED;
44 import org.openide.windows.WindowManager;
57 
61 @ConvertAsProperties(
62  dtd = "-//org.sleuthkit.autopsy.timeline//TimeLine//EN",
63  autostore = false)
64 @TopComponent.Description(
65  preferredID = "TimeLineTopComponent",
66  //iconBase="SET/PATH/TO/ICON/HERE",
67  persistenceType = TopComponent.PERSISTENCE_NEVER)
68 @TopComponent.Registration(mode = "timeline", openAtStartup = false)
69 public final class TimeLineTopComponent extends TopComponent implements ExplorerManager.Provider, TimeLineUI {
70 
71  private static final Logger LOGGER = Logger.getLogger(TimeLineTopComponent.class.getName());
72 
74 
76 
77  private final ExplorerManager em = new ExplorerManager();
78 
80 
83 
84  private final Tab eventsTab = new Tab(
85  NbBundle.getMessage(TimeLineTopComponent.class, "TimeLineTopComponent.eventsTab.name"));
86 
87  private final Tab filterTab = new Tab(
88  NbBundle.getMessage(TimeLineTopComponent.class, "TimeLineTopComponent.filterTab.name"));
89 
90  private final VBox leftVBox = new VBox(5);
91 
92  private final NavPanel navPanel = new NavPanel();
93 
94  private final StatusBar statusBar = new StatusBar();
95 
96  private final TabPane tabPane = new TabPane();
97 
99 
101 
102  private final SplitPane splitPane = new SplitPane();
103 
105 
107  initComponents();
108 
109  associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
110 
111  setName(NbBundle.getMessage(TimeLineTopComponent.class, "CTL_TimeLineTopComponent"));
112  setToolTipText(NbBundle.getMessage(TimeLineTopComponent.class, "HINT_TimeLineTopComponent"));
113  setIcon(WindowManager.getDefault().getMainWindow().getIconImage()); //use the same icon as main application
114 
115  timeZonePanel.setText(NbBundle.getMessage(this.getClass(), "TimeLineTopComponent.timeZonePanel.text"));
117  }
118 
119  synchronized private void customizeComponents() {
120 
121  dataContentPanel = DataContentPanel.createInstance();
122  this.contentViewerContainerPanel.add(dataContentPanel, BorderLayout.CENTER);
123  tlrv = new TimeLineResultView(dataContentPanel);
124  DataResultPanel dataResultPanel = tlrv.getDataResultPanel();
125  this.resultContainerPanel.add(dataResultPanel, BorderLayout.CENTER);
126  dataResultPanel.open();
127 
128  Platform.runLater(() -> {
129  //assemble ui componenets together
130  jFXstatusPanel.setScene(new Scene(statusBar));
131 
132  splitPane.setDividerPositions(0);
133  jFXVizPanel.setScene(new Scene(splitPane));
134 
135  filterTab.setClosable(false);
136  filterTab.setContent(filtersPanel);
137  filterTab.setGraphic(new ImageView("org/sleuthkit/autopsy/timeline/images/funnel.png")); // NON-NLS
138 
139  eventsTab.setClosable(false);
140  eventsTab.setContent(navPanel);
141  eventsTab.setGraphic(new ImageView("org/sleuthkit/autopsy/timeline/images/timeline_marker.png")); // NON-NLS
142 
143  tabPane.getTabs().addAll(filterTab, eventsTab);
144  VBox.setVgrow(tabPane, Priority.ALWAYS);
145 
146  VBox.setVgrow(timeZonePanel, Priority.SOMETIMES);
147  leftVBox.getChildren().addAll(timeZonePanel, zoomSettingsPane, tabPane);
148 
149  SplitPane.setResizableWithParent(leftVBox, Boolean.FALSE);
150  splitPane.getItems().addAll(leftVBox, visualizationPanel);
151 
152  });
153  }
154 
155  public synchronized void setController(TimeLineController controller) {
156  this.controller = controller;
157 
158  tlrv.setController(controller);
159  Platform.runLater(() -> {
160  jFXVizPanel.getScene().addEventFilter(KeyEvent.KEY_PRESSED, (
161  KeyEvent event) -> {
162  if (new KeyCodeCombination(KeyCode.LEFT, KeyCodeCombination.ALT_DOWN).match(event)) {
163  new Back(controller).handle(new ActionEvent());
164  } else if (new KeyCodeCombination(KeyCode.BACK_SPACE).match(event)) {
165  new Back(controller).handle(new ActionEvent());
166  } else if (new KeyCodeCombination(KeyCode.RIGHT, KeyCodeCombination.ALT_DOWN).match(event)) {
167  new Forward(controller).handle(new ActionEvent());
168  } else if (new KeyCodeCombination(KeyCode.BACK_SPACE, KeyCodeCombination.SHIFT_DOWN).match(event)) {
169  new Forward(controller).handle(new ActionEvent());
170  }
171  });
172  controller.getViewMode().addListener((Observable observable) -> {
173  if (controller.getViewMode().get().equals(VisualizationMode.COUNTS)) {
174  tabPane.getSelectionModel().select(filterTab);
175  }
176  });
177  eventsTab.disableProperty().bind(controller.getViewMode().isEqualTo(VisualizationMode.COUNTS));
178  visualizationPanel.setController(controller);
179  navPanel.setController(controller);
180  filtersPanel.setController(controller);
181  zoomSettingsPane.setController(controller);
182  statusBar.setController(controller);
183  });
184  }
185 
186  @Override
187  public List<Mode> availableModes(List<Mode> modes) {
188  return Collections.emptyList();
189  }
190 
196  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
197  private void initComponents() {
198 
199  jFXstatusPanel = new javafx.embed.swing.JFXPanel();
200  splitYPane = new javax.swing.JSplitPane();
201  jFXVizPanel = new javafx.embed.swing.JFXPanel();
202  lowerSplitXPane = new javax.swing.JSplitPane();
203  resultContainerPanel = new javax.swing.JPanel();
204  contentViewerContainerPanel = new javax.swing.JPanel();
205 
206  jFXstatusPanel.setPreferredSize(new java.awt.Dimension(100, 16));
207 
208  splitYPane.setDividerLocation(420);
209  splitYPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
210  splitYPane.setResizeWeight(0.9);
211  splitYPane.setPreferredSize(new java.awt.Dimension(1024, 400));
212  splitYPane.setLeftComponent(jFXVizPanel);
213 
214  lowerSplitXPane.setDividerLocation(600);
215  lowerSplitXPane.setResizeWeight(0.5);
216  lowerSplitXPane.setPreferredSize(new java.awt.Dimension(1200, 300));
217  lowerSplitXPane.setRequestFocusEnabled(false);
218 
219  resultContainerPanel.setPreferredSize(new java.awt.Dimension(700, 300));
220  resultContainerPanel.setLayout(new java.awt.BorderLayout());
221  lowerSplitXPane.setLeftComponent(resultContainerPanel);
222 
223  contentViewerContainerPanel.setPreferredSize(new java.awt.Dimension(500, 300));
224  contentViewerContainerPanel.setLayout(new java.awt.BorderLayout());
225  lowerSplitXPane.setRightComponent(contentViewerContainerPanel);
226 
227  splitYPane.setRightComponent(lowerSplitXPane);
228 
229  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
230  this.setLayout(layout);
231  layout.setHorizontalGroup(
232  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
233  .addComponent(splitYPane, javax.swing.GroupLayout.DEFAULT_SIZE, 972, Short.MAX_VALUE)
234  .addGroup(layout.createSequentialGroup()
235  .addGap(0, 0, 0)
236  .addComponent(jFXstatusPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
237  .addGap(0, 0, 0))
238  );
239  layout.setVerticalGroup(
240  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
241  .addGroup(layout.createSequentialGroup()
242  .addComponent(splitYPane, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)
243  .addGap(0, 0, 0)
244  .addComponent(jFXstatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
245  );
246  }// </editor-fold>//GEN-END:initComponents
247 
248  // Variables declaration - do not modify//GEN-BEGIN:variables
249  private javax.swing.JPanel contentViewerContainerPanel;
250  private javafx.embed.swing.JFXPanel jFXVizPanel;
251  private javafx.embed.swing.JFXPanel jFXstatusPanel;
252  private javax.swing.JSplitPane lowerSplitXPane;
253  private javax.swing.JPanel resultContainerPanel;
254  private javax.swing.JSplitPane splitYPane;
255  // End of variables declaration//GEN-END:variables
256 
257  @Override
258  public void componentOpened() {
259  WindowManager.getDefault().setTopComponentFloating(this, true);
260 
261  putClientProperty(PROP_UNDOCKING_DISABLED, true);
262  }
263 
264  @Override
265  public void componentClosed() {
266  // TODO add custom code on component closing
267  }
268 
269  void writeProperties(java.util.Properties p) {
270  // better to version settings since initial version as advocated at
271  // http://wiki.apidesign.org/wiki/PropertyFiles
272  p.setProperty("version", "1.0");
273  // TODO store your settings
274  }
275 
276  void readProperties(java.util.Properties p) {
277  String version = p.getProperty("version");
278  // TODO read your settings according to their version
279  }
280 
281  @Override
282  public ExplorerManager getExplorerManager() {
283  return em;
284  }
285 }
synchronized void setController(TimeLineController controller)
synchronized void setController(TimeLineController controller)
void setController(TimeLineController timeLineController)
synchronized void setController(TimeLineController controller)
void setController(TimeLineController controller)
Definition: NavPanel.java:110
synchronized ReadOnlyObjectProperty< VisualizationMode > getViewMode()
void setController(TimeLineController controller)
Definition: StatusBar.java:76
static Logger getLogger(String name)
Definition: Logger.java:131

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.