From bd9c9109e465ceb357d4f8592813e28fbfeb99eb Mon Sep 17 00:00:00 2001 From: jmillman Date: Tue, 13 Oct 2015 16:41:50 -0400 Subject: [PATCH] adjust EventClusterNode subbundle loading --- .../ui/detailview/EventBundleNodeBase.java | 6 +- .../ui/detailview/EventClusterNode.java | 144 +++++++++--------- .../ui/detailview/EventStripeNode.java | 2 - .../timeline/zooming/DescriptionLoD.java | 4 +- 4 files changed, 75 insertions(+), 81 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventBundleNodeBase.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventBundleNodeBase.java index 69d757eae8..ee57b6fe0d 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventBundleNodeBase.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventBundleNodeBase.java @@ -98,7 +98,7 @@ public abstract class EventBundleNodeBase descLOD = new SimpleObjectProperty<>(); - final SimpleObjectProperty descVisibility= new SimpleObjectProperty<>(DescriptionVisibility.SHOWN); + final SimpleObjectProperty descVisibility = new SimpleObjectProperty<>(DescriptionVisibility.SHOWN); protected final BundleType eventBundle; protected final ParentNodeType parentNode; @@ -181,7 +181,7 @@ public abstract class EventBundleNodeBase observable, DescriptionVisibility oldValue, DescriptionVisibility newValue) -> { setDescriptionVisibility(newValue); @@ -331,7 +331,7 @@ public abstract class EventBundleNodeBase subNodes.stream().anyMatch(subNode -> bundle.equals(subNode.getEventStripe())) ); - subNodePane.getChildren().clear(); subNodes.clear(); - if (descLOD.get().withRelativeDetail(relativeDetail) == getEventBundle().getDescriptionLoD()) { - countLabel.setVisible(true); - descLOD.set(getEventBundle().getDescriptionLoD()); - chart.layoutPlotChildren(); - } else { - /* - * make new ZoomParams to query with - * - * We need to extend end time because for the query by one second, - * because it is treated as an open interval but we want to include - * events at exactly the time of the last event in this cluster - */ - final RootFilter subClusterFilter = getSubClusterFilter(); - final Interval subClusterSpan = new Interval(getStartMillis(), getEndMillis() + 1000); - final EventTypeZoomLevel eventTypeZoomLevel = eventsModel.eventTypeZoomProperty().get(); - final ZoomParams zoomParams = new ZoomParams(subClusterSpan, eventTypeZoomLevel, subClusterFilter, getDescriptionLoD()); - Task> loggedTask = new Task>() { + /* + * make new ZoomParams to query with + * + * We need to extend end time because for the query by one second, + * because it is treated as an open interval but we want to include + * events at exactly the time of the last event in this cluster + */ + final RootFilter subClusterFilter = getSubClusterFilter(); + final Interval subClusterSpan = new Interval(getStartMillis(), getEndMillis() + 1000); + final EventTypeZoomLevel eventTypeZoomLevel = eventsModel.eventTypeZoomProperty().get(); + final ZoomParams zoomParams = new ZoomParams(subClusterSpan, eventTypeZoomLevel, subClusterFilter, getDescriptionLoD()); - private volatile DescriptionLoD loadedDescriptionLoD = getDescriptionLoD().withRelativeDetail(relativeDetail); + Task> loggedTask = new Task>() { - { - updateTitle(Bundle.EventStripeNode_loggedTask_name()); - } + private volatile DescriptionLoD loadedDescriptionLoD = getDescriptionLoD().withRelativeDetail(relativeDetail); - @Override - protected Collection call() throws Exception { - Collection bundles; - DescriptionLoD next = loadedDescriptionLoD; - do { - loadedDescriptionLoD = next; - if (loadedDescriptionLoD == getEventBundle().getDescriptionLoD()) { - return Collections.emptySet(); - } - bundles = eventsModel.getEventClusters(zoomParams.withDescrLOD(loadedDescriptionLoD)).stream() - .collect(Collectors.toMap((eventCluster) -> eventCluster.getDescription(), //key - (eventCluster) -> new EventStripe(eventCluster, getEventCluster()), //value - EventStripe::merge) //merge method - ).values(); - next = loadedDescriptionLoD.withRelativeDetail(relativeDetail); - } while (bundles.size() == 1 && nonNull(next)); + { + updateTitle(Bundle.EventStripeNode_loggedTask_name()); + } - // return list of AbstractEventStripeNodes representing sub-bundles - return bundles; - - } - - @Override - protected void succeeded() { - chart.setCursor(Cursor.WAIT); - try { - Collection bundles = get(); - - if (bundles.isEmpty()) { - countLabel.setVisible(true); - } else { - countLabel.setVisible(false); - chart.getEventBundles().addAll(bundles); - subNodes.addAll(bundles.stream() - .map(EventClusterNode.this::createStripeNode) - .sorted(Comparator.comparing(EventStripeNode::getStartMillis)) - .collect(Collectors.toList())); - subNodePane.getChildren().addAll(subNodes); - } - descLOD.set(loadedDescriptionLoD); - //assign subNodes and request chart layout - - } catch (InterruptedException | ExecutionException ex) { - LOGGER.log(Level.SEVERE, "Error loading subnodes", ex); + @Override + protected Collection call() throws Exception { + Collection bundles; + DescriptionLoD next = loadedDescriptionLoD; + do { + loadedDescriptionLoD = next; + if (loadedDescriptionLoD == getEventBundle().getDescriptionLoD()) { + return Collections.emptySet(); } - chart.layoutPlotChildren(); - chart.setCursor(null); - } - }; + bundles = eventsModel.getEventClusters(zoomParams.withDescrLOD(loadedDescriptionLoD)).stream() + .collect(Collectors.toMap(EventCluster::getDescription, //key + (eventCluster) -> new EventStripe(eventCluster, getEventCluster()), //value + EventStripe::merge) //merge method + ).values(); + next = loadedDescriptionLoD.withRelativeDetail(relativeDetail); + } while (bundles.size() == 1 && nonNull(next)); - //start task - chart.getController().monitorTask(loggedTask); - } + // return list of AbstractEventStripeNodes representing sub-bundles + return bundles; + + } + + @Override + protected void succeeded() { + + try { + Collection bundles = get(); + + if (bundles.isEmpty()) { + subNodePane.getChildren().clear(); + getChildren().setAll(subNodePane, infoHBox); + descLOD.set(getEventBundle().getDescriptionLoD()); + } else { + chart.getEventBundles().addAll(bundles); + subNodes.addAll(bundles.stream() + .map(EventClusterNode.this::createStripeNode) + .sorted(Comparator.comparing(EventStripeNode::getStartMillis)) + .collect(Collectors.toList())); + subNodePane.getChildren().setAll(subNodes); + getChildren().setAll(new VBox(infoHBox, subNodePane)); + descLOD.set(loadedDescriptionLoD); + } + } catch (InterruptedException | ExecutionException ex) { + LOGGER.log(Level.SEVERE, "Error loading subnodes", ex); + } + chart.layoutPlotChildren(); + chart.setCursor(null); + } + }; + + //start task + chart.getController().monitorTask(loggedTask); } private EventStripeNode createStripeNode(EventStripe stripe) { @@ -249,7 +246,7 @@ final public class EventClusterNode extends EventBundleNodeBase