19 package org.sleuthkit.autopsy.timeline;
21 import java.beans.PropertyVetoException;
22 import java.util.List;
23 import java.util.logging.Level;
24 import java.util.stream.Collectors;
25 import javafx.application.Platform;
26 import javafx.beans.InvalidationListener;
27 import javafx.beans.Observable;
28 import javafx.scene.Scene;
29 import javafx.scene.control.SplitPane;
30 import javafx.scene.control.Tab;
31 import javafx.scene.control.TabPane;
32 import javafx.scene.image.ImageView;
33 import javafx.scene.input.KeyCode;
34 import javafx.scene.input.KeyCodeCombination;
35 import javafx.scene.input.KeyEvent;
36 import javafx.scene.layout.Priority;
37 import javafx.scene.layout.VBox;
38 import javax.swing.JComponent;
39 import javax.swing.SwingUtilities;
40 import org.controlsfx.control.Notifications;
41 import org.joda.time.Interval;
42 import org.joda.time.format.DateTimeFormatter;
43 import org.openide.explorer.ExplorerManager;
44 import org.openide.explorer.ExplorerUtils;
45 import org.openide.nodes.AbstractNode;
46 import org.openide.nodes.Children;
47 import org.openide.nodes.Node;
48 import org.openide.util.NbBundle;
49 import org.openide.windows.Mode;
50 import org.openide.windows.RetainLocation;
51 import org.openide.windows.TopComponent;
52 import org.openide.windows.WindowManager;
75 @TopComponent.Description(
76 preferredID =
"TimeLineTopComponent",
78 persistenceType = TopComponent.PERSISTENCE_NEVER)
79 @TopComponent.Registration(mode =
"timeline", openAtStartup =
false)
80 @RetainLocation(
"timeline")
92 private final ExplorerManager em = new ExplorerManager();
100 @NbBundle.Messages({
"TimelineTopComponent.selectedEventListener.errorMsg=There was a problem getting the content for the selected event."})
101 private final InvalidationListener selectedEventsListener =
new InvalidationListener() {
103 public void invalidated(Observable observable) {
107 switch (controller.getViewMode()) {
112 for (
int i = 0; i < selectedEventIDs.size(); i++) {
115 Children children =
new Children.Array();
116 children.add(childArray);
118 SwingUtilities.invokeLater(() -> {
120 em.setRootContext(
new AbstractNode(children));
123 em.setSelectedNodes(childArray);
124 }
catch (PropertyVetoException ex) {
126 LOGGER.log(Level.SEVERE,
"Selecting the event node was vetoed.", ex);
129 if (childArray.length == 1) {
130 contentViewerPanel.setNode(childArray[0]);
132 contentViewerPanel.setNode(null);
135 }
catch (IllegalStateException ex) {
137 LOGGER.log(Level.SEVERE,
"There was no case open to lookup the Sleuthkit object backing a SingleEvent.", ex);
138 }
catch (TskCoreException ex) {
139 LOGGER.log(Level.SEVERE,
"Failed to lookup Sleuthkit object backing a SingleEvent.", ex);
140 Platform.runLater(() -> {
141 Notifications.create()
142 .owner(jFXViewPanel.getScene().getWindow())
143 .text(Bundle.TimelineTopComponent_selectedEventListener_errorMsg())
153 SwingUtilities.invokeLater(() -> {
154 dataResultPanel.setPath(getResultViewerSummaryString());
155 dataResultPanel.setNode(tableFilterNode);
159 throw new UnsupportedOperationException(
"Unknown view mode: " + controller.getViewMode());
165 switch (controller.getViewMode()) {
172 SwingUtilities.invokeLater(() -> {
173 splitYPane.remove(contentViewerPanel);
174 if ((horizontalSplitPane.getParent() == splitYPane) ==
false) {
175 splitYPane.setBottomComponent(horizontalSplitPane);
176 horizontalSplitPane.setRightComponent(contentViewerPanel);
185 SwingUtilities.invokeLater(() -> splitYPane.setBottomComponent(contentViewerPanel));
188 throw new UnsupportedOperationException(
"Unknown ViewMode: " + controller.getViewMode());
199 associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
205 this.controller = controller;
212 horizontalSplitPane.setLeftComponent(dataResultPanel);
213 horizontalSplitPane.setRightComponent(contentViewerPanel);
215 dataResultPanel.
open();
217 Platform.runLater(this::initFXComponents);
232 "TimeLineTopComponent.eventsTab.name=Events",
233 "TimeLineTopComponent.filterTab.name=Filters"})
234 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
235 void initFXComponents() {
237 final TimeZonePanel timeZonePanel =
new TimeZonePanel();
238 VBox.setVgrow(timeZonePanel, Priority.SOMETIMES);
239 HistoryToolBar historyToolBar =
new HistoryToolBar(controller);
240 final ZoomSettingsPane zoomSettingsPane =
new ZoomSettingsPane(controller);
243 final Tab filterTab =
new Tab(Bundle.TimeLineTopComponent_filterTab_name(),
new FilterSetPanel(controller));
244 filterTab.setClosable(
false);
245 filterTab.setGraphic(
new ImageView(
"org/sleuthkit/autopsy/timeline/images/funnel.png"));
248 final EventsTree eventsTree =
new EventsTree(controller);
249 final Tab eventsTreeTab =
new Tab(Bundle.TimeLineTopComponent_eventsTab_name(), eventsTree);
250 eventsTreeTab.setClosable(
false);
251 eventsTreeTab.setGraphic(
new ImageView(
"org/sleuthkit/autopsy/timeline/images/timeline_marker.png"));
252 eventsTreeTab.disableProperty().bind(controller.viewModeProperty().isNotEqualTo(ViewMode.DETAIL));
254 final TabPane leftTabPane =
new TabPane(filterTab, eventsTreeTab);
255 VBox.setVgrow(leftTabPane, Priority.ALWAYS);
256 controller.viewModeProperty().addListener(viewMode -> {
257 if (controller.getViewMode().equals(ViewMode.DETAIL) ==
false) {
259 leftTabPane.getSelectionModel().select(filterTab);
264 final VBox leftVBox =
new VBox(5, timeZonePanel, historyToolBar, zoomSettingsPane, leftTabPane);
265 SplitPane.setResizableWithParent(leftVBox, Boolean.FALSE);
267 final ViewFrame viewFrame =
new ViewFrame(controller, eventsTree);
268 final SplitPane mainSplitPane =
new SplitPane(leftVBox, viewFrame);
269 mainSplitPane.setDividerPositions(0);
271 final Scene scene =
new Scene(mainSplitPane);
272 scene.addEventFilter(KeyEvent.KEY_PRESSED, keyEvent -> {
273 if (new KeyCodeCombination(KeyCode.LEFT, KeyCodeCombination.ALT_DOWN).match(keyEvent)) {
274 new Back(controller).handle(null);
275 }
else if (
new KeyCodeCombination(KeyCode.BACK_SPACE).match(keyEvent)) {
276 new Back(controller).handle(null);
277 }
else if (
new KeyCodeCombination(KeyCode.RIGHT, KeyCodeCombination.ALT_DOWN).match(keyEvent)) {
278 new Forward(controller).handle(null);
279 }
else if (
new KeyCodeCombination(KeyCode.BACK_SPACE, KeyCodeCombination.SHIFT_DOWN).match(keyEvent)) {
280 new Forward(controller).handle(null);
285 jFXViewPanel.setScene(scene);
286 jFXstatusPanel.setScene(
new Scene(
new StatusBar(controller)));
296 return modes.stream().filter(mode -> mode.getName().equals(
"timeline") || mode.getName().equals(
"ImageGallery"))
297 .collect(Collectors.toList());
308 jFXstatusPanel =
new javafx.embed.swing.JFXPanel();
309 splitYPane =
new javax.swing.JSplitPane();
310 jFXViewPanel =
new javafx.embed.swing.JFXPanel();
311 horizontalSplitPane =
new javax.swing.JSplitPane();
312 leftFillerPanel =
new javax.swing.JPanel();
313 rightfillerPanel =
new javax.swing.JPanel();
315 jFXstatusPanel.setPreferredSize(
new java.awt.Dimension(100, 16));
317 splitYPane.setDividerLocation(420);
318 splitYPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
319 splitYPane.setResizeWeight(0.9);
320 splitYPane.setPreferredSize(
new java.awt.Dimension(1024, 400));
321 splitYPane.setLeftComponent(jFXViewPanel);
323 horizontalSplitPane.setDividerLocation(600);
324 horizontalSplitPane.setResizeWeight(0.5);
325 horizontalSplitPane.setPreferredSize(
new java.awt.Dimension(1200, 300));
326 horizontalSplitPane.setRequestFocusEnabled(
false);
328 javax.swing.GroupLayout leftFillerPanelLayout =
new javax.swing.GroupLayout(leftFillerPanel);
329 leftFillerPanel.setLayout(leftFillerPanelLayout);
330 leftFillerPanelLayout.setHorizontalGroup(
331 leftFillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
332 .addGap(0, 599, Short.MAX_VALUE)
334 leftFillerPanelLayout.setVerticalGroup(
335 leftFillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
336 .addGap(0, 54, Short.MAX_VALUE)
339 horizontalSplitPane.setLeftComponent(leftFillerPanel);
341 javax.swing.GroupLayout rightfillerPanelLayout =
new javax.swing.GroupLayout(rightfillerPanel);
342 rightfillerPanel.setLayout(rightfillerPanelLayout);
343 rightfillerPanelLayout.setHorizontalGroup(
344 rightfillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
345 .addGap(0, 364, Short.MAX_VALUE)
347 rightfillerPanelLayout.setVerticalGroup(
348 rightfillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
349 .addGap(0, 54, Short.MAX_VALUE)
352 horizontalSplitPane.setRightComponent(rightfillerPanel);
354 splitYPane.setRightComponent(horizontalSplitPane);
356 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
357 this.setLayout(layout);
358 layout.setHorizontalGroup(
359 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
360 .addComponent(splitYPane, javax.swing.GroupLayout.DEFAULT_SIZE, 972, Short.MAX_VALUE)
361 .addComponent(jFXstatusPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
363 layout.setVerticalGroup(
364 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
365 .addGroup(layout.createSequentialGroup()
366 .addComponent(splitYPane, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)
368 .addComponent(jFXstatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
383 super.componentOpened();
384 WindowManager.getDefault().setTopComponentFloating(
this,
true);
399 "# {0} - start of date range",
400 "# {1} - end of date range",
401 "TimeLineResultView.startDateToEndDate.text={0} to {1}"})
403 Interval selectedTimeRange = controller.getSelectedTimeRange();
404 if (selectedTimeRange == null) {
408 String start = selectedTimeRange.getStart()
410 .toString(zonedFormatter);
411 String end = selectedTimeRange.getEnd()
413 .toString(zonedFormatter);
414 return Bundle.TimeLineResultView_startDateToEndDate_text(start, end);
TimeLineTopComponent(TimeLineController controller)
static final KeyStroke BOOKMARK_SHORTCUT
static EventNode createEventNode(final Long eventID, FilteredEventsModel eventsModel)
static ReadOnlyObjectProperty< TimeZone > getTimeZone()
String getResultViewerSummaryString()
javafx.embed.swing.JFXPanel jFXstatusPanel
javax.swing.JSplitPane splitYPane
List< Mode > availableModes(List< Mode > modes)
static DataContentPanel createInstance()
javafx.embed.swing.JFXPanel jFXViewPanel
synchronized ObservableList< Long > getSelectedEventIDs()
static DateTimeZone getJodaTimeZone()
static DataResultPanel createInstanceUninitialized(String title, String pathText, Node rootNode, int totalMatches, DataContent customContentView)
javax.swing.JSplitPane horizontalSplitPane
synchronized ReadOnlyObjectProperty< ViewMode > viewModeProperty()
ExplorerManager getExplorerManager()
synchronized static Logger getLogger(String name)
static DateTimeFormatter getZonedFormatter()
javax.swing.JPanel rightfillerPanel
javax.swing.JPanel leftFillerPanel