19 package org.sleuthkit.autopsy.timeline.ui.detailview;
22 import java.util.concurrent.ConcurrentHashMap;
23 import java.util.logging.Level;
24 import javafx.collections.ListChangeListener;
25 import javafx.scene.chart.Axis;
26 import javafx.scene.shape.Line;
27 import javafx.scene.shape.StrokeLineCap;
28 import org.controlsfx.control.Notifications;
29 import org.openide.util.NbBundle;
60 @NbBundle.Messages({
"PrimaryDetailsChartLane.stripeChangeListener.errorMessage=Error adding stripe to chart lane."})
62 super(parentChart, dateAxis, verticalAxis,
true);
67 parentChart.getRootEventStripes().addListener((ListChangeListener.Change<? extends
EventStripe> change) -> {
68 while (change.next()) {
70 for (EventStripe stripe : change.getAddedSubList()) {
73 } catch (TskCoreException ex) {
74 Notifications.create().owner(getScene().getWindow())
75 .text(Bundle.PrimaryDetailsChartLane_stripeChangeListener_errorMessage()).showError();
76 logger.log(Level.SEVERE,
"Error adding stripe to chart lane.", ex);
78 change.getRemoved().forEach(this::removeEvent);
82 for (EventStripe stripe : parentChart.getRootEventStripes()) {
85 }
catch (TskCoreException ex) {
86 Notifications.create().owner(getScene().getWindow())
87 .text(Bundle.PrimaryDetailsChartLane_stripeChangeListener_errorMessage())
89 logger.log(Level.SEVERE,
"Error adding stripe to chart lane.", ex);
94 getSelectedNodes().addListener((ListChangeListener.Change<? extends
EventNodeBase<?>> change) -> {
95 while (change.next()) {
96 change.getRemoved().forEach(removedNode -> {
97 removedNode.getEvent().getClusters().forEach(cluster -> {
98 Line removedLine = projectionMap.remove(cluster);
99 getChartChildren().removeAll(removedLine);
103 change.getAddedSubList().forEach(addedNode -> {
104 for (EventCluster range : addedNode.getEvent().getClusters()) {
105 double y = dateAxis.getLayoutY() + PROJECTED_LINE_Y_OFFSET;
107 = new Line(dateAxis.localToParent(getXForEpochMillis(range.getStartMillis()), 0).getX(), y,
108 dateAxis.localToParent(getXForEpochMillis(range.getEndMillis()), 0).getX(), y);
109 line.setStroke(getColor(addedNode.getEventType()).deriveColor(0, 1, 1, .5));
110 line.setStrokeWidth(PROJECTED_LINE_STROKE_WIDTH);
111 line.setStrokeLineCap(StrokeLineCap.ROUND);
112 projectionMap.put(range, line);
113 getChartChildren().add(line);
121 return getXAxis().localToParent(getXForEpochMillis(epochMillis), 0).getX();
125 void doAdditionalLayout() {
126 for (
final Map.Entry<
EventCluster, Line> entry : projectionMap.entrySet()) {
128 final Line line = entry.getValue();
130 line.setStartX(getParentXForEpochMillis(cluster.
getStartMillis()));
131 line.setEndX(getParentXForEpochMillis(cluster.
getEndMillis()));
133 line.setStartY(getXAxis().getLayoutY() + PROJECTED_LINE_Y_OFFSET);
134 line.setEndY(getXAxis().getLayoutY() + PROJECTED_LINE_Y_OFFSET);
static final int PROJECTED_LINE_Y_OFFSET
static final int PROJECTED_LINE_STROKE_WIDTH
synchronized static Logger getLogger(String name)
ObservableList< DescriptionFilterState > getQuickHideFilters()
static final Logger logger
double getParentXForEpochMillis(Long epochMillis)
static Color getColor(TimelineEventType type)
final Map< EventCluster, Line > projectionMap