mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
show confirmation dialog when (globaly) switching to full descriptions for > 10,000 events
This commit is contained in:
parent
dd1a67747d
commit
941d6c8295
@ -23,8 +23,10 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.NumberFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@ -466,7 +468,22 @@ public class TimeLineController {
|
||||
}
|
||||
}
|
||||
|
||||
synchronized public void pushDescrLOD(DescriptionLOD newLOD) {
|
||||
synchronized public boolean pushDescrLOD(DescriptionLOD newLOD) {
|
||||
Map<EventType, Long> eventCounts = filteredEvents.getEventCounts(filteredEvents.getRequestedZoomParamters().get().getTimeRange());
|
||||
final Long count = eventCounts.values().stream().reduce(0l, Long::sum);
|
||||
|
||||
boolean shouldContinue = true;
|
||||
if (newLOD == DescriptionLOD.FULL && count > 10_000) {
|
||||
|
||||
int showConfirmDialog = JOptionPane.showConfirmDialog(mainFrame,
|
||||
"You are about to show details for " + NumberFormat.getInstance().format(count) + " events. This might be very slow or even crash Autopsy.\n\nDo you want to continue?",
|
||||
"",
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
|
||||
shouldContinue = (showConfirmDialog == JOptionPane.YES_OPTION);
|
||||
}
|
||||
|
||||
if (shouldContinue) {
|
||||
ZoomParams currentZoom = filteredEvents.getRequestedZoomParamters().get();
|
||||
if (currentZoom == null) {
|
||||
advance(InitialZoomState.withDescrLOD(newLOD));
|
||||
@ -474,6 +491,8 @@ public class TimeLineController {
|
||||
advance(currentZoom.withDescrLOD(newLOD));
|
||||
}
|
||||
}
|
||||
return shouldContinue;
|
||||
}
|
||||
|
||||
synchronized public void pushTimeAndType(Interval timeRange, EventTypeZoomLevel typeZoom) {
|
||||
// timeRange = this.filteredEvents.getSpanningInterval().overlap(timeRange);
|
||||
|
@ -259,4 +259,7 @@ public class FilteredEventsModel {
|
||||
// requestedLOD.set(zCrumb.getDescrLOD());
|
||||
// }
|
||||
// }
|
||||
public DescriptionLOD getDescriptionLOD() {
|
||||
return requestedLOD.get();
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,9 @@ public class ZoomSettingsPane extends TitledPane implements TimeLineView {
|
||||
initializeSlider(descrLODSlider,
|
||||
() -> {
|
||||
DescriptionLOD newLOD = DescriptionLOD.values()[Math.round(descrLODSlider.valueProperty().floatValue())];
|
||||
controller.pushDescrLOD(newLOD);
|
||||
if (controller.pushDescrLOD(newLOD) == false) {
|
||||
descrLODSlider.setValue(new DescrLODConverter().fromString(filteredEvents.getDescriptionLOD().toString()));
|
||||
}
|
||||
}, this.filteredEvents.descriptionLOD(),
|
||||
() -> {
|
||||
descrLODSlider.setValue(this.filteredEvents.descriptionLOD().get().ordinal());
|
||||
|
Loading…
x
Reference in New Issue
Block a user