19 package org.sleuthkit.autopsy.contentviewers;
21 import java.util.Arrays;
22 import java.util.List;
23 import java.util.Objects;
24 import org.openide.nodes.AbstractNode;
25 import org.openide.nodes.ChildFactory;
26 import org.openide.nodes.Children;
27 import org.openide.nodes.Node;
28 import org.openide.nodes.Sheet;
38 private final List<PropKeyValue>
rows;
53 for (
int i = 0; i < rows.size(); i++) {
67 if (Objects.isNull(rows) || rows.isEmpty() || key >= rows.size()) {
70 return new PListNode(rows.get(key));
77 class PListNode
extends AbstractNode {
79 private final PropKeyValue propKeyVal;
81 PListNode(
final PropKeyValue propKeyVal) {
83 super(propKeyVal.getChildren() == null ? Children.LEAF :
new PListNodeChildren(propKeyVal.getChildren()));
85 this.propKeyVal = propKeyVal;
87 super.setName(propKeyVal.getKey());
88 super.setDisplayName(propKeyVal.getKey());
89 if (propKeyVal.getType() == PropertyType.ARRAY) {
90 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/keychain-16.png");
91 }
else if (propKeyVal.getType() == PropertyType.DICTIONARY) {
92 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/keys-dict-16.png");
94 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/key-16.png");
103 protected Sheet createSheet() {
105 final Sheet sheet = super.createSheet();
106 Sheet.Set properties = sheet.get(Sheet.PROPERTIES);
107 if (properties == null) {
108 properties = Sheet.createPropertiesSet();
109 sheet.put(properties);
112 properties.put(
new NodeProperty<>(Bundle.PListNode_TypeCol(),
113 Bundle.PListNode_TypeCol(),
114 Bundle.PListNode_TypeCol(),
115 propKeyVal.getType().name()));
117 properties.put(
new NodeProperty<>(Bundle.PListNode_ValueCol(),
118 Bundle.PListNode_ValueCol(),
119 Bundle.PListNode_ValueCol(),
120 (propKeyVal.getChildren() == null) ? propKeyVal.getValue() :
""));
134 this.children = Arrays.asList(children);
139 super.setKeys(this.children);
144 return new Node[]{
new PListNode(propKeyVal)};
Node[] createNodes(final PropKeyValue propKeyVal)
Node createNodeForKey(final Integer key)
final List< PropKeyValue > rows
boolean createKeys(final List< Integer > keys)
final List< PropKeyValue > children