begin moving axis nodes into AbstractVisualizationPane.java

This commit is contained in:
jmillman 2016-04-28 16:53:22 -04:00
parent fb69ab8e37
commit 2eb50ba784
4 changed files with 41 additions and 49 deletions

View File

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

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013-15 Basis Technology Corp. * Copyright 2013-16 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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.BorderPane;
import javafx.scene.layout.CornerRadii; import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Priority; import javafx.scene.layout.Priority;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import static javafx.scene.layout.Region.USE_PREF_SIZE; import static javafx.scene.layout.Region.USE_PREF_SIZE;
@ -141,14 +140,7 @@ final public class VisualizationPanel extends BorderPane {
@FXML @FXML
private Label endLabel; private Label endLabel;
//// replacemetn axis label componenets
@FXML
private Pane partPane;
@FXML
private Pane contextPane;
@FXML
private Region spacer;
//// header toolbar componenets //// header toolbar componenets
@FXML @FXML
private ToolBar toolBar; private ToolBar toolBar;
@ -359,11 +351,11 @@ final public class VisualizationPanel extends BorderPane {
private void setViewMode(VisualizationMode visualizationMode) { private void setViewMode(VisualizationMode visualizationMode) {
switch (visualizationMode) { switch (visualizationMode) {
case COUNTS: case COUNTS:
setVisualization(new CountsViewPane(controller, partPane, contextPane, spacer)); setVisualization(new CountsViewPane(controller));
countsToggle.setSelected(true); countsToggle.setSelected(true);
break; break;
case DETAIL: case DETAIL:
setVisualization(new DetailViewPane(controller, partPane, contextPane, spacer)); setVisualization(new DetailViewPane(controller));
detailsToggle.setSelected(true); detailsToggle.setSelected(true);
break; break;
} }

View File

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

View File

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