diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java index 76b7b7f352..766f2b713d 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java @@ -91,12 +91,6 @@ public interface DisplayableItemNodeVisitor { */ T visit(Tags.RootNode node); - T visit(Tags.TagNameNode node); - - T visit(Tags.ContentTagTypeNode node); - - T visit(Tags.BlackboardArtifactTagTypeNode node); - /* * Reports @@ -270,21 +264,6 @@ public interface DisplayableItemNodeVisitor { return defaultVisit(node); } - @Override - public T visit(Tags.TagNameNode node) { - return defaultVisit(node); - } - - @Override - public T visit(Tags.ContentTagTypeNode node) { - return defaultVisit(node); - } - - @Override - public T visit(Tags.BlackboardArtifactTagTypeNode node) { - return defaultVisit(node); - } - @Override public T visit(Reports.ReportsListNode node) { return defaultVisit(node); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/RootContentChildren.java b/Core/src/org/sleuthkit/autopsy/datamodel/RootContentChildren.java index 695c3f6930..4ac4df209a 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/RootContentChildren.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/RootContentChildren.java @@ -97,7 +97,7 @@ public class RootContentChildren extends Children.Keys { public static Node createNode(Object key) { if (key instanceof Tags) { Tags tagsNodeKey = (Tags) key; - return tagsNodeKey.new RootNode(tagsNodeKey.filteringDataSourceObjId()); + return new Tags.RootNode(tagsNodeKey.filteringDataSourceObjId()); } else if (key instanceof DataSources) { DataSources dataSourcesKey = (DataSources) key; return new DataSourceFilesNode(dataSourcesKey.filteringDataSourceObjId()); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java index b26e8a6adb..c2239340ca 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java @@ -31,6 +31,30 @@ import org.sleuthkit.autopsy.mainui.nodes.TagNameFactory; * factory built on top of the NetBeans Children.Keys class. */ public class Tags { + private final static String DISPLAY_NAME = NbBundle.getMessage(RootNode.class, "TagsNode.displayName.text"); + private final long filteringDSObjId; // 0 if not filtering/grouping by data source + + Tags() { + this(0); + } + + Tags(long dsObjId) { + this.filteringDSObjId = dsObjId; + } + + /** + * Return the display name used by the tags node in the tree. + * + * @return - DISPLAY_NAME + */ + public static String getTagsDisplayName() { + return DISPLAY_NAME; + } + + long filteringDataSourceObjId() { + return this.filteringDSObjId; + } + /** * Instances of this class are the root nodes of tree that is a sub-tree of * the Autopsy presentation of the SleuthKit data model. The sub-tree @@ -38,16 +62,16 @@ public class Tags { * type, then by tag name. */ public static class RootNode extends DisplayableItemNode { - private final static String DISPLAY_NAME = NbBundle.getMessage(RootNode.class, "TagsNode.displayName.text"); + private final static String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS private final Long dataSourceObjId; public RootNode(Long dsId) { - super(Children.create(new TagNameFactory(dsId > 0 ? dsId : null), true), Lookups.singleton(DISPLAY_NAME)); + super(Children.create(new TagNameFactory(dsId != null && dsId> 0 ? dsId : null), true), Lookups.singleton(DISPLAY_NAME)); super.setName(DISPLAY_NAME); super.setDisplayName(DISPLAY_NAME); this.setIconBaseWithExtension(ICON_PATH); - this.dataSourceObjId = dsId > 0 ? dsId : null; + this.dataSourceObjId = dsId != null && dsId> 0 ? dsId : null; } @Override @@ -81,5 +105,12 @@ public class Tags { public Node clone() { return new RootNode(dataSourceObjId); } + + /** + * Cause the contents of the RootNode and its children to be updated. + */ + public void refresh() { + this.refresh(); + } } } diff --git a/Core/src/org/sleuthkit/autopsy/mainui/datamodel/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/mainui/datamodel/Bundle.properties-MERGED index 067caeaded..4fe5bc1c15 100644 --- a/Core/src/org/sleuthkit/autopsy/mainui/datamodel/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/mainui/datamodel/Bundle.properties-MERGED @@ -117,3 +117,5 @@ TagsDAO.tagColumns.sourceNameColLbl=Source Name TagsDAO.tagColumns.sourcePathColLbl=Source File Path TagsDAO.tagColumns.typeColLbl=Result Type TagsDAO.tagColumns.userNameColLbl=User Name +TagType_File_displayName=File Tags +TagType_Result_displayName=Result Tags diff --git a/Core/src/org/sleuthkit/autopsy/mainui/datamodel/TagsDAO.java b/Core/src/org/sleuthkit/autopsy/mainui/datamodel/TagsDAO.java index e1e5ac5b23..9f94b0d5d9 100755 --- a/Core/src/org/sleuthkit/autopsy/mainui/datamodel/TagsDAO.java +++ b/Core/src/org/sleuthkit/autopsy/mainui/datamodel/TagsDAO.java @@ -361,9 +361,9 @@ public class TagsDAO extends AbstractDAO { Collection daoEvents = Collections.singletonList(data); - Collection treeEvents = this.treeCounts.enqueueAll(daoEvents).stream() - .map(arEvt -> new TreeEvent(getTreeItem(arEvt, TreeResultsDTO.TreeDisplayCount.INDETERMINATE), false)) - .collect(Collectors.toList()); + Collection treeEvents = daoEvents.stream() + .map(arEvt -> new TreeEvent(getTreeItem(arEvt, TreeResultsDTO.TreeDisplayCount.UNSPECIFIED), true)) + .collect(Collectors.toSet()); return Stream.of(daoEvents, treeEvents) .flatMap(lst -> lst.stream()) @@ -610,7 +610,7 @@ public class TagsDAO extends AbstractDAO { return new TreeItemDTO<>( TagsSearchParams.getTypeId(), new TagsSearchParams(tagName, tagType, dataSourceId), - tagName.getId(), + tagName.getId() + "_" + tagType.name(), tagType.getDisplayName(), treeDisplayCount );