common files search results supports child row

This commit is contained in:
Brian Sweeney 2018-03-20 15:56:18 -06:00
parent 78c7e9cef1
commit e2633606f8
3 changed files with 58 additions and 1 deletions

View File

@ -88,7 +88,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
DataResultFilterNode dataResultFilterNode = new DataResultFilterNode(contentFilesNode, DirectoryTreeTopComponent.findInstance().getExplorerManager());
TableFilterNode tableFilterNode = new TableFilterNode(dataResultFilterNode, true);
TableFilterNode tableFilterNode = new TableFilterNode(dataResultFilterNode);
TopComponent component = DataResultTopComponent.createInstance(
title,

View File

@ -0,0 +1,47 @@
/*
*
* Autopsy Forensic Browser
*
* Copyright 2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.corecomponents;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
/**
* Provides TableFilterChildren functionality, and adds support for children
* of rows (plus/minus buttons for each row with children).
*/
class TableFilterChildrenWithDescendants extends TableFilterChildren {
private TableFilterChildrenWithDescendants(Node wrappedNode) {
super(wrappedNode);
}
public static Children createInstance(Node wrappedNode, boolean createChildren){
if(createChildren){
return new TableFilterChildrenWithDescendants(wrappedNode);
} else {
return Children.LEAF;
}
}
@Override
protected Node copyNode(Node nodeToCopy){
return new TableFilterNode(nodeToCopy, true);
}
}

View File

@ -49,6 +49,16 @@ public class TableFilterNode extends FilterNode {
super(node, TableFilterChildren.createInstance(node, createChildren), Lookups.proxy(node));
this.createChildren = createChildren;
}
/**
* Constructs a filter node that generates children using TableFilterChildrenWithDescendants.
* This enables row to have descendants.
* @param node The node to wrap
*/
public TableFilterNode(Node node){
super(node, TableFilterChildrenWithDescendants.createInstance(node, true), Lookups.proxy(node));
this.createChildren = true;
}
/**
* Constructs a filter node that creates at most one layer of child nodes