Merge pull request #2100 from millmanorama/TL-only-snapshot-visualization

TL only snapshot visualization
This commit is contained in:
Richard Cordovano 2016-05-04 14:29:29 -04:00
commit 1793aa2c5d
6 changed files with 133 additions and 141 deletions

View File

@ -25,6 +25,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.function.Supplier;
import java.util.logging.Level;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.Node;
@ -81,7 +82,7 @@ public class SaveSnapshotAsReport extends Action {
"SaveSnapShotAsReport.reportName.prompt=leave empty for default report name: {0}.",
"SaveSnapShotAsReport.reportName.header=Enter a report name for the Timeline Snapshot Report."
})
public SaveSnapshotAsReport(TimeLineController controller, Node node) {
public SaveSnapshotAsReport(TimeLineController controller, Supplier<Node> nodeSupplier) {
super(Bundle.SaveSnapShotAsReport_action_name_text());
setLongText(Bundle.SaveSnapShotAsReport_action_longText());
setGraphic(new ImageView(SNAP_SHOT));
@ -93,8 +94,7 @@ public class SaveSnapshotAsReport extends Action {
//capture generation date and use to make default report name
Date generationDate = new Date();
final String defaultReportName = FileUtil.escapeFileName(currentCase.getName() + " " + new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss").format(generationDate)); //NON_NLS
BufferedImage snapshot = SwingFXUtils.fromFXImage(node.snapshot(null, null), null);
BufferedImage snapshot = SwingFXUtils.fromFXImage(nodeSupplier.get().snapshot(null, null), null);
//prompt user to pick report name
TextInputDialog textInputDialog = new TextInputDialog();

View File

@ -29,6 +29,7 @@ import java.util.logging.Level;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.binding.DoubleBinding;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
@ -46,9 +47,11 @@ import javafx.scene.control.OverrunStyle;
import javafx.scene.control.Tooltip;
import javafx.scene.effect.Effect;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
@ -101,9 +104,9 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
protected ChartType chart;
//// replacement axis label componenets
private final Pane leafPane; // container for the leaf lables in the declutterd axis
private final Pane branchPane;// container for the branch lables in the declutterd axis
protected final Region spacer;
private final Pane leafPane = new Pane(); // container for the leaf lables in the declutterd axis
private final Pane branchPane = new Pane();// container for the branch lables in the declutterd axis
protected final Region spacer = new Region();
/**
* task used to reload the content of this visualization
@ -265,14 +268,22 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
return eventTypeToSeriesMap.get(et);
}
protected AbstractVisualizationPane(TimeLineController controller, Pane partPane, Pane contextPane, Region spacer) {
protected AbstractVisualizationPane(TimeLineController controller) {
this.controller = controller;
this.filteredEvents = controller.getEventsModel();
this.filteredEvents.registerForEvents(this);
this.filteredEvents.zoomParametersProperty().addListener(invalidationListener);
this.leafPane = partPane;
this.branchPane = contextPane;
this.spacer = spacer;
Platform.runLater(() -> {
VBox vBox = new VBox(leafPane, branchPane);
vBox.setFillWidth(false);
HBox hBox = new HBox(spacer, vBox);
hBox.setFillHeight(false);
setBottom(hBox);
DoubleBinding spacerSize = getYAxis().widthProperty().add(getYAxis().tickLengthProperty()).add(getAxisMargin());//getXAxis().startMarginProperty().multiply(2));
spacer.minWidthProperty().bind(spacerSize);
spacer.prefWidthProperty().bind(spacerSize);
spacer.maxWidthProperty().bind(spacerSize);
});
createSeries();
@ -444,6 +455,8 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
branchPane.getChildren().add(label);
}
public abstract double getAxisMargin();
/**
* A simple data object used to represent a partial date as up to two parts.
* A low frequency part (branch) containing all but the most specific

View File

@ -1,15 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuButton?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.ToggleButton?>
<?import javafx.scene.control.ToolBar?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import org.controlsfx.control.SegmentedButton?>
<?import jfxtras.scene.control.*?>
<?import org.controlsfx.control.*?>
<fx:root prefHeight="-1.0" prefWidth="-1.0" type="javafx.scene.layout.BorderPane" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
<fx:root prefHeight="-1.0" prefWidth="-1.0" type="javafx.scene.layout.BorderPane" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
<top>
<ToolBar fx:id="toolBar" prefWidth="200.0" BorderPane.alignment="CENTER">
<items>
@ -78,17 +86,6 @@
<bottom>
<VBox maxHeight="-Infinity">
<children>
<HBox fillHeight="false" BorderPane.alignment="CENTER">
<children>
<Region fx:id="spacer" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="5.0" prefWidth="20.0" />
<VBox fillWidth="false">
<children>
<Pane fx:id="partPane" />
<Pane fx:id="contextPane" />
</children>
</VBox>
</children>
</HBox>
<Separator />
<Separator />
<StackPane fx:id="rangeHistogramStack" maxHeight="-Infinity" BorderPane.alignment="CENTER">

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-15 Basis Technology Corp.
* Copyright 2013-16 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -51,7 +51,6 @@ import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import static javafx.scene.layout.Region.USE_PREF_SIZE;
@ -141,14 +140,6 @@ final public class VisualizationPanel extends BorderPane {
@FXML
private Label endLabel;
//// replacemetn axis label componenets
@FXML
private Pane partPane;
@FXML
private Pane contextPane;
@FXML
private Region spacer;
//// header toolbar componenets
@FXML
private ToolBar toolBar;
@ -288,7 +279,7 @@ final public class VisualizationPanel extends BorderPane {
setViewMode(controller.viewModeProperty().get());
//configure snapshor button / action
ActionUtils.configureButton(new SaveSnapshotAsReport(controller, VisualizationPanel.this), snapShotButton);
ActionUtils.configureButton(new SaveSnapshotAsReport(controller, notificationPane::getContent), snapShotButton);
/////configure start and end pickers
startLabel.setText(Bundle.VisualizationPanel_startLabel_text());
@ -359,11 +350,11 @@ final public class VisualizationPanel extends BorderPane {
private void setViewMode(VisualizationMode visualizationMode) {
switch (visualizationMode) {
case COUNTS:
setVisualization(new CountsViewPane(controller, partPane, contextPane, spacer));
setVisualization(new CountsViewPane(controller));
countsToggle.setSelected(true);
break;
case DETAIL:
setVisualization(new DetailViewPane(controller, partPane, contextPane, spacer));
setVisualization(new DetailViewPane(controller));
detailsToggle.setSelected(true);
break;
}

View File

@ -40,8 +40,6 @@ import javafx.scene.control.ToggleGroup;
import javafx.scene.control.Tooltip;
import javafx.scene.effect.Effect;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import org.joda.time.Interval;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -100,8 +98,8 @@ public class CountsViewPane extends AbstractVisualizationPane<String, Number, No
return new CountsUpdateTask();
}
public CountsViewPane(TimeLineController controller, Pane partPane, Pane contextPane, Region spacer) {
super(controller, partPane, contextPane, spacer);
public CountsViewPane(TimeLineController controller) {
super(controller);
chart = new EventCountsChart(controller, dateAxis, countAxis, selectedNodes);
chart.setData(dataSeries);
@ -111,19 +109,9 @@ public class CountsViewPane extends AbstractVisualizationPane<String, Number, No
settingsNodes = new ArrayList<>(new CountsViewSettingsPane().getChildrenUnmodifiable());
dateAxis.getTickMarks().addListener((Observable observable) -> {
layoutDateLabels();
});
dateAxis.categorySpacingProperty().addListener((Observable observable) -> {
layoutDateLabels();
});
dateAxis.getCategories().addListener((Observable observable) -> {
layoutDateLabels();
});
spacer.minWidthProperty().bind(countAxis.widthProperty().add(countAxis.tickLengthProperty()).add(dateAxis.startMarginProperty().multiply(2)));
spacer.prefWidthProperty().bind(countAxis.widthProperty().add(countAxis.tickLengthProperty()).add(dateAxis.startMarginProperty().multiply(2)));
spacer.maxWidthProperty().bind(countAxis.widthProperty().add(countAxis.tickLengthProperty()).add(dateAxis.startMarginProperty().multiply(2)));
dateAxis.getTickMarks().addListener((Observable observable) -> layoutDateLabels());
dateAxis.categorySpacingProperty().addListener((Observable observable) -> layoutDateLabels());
dateAxis.getCategories().addListener((Observable observable) -> layoutDateLabels());
scale.addListener(o -> {
countAxis.tickLabelsVisibleProperty().bind(scale.isEqualTo(ScaleType.LINEAR));
@ -135,12 +123,12 @@ public class CountsViewPane extends AbstractVisualizationPane<String, Number, No
}
@Override
protected NumberAxis getYAxis() {
final protected NumberAxis getYAxis() {
return countAxis;
}
@Override
protected CategoryAxis getXAxis() {
final protected CategoryAxis getXAxis() {
return dateAxis;
}
@ -164,6 +152,11 @@ public class CountsViewPane extends AbstractVisualizationPane<String, Number, No
}
}
@Override
public double getAxisMargin() {
return dateAxis.getStartMargin() + dateAxis.getEndMargin();
}
private class CountsViewSettingsPane extends HBox {
@FXML

View File

@ -42,8 +42,6 @@ import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.effect.Effect;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.stage.Modality;
import org.apache.commons.lang3.StringUtils;
import org.controlsfx.control.action.Action;
@ -57,8 +55,6 @@ import org.sleuthkit.autopsy.timeline.TimeLineController;
import org.sleuthkit.autopsy.timeline.datamodel.EventStripe;
import org.sleuthkit.autopsy.timeline.datamodel.TimeLineEvent;
import org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane;
import org.sleuthkit.autopsy.timeline.ui.detailview.HideDescriptionAction;
import org.sleuthkit.autopsy.timeline.ui.detailview.UnhideDescriptionAction;
import org.sleuthkit.autopsy.timeline.utils.MappedList;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
@ -103,8 +99,8 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
* axis
* @param bottomLeftSpacer a spacer to keep everything aligned.
*/
public DetailViewPane(TimeLineController controller, Pane partPane, Pane contextPane, Region bottomLeftSpacer) {
super(controller, partPane, contextPane, bottomLeftSpacer);
public DetailViewPane(TimeLineController controller) {
super(controller);
this.selectedEvents = new MappedList<>(getSelectedNodes(), EventNodeBase<?>::getEvent);
//initialize chart;
@ -116,9 +112,6 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
detailsChartDateAxis.getTickMarks().addListener((Observable observable) -> layoutDateLabels());
detailsChartDateAxis.getTickSpacing().addListener(observable -> layoutDateLabels());
verticalAxis.setAutoRanging(false); //prevent XYChart.updateAxisRange() from accessing dataSeries on JFX thread causing ConcurrentModificationException
bottomLeftSpacer.minWidthProperty().bind(verticalAxis.widthProperty().add(verticalAxis.tickLengthProperty()));
bottomLeftSpacer.prefWidthProperty().bind(verticalAxis.widthProperty().add(verticalAxis.tickLengthProperty()));
bottomLeftSpacer.maxWidthProperty().bind(verticalAxis.widthProperty().add(verticalAxis.tickLengthProperty()));
selectedNodes.addListener((Observable observable) -> {
//update selected nodes highlight
@ -175,7 +168,7 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
}
@Override
public Axis<DateTime> getXAxis() {
final public DateAxis getXAxis() {
return detailsChartDateAxis;
}
@ -215,7 +208,7 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
}
@Override
protected Axis<EventStripe> getYAxis() {
final protected Axis<EventStripe> getYAxis() {
return verticalAxis;
}
@ -244,6 +237,11 @@ public class DetailViewPane extends AbstractVisualizationPane<DateTime, EventStr
c1.applySelectionEffect(selected);
}
@Override
public double getAxisMargin() {
return 0;
}
/**
* A Pane that contains widgets to adjust settings specific to a
* DetailViewPane