Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
ZoomOut.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2015-2018 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 ZoomOut extends Action {
37 
38  final private static Logger logger = Logger.getLogger(ZoomOut.class.getName());
39 
40  private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png"); //NOI18N NON-NLS
41 
42  @NbBundle.Messages({"ZoomOut.longText=Zoom out to view about 50% more time.",
43  "ZoomOut.action.text=Zoom out",
44  "ZoomOut.errorMessage=Error zooming out.",
45  "ZoomOut.disabledProperty.errorMessage=Error getting spanning interval."})
46  public ZoomOut(TimeLineController controller) {
47  super(Bundle.ZoomOut_action_text());
48  setLongText(Bundle.ZoomOut_longText());
49  setGraphic(new ImageView(MAGNIFIER_OUT));
50  setEventHandler(actionEvent -> {
51  try {
52  controller.pushZoomOutTime();
53  } catch (TskCoreException ex) {
54  new Alert(Alert.AlertType.ERROR, Bundle.ZoomOut_errorMessage()).showAndWait();
55  logger.log(Level.SEVERE, "Error zooming out.", ex);
56  }
57  });
58 
59  //disable action when the current time range already encompases the entire case.
60  disabledProperty().bind(new BooleanBinding() {
61  private final EventsModel eventsModel = controller.getEventsModel();
62 
63  {
64  bind(eventsModel.modelParamsProperty(), eventsModel.timeRangeProperty());
65  }
66 
67  @Override
68  protected boolean computeValue() {
69  try {
70  return eventsModel.getTimeRange().contains(eventsModel.getSpanningInterval());
71  } catch (TskCoreException ex) {
72  new Alert(Alert.AlertType.ERROR, Bundle.ZoomOut_disabledProperty_errorMessage()).showAndWait();
73  logger.log(Level.SEVERE, "Error getting spanning interval.", ex);
74  return true;
75  }
76  }
77  });
78  }
79 }
final ReadOnlyObjectWrapper< Interval > timeRangeProperty
Interval getSpanningInterval(DateTimeZone timeZone)
ZoomOut(TimeLineController controller)
Definition: ZoomOut.java:46
final ReadOnlyObjectWrapper< EventsModelParams > modelParamsProperty
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Tue Jun 27 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.