mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #5019 from raman-bt/5237-ig-dup-ds
5237: Duplicate datasources do not show in the ImageGallery Path grou…
This commit is contained in:
commit
7065bd036f
@ -189,7 +189,7 @@ class GroupCellFactory {
|
||||
@Override
|
||||
public String getGroupName() {
|
||||
return Optional.ofNullable(getItem())
|
||||
.map(treeNode -> StringUtils.defaultIfBlank(treeNode.getPath(), DrawableGroup.getBlankGroupName()))
|
||||
.map(treeNode -> StringUtils.defaultIfBlank(treeNode.getDisplayName(), DrawableGroup.getBlankGroupName()))
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,11 @@ final public class GroupTree extends NavPanel<TreeItem<GroupTreeNode>> {
|
||||
String path = g.getGroupByValueDislpayName();
|
||||
if (g.getGroupByAttribute() == DrawableAttribute.PATH) {
|
||||
String[] cleanPathTokens = StringUtils.stripStart(path, "/").split("/");
|
||||
|
||||
// Append obj id to the top level data source name to allow for duplicate data source names
|
||||
if (g.getGroupKey().getDataSourceObjId() > 0) {
|
||||
cleanPathTokens[0] = cleanPathTokens[0].concat(String.format("(Id: %d)", g.getGroupKey().getDataSourceObjId()));
|
||||
}
|
||||
return Arrays.asList(cleanPathTokens);
|
||||
} else {
|
||||
String stripStart = StringUtils.strip(path, "/");
|
||||
|
@ -27,6 +27,7 @@ class GroupTreeNode {
|
||||
|
||||
private final String path;
|
||||
private DrawableGroup group;
|
||||
private final String dispName;
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
@ -36,9 +37,20 @@ class GroupTreeNode {
|
||||
return group;
|
||||
}
|
||||
|
||||
GroupTreeNode(String path, DrawableGroup group) {
|
||||
public String getDisplayName() {
|
||||
return dispName;
|
||||
}
|
||||
|
||||
GroupTreeNode(String path, DrawableGroup group) {
|
||||
this.path = path;
|
||||
this.group = group;
|
||||
|
||||
// If the path has a obj id, strip it for display purpose.
|
||||
if (path.toLowerCase().contains(("(Id: ").toLowerCase())) {
|
||||
dispName = path.substring(0, path.indexOf("(Id: "));
|
||||
} else {
|
||||
dispName = path;
|
||||
}
|
||||
}
|
||||
|
||||
void setGroup(DrawableGroup g) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user