From a1d3db93f5e5c88cc8c81ff45499cf8959d5eb5d Mon Sep 17 00:00:00 2001 From: Brian Sweeney Date: Wed, 11 Apr 2018 17:46:12 -0600 Subject: [PATCH] added a loading node for use when child nodes are still being loaded --- .../datamodel/CommonFileChildNode.java | 3 +- .../datamodel/CommonFileChildNodeLoading.java | 48 +++++++++++++++++++ .../datamodel/CommonFileParentNode.java | 5 ++ .../datamodel/DisplayableItemNodeVisitor.java | 7 +++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNodeLoading.java diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNode.java index 409c705521..0361f36377 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNode.java @@ -112,5 +112,6 @@ public class CommonFileChildNode extends FileNode { public String toString() { return displayString; } - } + } + } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNodeLoading.java b/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNodeLoading.java new file mode 100644 index 0000000000..3c2c525a67 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileChildNodeLoading.java @@ -0,0 +1,48 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit 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.datamodel; + +import org.openide.nodes.Children; + +/** + * A dummy node used by the child factory to display while children are being + * generated + */ +public class CommonFileChildNodeLoading extends DisplayableItemNode { + + public CommonFileChildNodeLoading(Children children) { + super(children); + } + + @Override + public T accept(DisplayableItemNodeVisitor visitor) { + return visitor.visit(this); + } + + @Override + public boolean isLeafTypeNode() { + return true; + } + + @Override + public String getItemType() { + return getClass().getName(); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileParentNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileParentNode.java index 2d7a06108b..7a2c8a5bac 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileParentNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/CommonFileParentNode.java @@ -140,6 +140,11 @@ public class CommonFileParentNode extends DisplayableItemNode { list.addAll(this.descendants); return true; } + + @Override + protected Node createWaitNode(){ + return new CommonFileChildNodeLoading(Children.LEAF); + } } @NbBundle.Messages({ diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java index ec54e37871..9586ca14e6 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java @@ -115,6 +115,8 @@ public interface DisplayableItemNodeVisitor { T visit (CommonFilesSearchNode cfsn); T visit (CommonFileChildNode cfcn); + + T visit (CommonFileChildNodeLoading cfcnl); /* * Tags @@ -199,6 +201,11 @@ public interface DisplayableItemNodeVisitor { return defaultVisit(cfsn); } + @Override + public T visit(CommonFileChildNodeLoading cfcnl){ + return defaultVisit(cfcnl); + } + @Override public T visit(DirectoryNode dn) { return defaultVisit(dn);