mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
fix stack overflow when zooming way out by disabling zooming out further than the entire case... other minor cleanup
This commit is contained in:
parent
3c235d9bac
commit
91f79a3a06
@ -3,4 +3,3 @@ DefaultFilters.action.name.text=apply default filters
|
|||||||
Forward.action.name.text=Forward
|
Forward.action.name.text=Forward
|
||||||
SaveSnapshot.action.name.text=save snapshot
|
SaveSnapshot.action.name.text=save snapshot
|
||||||
SaveSnapshot.fileChoose.title.text=Save snapshot to
|
SaveSnapshot.fileChoose.title.text=Save snapshot to
|
||||||
ZoomOut.action.name.text=apply default filters
|
|
44
Core/src/org/sleuthkit/autopsy/timeline/actions/ZoomIn.java
Normal file
44
Core/src/org/sleuthkit/autopsy/timeline/actions/ZoomIn.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2015 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.timeline.actions;
|
||||||
|
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import org.controlsfx.control.action.Action;
|
||||||
|
import org.openide.util.NbBundle;
|
||||||
|
import org.sleuthkit.autopsy.timeline.TimeLineController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ZoomIn extends Action {
|
||||||
|
|
||||||
|
private static final Image MAGNIFIER_IN = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-in-green.png"); //NOI18N
|
||||||
|
|
||||||
|
@NbBundle.Messages({"ZoomIn.longText=Zoom in to view half as much time.",
|
||||||
|
"ZoomIn.action.text=Zoom in"})
|
||||||
|
public ZoomIn(TimeLineController controller) {
|
||||||
|
super(Bundle.ZoomIn_action_text());
|
||||||
|
setLongText(Bundle.ZoomIn_longText());
|
||||||
|
setGraphic(new ImageView(MAGNIFIER_IN));
|
||||||
|
setEventHandler(actionEvent -> {
|
||||||
|
controller.pushZoomInTime();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2014 Basis Technology Corp.
|
* Copyright 2015 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -19,7 +19,8 @@
|
|||||||
package org.sleuthkit.autopsy.timeline.actions;
|
package org.sleuthkit.autopsy.timeline.actions;
|
||||||
|
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
import org.controlsfx.control.action.Action;
|
import org.controlsfx.control.action.Action;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.timeline.TimeLineController;
|
import org.sleuthkit.autopsy.timeline.TimeLineController;
|
||||||
@ -30,15 +31,22 @@ import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
|
|||||||
*/
|
*/
|
||||||
public class ZoomOut extends Action {
|
public class ZoomOut extends Action {
|
||||||
|
|
||||||
private final TimeLineController controller;
|
private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png"); //NOI18N
|
||||||
|
|
||||||
private final FilteredEventsModel eventsModel;
|
@NbBundle.Messages({"ZoomOut.longText=Zoom out to view 50% more time.",
|
||||||
|
"ZoomOut.action.text=Zoom out"})
|
||||||
|
public ZoomOut(TimeLineController controller) {
|
||||||
|
super(Bundle.ZoomOut_action_text());
|
||||||
|
setLongText(Bundle.ZoomOut_longText());
|
||||||
|
setGraphic(new ImageView(MAGNIFIER_OUT));
|
||||||
|
setEventHandler(actionEvent -> {
|
||||||
|
controller.pushZoomOutTime();
|
||||||
|
});
|
||||||
|
|
||||||
public ZoomOut(final TimeLineController controller) {
|
//disable action when the current time range already encompases the entire case.
|
||||||
super(NbBundle.getMessage(ZoomOut.class, "ZoomOut.action.name.text"));
|
|
||||||
this.controller = controller;
|
|
||||||
eventsModel = controller.getEventsModel();
|
|
||||||
disabledProperty().bind(new BooleanBinding() {
|
disabledProperty().bind(new BooleanBinding() {
|
||||||
|
private final FilteredEventsModel eventsModel = controller.getEventsModel();
|
||||||
|
|
||||||
{
|
{
|
||||||
bind(eventsModel.zoomParametersProperty());
|
bind(eventsModel.zoomParametersProperty());
|
||||||
}
|
}
|
||||||
@ -48,8 +56,5 @@ public class ZoomOut extends Action {
|
|||||||
return eventsModel.zoomParametersProperty().getValue().getTimeRange().contains(eventsModel.getSpanningInterval());
|
return eventsModel.zoomParametersProperty().getValue().getTimeRange().contains(eventsModel.getSpanningInterval());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setEventHandler((ActionEvent t) -> {
|
|
||||||
controller.zoomOutToActivity();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2014-15 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.timeline.actions;
|
||||||
|
|
||||||
|
import javafx.beans.binding.BooleanBinding;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import org.controlsfx.control.action.Action;
|
||||||
|
import org.openide.util.NbBundle;
|
||||||
|
import org.sleuthkit.autopsy.timeline.TimeLineController;
|
||||||
|
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ZoomToEvents extends Action {
|
||||||
|
|
||||||
|
private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png", 16, 16, true, true); //NOI18N
|
||||||
|
|
||||||
|
@NbBundle.Messages({"ZoomToEvents.action.text=Zoom to events",
|
||||||
|
"ZoomToEvents.longText=Zoom out to show the nearest events."})
|
||||||
|
public ZoomToEvents(final TimeLineController controller) {
|
||||||
|
super(Bundle.ZoomToEvents_action_text());
|
||||||
|
setLongText(Bundle.ZoomToEvents_longText());
|
||||||
|
setGraphic(new ImageView(MAGNIFIER_OUT));
|
||||||
|
setEventHandler(actionEvent -> {
|
||||||
|
controller.zoomOutToActivity();
|
||||||
|
});
|
||||||
|
|
||||||
|
//disable action when the current time range already encompases the entire case.
|
||||||
|
disabledProperty().bind(new BooleanBinding() {
|
||||||
|
private final FilteredEventsModel eventsModel = controller.getEventsModel();
|
||||||
|
|
||||||
|
{
|
||||||
|
bind(eventsModel.zoomParametersProperty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean computeValue() {
|
||||||
|
//TODO: do a db query to see if using this action will actually result in viewable events
|
||||||
|
return eventsModel.zoomParametersProperty().getValue().getTimeRange().contains(eventsModel.getSpanningInterval());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,7 @@
|
|||||||
<?import jfxtras.scene.control.*?>
|
<?import jfxtras.scene.control.*?>
|
||||||
<?import org.controlsfx.control.*?>
|
<?import org.controlsfx.control.*?>
|
||||||
|
|
||||||
<fx:root prefHeight="-1.0" prefWidth="-1.0" type="javafx.scene.layout.BorderPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
<fx:root prefHeight="-1.0" prefWidth="-1.0" type="javafx.scene.layout.BorderPane" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<top>
|
<top>
|
||||||
<ToolBar fx:id="toolBar" prefWidth="200.0" BorderPane.alignment="CENTER">
|
<ToolBar fx:id="toolBar" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
<items>
|
<items>
|
||||||
@ -115,7 +115,7 @@
|
|||||||
</Separator>
|
</Separator>
|
||||||
<HBox>
|
<HBox>
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="zoomOutButton" mnemonicParsing="false">
|
<Button fx:id="zoomOutButton" contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false">
|
||||||
<graphic>
|
<graphic>
|
||||||
<ImageView pickOnBounds="true" preserveRatio="true">
|
<ImageView pickOnBounds="true" preserveRatio="true">
|
||||||
<image>
|
<image>
|
||||||
@ -127,7 +127,7 @@
|
|||||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</Button>
|
</Button>
|
||||||
<Button fx:id="zoomInButton" mnemonicParsing="false">
|
<Button fx:id="zoomInButton" contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false">
|
||||||
<graphic>
|
<graphic>
|
||||||
<ImageView pickOnBounds="true" preserveRatio="true">
|
<ImageView pickOnBounds="true" preserveRatio="true">
|
||||||
<image>
|
<image>
|
||||||
@ -143,7 +143,7 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
<MenuButton fx:id="zoomMenuButton" mnemonicParsing="false">
|
<MenuButton fx:id="zoomMenuButton" mnemonicParsing="false">
|
||||||
<graphic>
|
<graphic>
|
||||||
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
<ImageView pickOnBounds="true" preserveRatio="true">
|
||||||
<image>
|
<image>
|
||||||
<Image url="@../images/magnifier-left.png" />
|
<Image url="@../images/magnifier-left.png" />
|
||||||
</image>
|
</image>
|
||||||
|
@ -66,6 +66,7 @@ import jfxtras.scene.control.LocalDateTimeTextField;
|
|||||||
import org.controlsfx.control.NotificationPane;
|
import org.controlsfx.control.NotificationPane;
|
||||||
import org.controlsfx.control.RangeSlider;
|
import org.controlsfx.control.RangeSlider;
|
||||||
import org.controlsfx.control.action.Action;
|
import org.controlsfx.control.action.Action;
|
||||||
|
import org.controlsfx.control.action.ActionUtils;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.DateTimeZone;
|
import org.joda.time.DateTimeZone;
|
||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
@ -78,7 +79,9 @@ import org.sleuthkit.autopsy.timeline.TimeLineView;
|
|||||||
import org.sleuthkit.autopsy.timeline.VisualizationMode;
|
import org.sleuthkit.autopsy.timeline.VisualizationMode;
|
||||||
import org.sleuthkit.autopsy.timeline.actions.ResetFilters;
|
import org.sleuthkit.autopsy.timeline.actions.ResetFilters;
|
||||||
import org.sleuthkit.autopsy.timeline.actions.SaveSnapshot;
|
import org.sleuthkit.autopsy.timeline.actions.SaveSnapshot;
|
||||||
|
import org.sleuthkit.autopsy.timeline.actions.ZoomIn;
|
||||||
import org.sleuthkit.autopsy.timeline.actions.ZoomOut;
|
import org.sleuthkit.autopsy.timeline.actions.ZoomOut;
|
||||||
|
import org.sleuthkit.autopsy.timeline.actions.ZoomToEvents;
|
||||||
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
|
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
|
||||||
import org.sleuthkit.autopsy.timeline.events.TagsUpdatedEvent;
|
import org.sleuthkit.autopsy.timeline.events.TagsUpdatedEvent;
|
||||||
import org.sleuthkit.autopsy.timeline.filters.TagsFilter;
|
import org.sleuthkit.autopsy.timeline.filters.TagsFilter;
|
||||||
@ -178,8 +181,8 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
|
|||||||
|
|
||||||
private FilteredEventsModel filteredEvents;
|
private FilteredEventsModel filteredEvents;
|
||||||
|
|
||||||
private final ChangeListener<Object> rangeSliderListener
|
private final ChangeListener<Object> rangeSliderListener =
|
||||||
= (observable1, oldValue, newValue) -> {
|
(observable1, oldValue, newValue) -> {
|
||||||
if (rangeSlider.isHighValueChanging() == false && rangeSlider.isLowValueChanging() == false) {
|
if (rangeSlider.isHighValueChanging() == false && rangeSlider.isLowValueChanging() == false) {
|
||||||
Long minTime = filteredEvents.getMinTime() * 1000;
|
Long minTime = filteredEvents.getMinTime() * 1000;
|
||||||
controller.pushTimeRange(new Interval(
|
controller.pushTimeRange(new Interval(
|
||||||
@ -289,13 +292,6 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
|
|||||||
}
|
}
|
||||||
zoomMenuButton.setText(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.zoomMenuButton.text")); // NON-NLS
|
zoomMenuButton.setText(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.zoomMenuButton.text")); // NON-NLS
|
||||||
|
|
||||||
zoomOutButton.setOnAction(e -> {
|
|
||||||
controller.pushZoomOutTime();
|
|
||||||
});
|
|
||||||
zoomInButton.setOnAction(e -> {
|
|
||||||
controller.pushZoomInTime();
|
|
||||||
});
|
|
||||||
|
|
||||||
snapShotButton.setOnAction((ActionEvent event) -> {
|
snapShotButton.setOnAction((ActionEvent event) -> {
|
||||||
//take snapshot
|
//take snapshot
|
||||||
final SnapshotParameters snapshotParameters = new SnapshotParameters();
|
final SnapshotParameters snapshotParameters = new SnapshotParameters();
|
||||||
@ -314,6 +310,9 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void setController(TimeLineController controller) {
|
public synchronized void setController(TimeLineController controller) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
ActionUtils.configureButton(new ZoomOut(controller), zoomOutButton);
|
||||||
|
ActionUtils.configureButton(new ZoomIn(controller), zoomInButton);
|
||||||
|
|
||||||
setModel(controller.getEventsModel());
|
setModel(controller.getEventsModel());
|
||||||
setViewMode(controller.viewModeProperty().get());
|
setViewMode(controller.viewModeProperty().get());
|
||||||
controller.getNeedsHistogramRebuild().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
|
controller.getNeedsHistogramRebuild().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
|
||||||
@ -380,14 +379,15 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
|
|||||||
visualization.hasEvents.addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
|
visualization.hasEvents.addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
|
||||||
if (newValue == false) {
|
if (newValue == false) {
|
||||||
|
|
||||||
notificationPane.setContent(new StackPane(visualization, new Region() {
|
notificationPane.setContent(
|
||||||
{
|
new StackPane(visualization,
|
||||||
setBackground(new Background(new BackgroundFill(Color.GREY, CornerRadii.EMPTY, Insets.EMPTY)));
|
new Region() {
|
||||||
setOpacity(.3);
|
{
|
||||||
}
|
setBackground(new Background(new BackgroundFill(Color.GREY, CornerRadii.EMPTY, Insets.EMPTY)));
|
||||||
}, new NoEventsDialog(() -> {
|
setOpacity(.3);
|
||||||
notificationPane.setContent(visualization);
|
}
|
||||||
})));
|
},
|
||||||
|
new NoEventsDialog(() -> notificationPane.setContent(visualization))));
|
||||||
} else {
|
} else {
|
||||||
notificationPane.setContent(visualization);
|
notificationPane.setContent(visualization);
|
||||||
}
|
}
|
||||||
@ -552,7 +552,6 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
|
|||||||
private NoEventsDialog(Runnable closeCallback) {
|
private NoEventsDialog(Runnable closeCallback) {
|
||||||
this.closeCallback = closeCallback;
|
this.closeCallback = closeCallback;
|
||||||
FXMLConstructor.construct(this, "NoEventsDialog.fxml"); // NON-NLS
|
FXMLConstructor.construct(this, "NoEventsDialog.fxml"); // NON-NLS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -562,15 +561,9 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
|
|||||||
assert zoomButton != null : "fx:id=\"zoomButton\" was not injected: check your FXML file 'NoEventsDialog.fxml'."; // NON-NLS
|
assert zoomButton != null : "fx:id=\"zoomButton\" was not injected: check your FXML file 'NoEventsDialog.fxml'."; // NON-NLS
|
||||||
|
|
||||||
noEventsDialogLabel.setText(NbBundle.getMessage(NoEventsDialog.class, "VisualizationPanel.noEventsDialogLabel.text")); // NON-NLS
|
noEventsDialogLabel.setText(NbBundle.getMessage(NoEventsDialog.class, "VisualizationPanel.noEventsDialogLabel.text")); // NON-NLS
|
||||||
zoomButton.setText(NbBundle.getMessage(NoEventsDialog.class, "VisualizationPanel.zoomButton.text")); // NON-NLS
|
ActionUtils.configureButton(new ZoomToEvents(controller), zoomButton);
|
||||||
|
|
||||||
Action zoomOutAction = new ZoomOut(controller);
|
dismissButton.setOnAction(actionEvent -> closeCallback.run());
|
||||||
zoomButton.setOnAction(zoomOutAction);
|
|
||||||
zoomButton.disableProperty().bind(zoomOutAction.disabledProperty());
|
|
||||||
|
|
||||||
dismissButton.setOnAction(e -> {
|
|
||||||
closeCallback.run();
|
|
||||||
});
|
|
||||||
Action defaultFiltersAction = new ResetFilters(controller);
|
Action defaultFiltersAction = new ResetFilters(controller);
|
||||||
resetFiltersButton.setOnAction(defaultFiltersAction);
|
resetFiltersButton.setOnAction(defaultFiltersAction);
|
||||||
resetFiltersButton.disableProperty().bind(defaultFiltersAction.disabledProperty());
|
resetFiltersButton.disableProperty().bind(defaultFiltersAction.disabledProperty());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user