Merge pull request #2140 from millmanorama/TL-dont-refresh-on-zoom-cancel

TL dont refresh on zoom cancel
This commit is contained in:
Richard Cordovano 2016-05-13 13:54:51 -04:00
commit f5c7faa227
4 changed files with 47 additions and 21 deletions

View File

@ -676,9 +676,6 @@ public class TimeLineController {
} }
} }
@NbBundle.Messages({"# {0} - the number of events",
"Timeline.pushDescrLOD.confdlg.msg=You are about to show details for {0} events. This might be very slow or even crash Autopsy.\n\nDo you want to continue?",
"Timeline.pushDescrLOD.confdlg.title=Change description level of detail?"})
synchronized public void pushDescrLOD(DescriptionLoD newLOD) { synchronized public void pushDescrLOD(DescriptionLoD newLOD) {
ZoomParams currentZoom = filteredEvents.zoomParametersProperty().get(); ZoomParams currentZoom = filteredEvents.zoomParametersProperty().get();
if (currentZoom == null) { if (currentZoom == null) {

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.timeline.ui; package org.sleuthkit.autopsy.timeline.ui;
import com.google.common.eventbus.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -71,6 +72,7 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.timeline.TimeLineController; import org.sleuthkit.autopsy.timeline.TimeLineController;
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel; import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.events.RefreshRequestedEvent;
/** /**
* Abstract base class for TimeLineChart based visualizations. * Abstract base class for TimeLineChart based visualizations.
@ -401,6 +403,17 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
controller.monitorTask(updateTask); controller.monitorTask(updateTask);
} }
/**
* Handle a RefreshRequestedEvent from the events model by updating the
* visualization.
*
* @param event The RefreshRequestedEvent to handle.
*/
@Subscribe
public void handleRefreshRequested(RefreshRequestedEvent event) {
refresh();
}
/** /**
* Dispose of this visualization and any resources it holds onto. * Dispose of this visualization and any resources it holds onto.
*/ */

View File

@ -382,8 +382,8 @@ final public class VisualizationPanel extends BorderPane {
} }
/** /**
* Handle a RefreshRequestedEvent from the events model by refreshing the * Handle a RefreshRequestedEvent from the events model by clearing the
* visualization. * refresh notification.
* *
* NOTE: This VisualizationPanel must be registered with the * NOTE: This VisualizationPanel must be registered with the
* filteredEventsModel's EventBus in order for this handler to be invoked. * filteredEventsModel's EventBus in order for this handler to be invoked.
@ -392,7 +392,6 @@ final public class VisualizationPanel extends BorderPane {
*/ */
@Subscribe @Subscribe
public void handleRefreshRequested(RefreshRequestedEvent event) { public void handleRefreshRequested(RefreshRequestedEvent event) {
visualization.refresh();
Platform.runLater(() -> { Platform.runLater(() -> {
if (Bundle.VisualizationPanel_tagsAddedOrDeleted().equals(notificationPane.getText())) { if (Bundle.VisualizationPanel_tagsAddedOrDeleted().equals(notificationPane.getText())) {
notificationPane.hide(); notificationPane.hide();
@ -543,22 +542,18 @@ final public class VisualizationPanel extends BorderPane {
controller.monitorTask(histogramTask); controller.monitorTask(histogramTask);
} }
/**
* Refresh the time selection UI to match the current zoome paramaters.
*/
private void refreshTimeUI() { private void refreshTimeUI() {
refreshTimeUI(filteredEvents.timeRangeProperty().get());
}
private void refreshTimeUI(Interval interval) {
RangeDivisionInfo rangeDivisionInfo = RangeDivisionInfo.getRangeDivisionInfo(filteredEvents.getSpanningInterval()); RangeDivisionInfo rangeDivisionInfo = RangeDivisionInfo.getRangeDivisionInfo(filteredEvents.getSpanningInterval());
final long minTime = rangeDivisionInfo.getLowerBound(); final long minTime = rangeDivisionInfo.getLowerBound();
final long maxTime = rangeDivisionInfo.getUpperBound(); final long maxTime = rangeDivisionInfo.getUpperBound();
long startMillis = interval.getStartMillis(); long startMillis = filteredEvents.getTimeRange().getStartMillis();
long endMillis = interval.getEndMillis(); long endMillis = filteredEvents.getTimeRange().getEndMillis();
if (minTime > 0 && maxTime > minTime) { if (minTime > 0 && maxTime > minTime) {
Platform.runLater(() -> { Platform.runLater(() -> {
startPicker.localDateTimeProperty().removeListener(startListener); startPicker.localDateTimeProperty().removeListener(startListener);
endPicker.localDateTimeProperty().removeListener(endListener); endPicker.localDateTimeProperty().removeListener(endListener);

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.timeline.ui.detailview; package org.sleuthkit.autopsy.timeline.ui.detailview;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -56,6 +57,7 @@ import org.sleuthkit.autopsy.timeline.datamodel.TimeLineEvent;
import org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane; import org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane;
import org.sleuthkit.autopsy.timeline.utils.MappedList; import org.sleuthkit.autopsy.timeline.utils.MappedList;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
import org.sleuthkit.autopsy.timeline.zooming.ZoomParams;
/** /**
* Controller class for a DetailsChart based implementation of a timeline view. * Controller class for a DetailsChart based implementation of a timeline view.
@ -87,6 +89,12 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
*/ */
private final MappedList<TimeLineEvent, EventNodeBase<?>> selectedEvents; private final MappedList<TimeLineEvent, EventNodeBase<?>> selectedEvents;
/**
* Local copy of the zoomParams. Used to backout of a zoomParam change
* without needing to requery/redraw the vis.
*/
private ZoomParams currentZoomParams;
/** /**
* Constructor for a DetailViewPane * Constructor for a DetailViewPane
* *
@ -343,7 +351,8 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
"DetailViewPane.loggedTask.continueButton=Continue", "DetailViewPane.loggedTask.continueButton=Continue",
"DetailViewPane.loggedTask.backButton=Back (Cancel)", "DetailViewPane.loggedTask.backButton=Back (Cancel)",
"# {0} - number of events", "# {0} - number of events",
"DetailViewPane.loggedTask.prompt=You are about to show details for {0} events. This might be very slow or even crash Autopsy.\n\nDo you want to continue?"})
"DetailViewPane.loggedTask.prompt=You are about to show details for {0} events. This might be very slow and could exhaust available memory.\n\nDo you want to continue?"})
private class DetailsUpdateTask extends VisualizationRefreshTask<Interval> { private class DetailsUpdateTask extends VisualizationRefreshTask<Interval> {
DetailsUpdateTask() { DetailsUpdateTask() {
@ -353,13 +362,17 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
@Override @Override
protected Boolean call() throws Exception { protected Boolean call() throws Exception {
super.call(); super.call();
if (isCancelled()) { if (isCancelled()) {
return null; return null;
} }
FilteredEventsModel eventsModel = getEventsModel(); FilteredEventsModel eventsModel = getEventsModel();
ZoomParams newZoomParams = eventsModel.getZoomParamaters();
//clear the chart and set the horixontal axis //if the zoomParams haven't actually changed, just bail
resetChart(eventsModel.getTimeRange()); if (Objects.equals(currentZoomParams, newZoomParams)) {
return true;
}
updateMessage(Bundle.DetailViewPane_loggedTask_queryDb()); updateMessage(Bundle.DetailViewPane_loggedTask_queryDb());
@ -378,17 +391,25 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
alert.setHeaderText(""); alert.setHeaderText("");
alert.initModality(Modality.APPLICATION_MODAL); alert.initModality(Modality.APPLICATION_MODAL);
alert.initOwner(getScene().getWindow()); alert.initOwner(getScene().getWindow());
ButtonType orElse = alert.showAndWait().orElse(back); ButtonType userResponse = alert.showAndWait().orElse(back);
if (orElse == back) { if (userResponse == back) {
DetailsUpdateTask.this.cancel(); DetailsUpdateTask.this.cancel();
} }
return orElse; return userResponse;
} }
}; };
//show dialog on JFX thread and block this thread until the dialog is dismissed. //show dialog on JFX thread and block this thread until the dialog is dismissed.
Platform.runLater(task); Platform.runLater(task);
task.get(); task.get();
} }
if (isCancelled()) {
return null;
}
//we are going to accept the new zoomParams
currentZoomParams = newZoomParams;
//clear the chart and set the horixontal axis
resetChart(eventsModel.getTimeRange());
updateMessage(Bundle.DetailViewPane_loggedTask_updateUI()); updateMessage(Bundle.DetailViewPane_loggedTask_updateUI());