mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
move refresh state into AbstractVisualizationPane; cleanup VisualizationPanel.java and VisualizationPanel.fxml
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.timeline.ui;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -72,7 +71,6 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
||||
import org.sleuthkit.autopsy.timeline.TimeLineController;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
|
||||
import org.sleuthkit.autopsy.timeline.events.RefreshRequestedEvent;
|
||||
|
||||
/**
|
||||
* Abstract base class for TimeLineChart based visualizations.
|
||||
@@ -106,6 +104,13 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
|
||||
return DEFAULT_TOOLTIP;
|
||||
}
|
||||
|
||||
/*
|
||||
* Boolean property that holds true if the visualziation may not represent
|
||||
* the current state of the DB, because, for example, tags have been updated
|
||||
* but the vis. was not refreshed.
|
||||
*/
|
||||
private final ReadOnlyBooleanWrapper needsRefresh = new ReadOnlyBooleanWrapper(false);
|
||||
|
||||
private final ReadOnlyBooleanWrapper hasVisibleEvents = new ReadOnlyBooleanWrapper(true);
|
||||
|
||||
/*
|
||||
@@ -133,6 +138,14 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
|
||||
|
||||
private InvalidationListener updateListener = any -> update();
|
||||
|
||||
public boolean needsRefresh() {
|
||||
return needsRefresh.get();
|
||||
}
|
||||
|
||||
public ReadOnlyBooleanProperty needsRefreshProperty() {
|
||||
return needsRefresh.getReadOnlyProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* The visualization nodes that are selected.
|
||||
*
|
||||
@@ -438,17 +451,6 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a RefreshRequestedEvent from the events model by updating the
|
||||
* visualization.
|
||||
*
|
||||
* @param event The RefreshRequestedEvent to handle.
|
||||
*/
|
||||
@Subscribe
|
||||
public void handleRefreshRequested(RefreshRequestedEvent event) {
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through the list of tick-marks building a two level structure of
|
||||
* replacement tick mark labels. (Visually) upper level has most
|
||||
@@ -532,6 +534,10 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
|
||||
requestParentLayout();
|
||||
}
|
||||
|
||||
void setNeedsRefresh() {
|
||||
needsRefresh.set(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Text Node to the specific label container for the decluttered axis
|
||||
* labels.
|
||||
@@ -693,6 +699,7 @@ public abstract class AbstractVisualizationPane<X, Y, NodeType extends Node, Cha
|
||||
@Override
|
||||
protected void succeeded() {
|
||||
super.succeeded();
|
||||
needsRefresh.set(false);
|
||||
layoutDateLabels();
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@@ -19,96 +19,88 @@
|
||||
|
||||
<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>
|
||||
<HBox alignment="CENTER_LEFT" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<ToolBar fx:id="toolBar" HBox.hgrow="NEVER">
|
||||
<items>
|
||||
<HBox alignment="CENTER_LEFT" BorderPane.alignment="CENTER" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label fx:id="visualizationModeLabel" text="Visualisation Mode:" textAlignment="CENTER" wrapText="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="5.0" />
|
||||
</HBox.margin>
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<ToolBar fx:id="toolBar" HBox.hgrow="ALWAYS">
|
||||
<items>
|
||||
<HBox alignment="CENTER_LEFT" BorderPane.alignment="CENTER" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<Label fx:id="visualizationModeLabel" text="Visualisation Mode:" textAlignment="CENTER" wrapText="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="5.0" />
|
||||
</HBox.margin>
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
|
||||
<SegmentedButton maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" HBox.hgrow="NEVER">
|
||||
<buttons>
|
||||
<ToggleButton fx:id="countsToggle" alignment="TOP_LEFT" mnemonicParsing="false" selected="true">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" mouseTransparent="true" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/chart_bar.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
<font>
|
||||
<Font name="System Bold" size="16.0" />
|
||||
</font>
|
||||
</ToggleButton>
|
||||
<ToggleButton fx:id="detailsToggle" alignment="CENTER_RIGHT" layoutX="74.0" mnemonicParsing="false" selected="false">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" mouseTransparent="true" pickOnBounds="true" preserveRatio="true" rotate="0.0" smooth="true" style="-fx-background-color:white;" x="2.0" y="1.0">
|
||||
<image>
|
||||
<Image url="@../images/20140521121247760_easyicon_net_32_colorized.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
<font>
|
||||
<Font name="System Bold" size="16.0" />
|
||||
</font>
|
||||
</ToggleButton>
|
||||
</buttons>
|
||||
<SegmentedButton maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" HBox.hgrow="NEVER">
|
||||
<buttons>
|
||||
<ToggleButton fx:id="countsToggle" alignment="TOP_LEFT" mnemonicParsing="false" selected="true">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" mouseTransparent="true" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/chart_bar.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
<font>
|
||||
<Font name="System Bold" size="16.0" />
|
||||
</font>
|
||||
</ToggleButton>
|
||||
<ToggleButton fx:id="detailsToggle" alignment="CENTER_RIGHT" layoutX="74.0" mnemonicParsing="false" selected="false">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" mouseTransparent="true" pickOnBounds="true" preserveRatio="true" rotate="0.0" smooth="true" style="-fx-background-color:white;" x="2.0" y="1.0">
|
||||
<image>
|
||||
<Image url="@../images/20140521121247760_easyicon_net_32_colorized.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
<font>
|
||||
<Font name="System Bold" size="16.0" />
|
||||
</font>
|
||||
</ToggleButton>
|
||||
</buttons>
|
||||
|
||||
</SegmentedButton>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
</padding>
|
||||
<BorderPane.margin>
|
||||
<Insets left="10.0" />
|
||||
</BorderPane.margin>
|
||||
</HBox>
|
||||
<Separator orientation="VERTICAL" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
<ToolBar maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
|
||||
<items>
|
||||
<Separator halignment="RIGHT" orientation="VERTICAL" HBox.hgrow="ALWAYS" />
|
||||
<Button fx:id="snapShotButton" mnemonicParsing="false" text="Snapshot Report">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/image.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Separator maxWidth="1.7976931348623157E308" orientation="VERTICAL" />
|
||||
<Button fx:id="refreshButton" alignment="CENTER_RIGHT" mnemonicParsing="false" text="Refresh Vis.">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/arrow-circle-double-135.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="updateDBButton" mnemonicParsing="false" text="Update DB">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/database_refresh.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
</items>
|
||||
</ToolBar>
|
||||
</children>
|
||||
</HBox>
|
||||
</SegmentedButton>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
</padding>
|
||||
<BorderPane.margin>
|
||||
<Insets left="10.0" />
|
||||
</BorderPane.margin>
|
||||
</HBox>
|
||||
<Separator halignment="LEFT" maxWidth="1.7976931348623157E308" orientation="VERTICAL" />
|
||||
<Separator halignment="LEFT" maxWidth="1.7976931348623157E308" orientation="VERTICAL" HBox.hgrow="ALWAYS" />
|
||||
<Button fx:id="snapShotButton" mnemonicParsing="false" text="Snapshot Report">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/image.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Separator maxWidth="1.7976931348623157E308" orientation="VERTICAL" />
|
||||
<Button fx:id="refreshButton" alignment="CENTER_RIGHT" mnemonicParsing="false" text="Refresh Vis.">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/arrow-circle-double-135.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="updateDBButton" mnemonicParsing="false" text="Update DB">
|
||||
<graphic>
|
||||
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../images/database_refresh.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
</items>
|
||||
</ToolBar>
|
||||
</top>
|
||||
<bottom>
|
||||
<VBox maxHeight="-Infinity">
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.function.Supplier;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.property.ReadOnlyBooleanWrapper;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
@@ -177,13 +176,6 @@ final public class VisualizationPanel extends BorderPane {
|
||||
*/
|
||||
private final NotificationPane notificationPane = new NotificationPane();
|
||||
|
||||
/*
|
||||
* Boolean property that holds true if the visualziation may not represent
|
||||
* the current state of the DB, because, for example, tags have been updated
|
||||
* but the vis. was not refreshed.
|
||||
*/
|
||||
private final ReadOnlyBooleanWrapper needsRefresh = new ReadOnlyBooleanWrapper(false);
|
||||
|
||||
private final TimeLineController controller;
|
||||
private final FilteredEventsModel filteredEvents;
|
||||
|
||||
@@ -283,7 +275,6 @@ final public class VisualizationPanel extends BorderPane {
|
||||
|
||||
//configure snapshor button / action
|
||||
ActionUtils.configureButton(new SaveSnapshotAsReport(controller, notificationPane::getContent), snapShotButton);
|
||||
ActionUtils.configureButton(new Refresh(), refreshButton);
|
||||
|
||||
ActionUtils.configureButton(new RebuildDataBase(controller), updateDBButton);
|
||||
|
||||
@@ -391,8 +382,8 @@ final public class VisualizationPanel extends BorderPane {
|
||||
*/
|
||||
@Subscribe
|
||||
public void handleTimeLineTagUpdate(TagsUpdatedEvent event) {
|
||||
visualization.setNeedsRefresh();
|
||||
Platform.runLater(() -> {
|
||||
VisualizationPanel.this.needsRefresh.set(true);
|
||||
if (notificationPane.isShowing() == false) {
|
||||
notificationPane.getActions().setAll(new Refresh());
|
||||
notificationPane.show(Bundle.VisualizationPanel_tagsAddedOrDeleted(), new ImageView(INFORMATION));
|
||||
@@ -401,9 +392,8 @@ final public class VisualizationPanel extends BorderPane {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle RefreshRequestedEvent.
|
||||
*
|
||||
* Mark that the visualization has been refreshed.
|
||||
* Handle a RefreshRequestedEvent from the events model by updating the
|
||||
* visualization.
|
||||
*
|
||||
* NOTE: This VisualizationPanel must be registered with the
|
||||
* filteredEventsModel's EventBus in order for this handler to be invoked.
|
||||
@@ -412,22 +402,18 @@ final public class VisualizationPanel extends BorderPane {
|
||||
*/
|
||||
@Subscribe
|
||||
public void handleRefreshRequested(RefreshRequestedEvent event) {
|
||||
visualization.update();
|
||||
Platform.runLater(() -> {
|
||||
VisualizationPanel.this.needsRefresh.set(false);
|
||||
if (notificationPane.getText().equals(Bundle.VisualizationPanel_tagsAddedOrDeleted())) {
|
||||
if (Bundle.VisualizationPanel_tagsAddedOrDeleted().equals(notificationPane.getText())) {
|
||||
notificationPane.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void handleFresh(DBUpdatedEvent event) {
|
||||
Platform.runLater(() -> {
|
||||
VisualizationPanel.this.refreshHistorgram();
|
||||
notificationPane.hide();
|
||||
});
|
||||
public void handleDBUpdated(DBUpdatedEvent event) {
|
||||
refreshHistorgram();
|
||||
Platform.runLater(notificationPane::hide);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -606,8 +592,9 @@ final public class VisualizationPanel extends BorderPane {
|
||||
}
|
||||
//setup new vis.
|
||||
visualization = vizPane;
|
||||
ActionUtils.configureButton(new Refresh(), refreshButton);
|
||||
visualization.update();
|
||||
toolBar.getItems().addAll(vizPane.getSettingsNodes());
|
||||
toolBar.getItems().addAll(2, vizPane.getSettingsNodes());
|
||||
notificationPane.setContent(visualization);
|
||||
|
||||
//listen to has event sproperty and show "dialog" if it is false.
|
||||
@@ -622,10 +609,7 @@ final public class VisualizationPanel extends BorderPane {
|
||||
});
|
||||
});
|
||||
|
||||
Platform.runLater(() -> {
|
||||
VisualizationPanel.this.needsRefresh.set(false);
|
||||
notificationPane.hide();
|
||||
});
|
||||
Platform.runLater(notificationPane::hide);
|
||||
}
|
||||
|
||||
@NbBundle.Messages("NoEventsDialog.titledPane.text=No Visible Events")
|
||||
@@ -760,14 +744,14 @@ final public class VisualizationPanel extends BorderPane {
|
||||
private class Refresh extends Action {
|
||||
|
||||
@NbBundle.Messages({
|
||||
"VisualizationPanel.refresh.text=Refresh",
|
||||
"VisualizationPanel.refresh.text=Refresh Vis.",
|
||||
"VisualizationPanel.refresh.longText=Refresh the visualization to include information that is in the database but not visualized, such as newly updated tags."})
|
||||
Refresh() {
|
||||
super(Bundle.VisualizationPanel_refresh_text());
|
||||
setLongText(Bundle.VisualizationPanel_refresh_longText());
|
||||
setGraphic(new ImageView(REFRESH));
|
||||
setEventHandler(actionEvent -> filteredEvents.fireRefreshRequest());
|
||||
disabledProperty().bind(needsRefresh.not());
|
||||
disabledProperty().bind(visualization.needsRefreshProperty().not());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user