From a1eea710a9ce4af1bc8b0bd51580a1e88cd9aadc Mon Sep 17 00:00:00 2001 From: jmillman Date: Tue, 19 Apr 2016 14:41:22 -0400 Subject: [PATCH] comments and minor cleanup in EventStripeNode --- .../ui/detailview/EventStripeNode.java | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventStripeNode.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventStripeNode.java index 12080118ec..144ec82228 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventStripeNode.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/EventStripeNode.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.timeline.ui.detailview; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import java.util.Arrays; import javafx.event.EventHandler; @@ -31,40 +32,52 @@ import org.controlsfx.control.action.ActionUtils; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.timeline.datamodel.EventCluster; import org.sleuthkit.autopsy.timeline.datamodel.EventStripe; +import org.sleuthkit.autopsy.timeline.datamodel.SingleEvent; import static org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.configureActionButton; /** - * Node used in {@link EventDetailsChart} to represent an EventStripe. + * Node used in DetailsChart to represent an EventStripe. */ final public class EventStripeNode extends MultiEventNodeBase { private static final Logger LOGGER = Logger.getLogger(EventStripeNode.class.getName()); - private Action newHideAction() { - return new HideDescriptionAction(getDescription(), getEvent().getDescriptionLoD(), chartLane.getParentChart()); - } + /** + * The button to expand hide stripes with this description, created lazily. + */ private Button hideButton; + /** + * Constructor + * + * @param chartLane the DetailsChartLane this node belongs to + * @param eventStripe the EventStripe represented by this node + * @param parentNode the EventClusterNode that is the parent of this node. + */ EventStripeNode(DetailsChartLane chartLane, EventStripe eventStripe, EventClusterNode parentNode) { super(chartLane, eventStripe, parentNode); - setMinHeight(24); + //setup description label descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); descrLabel.setPrefWidth(USE_COMPUTED_SIZE); + setMinHeight(24); setAlignment(subNodePane, Pos.BOTTOM_LEFT); if (eventStripe.getClusters().size() > 1) { for (EventCluster cluster : eventStripe.getClusters()) { subNodes.add(createChildNode(cluster.withParent(eventStripe))); } + //stack componenets vertically getChildren().addAll(new VBox(infoHBox, subNodePane)); } else { + //if the stripe only has one cluster, use alternate simpler layout EventNodeBase childNode; EventCluster cluster = Iterables.getOnlyElement(eventStripe.getClusters()).withParent(eventStripe); if (cluster.getEventIDs().size() == 1) { childNode = createChildNode(cluster); } else { + //if the cluster has more than one event, add the clusters controls to this stripe node directly. EventClusterNode eventClusterNode = (EventClusterNode) createChildNode(cluster); eventClusterNode.installActionButtons(); controlsHBox.getChildren().addAll(eventClusterNode.getNewCollapseButton(), eventClusterNode.getNewExpandButton()); @@ -72,22 +85,31 @@ final public class EventStripeNode extends MultiEventNodeBase createChildNode(EventCluster cluster) { - if (cluster.getEventIDs().size() == 1) { - return new SingleEventNode(getChartLane(), getChartLane().getController().getEventsModel().getEventById(Iterables.getOnlyElement(cluster.getEventIDs())).withParent(cluster), this); + ImmutableSet eventIDs = cluster.getEventIDs(); + if (eventIDs.size() == 1) { + SingleEvent singleEvent = getController().getEventsModel().getEventById(Iterables.getOnlyElement(eventIDs)).withParent(cluster); + return new SingleEventNode(getChartLane(), singleEvent, this); } else { return new EventClusterNode(getChartLane(), cluster, this); } @@ -106,6 +130,7 @@ final public class EventStripeNode extends MultiEventNodeBase getDoubleClickHandler() { return mouseEvent -> { + //no-op }; } @@ -115,6 +140,5 @@ final public class EventStripeNode extends MultiEventNodeBase