Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ZoomToEvents.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2014-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 */
19package org.sleuthkit.autopsy.timeline.actions;
20
21import java.util.logging.Level;
22import javafx.beans.binding.BooleanBinding;
23import javafx.scene.control.Alert;
24import javafx.scene.image.Image;
25import javafx.scene.image.ImageView;
26import org.controlsfx.control.action.Action;
27import org.openide.util.NbBundle;
28import org.sleuthkit.autopsy.coreutils.Logger;
29import org.sleuthkit.autopsy.timeline.TimeLineController;
30import org.sleuthkit.autopsy.timeline.EventsModel;
31import org.sleuthkit.datamodel.TskCoreException;
32
36public class ZoomToEvents extends Action {
37
38 private static final Logger logger = Logger.getLogger(ZoomToEvents.class.getName());
39 private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png", 16, 16, true, true); //NOI18N NON-NLS
40
41 @NbBundle.Messages({"ZoomToEvents.action.text=Zoom to events",
42 "ZoomToEvents.longText=Zoom out to show the nearest events.",
43 "ZoomToEvents.disabledProperty.errorMessage=Error getting spanning interval."})
44 public ZoomToEvents(final TimeLineController controller) {
45 super(Bundle.ZoomToEvents_action_text());
46 setLongText(Bundle.ZoomToEvents_longText());
47 setGraphic(new ImageView(MAGNIFIER_OUT));
48 setEventHandler(actionEvent -> {
49 try {
50 controller.zoomOutToActivity();
51 } catch (TskCoreException ex) {
52 logger.log(Level.SEVERE, "Error invoking ZoomToEvents action", ex);
53 new Alert(Alert.AlertType.ERROR, "Error zomming").showAndWait();
54 }
55 });
56
57 //disable action when the current time range already encompases the entire case.
58 disabledProperty().bind(new BooleanBinding() {
59 private final EventsModel eventsModel = controller.getEventsModel();
60
61 {
62 bind(eventsModel.modelParamsProperty());
63 }
64
65 @Override
66 protected boolean computeValue() {
67 try {
68 //TODO: do a db query to see if using this action will actually result in viewable events
69 return eventsModel.getTimeRange().contains(eventsModel.getSpanningInterval());
70 } catch (TskCoreException ex) {
71 new Alert(Alert.AlertType.ERROR, Bundle.ZoomToEvents_disabledProperty_errorMessage()).showAndWait();
72 logger.log(Level.SEVERE, "Error getting spanning interval.", ex);
73 return true;
74 }
75 }
76 });
77 }
78}
synchronized static Logger getLogger(String name)
Definition Logger.java:124
Interval getSpanningInterval(DateTimeZone timeZone)
final ReadOnlyObjectWrapper< EventsModelParams > modelParamsProperty
ZoomToEvents(final TimeLineController controller)

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.