Autopsy  4.15.0
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  */
19 package org.sleuthkit.autopsy.timeline.actions;
20 
21 import java.util.logging.Level;
22 import javafx.beans.binding.BooleanBinding;
23 import javafx.scene.control.Alert;
24 import javafx.scene.image.Image;
25 import javafx.scene.image.ImageView;
26 import org.controlsfx.control.action.Action;
27 import org.openide.util.NbBundle;
31 import org.sleuthkit.datamodel.TskCoreException;
32 
36 public 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 }
ZoomToEvents(final TimeLineController controller)
Interval getSpanningInterval(DateTimeZone timeZone)
final ReadOnlyObjectWrapper< EventsModelParams > modelParamsProperty
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

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