This commit is contained in:
jmillman 2014-09-03 15:30:37 -04:00
parent 990072d3bd
commit 4593b8d57e
14 changed files with 108 additions and 171 deletions

View File

@ -450,11 +450,11 @@ public final class ImageAnalyzerController implements FileUpdateListener {
for (GroupKey<?> gk : groupsForFile) {
Grouping g = groupManager.getGroupForKey(gk);
//if there is aleady a group that was previously deemed fully analyzed, then add this newly analyzed file to it.
if (g != null) {
//if there is aleady a group that was previously deemed fully analyzed, then add this newly analyzed file to it.
g.addFile(fileId);
} ////if there wasn't already a group check if there should be one now
else {
} else {
//if there wasn't already a group check if there should be one now
//TODO: use method in groupmanager ?
List<Long> checkAnalyzed = groupManager.checkAnalyzed(gk);
if (checkAnalyzed != null) { // => the group is analyzed, so add it to the ui

View File

@ -92,7 +92,7 @@ public class CategorizeAction extends AddTagAction {
List<ContentTag> allContentTags = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(file);
for (ContentTag ct : allContentTags) {
//this is bad: treating tags as categories as long as thier names start with prefix
//this is bad: treating tags as categories as long as their names start with prefix
//TODO: abandon using tags for categories and instead add a new column to DrawableDB
if (ct.getName().getDisplayName().startsWith(Category.CATEGORY_PREFIX)) {
LOGGER.log(Level.INFO, "removing old category from {0}", file.getName());
@ -104,8 +104,7 @@ public class CategorizeAction extends AddTagAction {
Case.getCurrentCase().getServices().getTagsManager().addContentTag(file, tagName, comment);
}
//make sure rest of ui hears category change.
controller.handleFileUpdate(
new FileUpdateEvent(Collections.singleton(fileID), DrawableAttribute.CATEGORY));
controller.handleFileUpdate(new FileUpdateEvent(Collections.singleton(fileID), DrawableAttribute.CATEGORY));
} catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "Error categorizing result", ex);

View File

@ -54,7 +54,7 @@ public enum Category implements Comparable<Category> {
final static private Map<String, Category> nameMap = new HashMap<>();
private static List<Category> valuesList = Arrays.asList(values());
private static final List<Category> valuesList = Arrays.asList(values());
static {
for (Category cat : values()) {

View File

@ -63,13 +63,11 @@ public class GroupKey<T extends Comparable<T>> implements Comparable<GroupKey<T>
return false;
}
final GroupKey<?> other = (GroupKey<?>) obj;
if (!Objects.equals(this.val, other.val)) {
return false;
}
if (this.attr != other.attr) {
return false;
}
return true;
return Objects.equals(this.val, other.val);
}
@Override

View File

@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.stream.Collectors;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@ -90,7 +91,7 @@ public class GroupManager {
@ThreadConfined(type = ThreadType.JFX)
private final ObservableList<Grouping> unSeenGroups = FXCollections.observableArrayList();
private final SortedList<Grouping> sortedUnSeenGroups = unSeenGroups.sorted();
private final SortedList<Grouping> sortedUnSeenGroups = new SortedList<>(unSeenGroups);
private final ObservableList<Grouping> publicSortedUnseenGroupsWrapper = FXCollections.unmodifiableObservableList(sortedUnSeenGroups);
@ -137,10 +138,16 @@ public class GroupManager {
* file is a part of
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public Set<GroupKey<?>> getGroupKeysForFile(DrawableFile<?> file) {
synchronized public Set<GroupKey<?>> getGroupKeysForFile(DrawableFile<?> file) {
Set<GroupKey<?>> resultSet = new HashSet<>();
for (Comparable<?> val : groupBy.getValue(file)) {
resultSet.add(new GroupKey(groupBy, val));
if (groupBy == DrawableAttribute.TAGS) {
if (((TagName) val).getDisplayName().startsWith(Category.CATEGORY_PREFIX) == false) {
resultSet.add(new GroupKey(groupBy, val));
}
} else {
resultSet.add(new GroupKey(groupBy, val));
}
}
return resultSet;
}
@ -154,7 +161,7 @@ public class GroupManager {
* @return a a set of {@link GroupKey}s representing the group(s) the given
* file is a part of
*/
public Set<GroupKey<?>> getGroupKeysForFileID(Long fileID) {
synchronized public Set<GroupKey<?>> getGroupKeysForFileID(Long fileID) {
try {
DrawableFile<?> file = db.getFileFromID(fileID);
return getGroupKeysForFile(file);
@ -185,7 +192,9 @@ public class GroupManager {
groupBy = DrawableAttribute.PATH;
sortOrder = SortOrder.ASCENDING;
Platform.runLater(() -> {
unSeenGroups.clear();
synchronized (unSeenGroups) {
unSeenGroups.clear();
}
analyzedGroups.clear();
});
synchronized (groupMap) {
@ -236,7 +245,9 @@ public class GroupManager {
}
public void markGroupSeen(Grouping group) {
unSeenGroups.remove(group);
synchronized (unSeenGroups) {
unSeenGroups.remove(group);
}
db.markGroupSeen(group.groupKey);
}
@ -255,13 +266,16 @@ public class GroupManager {
group.removeFile(fileID);
if (group.fileIds().isEmpty()) {
synchronized (groupMap) {
groupMap.remove(group.groupKey);
groupMap.remove(groupKey, group);
}
Platform.runLater(() -> {
analyzedGroups.remove(group);
unSeenGroups.remove(group);
synchronized (unSeenGroups) {
unSeenGroups.remove(group);
}
});
}
}
}
@ -292,9 +306,10 @@ public class GroupManager {
if (analyzedGroups.contains(g) == false) {
analyzedGroups.add(g);
}
if (groupSeen == false && unSeenGroups.contains(g) == false) {
unSeenGroups.add(g);
synchronized (unSeenGroups) {
if (groupSeen == false && unSeenGroups.contains(g) == false) {
unSeenGroups.add(g);
}
}
});
}
@ -399,7 +414,9 @@ public class GroupManager {
values = (List<A>) Category.valuesList();
break;
case TAGS:
values = (List<A>) Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse();
values = (List<A>) Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse().stream()
.filter(t -> t.getDisplayName().startsWith(Category.CATEGORY_PREFIX) == false)
.collect(Collectors.toList());
break;
case ANALYZED:
values = (List<A>) Arrays.asList(false, true);
@ -412,7 +429,6 @@ public class GroupManager {
//otherwise do straight db query
return db.findValuesForAttribute(groupBy, sortBy, sortOrder);
}
//sort in memory
Collections.sort(values, sortBy.getValueComparator(groupBy, sortOrder));
@ -600,7 +616,9 @@ public class GroupManager {
groupProgress = ProgressHandleFactory.createHandle("regrouping files by " + groupBy.attrName.toString() + " sorted by " + sortBy.name() + " in " + sortOrder.toString() + " order", this);
Platform.runLater(() -> {
analyzedGroups.clear();
unSeenGroups.clear();
synchronized (unSeenGroups) {
unSeenGroups.clear();
}
});
synchronized (groupMap) {
groupMap.clear();

View File

@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.imageanalyzer.grouping;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -42,7 +41,7 @@ public class Grouping {
public static final String UNKNOWN = "unknown";
final private ObservableList<Long> fileIDs = FXCollections.observableArrayList();
private final ObservableList<Long> fileIDs = FXCollections.observableArrayList();
//cache the number of files in this groups with hashset hits
private int filesWithHashSetHitsCount = -1;
@ -110,17 +109,13 @@ public class Grouping {
}
synchronized public void addFile(Long f) {
Platform.runLater(() -> {
if (fileIDs.contains(f) == false) {
fileIDs.add(f);
}
});
if (fileIDs.contains(f) == false) {
fileIDs.add(f);
}
}
synchronized public void removeFile(Long f) {
Platform.runLater(() -> {
fileIDs.removeAll(f);
});
fileIDs.removeAll(f);
}
}

View File

@ -34,6 +34,7 @@ import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.beans.Observable;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.ReadOnlyObjectWrapper;
@ -354,10 +355,13 @@ public class GroupPane extends BorderPane implements GroupView {
resetHeaderString();
//and assign fileIDs to gridView
if (grouping.get() == null) {
gridView.getItems().clear();
Platform.runLater(gridView.getItems()::clear);
} else {
gridView.setItems(grouping.get().fileIds());
grouping.get().fileIds().addListener((Observable p) -> {
Platform.runLater(() -> {
gridView.setItems(grouping.get().fileIds());
});
grouping.get().fileIds().addListener((Observable p) -> {
resetHeaderString();
});
}

View File

@ -24,6 +24,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.stream.Collectors;
import javafx.application.Platform;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
@ -52,6 +53,7 @@ import org.sleuthkit.autopsy.imageanalyzer.TagUtils;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.Category;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableFile;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
/**
@ -121,9 +123,15 @@ public class MetaDataPane extends AnchorPane implements Category.CategoryListene
});
attributeColumn.setPrefWidth(USE_COMPUTED_SIZE);
valueColumn.setCellValueFactory((p) -> {
return new SimpleStringProperty(StringUtils.join((Collection<?>) p.getValue().getValue(), ";"));
if (p.getValue().getKey() == DrawableAttribute.TAGS) {
return new SimpleStringProperty(((Collection<TagName>) p.getValue().getValue()).stream()
.map(TagName::getDisplayName)
.collect(Collectors.joining(" ; ", "", "")));
} else {
return new SimpleStringProperty(StringUtils.join((Collection<?>) p.getValue().getValue(), " ; "));
}
});
valueColumn.setPrefWidth(USE_COMPUTED_SIZE);
valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() {

View File

@ -75,6 +75,7 @@ import org.sleuthkit.autopsy.imageanalyzer.actions.SwingMenuItemAdapter;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.Category;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableFile;
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupKey;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
@ -250,6 +251,7 @@ public abstract class SingleDrawableViewBase extends AnchorPane implements Drawa
protected abstract void clearContent();
protected abstract void disposeContent();
protected abstract Runnable getContentUpdateRunnable();
protected abstract String getLabelText();
@ -264,18 +266,21 @@ public abstract class SingleDrawableViewBase extends AnchorPane implements Drawa
Exceptions.printStackTrace(ex);
}
} else {
//TODO: convert this to an action!
List<ContentTag> contentTagsByContent;
final ImageAnalyzerController controller = ImageAnalyzerController.getDefault();
try {
contentTagsByContent = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(getFile());
// remove file from old category group
controller.getGroupManager().removeFromGroup(new GroupKey<TagName>(DrawableAttribute.TAGS, TagUtils.getFollowUpTagName()), fileID);
List<ContentTag> contentTagsByContent = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(getFile());
for (ContentTag ct : contentTagsByContent) {
if (ct.getName().getDisplayName().equals(TagUtils.getFollowUpTagName().getDisplayName())) {
Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(ct);
SwingUtilities.invokeLater(() -> DirectoryTreeTopComponent.findInstance().refreshContentTreeSafe());
}
}
ImageAnalyzerController.getDefault().handleFileUpdate(new FileUpdateEvent(Collections.singleton(fileID), DrawableAttribute.TAGS));
controller.handleFileUpdate(new FileUpdateEvent(Collections.singleton(fileID), DrawableAttribute.TAGS));
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
}

View File

@ -37,17 +37,26 @@ class GroupTreeCell extends TreeCell<TreeNode> {
super.updateItem(tNode, empty);
prefWidthProperty().bind(getTreeView().widthProperty().subtract(15));
if (tNode != null) {
if (tNode == null || empty) {
Platform.runLater(() -> {
setTooltip(null);
setText(null);
setGraphic(null);
});
} else {
final String name = StringUtils.defaultIfBlank(tNode.getPath(), Grouping.UNKNOWN);
setTooltip(new Tooltip(name));
Platform.runLater(() -> {
setTooltip(new Tooltip(name));
});
if (tNode.getGroup() == null) {
setText(name);
setGraphic(new ImageView(EMPTY_FOLDER_ICON));
} else {
//this TreeNode has a group so append counts to name ...
setText(name + " (" + getNumerator() + getDenominator() + ")");
Platform.runLater(() -> {
setText(name);
setGraphic(new ImageView(EMPTY_FOLDER_ICON));
});
} else {
//if number of files in this group changes (eg file is recategorized), update counts
tNode.getGroup().fileIds().addListener((Observable o) -> {
Platform.runLater(() -> {
@ -55,13 +64,14 @@ class GroupTreeCell extends TreeCell<TreeNode> {
});
});
//... and use icon corresponding to group type
setGraphic(new ImageView(tNode.getGroup().groupKey.getAttribute().getIcon()));
Platform.runLater(() -> {
//this TreeNode has a group so append counts to name ...
setText(name + " (" + getNumerator() + getDenominator() + ")");
//... and use icon corresponding to group type
setGraphic(new ImageView(tNode.getGroup().groupKey.getAttribute().getIcon()));
});
}
} else {
setTooltip(null);
setText(null);
setGraphic(null);
}
}
@ -70,10 +80,15 @@ class GroupTreeCell extends TreeCell<TreeNode> {
* of hashset hits + "/"
*/
synchronized private String getNumerator() {
final String numerator = (getItem().getGroup().groupKey.getAttribute() != DrawableAttribute.HASHSET)
? getItem().getGroup().getFilesWithHashSetHitsCount() + "/"
: "";
return numerator;
try {
final String numerator = (getItem().getGroup().groupKey.getAttribute() != DrawableAttribute.HASHSET)
? getItem().getGroup().getFilesWithHashSetHitsCount() + "/"
: "";
return numerator;
} catch (NullPointerException e) {
//instead of this try catch block, remove the listener when assigned a null treeitem / group
return "";
}
}
/**

View File

@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.scene.control.TreeItem;
@ -189,7 +190,7 @@ class GroupTreeItem extends TreeItem<TreeNode> implements Comparable<GroupTreeIt
}
static GroupTreeItem getTreeItemForGroup(GroupTreeItem root, Grouping grouping) {
if (root.getValue().getGroup() == grouping) {
if (Objects.equals(root.getValue().getGroup(), grouping)) {
return root;
} else {
synchronized (root.getChildren()) {

View File

@ -1,5 +1,5 @@
#Updated by build script
#Wed, 27 Aug 2014 16:43:40 -0400
#Wed, 03 Sep 2014 09:52:11 -0400
LBL_splash_window_title=Starting Autopsy
SPLASH_HEIGHT=288
SPLASH_WIDTH=538

View File

@ -1,5 +1,5 @@
#Updated by build script
#Wed, 27 Aug 2014 16:43:40 -0400
#Wed, 03 Sep 2014 09:52:11 -0400
CTL_MainWindow_Title=Autopsy 3.1.0
CTL_MainWindow_Title_No_Project=Autopsy 3.1.0

View File

@ -13,111 +13,5 @@ cluster.path=\
${nbplatform.active.dir}/java:\
${nbplatform.active.dir}/platform
disabled.modules=\
org.apache.tools.ant.module,\
org.netbeans.api.debugger.jpda,\
org.netbeans.api.java,\
org.netbeans.lib.nbjavac,\
org.netbeans.libs.cglib,\
org.netbeans.libs.javacapi,\
org.netbeans.libs.javacimpl,\
org.netbeans.libs.springframework,\
org.netbeans.modules.ant.browsetask,\
org.netbeans.modules.ant.debugger,\
org.netbeans.modules.ant.freeform,\
org.netbeans.modules.ant.grammar,\
org.netbeans.modules.ant.kit,\
org.netbeans.modules.beans,\
org.netbeans.modules.classfile,\
org.netbeans.modules.dbschema,\
org.netbeans.modules.debugger.jpda,\
org.netbeans.modules.debugger.jpda.ant,\
org.netbeans.modules.debugger.jpda.kit,\
org.netbeans.modules.debugger.jpda.projects,\
org.netbeans.modules.debugger.jpda.ui,\
org.netbeans.modules.debugger.jpda.visual,\
org.netbeans.modules.findbugs.installer,\
org.netbeans.modules.form,\
org.netbeans.modules.form.binding,\
org.netbeans.modules.form.j2ee,\
org.netbeans.modules.form.kit,\
org.netbeans.modules.form.nb,\
org.netbeans.modules.form.refactoring,\
org.netbeans.modules.hibernate,\
org.netbeans.modules.hibernatelib,\
org.netbeans.modules.hudson.ant,\
org.netbeans.modules.hudson.maven,\
org.netbeans.modules.i18n,\
org.netbeans.modules.i18n.form,\
org.netbeans.modules.j2ee.core.utilities,\
org.netbeans.modules.j2ee.eclipselink,\
org.netbeans.modules.j2ee.eclipselinkmodelgen,\
org.netbeans.modules.j2ee.jpa.refactoring,\
org.netbeans.modules.j2ee.jpa.verification,\
org.netbeans.modules.j2ee.metadata,\
org.netbeans.modules.j2ee.metadata.model.support,\
org.netbeans.modules.j2ee.persistence,\
org.netbeans.modules.j2ee.persistence.kit,\
org.netbeans.modules.j2ee.persistenceapi,\
org.netbeans.modules.java.api.common,\
org.netbeans.modules.java.debug,\
org.netbeans.modules.java.editor,\
org.netbeans.modules.java.editor.lib,\
org.netbeans.modules.java.examples,\
org.netbeans.modules.java.freeform,\
org.netbeans.modules.java.guards,\
org.netbeans.modules.java.helpset,\
org.netbeans.modules.java.hints,\
org.netbeans.modules.java.hints.declarative,\
org.netbeans.modules.java.hints.declarative.test,\
org.netbeans.modules.java.hints.legacy.spi,\
org.netbeans.modules.java.hints.test,\
org.netbeans.modules.java.hints.ui,\
org.netbeans.modules.java.j2seplatform,\
org.netbeans.modules.java.j2seproject,\
org.netbeans.modules.java.kit,\
org.netbeans.modules.java.lexer,\
org.netbeans.modules.java.navigation,\
org.netbeans.modules.java.platform,\
org.netbeans.modules.java.preprocessorbridge,\
org.netbeans.modules.java.project,\
org.netbeans.modules.java.source,\
org.netbeans.modules.java.source.ant,\
org.netbeans.modules.java.source.queries,\
org.netbeans.modules.java.source.queriesimpl,\
org.netbeans.modules.java.sourceui,\
org.netbeans.modules.java.testrunner,\
org.netbeans.modules.javadoc,\
org.netbeans.modules.javawebstart,\
org.netbeans.modules.junit,\
org.netbeans.modules.maven,\
org.netbeans.modules.maven.checkstyle,\
org.netbeans.modules.maven.coverage,\
org.netbeans.modules.maven.embedder,\
org.netbeans.modules.maven.grammar,\
org.netbeans.modules.maven.graph,\
org.netbeans.modules.maven.hints,\
org.netbeans.modules.maven.indexer,\
org.netbeans.modules.maven.junit,\
org.netbeans.modules.maven.kit,\
org.netbeans.modules.maven.model,\
org.netbeans.modules.maven.osgi,\
org.netbeans.modules.maven.persistence,\
org.netbeans.modules.maven.refactoring,\
org.netbeans.modules.maven.repository,\
org.netbeans.modules.maven.search,\
org.netbeans.modules.maven.spring,\
org.netbeans.modules.projectimport.eclipse.core,\
org.netbeans.modules.projectimport.eclipse.j2se,\
org.netbeans.modules.refactoring.java,\
org.netbeans.modules.spellchecker.bindings.java,\
org.netbeans.modules.spring.beans,\
org.netbeans.modules.testng,\
org.netbeans.modules.testng.ant,\
org.netbeans.modules.testng.maven,\
org.netbeans.modules.websvc.jaxws21,\
org.netbeans.modules.websvc.jaxws21api,\
org.netbeans.modules.websvc.saas.codegen.java,\
org.netbeans.modules.xml.jaxb,\
org.netbeans.modules.xml.tools.java,\
org.netbeans.spi.java.hints
org.netbeans.modules.junit