Merge pull request #1317 from millmanorama/category_counts_during_ingest

show category count updates as ingest proceedes
This commit is contained in:
Richard Cordovano 2015-06-05 13:39:04 -04:00
commit e1a6f2a8c2
2 changed files with 11 additions and 22 deletions

View File

@ -698,9 +698,10 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
} }
} }
} }
if (evt.getChangedAttribute() == DrawableAttribute.CATEGORY) {
Category.fireChange(fileIDs); //we fire this event for all files so that the category counts get updated during initial db population
} Category.fireChange(fileIDs);
if (evt.getChangedAttribute() == DrawableAttribute.TAGS) { if (evt.getChangedAttribute() == DrawableAttribute.TAGS) {
TagUtils.fireChange(fileIDs); TagUtils.fireChange(fileIDs);
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-15 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");
@ -18,10 +18,8 @@
*/ */
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui;
import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
@ -35,12 +33,10 @@ import javafx.scene.layout.Priority;
import static javafx.scene.layout.Region.USE_COMPUTED_SIZE; import static javafx.scene.layout.Region.USE_COMPUTED_SIZE;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.util.Pair; import javafx.util.Pair;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor; import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.TagUtils;
import org.sleuthkit.autopsy.imagegallery.datamodel.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
@ -51,12 +47,6 @@ public class SummaryTablePane extends AnchorPane implements Category.CategoryLis
private static SummaryTablePane instance; private static SummaryTablePane instance;
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML @FXML
private TableColumn<Pair<Category, Integer>, String> catColumn; private TableColumn<Pair<Category, Integer>, String> catColumn;
@ -98,7 +88,6 @@ public class SummaryTablePane extends AnchorPane implements Category.CategoryLis
if (instance == null) { if (instance == null) {
instance = new SummaryTablePane(); instance = new SummaryTablePane();
} }
return instance; return instance;
} }
@ -107,9 +96,8 @@ public class SummaryTablePane extends AnchorPane implements Category.CategoryLis
*/ */
@Override @Override
public void handleCategoryChanged(Collection<Long> ids) { public void handleCategoryChanged(Collection<Long> ids) {
final ObservableList<Pair<Category, Integer>> data = FXCollections.observableArrayList();
if (Case.isCaseOpen()) { if (Case.isCaseOpen()) {
final ObservableList<Pair<Category, Integer>> data = FXCollections.observableArrayList();
for (Category cat : Category.values()) { for (Category cat : Category.values()) {
try { try {
data.add(new Pair<>(cat, ImageGalleryController.getDefault().getGroupManager().countFilesWithCategory(cat))); data.add(new Pair<>(cat, ImageGalleryController.getDefault().getGroupManager().countFilesWithCategory(cat)));
@ -117,11 +105,11 @@ public class SummaryTablePane extends AnchorPane implements Category.CategoryLis
Logger.getLogger(SummaryTablePane.class.getName()).log(Level.WARNING, "Error performing category file count"); Logger.getLogger(SummaryTablePane.class.getName()).log(Level.WARNING, "Error performing category file count");
} }
} }
Platform.runLater(() -> {
if (tableView != null) {
tableView.setItems(data);
}
});
} }
Platform.runLater(() -> {
if (tableView != null) {
tableView.setItems(data);
}
});
} }
} }