mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
prevent progressdialog from blocking input to the main timeline window
This commit is contained in:
parent
5f4b2f2b54
commit
843fefac25
@ -88,6 +88,7 @@ public class PromptDialogManager {
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
public void showProgressDialog(CancellationProgressTask<?> task) {
|
||||
currentDialog = new ProgressDialog(task);
|
||||
currentDialog.initModality(Modality.NONE);
|
||||
currentDialog.headerTextProperty().bind(task.titleProperty());
|
||||
setDialogIcons(currentDialog);
|
||||
currentDialog.setTitle(Bundle.PromptDialogManager_progressDialog_title());
|
||||
@ -98,6 +99,7 @@ public class PromptDialogManager {
|
||||
//co-ordinate task cancelation and dialog hiding.
|
||||
task.setOnCancelled(cancelled -> currentDialog.close());
|
||||
task.setOnSucceeded(succeeded -> currentDialog.close());
|
||||
task.setOnFailed(failed -> currentDialog.close());
|
||||
dialogPane.getButtonTypes().setAll(ButtonType.CANCEL);
|
||||
final Node cancelButton = dialogPane.lookupButton(ButtonType.CANCEL);
|
||||
cancelButton.disableProperty().bind(task.cancellableProperty().not());
|
||||
|
@ -30,6 +30,8 @@ import java.util.TimeZone;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.Observable;
|
||||
@ -288,26 +290,17 @@ public class TimeLineController {
|
||||
advance(filteredEvents.zoomParametersProperty().get().withTimeRange(boundingEventsInterval));
|
||||
}
|
||||
|
||||
/**
|
||||
* rebuld the repo.
|
||||
*
|
||||
* @return False if the repo was not rebuilt because because the user
|
||||
* aborted after prompt about ingest running. True if the repo was
|
||||
* rebuilt.
|
||||
*/
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
void rebuildRepo() {
|
||||
private void rebuildRepoHelper(Function<Consumer<Worker.State>, CancellationProgressTask<?>> repoBuilder) {
|
||||
SwingUtilities.invokeLater(this::closeTimelineWindow);
|
||||
final CancellationProgressTask<?> rebuildRepository = eventsRepository.rebuildRepository();
|
||||
boolean ingestRunning = IngestManager.getInstance().isIngestRunning();
|
||||
rebuildRepository.stateProperty().addListener((stateProperty, oldState, newSate) -> {
|
||||
//this will be on JFX thread
|
||||
final CancellationProgressTask<?> rebuildRepository = repoBuilder.apply(newSate -> {
|
||||
setIngestRunning(ingestRunning);
|
||||
//this will be on JFX thread
|
||||
switch (newSate) {
|
||||
case SUCCEEDED:
|
||||
setEventsDBStale(false);
|
||||
SwingUtilities.invokeLater(TimeLineController.this::showWindow);
|
||||
|
||||
historyManager.reset(filteredEvents.zoomParametersProperty().get());
|
||||
TimeLineController.this.showFullRange();
|
||||
break;
|
||||
@ -318,7 +311,18 @@ public class TimeLineController {
|
||||
}
|
||||
});
|
||||
promptDialogManager.showProgressDialog(rebuildRepository);
|
||||
}
|
||||
|
||||
/**
|
||||
* rebuld the repo.
|
||||
*
|
||||
* @return False if the repo was not rebuilt because because the user
|
||||
* aborted after prompt about ingest running. True if the repo was
|
||||
* rebuilt.
|
||||
*/
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
void rebuildRepo() {
|
||||
rebuildRepoHelper(eventsRepository::rebuildRepository);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -329,17 +333,7 @@ public class TimeLineController {
|
||||
*/
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
void rebuildTagsTable() {
|
||||
|
||||
SwingUtilities.invokeLater(this::closeTimelineWindow);
|
||||
CancellationProgressTask<?> rebuildTags = eventsRepository.rebuildTags();
|
||||
rebuildTags.stateProperty().addListener((stateProperty, oldState, newSate) -> {
|
||||
//this will be on JFX thread
|
||||
if (newSate == Worker.State.SUCCEEDED) {
|
||||
SwingUtilities.invokeLater(TimeLineController.this::showWindow);
|
||||
showFullRange();
|
||||
}
|
||||
});
|
||||
promptDialogManager.showProgressDialog(rebuildTags);
|
||||
rebuildRepoHelper(eventsRepository::rebuildTags);
|
||||
}
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
||||
|
@ -35,6 +35,7 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import javafx.application.Platform;
|
||||
@ -44,6 +45,7 @@ import javafx.beans.property.ReadOnlyObjectProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.ObservableMap;
|
||||
import javafx.concurrent.Worker;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.Interval;
|
||||
@ -177,7 +179,6 @@ public class EventsRepository {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public TimeLineEvent getEventById(Long eventID) {
|
||||
return idToEventCache.getUnchecked(eventID);
|
||||
}
|
||||
@ -310,8 +311,6 @@ public class EventsRepository {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean areFiltersEquivalent(RootFilter f1, RootFilter f2) {
|
||||
return SQLHelper.getSQLWhere(f1).equals(SQLHelper.getSQLWhere(f2));
|
||||
}
|
||||
@ -322,13 +321,13 @@ public class EventsRepository {
|
||||
}
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
public CancellationProgressTask<Void> rebuildRepository() {
|
||||
return rebuildRepository(DBPopulationMode.FULL);
|
||||
public CancellationProgressTask<Void> rebuildRepository(Consumer<Worker.State> onStateChange) {
|
||||
return rebuildRepository(DBPopulationMode.FULL, onStateChange);
|
||||
}
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
public CancellationProgressTask<Void> rebuildTags() {
|
||||
return rebuildRepository(DBPopulationMode.TAGS_ONLY);
|
||||
public CancellationProgressTask<Void> rebuildTags(Consumer<Worker.State> onStateChange) {
|
||||
return rebuildRepository(DBPopulationMode.TAGS_ONLY, onStateChange);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -336,12 +335,12 @@ public class EventsRepository {
|
||||
* @param mode the value of mode
|
||||
*/
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
private CancellationProgressTask<Void> rebuildRepository(final DBPopulationMode mode) {
|
||||
private CancellationProgressTask<Void> rebuildRepository(final DBPopulationMode mode, Consumer<Worker.State> onStateChange) {
|
||||
LOGGER.log(Level.INFO, "(re)starting {0} db population task", mode); //NON-NLS
|
||||
if (dbWorker != null) {
|
||||
dbWorker.cancel();
|
||||
}
|
||||
dbWorker = new DBPopulationWorker(mode);
|
||||
dbWorker = new DBPopulationWorker(mode, onStateChange);
|
||||
workerExecutor.execute(dbWorker);
|
||||
return dbWorker;
|
||||
}
|
||||
@ -406,10 +405,11 @@ public class EventsRepository {
|
||||
}
|
||||
}
|
||||
|
||||
DBPopulationWorker(DBPopulationMode mode) {
|
||||
DBPopulationWorker(DBPopulationMode mode, Consumer<Worker.State> onStateChange) {
|
||||
skCase = autoCase.getSleuthkitCase();
|
||||
tagsManager = autoCase.getServices().getTagsManager();
|
||||
this.dbPopulationMode = mode;
|
||||
this.stateProperty().addListener(observable -> onStateChange.accept(getState()));
|
||||
}
|
||||
|
||||
void restartProgressHandle(String title, String message, Double workDone, double total, Boolean cancellable) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user