From 8ac29a33cf32af78e9681b25fcff01b54221179d Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 May 2018 16:20:51 -0400 Subject: [PATCH] 3815 adjust comments regarding for clarity and accuracy regarding the EventBus in AutoIngestJobsNode --- .../autoingest/AutoIngestJobsNode.java | 25 +++++++++++-------- .../autoingest/AutoIngestJobsPanel.java | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java index 091a593e74..d0da9028c0 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java @@ -41,7 +41,8 @@ import org.sleuthkit.autopsy.guiutils.StatusIconCellRenderer; * Each job with the specified status will have a child node representing it. */ final class AutoIngestJobsNode extends AbstractNode { - + + //Event bus is non static so that each instance of this will only listen to events sent to that instance private final EventBus refreshChildrenEventBus; @Messages({ @@ -151,10 +152,11 @@ final class AutoIngestJobsNode extends AbstractNode { * and refresh the children created by this factory. * * - * @param refreshEvent the String which was received + * @param refreshEvent the AutoIngestRefreshEvent which was received */ @Subscribe private void subscribeToRefresh(AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent refreshEvent) { + //Ignore netbeans suggesting this isn't being used, it is used behind the scenes by the EventBus //RefreshChildrenEvents can change which children are present however //RefreshJobEvents and RefreshCaseEvents can still change the order we want to display them in refresh(true); @@ -296,28 +298,30 @@ final class AutoIngestJobsNode extends AbstractNode { } /** - * Receive events of type String from the EventBus which this class - * is registered to, and refresh the node's properties if the event - * matches the REFRESH_EVENT. + * Receive events of type RefreshJobEvent from the EventBus which + * this class is registered to and refresh the nodes properties if + * it is the node for the job specified in the event. * - * @param refreshEvent the String which was received + * @param refreshEvent the RefreshJobEvent which was received */ @Subscribe private void subscribeToRefreshJob(AutoIngestNodeRefreshEvents.RefreshJobEvent refreshEvent) { + //Ignore netbeans suggesting this isn't being used, it is used behind the scenes by the EventBus if (getAutoIngestJob().equals(refreshEvent.getJobToRefresh())) { setSheet(createSheet()); } } /** - * Receive events of type String from the EventBus which this class - * is registered to, and refresh the node's properties if the event - * matches the REFRESH_EVENT. + * Receive events of type RefreshCaseEvent from the EventBus which + * this class is registered to and refresh the nodes which have jobs + * which are members of case specified in the event. * - * @param refreshEvent the String which was received + * @param refreshEvent the RefreshCaseEvent which was received */ @Subscribe private void subscribeToRefreshCase(AutoIngestNodeRefreshEvents.RefreshCaseEvent refreshEvent) { + //Ignore netbeans suggesting this isn't being used, it is used behind the scenes by the EventBus if (getAutoIngestJob().getManifest().getCaseName().equals(refreshEvent.getCaseToRefresh())) { setSheet(createSheet()); } @@ -331,6 +335,7 @@ final class AutoIngestJobsNode extends AbstractNode { * @param refreshEvent - the RefreshChildrenEvent which was received */ private void subscribeToRefreshChildren(AutoIngestNodeRefreshEvents.RefreshChildrenEvent refreshEvent) { + //Ignore netbeans suggesting this isn't being used, it is used behind the scenes by the EventBus if (jobStatus == AutoIngestJobStatus.RUNNING_JOB) { setSheet(createSheet()); } diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java index 9820f08e74..561864df59 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java @@ -170,6 +170,7 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa if (explorerManager.getRootContext() instanceof AutoIngestJobsNode) { ((AutoIngestJobsNode) explorerManager.getRootContext()).refresh(refreshEvent); } else { + //Make a new AutoIngestJobsNode with it's own EventBus and set it as the root context explorerManager.setRootContext(new AutoIngestJobsNode(jobsSnapshot, status, new EventBus("AutoIngestJobsNodeEventBus"))); } outline.setRowSelectionAllowed(true);