Skip to content

Commit

Permalink
'#43 Adds a distinct tree icon for report folders (decoded data that has
Browse files Browse the repository at this point in the history
children), as the Leapp Report.
  • Loading branch information
patrickdalla committed Oct 17, 2023
1 parent e0a0d64 commit 318fba3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions iped-app/src/main/java/iped/app/ui/IconManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public class IconManager {

private static final String folderOpenedKey = "folder-opened";
private static final String folderClosedKey = "folder-closed";

private static final String reportFolderIcon = "reportfolder";
private static final String reportFolderOpenedIcon = "reportfolder";

private static final String diskKey = "drive";
private static final String fileKey = "file";

Expand Down Expand Up @@ -114,6 +118,10 @@ public static Icon getFolderIcon(boolean isOpened) {
return getTreeIcon(isOpened ? folderOpenedKey : folderClosedKey);
}

public static Icon getReportFolderIcon(boolean isOpened) {
return getTreeIcon(isOpened ? reportFolderOpenedIcon : reportFolderIcon);
}

public static Icon getFolderIconGallery() {
return getFolderIconGallery(false);
}
Expand Down
6 changes: 6 additions & 0 deletions iped-app/src/main/java/iped/app/ui/TreeCellRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import iped.app.ui.TreeViewModel.Node;
import iped.engine.task.index.IndexItem;
import iped.properties.BasicProps;
import iped.properties.ExtraProperties;

public class TreeCellRenderer extends DefaultTreeCellRenderer {

Expand All @@ -43,10 +44,15 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean
boolean isDir = Boolean.valueOf(node.getDoc().get(IndexItem.ISDIR)) || node.docId == -1;
super.getTreeCellRendererComponent(tree, value, selected, expanded, !isDir, row, hasFocus);

boolean isDecodedReport = Boolean.valueOf(node.getDoc().get(ExtraProperties.DECODED_DATA));
isDecodedReport = isDecodedReport && Boolean.valueOf(node.getDoc().get(BasicProps.HASCHILD));

if (row == 0) {
setIcon(rootIcon);
} else if (isDir) {
setIcon(IconManager.getFolderIcon(expanded));
} else if (isDecodedReport) {
setIcon(IconManager.getReportFolderIcon(expanded));
} else {
Document doc = node.getDoc();
String type = doc.get(BasicProps.TYPE);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 318fba3

Please sign in to comment.