mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-11 23:46:15 +00:00
comments and minor cleanup in EventStripeNode
This commit is contained in:
parent
f041783a19
commit
a1eea710a9
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.timeline.ui.detailview;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.util.Arrays;
|
||||
import javafx.event.EventHandler;
|
||||
@ -31,40 +32,52 @@ import org.controlsfx.control.action.ActionUtils;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.EventStripe;
|
||||
import org.sleuthkit.autopsy.timeline.datamodel.SingleEvent;
|
||||
import static org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.configureActionButton;
|
||||
|
||||
/**
|
||||
* Node used in {@link EventDetailsChart} to represent an EventStripe.
|
||||
* Node used in DetailsChart to represent an EventStripe.
|
||||
*/
|
||||
final public class EventStripeNode extends MultiEventNodeBase<EventStripe, EventCluster, EventClusterNode> {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(EventStripeNode.class.getName());
|
||||
|
||||
private Action newHideAction() {
|
||||
return new HideDescriptionAction(getDescription(), getEvent().getDescriptionLoD(), chartLane.getParentChart());
|
||||
}
|
||||
/**
|
||||
* The button to expand hide stripes with this description, created lazily.
|
||||
*/
|
||||
private Button hideButton;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param chartLane the DetailsChartLane this node belongs to
|
||||
* @param eventStripe the EventStripe represented by this node
|
||||
* @param parentNode the EventClusterNode that is the parent of this node.
|
||||
*/
|
||||
EventStripeNode(DetailsChartLane<?> chartLane, EventStripe eventStripe, EventClusterNode parentNode) {
|
||||
super(chartLane, eventStripe, parentNode);
|
||||
setMinHeight(24);
|
||||
|
||||
//setup description label
|
||||
descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
|
||||
descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
|
||||
|
||||
setMinHeight(24);
|
||||
setAlignment(subNodePane, Pos.BOTTOM_LEFT);
|
||||
|
||||
if (eventStripe.getClusters().size() > 1) {
|
||||
for (EventCluster cluster : eventStripe.getClusters()) {
|
||||
subNodes.add(createChildNode(cluster.withParent(eventStripe)));
|
||||
}
|
||||
//stack componenets vertically
|
||||
getChildren().addAll(new VBox(infoHBox, subNodePane));
|
||||
} else {
|
||||
//if the stripe only has one cluster, use alternate simpler layout
|
||||
EventNodeBase<?> childNode;
|
||||
EventCluster cluster = Iterables.getOnlyElement(eventStripe.getClusters()).withParent(eventStripe);
|
||||
if (cluster.getEventIDs().size() == 1) {
|
||||
childNode = createChildNode(cluster);
|
||||
} else {
|
||||
//if the cluster has more than one event, add the clusters controls to this stripe node directly.
|
||||
EventClusterNode eventClusterNode = (EventClusterNode) createChildNode(cluster);
|
||||
eventClusterNode.installActionButtons();
|
||||
controlsHBox.getChildren().addAll(eventClusterNode.getNewCollapseButton(), eventClusterNode.getNewExpandButton());
|
||||
@ -72,22 +85,31 @@ final public class EventStripeNode extends MultiEventNodeBase<EventStripe, Event
|
||||
childNode = eventClusterNode;
|
||||
}
|
||||
|
||||
//hide the cluster description
|
||||
childNode.setDescriptionVisibility(DescriptionVisibility.HIDDEN);
|
||||
|
||||
subNodes.add(childNode);
|
||||
//stack componenet in z rather than vertically
|
||||
getChildren().addAll(infoHBox, subNodePane);
|
||||
}
|
||||
}
|
||||
|
||||
public EventStripe getEventStripe() {
|
||||
return getEvent();
|
||||
/**
|
||||
* Get a new Action that hides stripes with the same description as this
|
||||
* one.
|
||||
*
|
||||
* @return a new Action that hides stripes with the same description as this
|
||||
* one.
|
||||
*/
|
||||
private Action newHideAction() {
|
||||
return new HideDescriptionAction(getDescription(), getEvent().getDescriptionLoD(), chartLane.getParentChart());
|
||||
}
|
||||
|
||||
@Override
|
||||
void installActionButtons() {
|
||||
super.installActionButtons();
|
||||
if (chartLane.quickHideFiltersEnabled() && hideButton == null) {
|
||||
hideButton = ActionUtils.createButton(newHideAction(),
|
||||
ActionUtils.ActionTextBehavior.HIDE);
|
||||
hideButton = ActionUtils.createButton(newHideAction(), ActionUtils.ActionTextBehavior.HIDE);
|
||||
configureActionButton(hideButton);
|
||||
|
||||
controlsHBox.getChildren().add(hideButton);
|
||||
@ -96,8 +118,10 @@ final public class EventStripeNode extends MultiEventNodeBase<EventStripe, Event
|
||||
|
||||
@Override
|
||||
EventNodeBase<?> createChildNode(EventCluster cluster) {
|
||||
if (cluster.getEventIDs().size() == 1) {
|
||||
return new SingleEventNode(getChartLane(), getChartLane().getController().getEventsModel().getEventById(Iterables.getOnlyElement(cluster.getEventIDs())).withParent(cluster), this);
|
||||
ImmutableSet<Long> eventIDs = cluster.getEventIDs();
|
||||
if (eventIDs.size() == 1) {
|
||||
SingleEvent singleEvent = getController().getEventsModel().getEventById(Iterables.getOnlyElement(eventIDs)).withParent(cluster);
|
||||
return new SingleEventNode(getChartLane(), singleEvent, this);
|
||||
} else {
|
||||
return new EventClusterNode(getChartLane(), cluster, this);
|
||||
}
|
||||
@ -106,6 +130,7 @@ final public class EventStripeNode extends MultiEventNodeBase<EventStripe, Event
|
||||
@Override
|
||||
EventHandler<MouseEvent> getDoubleClickHandler() {
|
||||
return mouseEvent -> {
|
||||
//no-op
|
||||
};
|
||||
}
|
||||
|
||||
@ -115,6 +140,5 @@ final public class EventStripeNode extends MultiEventNodeBase<EventStripe, Event
|
||||
super.getActions(),
|
||||
Arrays.asList(newHideAction())
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user