mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Merge pull request #1972 from millmanorama/IG-backgroundtask-cleanup
Ig backgroundtask cleanup
This commit is contained in:
commit
fb0ddccdd4
@ -128,8 +128,6 @@ public final class ImageGalleryController implements Executor {
|
||||
*/
|
||||
private final SimpleBooleanProperty listeningEnabled = new SimpleBooleanProperty(false);
|
||||
|
||||
private final ReadOnlyIntegerWrapper queueSizeProperty = new ReadOnlyIntegerWrapper(0);
|
||||
|
||||
private final ReadOnlyBooleanWrapper regroupDisabled = new ReadOnlyBooleanWrapper(false);
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
@ -154,7 +152,6 @@ public final class ImageGalleryController implements Executor {
|
||||
|
||||
private Node infoOverlay;
|
||||
private SleuthkitCase sleuthKitCase;
|
||||
// private NavPanel navPanel;
|
||||
|
||||
public ReadOnlyBooleanProperty getMetaDataCollapsed() {
|
||||
return metaDataCollapsed.getReadOnlyProperty();
|
||||
@ -176,7 +173,7 @@ public final class ImageGalleryController implements Executor {
|
||||
return historyManager.currentState();
|
||||
}
|
||||
|
||||
public synchronized FileIDSelectionModel getSelectionModel() {
|
||||
public FileIDSelectionModel getSelectionModel() {
|
||||
return selectionModel;
|
||||
}
|
||||
|
||||
@ -188,12 +185,16 @@ public final class ImageGalleryController implements Executor {
|
||||
return db;
|
||||
}
|
||||
|
||||
synchronized public void setListeningEnabled(boolean enabled) {
|
||||
listeningEnabled.set(enabled);
|
||||
public void setListeningEnabled(boolean enabled) {
|
||||
synchronized (listeningEnabled) {
|
||||
listeningEnabled.set(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized boolean isListeningEnabled() {
|
||||
return listeningEnabled.get();
|
||||
boolean isListeningEnabled() {
|
||||
synchronized (listeningEnabled) {
|
||||
return listeningEnabled.get();
|
||||
}
|
||||
}
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.ANY)
|
||||
@ -249,12 +250,14 @@ public final class ImageGalleryController implements Executor {
|
||||
checkForGroups();
|
||||
});
|
||||
|
||||
IngestManager.getInstance().addIngestModuleEventListener((PropertyChangeEvent evt) -> {
|
||||
Platform.runLater(this::updateRegroupDisabled);
|
||||
});
|
||||
IngestManager.getInstance().addIngestJobEventListener((PropertyChangeEvent evt) -> {
|
||||
Platform.runLater(this::updateRegroupDisabled);
|
||||
});
|
||||
IngestManager ingestManager = IngestManager.getInstance();
|
||||
PropertyChangeListener ingestEventHandler =
|
||||
propertyChangeEvent -> Platform.runLater(this::updateRegroupDisabled);
|
||||
|
||||
ingestManager.addIngestModuleEventListener(ingestEventHandler);
|
||||
ingestManager.addIngestJobEventListener(ingestEventHandler);
|
||||
|
||||
queueSizeProperty.addListener(obs -> this.updateRegroupDisabled());
|
||||
}
|
||||
|
||||
public ReadOnlyBooleanProperty getCanAdvance() {
|
||||
@ -281,8 +284,9 @@ public final class ImageGalleryController implements Executor {
|
||||
return historyManager.retreat();
|
||||
}
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
private void updateRegroupDisabled() {
|
||||
regroupDisabled.set(getFileUpdateQueueSizeProperty().get() > 0 || IngestManager.getInstance().isIngestRunning());
|
||||
regroupDisabled.set((queueSizeProperty.get() > 0) || IngestManager.getInstance().isIngestRunning());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -313,7 +317,7 @@ public final class ImageGalleryController implements Executor {
|
||||
new ProgressIndicator()));
|
||||
}
|
||||
|
||||
} else if (getFileUpdateQueueSizeProperty().get() > 0) {
|
||||
} else if (queueSizeProperty.get() > 0) {
|
||||
replaceNotification(fullUIStackPane,
|
||||
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg3(),
|
||||
new ProgressIndicator()));
|
||||
@ -358,20 +362,14 @@ public final class ImageGalleryController implements Executor {
|
||||
}
|
||||
}
|
||||
|
||||
private void restartWorker() {
|
||||
if (dbWorkerThread != null) {
|
||||
synchronized private DBWorkerThread restartWorker() {
|
||||
if (dbWorkerThread == null) {
|
||||
dbWorkerThread = new DBWorkerThread(this);
|
||||
dbWorkerThread.start();
|
||||
} else {
|
||||
// Keep using the same worker thread if one exists
|
||||
return;
|
||||
}
|
||||
dbWorkerThread = new DBWorkerThread();
|
||||
|
||||
getFileUpdateQueueSizeProperty().addListener((Observable o) -> {
|
||||
Platform.runLater(this::updateRegroupDisabled);
|
||||
});
|
||||
|
||||
Thread th = new Thread(dbWorkerThread, "DB-Worker-Thread");
|
||||
th.setDaemon(false); // we want it to go away when it is done
|
||||
th.start();
|
||||
return dbWorkerThread;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -412,15 +410,16 @@ public final class ImageGalleryController implements Executor {
|
||||
setListeningEnabled(false);
|
||||
ThumbnailCache.getDefault().clearCache();
|
||||
historyManager.clear();
|
||||
groupManager.clear();
|
||||
tagsManager.clearFollowUpTagName();
|
||||
tagsManager.unregisterListener(groupManager);
|
||||
tagsManager.unregisterListener(categoryManager);
|
||||
dbWorkerThread.cancelAllTasks();
|
||||
dbWorkerThread.cancel();
|
||||
dbWorkerThread = null;
|
||||
restartWorker();
|
||||
dbWorkerThread = restartWorker();
|
||||
|
||||
Toolbar.getDefault(this).reset();
|
||||
groupManager.clear();
|
||||
|
||||
if (db != null) {
|
||||
db.closeDBCon();
|
||||
}
|
||||
@ -432,11 +431,9 @@ public final class ImageGalleryController implements Executor {
|
||||
*
|
||||
* @param innerTask
|
||||
*/
|
||||
public void queueDBWorkerTask(InnerTask innerTask) {
|
||||
|
||||
// @@@ We could make a lock for the worker thread
|
||||
public synchronized void queueDBWorkerTask(BackgroundTask innerTask) {
|
||||
if (dbWorkerThread == null) {
|
||||
restartWorker();
|
||||
dbWorkerThread = restartWorker();
|
||||
}
|
||||
dbWorkerThread.addTask(innerTask);
|
||||
}
|
||||
@ -456,10 +453,6 @@ public final class ImageGalleryController implements Executor {
|
||||
Platform.runLater(this::checkForGroups);
|
||||
}
|
||||
|
||||
public ReadOnlyIntegerProperty getFileUpdateQueueSizeProperty() {
|
||||
return queueSizeProperty.getReadOnlyProperty();
|
||||
}
|
||||
|
||||
public ReadOnlyDoubleProperty regroupProgress() {
|
||||
return groupManager.regroupProgress();
|
||||
}
|
||||
@ -497,29 +490,43 @@ public final class ImageGalleryController implements Executor {
|
||||
return undoManager;
|
||||
}
|
||||
|
||||
// @@@ REVIEW IF THIS SHOLD BE STATIC...
|
||||
//TODO: concept seems like the controller deal with how much work to do at a given time
|
||||
public ReadOnlyIntegerProperty getDBTasksQueueSizeProperty() {
|
||||
return queueSizeProperty.getReadOnlyProperty();
|
||||
}
|
||||
private final ReadOnlyIntegerWrapper queueSizeProperty = new ReadOnlyIntegerWrapper(0);
|
||||
|
||||
// @@@ review this class for synchronization issues (i.e. reset and cancel being called, add, etc.)
|
||||
private class DBWorkerThread implements Runnable {
|
||||
static private class DBWorkerThread extends Thread implements Cancellable {
|
||||
|
||||
private final ImageGalleryController controller;
|
||||
|
||||
DBWorkerThread(ImageGalleryController controller) {
|
||||
super("DB-Worker-Thread");
|
||||
setDaemon(false);
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
// true if the process was requested to stop. Currently no way to reset it
|
||||
private volatile boolean cancelled = false;
|
||||
|
||||
// list of tasks to run
|
||||
private final BlockingQueue<InnerTask> workQueue = new LinkedBlockingQueue<>();
|
||||
private final BlockingQueue<BackgroundTask> workQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
/**
|
||||
* Cancel all of the queued up tasks and the currently scheduled task.
|
||||
* Note that after you cancel, you cannot submit new jobs to this
|
||||
* thread.
|
||||
*/
|
||||
public void cancelAllTasks() {
|
||||
@Override
|
||||
public boolean cancel() {
|
||||
cancelled = true;
|
||||
for (InnerTask it : workQueue) {
|
||||
for (BackgroundTask it : workQueue) {
|
||||
it.cancel();
|
||||
}
|
||||
workQueue.clear();
|
||||
queueSizeProperty.set(workQueue.size());
|
||||
int size = workQueue.size();
|
||||
Platform.runLater(() -> controller.queueSizeProperty.set(size));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -527,11 +534,10 @@ public final class ImageGalleryController implements Executor {
|
||||
*
|
||||
* @param it
|
||||
*/
|
||||
public void addTask(InnerTask it) {
|
||||
public void addTask(BackgroundTask it) {
|
||||
workQueue.add(it);
|
||||
Platform.runLater(() -> {
|
||||
queueSizeProperty.set(workQueue.size());
|
||||
});
|
||||
int size = workQueue.size();
|
||||
Platform.runLater(() -> controller.queueSizeProperty.set(size));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -539,19 +545,17 @@ public final class ImageGalleryController implements Executor {
|
||||
|
||||
// nearly infinite loop waiting for tasks
|
||||
while (true) {
|
||||
if (cancelled) {
|
||||
if (cancelled || isInterrupted()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
InnerTask it = workQueue.take();
|
||||
BackgroundTask it = workQueue.take();
|
||||
|
||||
if (it.isCancelled() == false) {
|
||||
it.run();
|
||||
}
|
||||
|
||||
Platform.runLater(() -> {
|
||||
queueSizeProperty.set(workQueue.size());
|
||||
});
|
||||
int size = workQueue.size();
|
||||
Platform.runLater(() -> controller.queueSizeProperty.set(size));
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Failed to run DB worker thread", ex); //NON-NLS
|
||||
@ -569,7 +573,14 @@ public final class ImageGalleryController implements Executor {
|
||||
*/
|
||||
@NbBundle.Messages({"ImageGalleryController.InnerTask.progress.name=progress",
|
||||
"ImageGalleryController.InnerTask.message.name=status"})
|
||||
static public abstract class InnerTask implements Runnable, Cancellable {
|
||||
static public abstract class BackgroundTask implements Runnable, Cancellable {
|
||||
|
||||
private final SimpleObjectProperty<Worker.State> state = new SimpleObjectProperty<>(Worker.State.READY);
|
||||
private final SimpleDoubleProperty progress = new SimpleDoubleProperty(this, Bundle.ImageGalleryController_InnerTask_progress_name());
|
||||
private final SimpleStringProperty message = new SimpleStringProperty(this, Bundle.ImageGalleryController_InnerTask_message_name());
|
||||
|
||||
protected BackgroundTask() {
|
||||
}
|
||||
|
||||
public double getProgress() {
|
||||
return progress.get();
|
||||
@ -586,9 +597,6 @@ public final class ImageGalleryController implements Executor {
|
||||
public final void updateMessage(String Status) {
|
||||
this.message.set(Status);
|
||||
}
|
||||
private final SimpleObjectProperty<Worker.State> state = new SimpleObjectProperty<>(Worker.State.READY);
|
||||
private final SimpleDoubleProperty progress = new SimpleDoubleProperty(this, Bundle.ImageGalleryController_InnerTask_progress_name());
|
||||
private final SimpleStringProperty message = new SimpleStringProperty(this, Bundle.ImageGalleryController_InnerTask_message_name());
|
||||
|
||||
public SimpleDoubleProperty progressProperty() {
|
||||
return progress;
|
||||
@ -602,24 +610,21 @@ public final class ImageGalleryController implements Executor {
|
||||
return state.get();
|
||||
}
|
||||
|
||||
protected void updateState(Worker.State newState) {
|
||||
state.set(newState);
|
||||
}
|
||||
|
||||
public ReadOnlyObjectProperty<Worker.State> stateProperty() {
|
||||
return new ReadOnlyObjectWrapper<>(state.get());
|
||||
}
|
||||
|
||||
protected InnerTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public boolean cancel() {
|
||||
public synchronized boolean cancel() {
|
||||
updateState(Worker.State.CANCELLED);
|
||||
return true;
|
||||
}
|
||||
|
||||
synchronized protected boolean isCancelled() {
|
||||
protected void updateState(Worker.State newState) {
|
||||
state.set(newState);
|
||||
}
|
||||
|
||||
protected synchronized boolean isCancelled() {
|
||||
return getState() == Worker.State.CANCELLED;
|
||||
}
|
||||
}
|
||||
@ -627,7 +632,7 @@ public final class ImageGalleryController implements Executor {
|
||||
/**
|
||||
* Abstract base class for tasks associated with a file in the database
|
||||
*/
|
||||
static public abstract class FileTask extends InnerTask {
|
||||
static public abstract class FileTask extends BackgroundTask {
|
||||
|
||||
private final AbstractFile file;
|
||||
private final DrawableDB taskDB;
|
||||
@ -704,7 +709,7 @@ public final class ImageGalleryController implements Executor {
|
||||
@NbBundle.Messages({"BulkTask.committingDb.status=commiting image/video database",
|
||||
"BulkTask.stopCopy.status=Stopping copy to drawable db task.",
|
||||
"BulkTask.errPopulating.errMsg=There was an error populating Image Gallery database."})
|
||||
abstract static private class BulkTransferTask extends InnerTask {
|
||||
abstract static private class BulkTransferTask extends BackgroundTask {
|
||||
|
||||
static private final String FILE_EXTENSION_CLAUSE =
|
||||
"(name LIKE '%." //NON-NLS
|
||||
@ -805,10 +810,11 @@ public final class ImageGalleryController implements Executor {
|
||||
* adds them to the Drawable DB. Uses the presence of a mimetype as an
|
||||
* approximation to 'analyzed'.
|
||||
*/
|
||||
@NbBundle.Messages({"CopyAnalyzedFiles.committingDb.status=commiting image/video database",
|
||||
"CopyAnalyzedFiles.stopCopy.status=Stopping copy to drawable db task.",
|
||||
"CopyAnalyzedFiles.errPopulating.errMsg=There was an error populating Image Gallery database."})
|
||||
static private class CopyAnalyzedFiles extends BulkTransferTask {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(CopyAnalyzedFiles.class.getName());
|
||||
|
||||
CopyAnalyzedFiles(ImageGalleryController controller, DrawableDB taskDB, SleuthkitCase tskCase) {
|
||||
super(controller, taskDB, tskCase);
|
||||
}
|
||||
@ -866,6 +872,7 @@ public final class ImageGalleryController implements Executor {
|
||||
* TODO: create methods to simplify progress value/text updates to both
|
||||
* netbeans and ImageGallery progress/status
|
||||
*/
|
||||
@NbBundle.Messages({"PrePopulateDataSourceFiles.committingDb.status=commiting image/video database"})
|
||||
static private class PrePopulateDataSourceFiles extends BulkTransferTask {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(PrePopulateDataSourceFiles.class.getName());
|
||||
|
@ -112,7 +112,7 @@ public class CategorizeAction extends Action {
|
||||
@NbBundle.Messages({"# {0} - fileID number",
|
||||
"CategorizeTask.errorUnable.msg=Unable to categorize {0}.",
|
||||
"CategorizeTask.errorUnable.title=Categorizing Error"})
|
||||
private class CategorizeTask extends ImageGalleryController.InnerTask {
|
||||
private class CategorizeTask extends ImageGalleryController.BackgroundTask {
|
||||
|
||||
private final Set<Long> fileIDs;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.imagegallery.actions;
|
||||
|
||||
import java.util.HashSet;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
|
||||
|
||||
@ -28,6 +28,10 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
|
||||
public class CategorizeGroupAction extends CategorizeAction {
|
||||
|
||||
public CategorizeGroupAction(Category cat, ImageGalleryController controller) {
|
||||
super(controller, cat, new HashSet<>(controller.viewState().get().getGroup().getFileIDs()));
|
||||
super(controller, cat, null);
|
||||
setEventHandler(actionEvent ->
|
||||
new CategorizeAction(controller, cat, ImmutableSet.copyOf(controller.viewState().get().getGroup().getFileIDs()))
|
||||
.handle(actionEvent)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,10 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
|
||||
public class CategorizeSelectedFilesAction extends CategorizeAction {
|
||||
|
||||
public CategorizeSelectedFilesAction(Category cat, ImageGalleryController controller) {
|
||||
super(controller, cat, controller.getSelectionModel().getSelected());
|
||||
super(controller, cat, null);
|
||||
setEventHandler(actionEvent ->
|
||||
new CategorizeAction(controller, cat, controller.getSelectionModel().getSelected())
|
||||
.handle(actionEvent)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,10 @@ import org.sleuthkit.datamodel.TagName;
|
||||
public class TagGroupAction extends AddTagAction {
|
||||
|
||||
public TagGroupAction(final TagName tagName, ImageGalleryController controller) {
|
||||
super(controller, tagName, ImmutableSet.copyOf(controller.viewState().get().getGroup().getFileIDs()));
|
||||
super(controller, tagName, null);
|
||||
setEventHandler(actionEvent ->
|
||||
new AddTagAction(controller, tagName, ImmutableSet.copyOf(controller.viewState().get().getGroup().getFileIDs())).
|
||||
handle(actionEvent)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,10 @@ import org.sleuthkit.datamodel.TagName;
|
||||
public class TagSelectedFilesAction extends AddTagAction {
|
||||
|
||||
public TagSelectedFilesAction(final TagName tagName, ImageGalleryController controller) {
|
||||
super(controller, tagName, controller.getSelectionModel().getSelected());
|
||||
super(controller, tagName, null);
|
||||
setEventHandler(actionEvent ->
|
||||
new AddTagAction(controller, tagName, controller.getSelectionModel().getSelected()).
|
||||
handle(actionEvent)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class DrawableTagsManager {
|
||||
} catch (TagsManager.TagNameAlreadyExistsException ex) {
|
||||
throw new TskCoreException("tagame exists but wasn't found", ex);
|
||||
}
|
||||
} catch (IllegalStateException ex) {
|
||||
} catch (NullPointerException | IllegalStateException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Case was closed out from underneath", ex); //NON-NLS
|
||||
throw new TskCoreException("Case was closed out from underneath", ex);
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ProgressBar?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
|
||||
<fx:root id="AnchorPane" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" type="javafx.scene.layout.AnchorPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<fx:root id="AnchorPane" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" type="javafx.scene.layout.AnchorPane" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<BorderPane minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<right>
|
||||
<HBox alignment="CENTER_RIGHT" prefHeight="-1.0" prefWidth="-1.0" BorderPane.alignment="CENTER_RIGHT">
|
||||
<HBox alignment="CENTER_RIGHT" prefHeight="-1.0" prefWidth="-1.0" spacing="5.0" BorderPane.alignment="CENTER_RIGHT">
|
||||
<children>
|
||||
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
@ -18,7 +22,10 @@
|
||||
<Label id="fileUpdateLabel" fx:id="fileUpdateTaskLabel" alignment="CENTER" contentDisplay="CENTER" graphicTextGap="0.0" labelFor="$fileTaskProgresBar" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="-1.0" text="0 File Update Tasks" StackPane.alignment="CENTER">
|
||||
<StackPane.margin>
|
||||
<Insets left="3.0" right="3.0" />
|
||||
</StackPane.margin></Label>
|
||||
</StackPane.margin>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
</padding></Label>
|
||||
</children>
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
@ -27,10 +34,13 @@
|
||||
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ProgressBar fx:id="bgTaskProgressBar" maxHeight="-1.0" maxWidth="-1.0" minHeight="-Infinity" minWidth="-1.0" prefHeight="24.0" prefWidth="-1.0" progress="0.0" StackPane.alignment="CENTER" />
|
||||
<Label fx:id="bgTaskLabel" alignment="CENTER" cache="false" contentDisplay="CENTER" disable="false" focusTraversable="false" labelFor="$uiTaskProgressBar" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" text="" StackPane.alignment="CENTER">
|
||||
<Label fx:id="bgTaskLabel" alignment="CENTER" cache="false" contentDisplay="CENTER" disable="false" focusTraversable="false" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" text="" StackPane.alignment="CENTER">
|
||||
<StackPane.margin>
|
||||
<Insets left="3.0" right="3.0" />
|
||||
</StackPane.margin></Label>
|
||||
</StackPane.margin>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
</padding></Label>
|
||||
</children>
|
||||
<HBox.margin>
|
||||
<Insets right="5.0" />
|
||||
@ -42,19 +52,6 @@
|
||||
</BorderPane.margin>
|
||||
</HBox>
|
||||
</right>
|
||||
<center>
|
||||
<HBox>
|
||||
<children>
|
||||
<Label fx:id="statusLabel" maxWidth="-Infinity" minWidth="-Infinity" wrapText="true" BorderPane.alignment="CENTER" HBox.hgrow="ALWAYS">
|
||||
<BorderPane.margin>
|
||||
<Insets left="10.0" right="10.0" />
|
||||
</BorderPane.margin>
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" right="10.0" />
|
||||
</HBox.margin></Label>
|
||||
</children>
|
||||
</HBox>
|
||||
</center>
|
||||
<left><Label fx:id="staleLabel" text="Some data may be out of date. Enable listening to ingest to update." BorderPane.alignment="CENTER">
|
||||
<graphic><ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013-14 Basis Technology Corp.
|
||||
* Copyright 2013-16 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,8 +19,6 @@
|
||||
package org.sleuthkit.autopsy.imagegallery.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
@ -38,21 +36,12 @@ public class StatusBar extends AnchorPane {
|
||||
|
||||
private final ImageGalleryController controller;
|
||||
|
||||
@FXML
|
||||
private ResourceBundle resources;
|
||||
|
||||
@FXML
|
||||
private URL location;
|
||||
|
||||
@FXML
|
||||
private ProgressBar fileTaskProgresBar;
|
||||
|
||||
@FXML
|
||||
private Label fileUpdateTaskLabel;
|
||||
|
||||
@FXML
|
||||
private Label statusLabel;
|
||||
|
||||
@FXML
|
||||
private Label bgTaskLabel;
|
||||
|
||||
@ -64,42 +53,32 @@ public class StatusBar extends AnchorPane {
|
||||
|
||||
@FXML
|
||||
@NbBundle.Messages({"StatusBar.fileUpdateTaskLabel.text= File Update Tasks",
|
||||
"StatusBar.bgTaskLabel.text=Regrouping",
|
||||
"StatuBar.toolTip=Some data may be out of date. Enable Image Gallery in Tools | Options | Image /Video Gallery , after ingest is complete to update the Image Gallery data."})
|
||||
"StatusBar.bgTaskLabel.text=Regrouping",
|
||||
"StatuBar.toolTip=Some data may be out of date. Enable Image Gallery in Tools | Options | Image /Video Gallery , after ingest is complete to update the Image Gallery data."})
|
||||
void initialize() {
|
||||
assert fileTaskProgresBar != null : "fx:id=\"fileTaskProgresBar\" was not injected: check your FXML file 'StatusBar.fxml'.";
|
||||
assert fileUpdateTaskLabel != null : "fx:id=\"fileUpdateTaskLabel\" was not injected: check your FXML file 'StatusBar.fxml'.";
|
||||
assert statusLabel != null : "fx:id=\"statusLabel\" was not injected: check your FXML file 'StatusBar.fxml'.";
|
||||
assert bgTaskLabel != null : "fx:id=\"bgTaskLabel\" was not injected: check your FXML file 'StatusBar.fxml'.";
|
||||
assert bgTaskProgressBar != null : "fx:id=\"bgTaskProgressBar\" was not injected: check your FXML file 'StatusBar.fxml'.";
|
||||
|
||||
fileUpdateTaskLabel.textProperty().bind(controller.getFileUpdateQueueSizeProperty().asString().concat(Bundle.StatusBar_fileUpdateTaskLabel_text()));//;setText(newSize.toString() + " File Update Tasks");
|
||||
fileTaskProgresBar.progressProperty().bind(controller.getFileUpdateQueueSizeProperty().negate());
|
||||
// controller.getFileUpdateQueueSizeProperty().addListener((ov, oldSize, newSize) -> {
|
||||
// Platform.runLater(() -> {
|
||||
//
|
||||
//
|
||||
// });
|
||||
// });
|
||||
fileUpdateTaskLabel.textProperty().bind(controller.getDBTasksQueueSizeProperty().asString().concat(Bundle.StatusBar_fileUpdateTaskLabel_text()));
|
||||
fileTaskProgresBar.progressProperty().bind(controller.getDBTasksQueueSizeProperty().negate());
|
||||
|
||||
controller.regroupProgress().addListener((ov, oldSize, newSize) -> {
|
||||
Platform.runLater(() -> {
|
||||
if(controller.regroupProgress().lessThan(1.0).get()){
|
||||
if (controller.regroupProgress().lessThan(1.0).get()) {
|
||||
// Regrouping in progress
|
||||
bgTaskProgressBar.progressProperty().setValue(-1.0);
|
||||
bgTaskLabel.setText(Bundle.StatusBar_bgTaskLabel_text());
|
||||
} else{
|
||||
} else {
|
||||
// Clear the progress bar
|
||||
bgTaskProgressBar.progressProperty().setValue(0.0);
|
||||
bgTaskLabel.setText("");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Platform.runLater(() -> {
|
||||
staleLabel.setTooltip(new Tooltip(Bundle.StatuBar_toolTip()));
|
||||
});
|
||||
Platform.runLater(() -> staleLabel.setTooltip(new Tooltip(Bundle.StatuBar_toolTip())));
|
||||
staleLabel.visibleProperty().bind(controller.stale());
|
||||
}
|
||||
|
||||
@ -116,14 +95,4 @@ public class StatusBar extends AnchorPane {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setLabelText(final String newText) {
|
||||
Platform.runLater(() -> {
|
||||
statusLabel.setText(newText);
|
||||
});
|
||||
}
|
||||
|
||||
public String getLabeltext() {
|
||||
return statusLabel.getText();
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ import javafx.scene.control.Slider;
|
||||
import javafx.scene.control.SplitMenuButton;
|
||||
import javafx.scene.control.ToolBar;
|
||||
import javax.swing.SortOrder;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
||||
@ -74,8 +73,6 @@ public class Toolbar extends ToolBar {
|
||||
@FXML
|
||||
private Label groupByLabel;
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private Label tagImageViewLabel;
|
||||
|
||||
@ -115,12 +112,12 @@ public class Toolbar extends ToolBar {
|
||||
|
||||
@FXML
|
||||
@NbBundle.Messages({"Toolbar.groupByLabel=Group By:",
|
||||
"Toolbar.sortByLabel=Sort By:",
|
||||
"Toolbar.ascRadio=Ascending",
|
||||
"Toolbar.descRadio=Descending",
|
||||
"Toolbar.tagImageViewLabel=Tag Group's Files:",
|
||||
"Toolbar.categoryImageViewLabel=Categorize Group's Files:",
|
||||
"Toolbar.thumbnailSizeLabel=Thumbnail Size (px):"})
|
||||
"Toolbar.sortByLabel=Sort By:",
|
||||
"Toolbar.ascRadio=Ascending",
|
||||
"Toolbar.descRadio=Descending",
|
||||
"Toolbar.tagImageViewLabel=Tag Group's Files:",
|
||||
"Toolbar.categoryImageViewLabel=Categorize Group's Files:",
|
||||
"Toolbar.thumbnailSizeLabel=Thumbnail Size (px):"})
|
||||
void initialize() {
|
||||
assert catGroupMenuButton != null : "fx:id=\"catSelectedMenubutton\" was not injected: check your FXML file 'Toolbar.fxml'.";
|
||||
assert groupByBox != null : "fx:id=\"groupByBox\" was not injected: check your FXML file 'Toolbar.fxml'.";
|
||||
@ -148,11 +145,6 @@ public class Toolbar extends ToolBar {
|
||||
}
|
||||
});
|
||||
|
||||
groupByLabel.setText(Bundle.Toolbar_groupByLabel());
|
||||
tagImageViewLabel.setText(Bundle.Toolbar_tagImageViewLabel());
|
||||
categoryImageViewLabel.setText(Bundle.Toolbar_categoryImageViewLabel());
|
||||
thumbnailSizeLabel.setText(Bundle.Toolbar_thumbnailSizeLabel());
|
||||
|
||||
CategorizeGroupAction cat5GroupAction = new CategorizeGroupAction(Category.FIVE, controller);
|
||||
catGroupMenuButton.setOnAction(cat5GroupAction);
|
||||
catGroupMenuButton.setText(cat5GroupAction.getText());
|
||||
@ -164,6 +156,12 @@ public class Toolbar extends ToolBar {
|
||||
catGroupMenuButton.getItems().setAll(categoryMenues);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
groupByLabel.setText(Bundle.Toolbar_groupByLabel());
|
||||
tagImageViewLabel.setText(Bundle.Toolbar_tagImageViewLabel());
|
||||
categoryImageViewLabel.setText(Bundle.Toolbar_categoryImageViewLabel());
|
||||
thumbnailSizeLabel.setText(Bundle.Toolbar_thumbnailSizeLabel());
|
||||
|
||||
groupByBox.setItems(FXCollections.observableList(DrawableAttribute.getGroupableAttrs()));
|
||||
groupByBox.getSelectionModel().select(DrawableAttribute.PATH);
|
||||
@ -182,8 +180,6 @@ public class Toolbar extends ToolBar {
|
||||
queryInvalidationListener.invalidated(observable);
|
||||
});
|
||||
|
||||
|
||||
|
||||
sortChooser.sortOrderProperty().addListener(queryInvalidationListener);
|
||||
sortChooser.setComparator(GroupSortBy.PRIORITY);
|
||||
getItems().add(1, sortChooser);
|
||||
@ -202,8 +198,6 @@ public class Toolbar extends ToolBar {
|
||||
public void reset() {
|
||||
Platform.runLater(() -> {
|
||||
groupByBox.getSelectionModel().select(DrawableAttribute.PATH);
|
||||
// sortByBox.getSelectionModel().select(GroupSortBy.NONE);
|
||||
// orderGroup.selectToggle(ascRadio);
|
||||
sizeSlider.setValue(SIZE_SLIDER_DEFAULT);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user