mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
load tooltip info on background thread
This commit is contained in:
parent
eb0c72b43a
commit
d8c78b56fa
@ -19,13 +19,17 @@
|
||||
package org.sleuthkit.autopsy.timeline.ui.detailview;
|
||||
|
||||
import com.google.common.collect.Range;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import static java.util.Objects.nonNull;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.event.ActionEvent;
|
||||
@ -59,18 +63,28 @@ import static javafx.scene.layout.Region.USE_PREF_SIZE;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.controlsfx.control.action.Action;
|
||||
import org.controlsfx.control.action.ActionUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Interval;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.coreutils.ColorUtilities;
|
||||
import org.sleuthkit.autopsy.coreutils.LoggedTask;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.timeline.TimeLineController;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.EventStripe;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.TimeLineEvent;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
|
||||
import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter;
|
||||
import org.sleuthkit.autopsy.timeline.filters.RootFilter;
|
||||
import org.sleuthkit.autopsy.timeline.filters.TypeFilter;
|
||||
import static org.sleuthkit.autopsy.timeline.ui.detailview.Bundle.EventStripeNode_loggedTask_name;
|
||||
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD;
|
||||
import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel;
|
||||
import org.sleuthkit.autopsy.timeline.zooming.ZoomParams;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
@ -270,7 +284,8 @@ final public class EventStripeNode extends StackPane {
|
||||
"EventStripeNode.tooltip.text={0} {1} events\n{2}\nbetween\t{3}\nand \t{4}"})
|
||||
synchronized void installTooltip() {
|
||||
if (tooltip == null) {
|
||||
Task<String> tooltTipTask = new Task<String>() {
|
||||
setCursor(Cursor.WAIT);
|
||||
final Task<String> tooltTipTask = new Task<String>() {
|
||||
|
||||
@Override
|
||||
protected String call() throws Exception {
|
||||
@ -312,20 +327,27 @@ final public class EventStripeNode extends StackPane {
|
||||
super.succeeded();
|
||||
try {
|
||||
tooltip = new Tooltip(get());
|
||||
Tooltip.install(this, tooltip);
|
||||
Tooltip.install(EventStripeNode.this, tooltip);
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Tooltip generation failed.", ex);
|
||||
Tooltip.uninstall(this, tooltip);
|
||||
Tooltip.uninstall(EventStripeNode.this, tooltip);
|
||||
tooltip = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tooltTipTask.stateProperty().addListener((Observable observable) -> {
|
||||
if (tooltTipTask.isDone()) {
|
||||
setCursor(null);
|
||||
}
|
||||
});
|
||||
|
||||
chart.getController().monitorTask(tooltTipTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EventStripeNode getNodeForBundle(EventStripe cluster) {
|
||||
EventStripeNode getNodeForBundle(EventStripe cluster
|
||||
) {
|
||||
return new EventStripeNode(chart, cluster, this);
|
||||
}
|
||||
|
||||
@ -518,36 +540,7 @@ EventStripeNode getNodeForBundle(EventStripe cluster) {
|
||||
Set<Long> getEventsIDs() {
|
||||
return eventStripe.getEventIDs();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* event handler used for mouse events on {@link EventStripeNode}s
|
||||
@ -593,9 +586,9 @@ EventStripeNode getNodeForBundle(EventStripe cluster) {
|
||||
t.consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ExpandClusterAction extends Action {
|
||||
private class ExpandClusterAction extends Action {
|
||||
|
||||
@NbBundle.Messages("ExpandClusterAction.text=Expand")
|
||||
ExpandClusterAction() {
|
||||
@ -611,9 +604,9 @@ private class ExpandClusterAction extends Action {
|
||||
});
|
||||
disabledProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CollapseClusterAction extends Action {
|
||||
private class CollapseClusterAction extends Action {
|
||||
|
||||
@NbBundle.Messages("CollapseClusterAction.text=Collapse")
|
||||
CollapseClusterAction() {
|
||||
@ -628,5 +621,5 @@ private class CollapseClusterAction extends Action {
|
||||
});
|
||||
disabledProperty().bind(descLOD.isEqualTo(eventStripe.getDescriptionLOD()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user