Merge pull request #1972 from millmanorama/IG-backgroundtask-cleanup

Ig backgroundtask cleanup
This commit is contained in:
Richard Cordovano 2016-02-19 11:46:10 -05:00
commit fb0ddccdd4
10 changed files with 143 additions and 160 deletions

View File

@ -128,8 +128,6 @@ public final class ImageGalleryController implements Executor {
*/ */
private final SimpleBooleanProperty listeningEnabled = new SimpleBooleanProperty(false); private final SimpleBooleanProperty listeningEnabled = new SimpleBooleanProperty(false);
private final ReadOnlyIntegerWrapper queueSizeProperty = new ReadOnlyIntegerWrapper(0);
private final ReadOnlyBooleanWrapper regroupDisabled = new ReadOnlyBooleanWrapper(false); private final ReadOnlyBooleanWrapper regroupDisabled = new ReadOnlyBooleanWrapper(false);
@ThreadConfined(type = ThreadConfined.ThreadType.JFX) @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
@ -154,7 +152,6 @@ public final class ImageGalleryController implements Executor {
private Node infoOverlay; private Node infoOverlay;
private SleuthkitCase sleuthKitCase; private SleuthkitCase sleuthKitCase;
// private NavPanel navPanel;
public ReadOnlyBooleanProperty getMetaDataCollapsed() { public ReadOnlyBooleanProperty getMetaDataCollapsed() {
return metaDataCollapsed.getReadOnlyProperty(); return metaDataCollapsed.getReadOnlyProperty();
@ -176,7 +173,7 @@ public final class ImageGalleryController implements Executor {
return historyManager.currentState(); return historyManager.currentState();
} }
public synchronized FileIDSelectionModel getSelectionModel() { public FileIDSelectionModel getSelectionModel() {
return selectionModel; return selectionModel;
} }
@ -188,13 +185,17 @@ public final class ImageGalleryController implements Executor {
return db; return db;
} }
synchronized public void setListeningEnabled(boolean enabled) { public void setListeningEnabled(boolean enabled) {
synchronized (listeningEnabled) {
listeningEnabled.set(enabled); listeningEnabled.set(enabled);
} }
}
synchronized boolean isListeningEnabled() { boolean isListeningEnabled() {
synchronized (listeningEnabled) {
return listeningEnabled.get(); return listeningEnabled.get();
} }
}
@ThreadConfined(type = ThreadConfined.ThreadType.ANY) @ThreadConfined(type = ThreadConfined.ThreadType.ANY)
void setStale(Boolean b) { void setStale(Boolean b) {
@ -249,12 +250,14 @@ public final class ImageGalleryController implements Executor {
checkForGroups(); checkForGroups();
}); });
IngestManager.getInstance().addIngestModuleEventListener((PropertyChangeEvent evt) -> { IngestManager ingestManager = IngestManager.getInstance();
Platform.runLater(this::updateRegroupDisabled); PropertyChangeListener ingestEventHandler =
}); propertyChangeEvent -> Platform.runLater(this::updateRegroupDisabled);
IngestManager.getInstance().addIngestJobEventListener((PropertyChangeEvent evt) -> {
Platform.runLater(this::updateRegroupDisabled); ingestManager.addIngestModuleEventListener(ingestEventHandler);
}); ingestManager.addIngestJobEventListener(ingestEventHandler);
queueSizeProperty.addListener(obs -> this.updateRegroupDisabled());
} }
public ReadOnlyBooleanProperty getCanAdvance() { public ReadOnlyBooleanProperty getCanAdvance() {
@ -281,8 +284,9 @@ public final class ImageGalleryController implements Executor {
return historyManager.retreat(); return historyManager.retreat();
} }
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
private void updateRegroupDisabled() { 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())); new ProgressIndicator()));
} }
} else if (getFileUpdateQueueSizeProperty().get() > 0) { } else if (queueSizeProperty.get() > 0) {
replaceNotification(fullUIStackPane, replaceNotification(fullUIStackPane,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg3(), new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg3(),
new ProgressIndicator())); new ProgressIndicator()));
@ -358,20 +362,14 @@ public final class ImageGalleryController implements Executor {
} }
} }
private void restartWorker() { synchronized private DBWorkerThread restartWorker() {
if (dbWorkerThread != null) { if (dbWorkerThread == null) {
dbWorkerThread = new DBWorkerThread(this);
dbWorkerThread.start();
} else {
// Keep using the same worker thread if one exists // Keep using the same worker thread if one exists
return;
} }
dbWorkerThread = new DBWorkerThread(); return 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();
} }
/** /**
@ -412,15 +410,16 @@ public final class ImageGalleryController implements Executor {
setListeningEnabled(false); setListeningEnabled(false);
ThumbnailCache.getDefault().clearCache(); ThumbnailCache.getDefault().clearCache();
historyManager.clear(); historyManager.clear();
groupManager.clear();
tagsManager.clearFollowUpTagName(); tagsManager.clearFollowUpTagName();
tagsManager.unregisterListener(groupManager); tagsManager.unregisterListener(groupManager);
tagsManager.unregisterListener(categoryManager); tagsManager.unregisterListener(categoryManager);
dbWorkerThread.cancelAllTasks(); dbWorkerThread.cancel();
dbWorkerThread = null; dbWorkerThread = null;
restartWorker(); dbWorkerThread = restartWorker();
Toolbar.getDefault(this).reset(); Toolbar.getDefault(this).reset();
groupManager.clear();
if (db != null) { if (db != null) {
db.closeDBCon(); db.closeDBCon();
} }
@ -432,11 +431,9 @@ public final class ImageGalleryController implements Executor {
* *
* @param innerTask * @param innerTask
*/ */
public void queueDBWorkerTask(InnerTask innerTask) { public synchronized void queueDBWorkerTask(BackgroundTask innerTask) {
// @@@ We could make a lock for the worker thread
if (dbWorkerThread == null) { if (dbWorkerThread == null) {
restartWorker(); dbWorkerThread = restartWorker();
} }
dbWorkerThread.addTask(innerTask); dbWorkerThread.addTask(innerTask);
} }
@ -456,10 +453,6 @@ public final class ImageGalleryController implements Executor {
Platform.runLater(this::checkForGroups); Platform.runLater(this::checkForGroups);
} }
public ReadOnlyIntegerProperty getFileUpdateQueueSizeProperty() {
return queueSizeProperty.getReadOnlyProperty();
}
public ReadOnlyDoubleProperty regroupProgress() { public ReadOnlyDoubleProperty regroupProgress() {
return groupManager.regroupProgress(); return groupManager.regroupProgress();
} }
@ -497,29 +490,43 @@ public final class ImageGalleryController implements Executor {
return undoManager; return undoManager;
} }
// @@@ REVIEW IF THIS SHOLD BE STATIC... public ReadOnlyIntegerProperty getDBTasksQueueSizeProperty() {
//TODO: concept seems like the controller deal with how much work to do at a given time 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.) // @@@ 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 // true if the process was requested to stop. Currently no way to reset it
private volatile boolean cancelled = false; private volatile boolean cancelled = false;
// list of tasks to run // 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. * Cancel all of the queued up tasks and the currently scheduled task.
* Note that after you cancel, you cannot submit new jobs to this * Note that after you cancel, you cannot submit new jobs to this
* thread. * thread.
*/ */
public void cancelAllTasks() { @Override
public boolean cancel() {
cancelled = true; cancelled = true;
for (InnerTask it : workQueue) { for (BackgroundTask it : workQueue) {
it.cancel(); it.cancel();
} }
workQueue.clear(); 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 * @param it
*/ */
public void addTask(InnerTask it) { public void addTask(BackgroundTask it) {
workQueue.add(it); workQueue.add(it);
Platform.runLater(() -> { int size = workQueue.size();
queueSizeProperty.set(workQueue.size()); Platform.runLater(() -> controller.queueSizeProperty.set(size));
});
} }
@Override @Override
@ -539,19 +545,17 @@ public final class ImageGalleryController implements Executor {
// nearly infinite loop waiting for tasks // nearly infinite loop waiting for tasks
while (true) { while (true) {
if (cancelled) { if (cancelled || isInterrupted()) {
return; return;
} }
try { try {
InnerTask it = workQueue.take(); BackgroundTask it = workQueue.take();
if (it.isCancelled() == false) { if (it.isCancelled() == false) {
it.run(); it.run();
} }
int size = workQueue.size();
Platform.runLater(() -> { Platform.runLater(() -> controller.queueSizeProperty.set(size));
queueSizeProperty.set(workQueue.size());
});
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
LOGGER.log(Level.SEVERE, "Failed to run DB worker thread", ex); //NON-NLS 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", @NbBundle.Messages({"ImageGalleryController.InnerTask.progress.name=progress",
"ImageGalleryController.InnerTask.message.name=status"}) "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() { public double getProgress() {
return progress.get(); return progress.get();
@ -586,9 +597,6 @@ public final class ImageGalleryController implements Executor {
public final void updateMessage(String Status) { public final void updateMessage(String Status) {
this.message.set(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() { public SimpleDoubleProperty progressProperty() {
return progress; return progress;
@ -602,24 +610,21 @@ public final class ImageGalleryController implements Executor {
return state.get(); return state.get();
} }
protected void updateState(Worker.State newState) {
state.set(newState);
}
public ReadOnlyObjectProperty<Worker.State> stateProperty() { public ReadOnlyObjectProperty<Worker.State> stateProperty() {
return new ReadOnlyObjectWrapper<>(state.get()); return new ReadOnlyObjectWrapper<>(state.get());
} }
protected InnerTask() {
}
@Override @Override
synchronized public boolean cancel() { public synchronized boolean cancel() {
updateState(Worker.State.CANCELLED); updateState(Worker.State.CANCELLED);
return true; return true;
} }
synchronized protected boolean isCancelled() { protected void updateState(Worker.State newState) {
state.set(newState);
}
protected synchronized boolean isCancelled() {
return getState() == Worker.State.CANCELLED; 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 * 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 AbstractFile file;
private final DrawableDB taskDB; private final DrawableDB taskDB;
@ -704,7 +709,7 @@ public final class ImageGalleryController implements Executor {
@NbBundle.Messages({"BulkTask.committingDb.status=commiting image/video database", @NbBundle.Messages({"BulkTask.committingDb.status=commiting image/video database",
"BulkTask.stopCopy.status=Stopping copy to drawable db task.", "BulkTask.stopCopy.status=Stopping copy to drawable db task.",
"BulkTask.errPopulating.errMsg=There was an error populating Image Gallery database."}) "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 = static private final String FILE_EXTENSION_CLAUSE =
"(name LIKE '%." //NON-NLS "(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 * adds them to the Drawable DB. Uses the presence of a mimetype as an
* approximation to 'analyzed'. * 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 { static private class CopyAnalyzedFiles extends BulkTransferTask {
private static final Logger LOGGER = Logger.getLogger(CopyAnalyzedFiles.class.getName());
CopyAnalyzedFiles(ImageGalleryController controller, DrawableDB taskDB, SleuthkitCase tskCase) { CopyAnalyzedFiles(ImageGalleryController controller, DrawableDB taskDB, SleuthkitCase tskCase) {
super(controller, taskDB, 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 * TODO: create methods to simplify progress value/text updates to both
* netbeans and ImageGallery progress/status * netbeans and ImageGallery progress/status
*/ */
@NbBundle.Messages({"PrePopulateDataSourceFiles.committingDb.status=commiting image/video database"})
static private class PrePopulateDataSourceFiles extends BulkTransferTask { static private class PrePopulateDataSourceFiles extends BulkTransferTask {
private static final Logger LOGGER = Logger.getLogger(PrePopulateDataSourceFiles.class.getName()); private static final Logger LOGGER = Logger.getLogger(PrePopulateDataSourceFiles.class.getName());

View File

@ -112,7 +112,7 @@ public class CategorizeAction extends Action {
@NbBundle.Messages({"# {0} - fileID number", @NbBundle.Messages({"# {0} - fileID number",
"CategorizeTask.errorUnable.msg=Unable to categorize {0}.", "CategorizeTask.errorUnable.msg=Unable to categorize {0}.",
"CategorizeTask.errorUnable.title=Categorizing Error"}) "CategorizeTask.errorUnable.title=Categorizing Error"})
private class CategorizeTask extends ImageGalleryController.InnerTask { private class CategorizeTask extends ImageGalleryController.BackgroundTask {
private final Set<Long> fileIDs; private final Set<Long> fileIDs;

View File

@ -18,7 +18,7 @@
*/ */
package org.sleuthkit.autopsy.imagegallery.actions; 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.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.datamodel.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
@ -28,6 +28,10 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
public class CategorizeGroupAction extends CategorizeAction { public class CategorizeGroupAction extends CategorizeAction {
public CategorizeGroupAction(Category cat, ImageGalleryController controller) { 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)
);
} }
} }

View File

@ -27,6 +27,10 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
public class CategorizeSelectedFilesAction extends CategorizeAction { public class CategorizeSelectedFilesAction extends CategorizeAction {
public CategorizeSelectedFilesAction(Category cat, ImageGalleryController controller) { 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)
);
} }
} }

View File

@ -28,6 +28,10 @@ import org.sleuthkit.datamodel.TagName;
public class TagGroupAction extends AddTagAction { public class TagGroupAction extends AddTagAction {
public TagGroupAction(final TagName tagName, ImageGalleryController controller) { 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)
);
} }
} }

View File

@ -27,6 +27,10 @@ import org.sleuthkit.datamodel.TagName;
public class TagSelectedFilesAction extends AddTagAction { public class TagSelectedFilesAction extends AddTagAction {
public TagSelectedFilesAction(final TagName tagName, ImageGalleryController controller) { 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)
);
} }
} }

View File

@ -213,7 +213,7 @@ public class DrawableTagsManager {
} catch (TagsManager.TagNameAlreadyExistsException ex) { } catch (TagsManager.TagNameAlreadyExistsException ex) {
throw new TskCoreException("tagame exists but wasn't found", 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 LOGGER.log(Level.SEVERE, "Case was closed out from underneath", ex); //NON-NLS
throw new TskCoreException("Case was closed out from underneath", ex); throw new TskCoreException("Case was closed out from underneath", ex);
} }

View File

@ -1,16 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?> <?import javafx.geometry.Insets?>
<?import javafx.geometry.*?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.image.*?> <?import javafx.scene.image.Image?>
<?import javafx.scene.layout.*?> <?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> <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"> <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> <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> <children>
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="NEVER"> <StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="NEVER">
<children> <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"> <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> <StackPane.margin>
<Insets left="3.0" right="3.0" /> <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> </children>
<HBox.margin> <HBox.margin>
<Insets /> <Insets />
@ -27,10 +34,13 @@
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="NEVER"> <StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="NEVER">
<children> <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" /> <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> <StackPane.margin>
<Insets left="3.0" right="3.0" /> <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> </children>
<HBox.margin> <HBox.margin>
<Insets right="5.0" /> <Insets right="5.0" />
@ -42,19 +52,6 @@
</BorderPane.margin> </BorderPane.margin>
</HBox> </HBox>
</right> </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"> <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"> <graphic><ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
<image> <image>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013-14 Basis Technology Corp. * Copyright 2013-16 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,8 +19,6 @@
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
@ -38,21 +36,12 @@ public class StatusBar extends AnchorPane {
private final ImageGalleryController controller; private final ImageGalleryController controller;
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML @FXML
private ProgressBar fileTaskProgresBar; private ProgressBar fileTaskProgresBar;
@FXML @FXML
private Label fileUpdateTaskLabel; private Label fileUpdateTaskLabel;
@FXML
private Label statusLabel;
@FXML @FXML
private Label bgTaskLabel; private Label bgTaskLabel;
@ -69,18 +58,11 @@ public class StatusBar extends AnchorPane {
void initialize() { void initialize() {
assert fileTaskProgresBar != null : "fx:id=\"fileTaskProgresBar\" was not injected: check your FXML file 'StatusBar.fxml'."; 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 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 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'."; 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"); fileUpdateTaskLabel.textProperty().bind(controller.getDBTasksQueueSizeProperty().asString().concat(Bundle.StatusBar_fileUpdateTaskLabel_text()));
fileTaskProgresBar.progressProperty().bind(controller.getFileUpdateQueueSizeProperty().negate()); fileTaskProgresBar.progressProperty().bind(controller.getDBTasksQueueSizeProperty().negate());
// controller.getFileUpdateQueueSizeProperty().addListener((ov, oldSize, newSize) -> {
// Platform.runLater(() -> {
//
//
// });
// });
controller.regroupProgress().addListener((ov, oldSize, newSize) -> { controller.regroupProgress().addListener((ov, oldSize, newSize) -> {
Platform.runLater(() -> { Platform.runLater(() -> {
@ -96,10 +78,7 @@ public class StatusBar extends AnchorPane {
}); });
}); });
Platform.runLater(() -> staleLabel.setTooltip(new Tooltip(Bundle.StatuBar_toolTip())));
Platform.runLater(() -> {
staleLabel.setTooltip(new Tooltip(Bundle.StatuBar_toolTip()));
});
staleLabel.visibleProperty().bind(controller.stale()); 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();
}
} }

View File

@ -36,7 +36,6 @@ import javafx.scene.control.Slider;
import javafx.scene.control.SplitMenuButton; import javafx.scene.control.SplitMenuButton;
import javafx.scene.control.ToolBar; import javafx.scene.control.ToolBar;
import javax.swing.SortOrder; import javax.swing.SortOrder;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor; import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
@ -74,8 +73,6 @@ public class Toolbar extends ToolBar {
@FXML @FXML
private Label groupByLabel; private Label groupByLabel;
@FXML @FXML
private Label tagImageViewLabel; private Label tagImageViewLabel;
@ -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); CategorizeGroupAction cat5GroupAction = new CategorizeGroupAction(Category.FIVE, controller);
catGroupMenuButton.setOnAction(cat5GroupAction); catGroupMenuButton.setOnAction(cat5GroupAction);
catGroupMenuButton.setText(cat5GroupAction.getText()); catGroupMenuButton.setText(cat5GroupAction.getText());
@ -165,6 +157,12 @@ 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());
groupByBox.setItems(FXCollections.observableList(DrawableAttribute.getGroupableAttrs())); groupByBox.setItems(FXCollections.observableList(DrawableAttribute.getGroupableAttrs()));
groupByBox.getSelectionModel().select(DrawableAttribute.PATH); groupByBox.getSelectionModel().select(DrawableAttribute.PATH);
groupByBox.getSelectionModel().selectedItemProperty().addListener(queryInvalidationListener); groupByBox.getSelectionModel().selectedItemProperty().addListener(queryInvalidationListener);
@ -182,8 +180,6 @@ public class Toolbar extends ToolBar {
queryInvalidationListener.invalidated(observable); queryInvalidationListener.invalidated(observable);
}); });
sortChooser.sortOrderProperty().addListener(queryInvalidationListener); sortChooser.sortOrderProperty().addListener(queryInvalidationListener);
sortChooser.setComparator(GroupSortBy.PRIORITY); sortChooser.setComparator(GroupSortBy.PRIORITY);
getItems().add(1, sortChooser); getItems().add(1, sortChooser);
@ -202,8 +198,6 @@ public class Toolbar extends ToolBar {
public void reset() { public void reset() {
Platform.runLater(() -> { Platform.runLater(() -> {
groupByBox.getSelectionModel().select(DrawableAttribute.PATH); groupByBox.getSelectionModel().select(DrawableAttribute.PATH);
// sortByBox.getSelectionModel().select(GroupSortBy.NONE);
// orderGroup.selectToggle(ascRadio);
sizeSlider.setValue(SIZE_SLIDER_DEFAULT); sizeSlider.setValue(SIZE_SLIDER_DEFAULT);
}); });
} }