From 9fa11797f90c8b8328c2fb1cc41a8d3d1c47ecb0 Mon Sep 17 00:00:00 2001 From: jmillman Date: Thu, 5 May 2016 13:25:36 -0400 Subject: [PATCH] more cleanup in AbstractVisualizationPane and CountsViewPane --- .../ui/AbstractVisualizationPane.java | 104 ++++++++++-------- .../ui/countsview/CountsViewPane.java | 4 +- .../ui/detailview/DetailViewPane.java | 4 +- 3 files changed, 64 insertions(+), 48 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractVisualizationPane.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractVisualizationPane.java index 43a99c5d50..20bc125d5e 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractVisualizationPane.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractVisualizationPane.java @@ -19,6 +19,7 @@ package org.sleuthkit.autopsy.timeline.ui; import com.google.common.eventbus.Subscribe; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -76,10 +77,10 @@ import org.sleuthkit.autopsy.timeline.events.RefreshRequestedEvent; /** * Abstract base class for TimeLineChart based visualizations. * - * @param the type of data plotted along the x axis - * @param the type of data plotted along the y axis - * @param the type of nodes used to represent data items - * @param the type of the TimeLineChart this class uses to plot + * @param The type of data plotted along the x axis + * @param The type of data plotted along the y axis + * @param The type of nodes used to represent data items + * @param The type of the TimeLineChart this class uses to plot * the data. Must extend Region. * * TODO: this is becoming (too?) closely tied to the notion that their is a @@ -95,6 +96,12 @@ public abstract class AbstractVisualizationPane of the nodes that are selected in * this visualization. */ - public ObservableList getSelectedNodes() { + protected ObservableList getSelectedNodes() { return selectedNodes; } @@ -169,7 +176,7 @@ public abstract class AbstractVisualizationPane getYAxis(); + /** + * Get the total amount of space (in pixels) the x-axis uses to pad the left + * and right sides. This value is used to keep decluttered axis aligned + * correctly. + * + * @return The x-axis margin (in pixels) + */ + abstract protected double getAxisMargin(); + /** * Clear all data items from this chart. */ @@ -305,7 +321,7 @@ public abstract class AbstractVisualizationPane c) -> { - while (c.next()) { - c.getRemoved().forEach(n -> applySelectionEffect(n, false)); - c.getAddedSubList().forEach(n -> applySelectionEffect(n, true)); + selectedNodes.addListener((ListChangeListener.Change change) -> { + while (change.next()) { + change.getRemoved().forEach(node -> applySelectionEffect(node, false)); + change.getAddedSubList().forEach(node -> applySelectionEffect(node, true)); } }); TimeLineController.getTimeZone().addListener(updateListener); //show tooltip text in status bar - hoverProperty().addListener(observable -> controller.setStatus(isHover() ? DEFAULT_TOOLTIP.getText() : "")); + hoverProperty().addListener(hoverProp -> controller.setStatus(isHover() ? DEFAULT_TOOLTIP.getText() : "")); } + /** + * Handle a RefreshRequestedEvent from the events model by updating the + * visualization. + * + * @param event The RefreshRequestedEvent to handle. + */ @Subscribe public void handleRefreshRequested(RefreshRequestedEvent event) { update(); @@ -435,13 +457,12 @@ public abstract class AbstractVisualizationPane> tickMarks = getXAxis().getTickMarks().sorted(Comparator.comparing(Axis.TickMark::getPosition)); if (tickMarks.isEmpty() == false) { @@ -463,13 +484,11 @@ public abstract class AbstractVisualizationPane