19 package org.sleuthkit.autopsy.contentviewers;
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.List;
25 import java.util.Objects;
26 import javax.swing.Action;
27 import org.openide.nodes.AbstractNode;
28 import org.openide.nodes.ChildFactory;
29 import org.openide.nodes.Children;
30 import org.openide.nodes.Node;
31 import org.openide.nodes.Sheet;
39 private final List<Map<String, Object>>
rows;
44 this.colActions = actions;
50 for (
int i = 0; i < rows.size(); i++) {
59 if (Objects.isNull(rows) || rows.isEmpty() || key >= rows.size()) {
63 return new SQLiteTableRowNode(rows.get(key), this.
colActions );
72 class SQLiteTableRowNode
extends AbstractNode {
74 private final Map<String, Object> row;
75 private final List<Action> nodeActions;
77 SQLiteTableRowNode(Map<String, Object> row, List<Action> actions) {
80 this.nodeActions = actions;
84 protected Sheet createSheet() {
86 Sheet sheet = super.createSheet();
87 Sheet.Set properties = sheet.get(Sheet.PROPERTIES);
88 if (properties == null) {
89 properties = Sheet.createPropertiesSet();
90 sheet.put(properties);
93 for (Map.Entry<String, Object> col : row.entrySet()) {
94 String colName = col.getKey();
95 String colVal = col.getValue().toString();
96 properties.put(
new NodeProperty<>(colName, colName, colName, colVal));
103 public Action[] getActions(
boolean context) {
104 List<Action> actions =
new ArrayList<>();
106 actions.addAll(Arrays.asList(super.getActions(context)));
107 actions.addAll(nodeActions);
109 return actions.toArray(
new Action[actions.size()]);
final List< Action > colActions
final List< Map< String, Object > > rows
Node createNodeForKey(Integer key)
boolean createKeys(List< Integer > keys)