cleanup drill down in details view

This commit is contained in:
jmillman
2014-10-23 16:28:31 -04:00
parent 5fa7e95789
commit 4e2397baa2
4 changed files with 31 additions and 79 deletions
@@ -51,8 +51,8 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
private final MediaViewVideoPanel videoPanel;
private final Set<String> videoExtensions; // get them from the panel
private final Set<String> imageExtensions;
private final Set<String> videoMimes;
private final Set<String> imageMimes;
private final TreeSet<String> videoMimes;
private final TreeSet<String> imageMimes;
private final MediaViewImagePanel imagePanel;
private boolean videoPanelInited;
private boolean imagePanelInited;
@@ -62,7 +62,7 @@
</BorderPane.margin>
</HBox>
<Separator orientation="VERTICAL" />
<Button fx:id="snapShotButton" mnemonicParsing="false" text="snapshot">
<Button fx:id="snapShotButton" mnemonicParsing="false" text="Screenshot">
<graphic>
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
<image>
@@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.timeline.ui.detailview;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
@@ -53,16 +52,12 @@ import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import org.apache.commons.lang3.StringUtils;
import org.controlsfx.control.action.ActionGroup;
import org.controlsfx.control.action.ActionUtils;
import org.joda.time.DateTime;
import org.joda.time.Interval;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.coreutils.ColorUtilities;
import org.sleuthkit.autopsy.coreutils.LoggedTask;
import org.sleuthkit.autopsy.timeline.TimeLineController;
import org.sleuthkit.autopsy.timeline.actions.Back;
import org.sleuthkit.autopsy.timeline.actions.Forward;
import org.sleuthkit.autopsy.timeline.events.AggregateEvent;
import org.sleuthkit.autopsy.timeline.filters.Filter;
import org.sleuthkit.autopsy.timeline.filters.TextFilter;
@@ -91,6 +86,7 @@ public class AggregateEventNode extends StackPane {
/** The label used to display this node's event's description */
private final Label descrLabel = new Label();
/** The label used to display this node's event count */
private final Label countLabel = new Label();
@@ -117,7 +113,6 @@ public class AggregateEventNode extends StackPane {
private final Button plusButton = new Button(null, new ImageView(PLUS)) {
{
// setBackground(null);
setMinSize(16, 16);
setMaxSize(16, 16);
setPrefSize(16, 16);
@@ -125,7 +120,6 @@ public class AggregateEventNode extends StackPane {
};
private final Button minusButton = new Button(null, new ImageView(MINUS)) {
{
// setBackground(null);
setMinSize(16, 16);
setMaxSize(16, 16);
setPrefSize(16, 16);
@@ -144,17 +138,19 @@ public class AggregateEventNode extends StackPane {
final Region region = new Region();
HBox.setHgrow(region, Priority.ALWAYS);
final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton);
// hBox.setPrefWidth(USE_COMPUTED_SIZE);
// hBox.setMinWidth(USE_PREF_SIZE);
hBox.setPrefWidth(USE_COMPUTED_SIZE);
hBox.setMinWidth(USE_PREF_SIZE);
hBox.setPadding(new Insets(2, 5, 2, 5));
hBox.setAlignment(Pos.CENTER_LEFT);
minusButton.setVisible(false);
plusButton.setVisible(false);
minusButton.setManaged(false);
plusButton.setManaged(false);
final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null);
BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT);
// new BorderPane(subNodePane, descrLabel, null, null, null);
//set initial properties
borderPane.setPrefWidth(USE_COMPUTED_SIZE);
getChildren().addAll(spanRegion, borderPane);
setAlignment(Pos.TOP_LEFT);
@@ -162,7 +158,6 @@ public class AggregateEventNode extends StackPane {
minWidthProperty().bind(spanRegion.widthProperty());
setPrefHeight(USE_COMPUTED_SIZE);
setMaxHeight(USE_PREF_SIZE);
// setMargin(hBox, new Insets(2, 5, 2, 5));
//set up subnode pane sizing contraints
subNodePane.setPrefHeight(USE_COMPUTED_SIZE);
@@ -196,12 +191,19 @@ public class AggregateEventNode extends StackPane {
spanRegion.setEffect(new DropShadow(10, evtColor));
minusButton.setVisible(true);
plusButton.setVisible(true);
minusButton.setManaged(true);
plusButton.setManaged(true);
toFront();
});
setOnMouseExited((MouseEvent e) -> {
spanRegion.setEffect(null);
minusButton.setVisible(false);
plusButton.setVisible(false);
minusButton.setManaged(false);
plusButton.setManaged(false);
});
setOnMouseClicked(new EventMouseHandler());
@@ -229,8 +231,7 @@ public class AggregateEventNode extends StackPane {
Tooltip.install(AggregateEventNode.this, new Tooltip(getEvent().getEventIDs().size() + " " + getEvent().getType() + " events\n"
+ getEvent().getDescription()
+ "\nbetween " + getEvent().getSpan().getStart().toString(TimeLineController.getZonedFormatter())
+ "\nand " + getEvent().getSpan().getEnd().toString(TimeLineController.getZonedFormatter())
+ "\nright-click to adjust local description zoom."));
+ "\nand " + getEvent().getSpan().getEnd().toString(TimeLineController.getZonedFormatter())));
}
public Pane getSubNodePane() {
@@ -257,7 +258,7 @@ public class AggregateEventNode extends StackPane {
*
* @param w the maximum width the description label should have
*/
public void setDescriptionLabelMaxWidth(double w) {
public void setDescriptionWidth(double w) {
descrLabel.setMaxWidth(w);
}
@@ -279,10 +280,8 @@ public class AggregateEventNode extends StackPane {
default:
case SHOWN:
String description = event.getDescription();
// parentEventNode.getEvent().getDescription()
// StringUtils.substringAfter(event.getDescription(), parentEventNode.getEvent().getDescription());
description = parentEventNode != null
? "..." + StringUtils.substringAfter(description, parentEventNode.getEvent().getDescription())
? " ..." + StringUtils.substringAfter(description, parentEventNode.getEvent().getDescription())
: description;
descrLabel.setText(description);
countLabel.setText(((size == 1) ? "" : " (" + size + ")"));
@@ -387,34 +386,13 @@ public class AggregateEventNode extends StackPane {
@Override
protected void succeeded() {
try {
if (get().size() > 1) {
chart.setCursor(Cursor.WAIT);
//assign subNodes and erquest chart layout
getSubNodePane().getChildren().setAll(get());
setDescriptionVisibility(descrVis);
chart.setRequiresLayout(true);
chart.requestChartLayout();
chart.setCursor(null);
} else if (get().size() == 1) {
chart.setCursor(Cursor.WAIT);
switch (descrVis) {
case COUNT_ONLY:
descrLabel.setText("");
break;
case HIDDEN:
descrLabel.setText("");
break;
default:
case SHOWN:
descrLabel.setText(get().get(0).getEvent().getDescription());
break;
}
chart.setRequiresLayout(true);
chart.requestChartLayout();
chart.setCursor(null);
} else {
get();
}
chart.setCursor(Cursor.WAIT);
//assign subNodes and request chart layout
getSubNodePane().getChildren().setAll(get());
setDescriptionVisibility(descrVis);
chart.setRequiresLayout(true);
chart.requestChartLayout();
chart.setCursor(null);
} catch (InterruptedException | ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
@@ -431,8 +409,8 @@ public class AggregateEventNode extends StackPane {
@Override
public void handle(MouseEvent t) {
t.consume();
if (t.getButton() == MouseButton.PRIMARY) {
t.consume();
if (t.isShiftDown()) {
if (chart.selectedNodes.contains(AggregateEventNode.this) == false) {
chart.selectedNodes.add(AggregateEventNode.this);
@@ -448,31 +426,7 @@ public class AggregateEventNode extends StackPane {
} else {
chart.selectedNodes.setAll(AggregateEventNode.this);
}
} else if (t.getButton() == MouseButton.SECONDARY) {
if (chart.getChartContextMenu() != null) {
chart.getChartContextMenu().hide();
}
//we use a per node menu to remember the slider position
ContextMenu nodeContextMenu = getContextMenu();
if (nodeContextMenu == null) {
nodeContextMenu = builContextMenu();
setContextMenu(nodeContextMenu);
}
nodeContextMenu.show(AggregateEventNode.this, t.getScreenX(), t.getScreenY());
}
}
private ContextMenu builContextMenu() {
//we don't reuse item from chartContextMenu because 'place marker' is location specific.
//TODO: refactor this so we can reuse chartContextMenu items
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().addAll(ActionUtils.createContextMenu(
Arrays.asList(new ActionGroup("Zoom History", new Back(chart.getController()),
new Forward(chart.getController())))).getItems());
//TODO: add tagging actions here
contextMenu.setAutoHide(true);
return contextMenu;
}
}
}
@@ -60,7 +60,6 @@ import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.shape.Line;
import javafx.scene.shape.StrokeLineCap;
import javafx.scene.text.Text;
import javafx.util.Duration;
import javax.annotation.concurrent.GuardedBy;
import org.controlsfx.control.action.AbstractAction;
@@ -349,7 +348,7 @@ public final class EventDetailChart extends XYChart<DateTime, AggregateEvent> im
* @return the DateTime along the x-axis corresponding to the given x value
* (in the space of this {@link EventDetailChart}
*/
public final DateTime getDateTimeForPosition(double x) {
public DateTime getDateTimeForPosition(double x) {
return getXAxis().getValueForDisplay(getXAxis().parentToLocal(x, 0).getX());
}
@@ -553,10 +552,9 @@ public final class EventDetailChart extends XYChart<DateTime, AggregateEvent> im
//size timespan border
tlNode.setSpanWidth(span);
if (truncateAll.get()) { //if truncate option is selected limit width of description label
tlNode.setDescriptionLabelMaxWidth(Math.max(span, truncateWidth.get()));
tlNode.setDescriptionWidth(Math.max(span, truncateWidth.get()));
} else { //else set it unbounded
tlNode.setDescriptionLabelMaxWidth(20 + new Text(tlNode.getDisplayedDescription()).getLayoutBounds().getWidth());
tlNode.setDescriptionWidth(USE_PREF_SIZE);//20 + new Text(tlNode.getDisplayedDescription()).getLayoutBounds().getWidth());
}
tlNode.autosize(); //compute size of tlNode based on constraints and event data