Merge pull request #1600 from millmanorama/TL_quick_hide

added feature to hide individual clusters/descriptions
This commit is contained in:
Richard Cordovano 2015-10-07 10:51:32 -04:00
commit 4f15aed515
45 changed files with 1226 additions and 684 deletions

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.coreutils; package org.sleuthkit.autopsy.coreutils;
import java.util.Deque;
import java.util.Objects; import java.util.Objects;
import javafx.beans.property.Property; import javafx.beans.property.Property;
import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.beans.property.ReadOnlyBooleanProperty;
@ -143,7 +144,6 @@ public class History<T> {
* @throws IllegalArgumentException if newState == null * @throws IllegalArgumentException if newState == null
*/ */
synchronized public void advance(T newState) throws IllegalArgumentException { synchronized public void advance(T newState) throws IllegalArgumentException {
if (newState != null && Objects.equals(currentState.get(), newState) == false) { if (newState != null && Objects.equals(currentState.get(), newState) == false) {
if (currentState.get() != null) { if (currentState.get() != null) {
historyStack.push(currentState.get()); historyStack.push(currentState.get());

View File

@ -76,10 +76,11 @@ import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel; import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.db.EventsRepository; import org.sleuthkit.autopsy.timeline.db.EventsRepository;
import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter;
import org.sleuthkit.autopsy.timeline.filters.RootFilter; import org.sleuthkit.autopsy.timeline.filters.RootFilter;
import org.sleuthkit.autopsy.timeline.filters.TypeFilter; import org.sleuthkit.autopsy.timeline.filters.TypeFilter;
import org.sleuthkit.autopsy.timeline.utils.IntervalUtils; import org.sleuthkit.autopsy.timeline.utils.IntervalUtils;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel; import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel;
import org.sleuthkit.autopsy.timeline.zooming.ZoomParams; import org.sleuthkit.autopsy.timeline.zooming.ZoomParams;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
@ -136,6 +137,13 @@ public class TimeLineController {
private final Case autoCase; private final Case autoCase;
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
private final ObservableList<DescriptionFilter> quickHideMaskFilters = FXCollections.observableArrayList();
public ObservableList<DescriptionFilter> getQuickHideFilters() {
return quickHideMaskFilters;
}
/** /**
* @return the autopsy Case assigned to the controller * @return the autopsy Case assigned to the controller
*/ */
@ -173,7 +181,7 @@ public class TimeLineController {
@GuardedBy("this") @GuardedBy("this")
private final ReadOnlyObjectWrapper<VisualizationMode> viewMode = new ReadOnlyObjectWrapper<>(VisualizationMode.COUNTS); private final ReadOnlyObjectWrapper<VisualizationMode> viewMode = new ReadOnlyObjectWrapper<>(VisualizationMode.COUNTS);
synchronized public ReadOnlyObjectProperty<VisualizationMode> getViewMode() { synchronized public ReadOnlyObjectProperty<VisualizationMode> viewModeProperty() {
return viewMode.getReadOnlyProperty(); return viewMode.getReadOnlyProperty();
} }
@ -256,7 +264,7 @@ public class TimeLineController {
InitialZoomState = new ZoomParams(filteredEvents.getSpanningInterval(), InitialZoomState = new ZoomParams(filteredEvents.getSpanningInterval(),
EventTypeZoomLevel.BASE_TYPE, EventTypeZoomLevel.BASE_TYPE,
filteredEvents.filterProperty().get(), filteredEvents.filterProperty().get(),
DescriptionLOD.SHORT); DescriptionLoD.SHORT);
historyManager.advance(InitialZoomState); historyManager.advance(InitialZoomState);
} }
@ -556,12 +564,12 @@ public class TimeLineController {
@NbBundle.Messages({"# {0} - the number of events", @NbBundle.Messages({"# {0} - the number of events",
"Timeline.pushDescrLOD.confdlg.msg=You are about to show details for {0} events." "Timeline.pushDescrLOD.confdlg.msg=You are about to show details for {0} events."
+ " This might be very slow or even crash Autopsy.\n\nDo you want to continue?"}) + " This might be very slow or even crash Autopsy.\n\nDo you want to continue?"})
synchronized public boolean pushDescrLOD(DescriptionLOD newLOD) { synchronized public boolean pushDescrLOD(DescriptionLoD newLOD) {
Map<EventType, Long> eventCounts = filteredEvents.getEventCounts(filteredEvents.zoomParametersProperty().get().getTimeRange()); Map<EventType, Long> eventCounts = filteredEvents.getEventCounts(filteredEvents.zoomParametersProperty().get().getTimeRange());
final Long count = eventCounts.values().stream().reduce(0l, Long::sum); final Long count = eventCounts.values().stream().reduce(0l, Long::sum);
boolean shouldContinue = true; boolean shouldContinue = true;
if (newLOD == DescriptionLOD.FULL && count > 10_000) { if (newLOD == DescriptionLoD.FULL && count > 10_000) {
String format = NumberFormat.getInstance().format(count); String format = NumberFormat.getInstance().format(count);
int showConfirmDialog = JOptionPane.showConfirmDialog(mainFrame, int showConfirmDialog = JOptionPane.showConfirmDialog(mainFrame,
@ -616,7 +624,6 @@ public class TimeLineController {
synchronized private void advance(ZoomParams newState) { synchronized private void advance(ZoomParams newState) {
historyManager.advance(newState); historyManager.advance(newState);
} }
public void selectTimeAndType(Interval interval, EventType type) { public void selectTimeAndType(Interval interval, EventType type) {

View File

@ -169,12 +169,12 @@ public final class TimeLineTopComponent extends TopComponent implements Explorer
new Forward(controller).handle(new ActionEvent()); new Forward(controller).handle(new ActionEvent());
} }
}); });
controller.getViewMode().addListener((Observable observable) -> { controller.viewModeProperty().addListener((Observable observable) -> {
if (controller.getViewMode().get().equals(VisualizationMode.COUNTS)) { if (controller.viewModeProperty().get().equals(VisualizationMode.COUNTS)) {
tabPane.getSelectionModel().select(filterTab); tabPane.getSelectionModel().select(filterTab);
} }
}); });
eventsTab.disableProperty().bind(controller.getViewMode().isEqualTo(VisualizationMode.COUNTS)); eventsTab.disableProperty().bind(controller.viewModeProperty().isEqualTo(VisualizationMode.COUNTS));
visualizationPanel.setController(controller); visualizationPanel.setController(controller);
navPanel.setController(controller); navPanel.setController(controller);
filtersPanel.setController(controller); filtersPanel.setController(controller);

View File

@ -1,14 +1,28 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Autopsy Forensic Browser
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * Copyright 2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.sleuthkit.autopsy.timeline.datamodel; package org.sleuthkit.autopsy.timeline.datamodel;
import com.google.common.collect.Range; import com.google.common.collect.Range;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
/** /**
* *
@ -17,10 +31,11 @@ public interface EventBundle {
String getDescription(); String getDescription();
DescriptionLOD getDescriptionLOD(); DescriptionLoD getDescriptionLoD();
Set<Long> getEventIDs(); Set<Long> getEventIDs();
Set<Long> getEventIDsWithHashHits(); Set<Long> getEventIDsWithHashHits();
Set<Long> getEventIDsWithTags(); Set<Long> getEventIDsWithTags();
@ -33,4 +48,9 @@ public interface EventBundle {
Iterable<Range<Long>> getRanges(); Iterable<Range<Long>> getRanges();
Optional<EventBundle> getParentBundle();
default long getCount() {
return getEventIDs().size();
}
} }

View File

@ -21,59 +21,87 @@ package org.sleuthkit.autopsy.timeline.datamodel;
import com.google.common.collect.Range; import com.google.common.collect.Range;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import java.util.Collections; import java.util.Collections;
import java.util.Objects;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
import org.joda.time.Interval; import org.joda.time.Interval;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.utils.IntervalUtils; import org.sleuthkit.autopsy.timeline.utils.IntervalUtils;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
/** /**
* Represents a set of other (TimeLineEvent) events aggregated together. All the * Represents a set of other (TimeLineEvent) events clustered together. All the
* sub events should have the same type and matching descriptions at the * sub events should have the same type and matching descriptions at the
* designated 'zoom level'. * designated 'zoom level', and be 'close together' in time.
*/ */
@Immutable @Immutable
public class EventCluster implements EventBundle { public class EventCluster implements EventBundle {
/** /**
* the smallest time interval containing all the aggregated events * merge two event clusters into one new event cluster.
*
* @param cluster1
* @param cluster2
*
* @return a new event cluster that is the result of merging the given
* events clusters
*/
public static EventCluster merge(EventCluster cluster1, EventCluster cluster2) {
if (cluster1.getEventType() != cluster2.getEventType()) {
throw new IllegalArgumentException("event clusters are not compatible: they have different types");
}
if (!cluster1.getDescription().equals(cluster2.getDescription())) {
throw new IllegalArgumentException("event clusters are not compatible: they have different descriptions");
}
Sets.SetView<Long> idsUnion = Sets.union(cluster1.getEventIDs(), cluster2.getEventIDs());
Sets.SetView<Long> hashHitsUnion = Sets.union(cluster1.getEventIDsWithHashHits(), cluster2.getEventIDsWithHashHits());
Sets.SetView<Long> taggedUnion = Sets.union(cluster1.getEventIDsWithTags(), cluster2.getEventIDsWithTags());
return new EventCluster(IntervalUtils.span(cluster1.span, cluster2.span), cluster1.getEventType(), idsUnion, hashHitsUnion, taggedUnion, cluster1.getDescription(), cluster1.lod);
}
final private EventBundle parent;
/**
* the smallest time interval containing all the clustered events
*/ */
final private Interval span; final private Interval span;
/** /**
* the type of all the aggregted events * the type of all the clustered events
*/ */
final private EventType type; final private EventType type;
/** /**
* the common description of all the aggregated events * the common description of all the clustered events
*/ */
final private String description; final private String description;
/** /**
* the description level of detail that the events were aggregated at. * the description level of detail that the events were clustered at.
*/ */
private final DescriptionLOD lod; private final DescriptionLoD lod;
/** /**
* the set of ids of the aggregated events * the set of ids of the clustered events
*/ */
final private Set<Long> eventIDs; final private Set<Long> eventIDs;
/** /**
* the ids of the subset of aggregated events that have at least one tag * the ids of the subset of clustered events that have at least one tag
* applied to them * applied to them
*/ */
private final Set<Long> tagged; private final Set<Long> tagged;
/** /**
* the ids of the subset of aggregated events that have at least one hash * the ids of the subset of clustered events that have at least one hash set
* set hit * hit
*/ */
private final Set<Long> hashHits; private final Set<Long> hashHits;
public EventCluster(Interval spanningInterval, EventType type, Set<Long> eventIDs, Set<Long> hashHits, Set<Long> tagged, String description, DescriptionLOD lod) { private EventCluster(Interval spanningInterval, EventType type, Set<Long> eventIDs, Set<Long> hashHits, Set<Long> tagged, String description, DescriptionLoD lod, EventBundle parent) {
this.span = spanningInterval; this.span = spanningInterval;
this.type = type; this.type = type;
@ -82,73 +110,62 @@ public class EventCluster implements EventBundle {
this.description = description; this.description = description;
this.eventIDs = eventIDs; this.eventIDs = eventIDs;
this.lod = lod; this.lod = lod;
this.parent = parent;
}
public EventCluster(Interval spanningInterval, EventType type, Set<Long> eventIDs, Set<Long> hashHits, Set<Long> tagged, String description, DescriptionLoD lod) {
this(spanningInterval, type, eventIDs, hashHits, tagged, description, lod, null);
}
@Override
public Optional<EventBundle> getParentBundle() {
return Optional.ofNullable(parent);
} }
/**
* @return the actual interval from the first event to the last event
*/
public Interval getSpan() { public Interval getSpan() {
return span; return span;
} }
@Override
public long getStartMillis() { public long getStartMillis() {
return span.getStartMillis(); return span.getStartMillis();
} }
@Override
public long getEndMillis() { public long getEndMillis() {
return span.getEndMillis(); return span.getEndMillis();
} }
@Override
public Set<Long> getEventIDs() { public Set<Long> getEventIDs() {
return Collections.unmodifiableSet(eventIDs); return Collections.unmodifiableSet(eventIDs);
} }
@Override
public Set<Long> getEventIDsWithHashHits() { public Set<Long> getEventIDsWithHashHits() {
return Collections.unmodifiableSet(hashHits); return Collections.unmodifiableSet(hashHits);
} }
@Override
public Set<Long> getEventIDsWithTags() { public Set<Long> getEventIDsWithTags() {
return Collections.unmodifiableSet(tagged); return Collections.unmodifiableSet(tagged);
} }
@Override
public String getDescription() { public String getDescription() {
return description; return description;
} }
@Override
public EventType getEventType() { public EventType getEventType() {
return type; return type;
} }
@Override @Override
public DescriptionLOD getDescriptionLOD() { public DescriptionLoD getDescriptionLoD() {
return lod; return lod;
} }
/**
* merge two aggregate events into one new aggregate event.
*
* @param cluster1
* @param aggEVent2
*
* @return a new aggregate event that is the result of merging the given
* events
*/
public static EventCluster merge(EventCluster cluster1, EventCluster cluster2) {
if (cluster1.getEventType() != cluster2.getEventType()) {
throw new IllegalArgumentException("aggregate events are not compatible they have different types");
}
if (!cluster1.getDescription().equals(cluster2.getDescription())) {
throw new IllegalArgumentException("aggregate events are not compatible they have different descriptions");
}
Sets.SetView<Long> idsUnion = Sets.union(cluster1.getEventIDs(), cluster2.getEventIDs());
Sets.SetView<Long> hashHitsUnion = Sets.union(cluster1.getEventIDsWithHashHits(), cluster2.getEventIDsWithHashHits());
Sets.SetView<Long> taggedUnion = Sets.union(cluster1.getEventIDsWithTags(), cluster2.getEventIDsWithTags());
return new EventCluster(IntervalUtils.span(cluster1.span, cluster2.span), cluster1.getEventType(), idsUnion, hashHitsUnion, taggedUnion, cluster1.getDescription(), cluster1.lod);
}
Range<Long> getRange() { Range<Long> getRange() {
if (getEndMillis() > getStartMillis()) { if (getEndMillis() > getStartMillis()) {
return Range.closedOpen(getSpan().getStartMillis(), getSpan().getEndMillis()); return Range.closedOpen(getSpan().getStartMillis(), getSpan().getEndMillis());
@ -162,4 +179,20 @@ public class EventCluster implements EventBundle {
return Collections.singletonList(getRange()); return Collections.singletonList(getRange());
} }
/**
* return a new EventCluster identical to this one, except with the given
* EventBundle as the parent.
*
* @param parent
*
* @return a new EventCluster identical to this one, except with the given
* EventBundle as the parent.
*/
public EventCluster withParent(EventBundle parent) {
if (Objects.nonNull(this.parent)) {
throw new IllegalStateException("Event Cluster already has a parent!");
}
return new EventCluster(span, type, eventIDs, hashHits, tagged, description, lod, parent);
}
} }

View File

@ -13,50 +13,63 @@ import com.google.common.collect.TreeRangeMap;
import com.google.common.collect.TreeRangeSet; import com.google.common.collect.TreeRangeSet;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
import org.python.google.common.base.Objects; import org.python.google.common.base.Objects;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
/** /**
* * A 'collection' of {@link EventCluster}s, all having the same type,
* description, and zoom levels.
*/ */
@Immutable @Immutable
public final class EventStripe implements EventBundle { public final class EventStripe implements EventBundle {
public static EventStripe merge(EventStripe u, EventStripe v) {
Preconditions.checkNotNull(u);
Preconditions.checkNotNull(v);
Preconditions.checkArgument(Objects.equal(u.description, v.description));
Preconditions.checkArgument(Objects.equal(u.lod, v.lod));
Preconditions.checkArgument(Objects.equal(u.type, v.type));
Preconditions.checkArgument(Objects.equal(u.parent, v.parent));
return new EventStripe(u, v);
}
private final EventBundle parent;
private final RangeSet<Long> spans = TreeRangeSet.create(); private final RangeSet<Long> spans = TreeRangeSet.create();
private final RangeMap<Long, EventCluster> spanMap = TreeRangeMap.create(); private final RangeMap<Long, EventCluster> spanMap = TreeRangeMap.create();
/** /**
* the type of all the aggregted events * the type of all the events
*/ */
private final EventType type; private final EventType type;
/** /**
* the common description of all the aggregated events * the common description of all the events
*/ */
private final String description; private final String description;
/** /**
* the description level of detail that the events were aggregated at. * the description level of detail that the events were clustered at.
*/ */
private final DescriptionLOD lod; private final DescriptionLoD lod;
/** /**
* the set of ids of the aggregated events * the set of ids of the events
*/ */
private final Set<Long> eventIDs = new HashSet<>(); private final Set<Long> eventIDs = new HashSet<>();
/** /**
* the ids of the subset of aggregated events that have at least one tag * the ids of the subset of events that have at least one tag applied to
* applied to them * them
*/ */
private final Set<Long> tagged = new HashSet<>(); private final Set<Long> tagged = new HashSet<>();
/** /**
* the ids of the subset of aggregated events that have at least one hash * the ids of the subset of events that have at least one hash set hit
* set hit
*/ */
private final Set<Long> hashHits = new HashSet<>(); private final Set<Long> hashHits = new HashSet<>();
@ -65,10 +78,11 @@ public final class EventStripe implements EventBundle {
spanMap.put(cluster.getRange(), cluster); spanMap.put(cluster.getRange(), cluster);
type = cluster.getEventType(); type = cluster.getEventType();
description = cluster.getDescription(); description = cluster.getDescription();
lod = cluster.getDescriptionLOD(); lod = cluster.getDescriptionLoD();
eventIDs.addAll(cluster.getEventIDs()); eventIDs.addAll(cluster.getEventIDs());
tagged.addAll(cluster.getEventIDsWithTags()); tagged.addAll(cluster.getEventIDsWithTags());
hashHits.addAll(cluster.getEventIDsWithHashHits()); hashHits.addAll(cluster.getEventIDsWithHashHits());
parent = cluster.getParentBundle().orElse(null);
} }
private EventStripe(EventStripe u, EventStripe v) { private EventStripe(EventStripe u, EventStripe v) {
@ -78,22 +92,19 @@ public final class EventStripe implements EventBundle {
spanMap.putAll(v.spanMap); spanMap.putAll(v.spanMap);
type = u.getEventType(); type = u.getEventType();
description = u.getDescription(); description = u.getDescription();
lod = u.getDescriptionLOD(); lod = u.getDescriptionLoD();
eventIDs.addAll(u.getEventIDs()); eventIDs.addAll(u.getEventIDs());
eventIDs.addAll(v.getEventIDs()); eventIDs.addAll(v.getEventIDs());
tagged.addAll(u.getEventIDsWithTags()); tagged.addAll(u.getEventIDsWithTags());
tagged.addAll(v.getEventIDsWithTags()); tagged.addAll(v.getEventIDsWithTags());
hashHits.addAll(u.getEventIDsWithHashHits()); hashHits.addAll(u.getEventIDsWithHashHits());
hashHits.addAll(v.getEventIDsWithHashHits()); hashHits.addAll(v.getEventIDsWithHashHits());
parent = u.getParentBundle().orElse(null);
} }
public static EventStripe merge(EventStripe u, EventStripe v) { @Override
Preconditions.checkNotNull(u); public Optional<EventBundle> getParentBundle() {
Preconditions.checkNotNull(v); return Optional.ofNullable(parent);
Preconditions.checkArgument(Objects.equal(u.description, v.description));
Preconditions.checkArgument(Objects.equal(u.lod, v.lod));
Preconditions.checkArgument(Objects.equal(u.type, v.type));
return new EventStripe(u, v);
} }
@Override @Override
@ -107,7 +118,7 @@ public final class EventStripe implements EventBundle {
} }
@Override @Override
public DescriptionLOD getDescriptionLOD() { public DescriptionLoD getDescriptionLoD() {
return lod; return lod;
} }

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.timeline.datamodel;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -55,7 +56,7 @@ import org.sleuthkit.autopsy.timeline.filters.TagNameFilter;
import org.sleuthkit.autopsy.timeline.filters.TagsFilter; import org.sleuthkit.autopsy.timeline.filters.TagsFilter;
import org.sleuthkit.autopsy.timeline.filters.TextFilter; import org.sleuthkit.autopsy.timeline.filters.TextFilter;
import org.sleuthkit.autopsy.timeline.filters.TypeFilter; import org.sleuthkit.autopsy.timeline.filters.TypeFilter;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel; import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel;
import org.sleuthkit.autopsy.timeline.zooming.ZoomParams; import org.sleuthkit.autopsy.timeline.zooming.ZoomParams;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
@ -104,7 +105,7 @@ public final class FilteredEventsModel {
private final ReadOnlyObjectWrapper< EventTypeZoomLevel> requestedTypeZoom = new ReadOnlyObjectWrapper<>(EventTypeZoomLevel.BASE_TYPE); private final ReadOnlyObjectWrapper< EventTypeZoomLevel> requestedTypeZoom = new ReadOnlyObjectWrapper<>(EventTypeZoomLevel.BASE_TYPE);
@GuardedBy("this") @GuardedBy("this")
private final ReadOnlyObjectWrapper< DescriptionLOD> requestedLOD = new ReadOnlyObjectWrapper<>(DescriptionLOD.SHORT); private final ReadOnlyObjectWrapper< DescriptionLoD> requestedLOD = new ReadOnlyObjectWrapper<>(DescriptionLoD.SHORT);
@GuardedBy("this") @GuardedBy("this")
private final ReadOnlyObjectWrapper<ZoomParams> requestedZoomParamters = new ReadOnlyObjectWrapper<>(); private final ReadOnlyObjectWrapper<ZoomParams> requestedZoomParamters = new ReadOnlyObjectWrapper<>();
@ -143,6 +144,7 @@ public final class FilteredEventsModel {
}); });
requestedFilter.set(getDefaultFilter()); requestedFilter.set(getDefaultFilter());
//TODO: use bindings to keep these in sync? -jm
requestedZoomParamters.addListener((Observable observable) -> { requestedZoomParamters.addListener((Observable observable) -> {
final ZoomParams zoomParams = requestedZoomParamters.get(); final ZoomParams zoomParams = requestedZoomParamters.get();
@ -153,7 +155,7 @@ public final class FilteredEventsModel {
|| zoomParams.getTimeRange().equals(requestedTimeRange.get()) == false) { || zoomParams.getTimeRange().equals(requestedTimeRange.get()) == false) {
requestedTypeZoom.set(zoomParams.getTypeZoomLevel()); requestedTypeZoom.set(zoomParams.getTypeZoomLevel());
requestedFilter.set(zoomParams.getFilter().copyOf()); requestedFilter.set(zoomParams.getFilter());
requestedTimeRange.set(zoomParams.getTimeRange()); requestedTimeRange.set(zoomParams.getTimeRange());
requestedLOD.set(zoomParams.getDescriptionLOD()); requestedLOD.set(zoomParams.getDescriptionLOD());
} }
@ -178,7 +180,7 @@ public final class FilteredEventsModel {
return requestedTimeRange.getReadOnlyProperty(); return requestedTimeRange.getReadOnlyProperty();
} }
synchronized public ReadOnlyObjectProperty<DescriptionLOD> descriptionLODProperty() { synchronized public ReadOnlyObjectProperty<DescriptionLoD> descriptionLODProperty() {
return requestedLOD.getReadOnlyProperty(); return requestedLOD.getReadOnlyProperty();
} }
@ -190,7 +192,7 @@ public final class FilteredEventsModel {
return requestedTypeZoom.getReadOnlyProperty(); return requestedTypeZoom.getReadOnlyProperty();
} }
synchronized public DescriptionLOD getDescriptionLOD() { synchronized public DescriptionLoD getDescriptionLOD() {
return requestedLOD.get(); return requestedLOD.get();
} }
@ -227,7 +229,7 @@ public final class FilteredEventsModel {
tagNameFilter.setSelected(Boolean.TRUE); tagNameFilter.setSelected(Boolean.TRUE);
tagsFilter.addSubFilter(tagNameFilter); tagsFilter.addSubFilter(tagNameFilter);
}); });
return new RootFilter(new HideKnownFilter(), tagsFilter, hashHitsFilter, new TextFilter(), new TypeFilter(RootEventType.getInstance()), dataSourcesFilter); return new RootFilter(new HideKnownFilter(), tagsFilter, hashHitsFilter, new TextFilter(), new TypeFilter(RootEventType.getInstance()), dataSourcesFilter, Collections.emptySet());
} }
public Interval getBoundingEventsInterval() { public Interval getBoundingEventsInterval() {
@ -320,17 +322,15 @@ public final class FilteredEventsModel {
} }
/** /**
* @param aggregation
* *
* @return a list of aggregated events that are within the requested time * @return a list of event clusters at the requested zoom levels that are
* range and pass the requested filter, using the given aggregation * within the requested time range and pass the requested filter
* to control the grouping of events
*/ */
public List<EventCluster> getAggregatedEvents() { public List<EventCluster> getEventClusters() {
final Interval range; final Interval range;
final RootFilter filter; final RootFilter filter;
final EventTypeZoomLevel zoom; final EventTypeZoomLevel zoom;
final DescriptionLOD lod; final DescriptionLoD lod;
synchronized (this) { synchronized (this) {
range = requestedTimeRange.get(); range = requestedTimeRange.get();
filter = requestedFilter.get(); filter = requestedFilter.get();

View File

@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableMap;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.TskData;
/** /**
@ -38,7 +38,7 @@ public class TimeLineEvent {
private final long time; private final long time;
private final EventType subType; private final EventType subType;
private final ImmutableMap<DescriptionLOD, String> descriptions; private final ImmutableMap<DescriptionLoD, String> descriptions;
private final TskData.FileKnown known; private final TskData.FileKnown known;
private final boolean hashHit; private final boolean hashHit;
@ -50,10 +50,9 @@ public class TimeLineEvent {
this.artifactID = artifactID == 0 ? null : artifactID; this.artifactID = artifactID == 0 ? null : artifactID;
this.time = time; this.time = time;
this.subType = type; this.subType = type;
descriptions = ImmutableMap.<DescriptionLOD, String>of( descriptions = ImmutableMap.<DescriptionLoD, String>of(DescriptionLoD.FULL, fullDescription,
DescriptionLOD.FULL, fullDescription, DescriptionLoD.MEDIUM, medDescription,
DescriptionLOD.MEDIUM, medDescription, DescriptionLoD.SHORT, shortDescription);
DescriptionLOD.SHORT, shortDescription);
this.known = known; this.known = known;
this.hashHit = hashHit; this.hashHit = hashHit;
@ -94,22 +93,22 @@ public class TimeLineEvent {
} }
public String getFullDescription() { public String getFullDescription() {
return getDescription(DescriptionLOD.FULL); return getDescription(DescriptionLoD.FULL);
} }
public String getMedDescription() { public String getMedDescription() {
return getDescription(DescriptionLOD.MEDIUM); return getDescription(DescriptionLoD.MEDIUM);
} }
public String getShortDescription() { public String getShortDescription() {
return getDescription(DescriptionLOD.SHORT); return getDescription(DescriptionLoD.SHORT);
} }
public TskData.FileKnown getKnown() { public TskData.FileKnown getKnown() {
return known; return known;
} }
public String getDescription(DescriptionLOD lod) { public String getDescription(DescriptionLoD lod) {
return descriptions.get(lod); return descriptions.get(lod);
} }

View File

@ -64,7 +64,7 @@ import static org.sleuthkit.autopsy.timeline.db.SQLHelper.useTagTablesHelper;
import org.sleuthkit.autopsy.timeline.filters.RootFilter; import org.sleuthkit.autopsy.timeline.filters.RootFilter;
import org.sleuthkit.autopsy.timeline.filters.TagsFilter; import org.sleuthkit.autopsy.timeline.filters.TagsFilter;
import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo; import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel; import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel;
import org.sleuthkit.autopsy.timeline.zooming.ZoomParams; import org.sleuthkit.autopsy.timeline.zooming.ZoomParams;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
@ -1046,7 +1046,7 @@ public class EventDB {
//unpack params //unpack params
Interval timeRange = params.getTimeRange(); Interval timeRange = params.getTimeRange();
RootFilter filter = params.getFilter(); RootFilter filter = params.getFilter();
DescriptionLOD descriptionLOD = params.getDescriptionLOD(); DescriptionLoD descriptionLOD = params.getDescriptionLOD();
EventTypeZoomLevel typeZoomLevel = params.getTypeZoomLevel(); EventTypeZoomLevel typeZoomLevel = params.getTypeZoomLevel();
//ensure length of querried interval is not 0 //ensure length of querried interval is not 0
@ -1076,6 +1076,7 @@ public class EventDB {
+ "\n GROUP BY interval, " + typeColumn + " , " + descriptionColumn // NON-NLS + "\n GROUP BY interval, " + typeColumn + " , " + descriptionColumn // NON-NLS
+ "\n ORDER BY min(time)"; // NON-NLS + "\n ORDER BY min(time)"; // NON-NLS
System.out.println(query);
// perform query and map results to AggregateEvent objects // perform query and map results to AggregateEvent objects
List<EventCluster> events = new ArrayList<>(); List<EventCluster> events = new ArrayList<>();
@ -1108,7 +1109,7 @@ public class EventDB {
* *
* @throws SQLException * @throws SQLException
*/ */
private EventCluster eventClusterHelper(ResultSet rs, boolean useSubTypes, DescriptionLOD descriptionLOD, TagsFilter filter) throws SQLException { private EventCluster eventClusterHelper(ResultSet rs, boolean useSubTypes, DescriptionLoD descriptionLOD, TagsFilter filter) throws SQLException {
Interval interval = new Interval(rs.getLong("min(time)") * 1000, rs.getLong("max(time)") * 1000, TimeLineController.getJodaTimeZone());// NON-NLS Interval interval = new Interval(rs.getLong("min(time)") * 1000, rs.getLong("max(time)") * 1000, TimeLineController.getJodaTimeZone());// NON-NLS
String eventIDsString = rs.getString("event_ids");// NON-NLS String eventIDsString = rs.getString("event_ids");// NON-NLS
Set<Long> eventIDs = SQLHelper.unGroupConcat(eventIDsString, Long::valueOf); Set<Long> eventIDs = SQLHelper.unGroupConcat(eventIDsString, Long::valueOf);

View File

@ -622,4 +622,9 @@ public class EventsRepository {
} }
} }
} }
public boolean areFiltersEquivalent(RootFilter f1, RootFilter f2) {
return SQLHelper.getSQLWhere(f1).equals(SQLHelper.getSQLWhere(f2));
}
} }

View File

@ -43,9 +43,9 @@ import org.sleuthkit.autopsy.timeline.filters.TextFilter;
import org.sleuthkit.autopsy.timeline.filters.TypeFilter; import org.sleuthkit.autopsy.timeline.filters.TypeFilter;
import org.sleuthkit.autopsy.timeline.filters.UnionFilter; import org.sleuthkit.autopsy.timeline.filters.UnionFilter;
import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo; import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
import static org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD.FULL; import static org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD.FULL;
import static org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD.MEDIUM; import static org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD.MEDIUM;
import static org.sleuthkit.autopsy.timeline.zooming.TimeUnits.DAYS; import static org.sleuthkit.autopsy.timeline.zooming.TimeUnits.DAYS;
import static org.sleuthkit.autopsy.timeline.zooming.TimeUnits.HOURS; import static org.sleuthkit.autopsy.timeline.zooming.TimeUnits.HOURS;
import static org.sleuthkit.autopsy.timeline.zooming.TimeUnits.MINUTES; import static org.sleuthkit.autopsy.timeline.zooming.TimeUnits.MINUTES;
@ -58,16 +58,16 @@ import org.sleuthkit.datamodel.TskData;
* Static helper methods for converting between java data model objects and * Static helper methods for converting between java data model objects and
* sqlite queries. * sqlite queries.
*/ */
public class SQLHelper { class SQLHelper {
static String useHashHitTablesHelper(RootFilter filter) { static String useHashHitTablesHelper(RootFilter filter) {
HashHitsFilter hashHitFilter = filter.getHashHitsFilter(); HashHitsFilter hashHitFilter = filter.getHashHitsFilter();
return hashHitFilter.isSelected() && false == hashHitFilter.isDisabled() ? " LEFT JOIN hash_set_hits " : " "; return hashHitFilter.isActive() ? " LEFT JOIN hash_set_hits " : " ";
} }
static String useTagTablesHelper(RootFilter filter) { static String useTagTablesHelper(RootFilter filter) {
TagsFilter tagsFilter = filter.getTagsFilter(); TagsFilter tagsFilter = filter.getTagsFilter();
return tagsFilter.isSelected() && false == tagsFilter.isDisabled() ? " LEFT JOIN tags " : " "; return tagsFilter.isActive() ? " LEFT JOIN tags " : " ";
} }
/** /**
@ -149,7 +149,7 @@ public class SQLHelper {
} }
private static String getSQLWhere(HideKnownFilter filter) { private static String getSQLWhere(HideKnownFilter filter) {
if (filter.isSelected()) { if (filter.isActive()) {
return "(known_state IS NOT '" + TskData.FileKnown.KNOWN.getFileKnownValue() + "')"; // NON-NLS return "(known_state IS NOT '" + TskData.FileKnown.KNOWN.getFileKnownValue() + "')"; // NON-NLS
} else { } else {
return "1"; return "1";
@ -157,16 +157,16 @@ public class SQLHelper {
} }
private static String getSQLWhere(DescriptionFilter filter) { private static String getSQLWhere(DescriptionFilter filter) {
if (filter.isSelected()) { if (filter.isActive()) {
return "(" + getDescriptionColumn(filter.getDescriptionLoD()) + " LIKE '" + filter.getDescription() + "')"; // NON-NLS String likeOrNotLike = (filter.getFilterMode() == DescriptionFilter.FilterMode.INCLUDE ? "" : " NOT") + " LIKE '";
return "(" + getDescriptionColumn(filter.getDescriptionLoD()) + likeOrNotLike + filter.getDescription() + "' )"; // NON-NLS
} else { } else {
return "1"; return "1";
} }
} }
private static String getSQLWhere(TagsFilter filter) { private static String getSQLWhere(TagsFilter filter) {
if (filter.isSelected() if (filter.isActive()
&& (false == filter.isDisabled())
&& (filter.getSubFilters().isEmpty() == false)) { && (filter.getSubFilters().isEmpty() == false)) {
String tagNameIDs = filter.getSubFilters().stream() String tagNameIDs = filter.getSubFilters().stream()
.filter((TagNameFilter t) -> t.isSelected() && !t.isDisabled()) .filter((TagNameFilter t) -> t.isSelected() && !t.isDisabled())
@ -181,8 +181,7 @@ public class SQLHelper {
} }
private static String getSQLWhere(HashHitsFilter filter) { private static String getSQLWhere(HashHitsFilter filter) {
if (filter.isSelected() if (filter.isActive()
&& (false == filter.isDisabled())
&& (filter.getSubFilters().isEmpty() == false)) { && (filter.getSubFilters().isEmpty() == false)) {
String hashSetIDs = filter.getSubFilters().stream() String hashSetIDs = filter.getSubFilters().stream()
.filter((HashSetFilter t) -> t.isSelected() && !t.isDisabled()) .filter((HashSetFilter t) -> t.isSelected() && !t.isDisabled())
@ -195,7 +194,7 @@ public class SQLHelper {
} }
private static String getSQLWhere(DataSourceFilter filter) { private static String getSQLWhere(DataSourceFilter filter) {
if (filter.isSelected()) { if (filter.isActive()) {
return "(datasource_id = '" + filter.getDataSourceID() + "')"; return "(datasource_id = '" + filter.getDataSourceID() + "')";
} else { } else {
return "1"; return "1";
@ -203,15 +202,15 @@ public class SQLHelper {
} }
private static String getSQLWhere(DataSourcesFilter filter) { private static String getSQLWhere(DataSourcesFilter filter) {
return (filter.isSelected()) ? "(datasource_id in (" return (filter.isActive()) ? "(datasource_id in ("
+ filter.getSubFilters().stream() + filter.getSubFilters().stream()
.filter(AbstractFilter::isSelected) .filter(AbstractFilter::isActive)
.map((dataSourceFilter) -> String.valueOf(dataSourceFilter.getDataSourceID())) .map((dataSourceFilter) -> String.valueOf(dataSourceFilter.getDataSourceID()))
.collect(Collectors.joining(", ")) + "))" : "1"; .collect(Collectors.joining(", ")) + "))" : "1";
} }
private static String getSQLWhere(TextFilter filter) { private static String getSQLWhere(TextFilter filter) {
if (filter.isSelected()) { if (filter.isActive()) {
if (StringUtils.isBlank(filter.getText())) { if (StringUtils.isBlank(filter.getText())) {
return "1"; return "1";
} }
@ -237,7 +236,7 @@ public class SQLHelper {
return "0"; return "0";
} else if (typeFilter.getEventType() instanceof RootEventType) { } else if (typeFilter.getEventType() instanceof RootEventType) {
if (typeFilter.getSubFilters().stream() if (typeFilter.getSubFilters().stream()
.allMatch(subFilter -> subFilter.isSelected() && subFilter.getSubFilters().stream().allMatch(Filter::isSelected))) { .allMatch(subFilter -> subFilter.isActive() && subFilter.getSubFilters().stream().allMatch(Filter::isActive))) {
return "1"; //then collapse clause to true return "1"; //then collapse clause to true
} }
} }
@ -245,7 +244,7 @@ public class SQLHelper {
} }
private static List<Integer> getActiveSubTypes(TypeFilter filter) { private static List<Integer> getActiveSubTypes(TypeFilter filter) {
if (filter.isSelected()) { if (filter.isActive()) {
if (filter.getSubFilters().isEmpty()) { if (filter.getSubFilters().isEmpty()) {
return Collections.singletonList(RootEventType.allTypes.indexOf(filter.getEventType())); return Collections.singletonList(RootEventType.allTypes.indexOf(filter.getEventType()));
} else { } else {
@ -285,7 +284,7 @@ public class SQLHelper {
} }
} }
static String getDescriptionColumn(DescriptionLOD lod) { static String getDescriptionColumn(DescriptionLoD lod) {
switch (lod) { switch (lod) {
case FULL: case FULL:
return "full_description"; return "full_description";

View File

@ -18,6 +18,8 @@
*/ */
package org.sleuthkit.autopsy.timeline.filters; package org.sleuthkit.autopsy.timeline.filters;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
/** /**
@ -28,9 +30,10 @@ public abstract class AbstractFilter implements Filter {
private final SimpleBooleanProperty selected = new SimpleBooleanProperty(true); private final SimpleBooleanProperty selected = new SimpleBooleanProperty(true);
private final SimpleBooleanProperty disabled = new SimpleBooleanProperty(false); private final SimpleBooleanProperty disabled = new SimpleBooleanProperty(false);
private final BooleanBinding activeProperty = Bindings.and(selected, disabled.not());
@Override @Override
public SimpleBooleanProperty getSelectedProperty() { public SimpleBooleanProperty selectedProperty() {
return selected; return selected;
} }
@ -64,4 +67,11 @@ public abstract class AbstractFilter implements Filter {
return "[" + (isSelected() ? "x" : " ") + "]"; // NON-NLS return "[" + (isSelected() ? "x" : " ") + "]"; // NON-NLS
} }
public final boolean isActive() {
return activeProperty.get();
}
public final BooleanBinding activeProperty() {
return activeProperty;
}
} }

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.timeline.filters; package org.sleuthkit.autopsy.timeline.filters;
import java.util.List; import java.util.List;
import java.util.Objects;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
@ -71,7 +72,7 @@ public abstract class CompoundFilter<SubFilterType extends Filter> extends Abstr
private void addSubFilterListeners(List<? extends SubFilterType> newSubfilters) { private void addSubFilterListeners(List<? extends SubFilterType> newSubfilters) {
for (SubFilterType sf : newSubfilters) { for (SubFilterType sf : newSubfilters) {
//if a subfilter changes active state //if a subfilter changes active state
sf.getSelectedProperty().addListener((Observable observable) -> { sf.selectedProperty().addListener((Observable observable) -> {
//set this filter acttive af any of the subfilters are active. //set this filter acttive af any of the subfilters are active.
setSelected(getSubFilters().parallelStream().anyMatch(Filter::isSelected)); setSelected(getSubFilters().parallelStream().anyMatch(Filter::isSelected));
}); });
@ -83,10 +84,21 @@ public abstract class CompoundFilter<SubFilterType extends Filter> extends Abstr
return false; return false;
} }
for (int i = 0; i < oneFilter.getSubFilters().size(); i++) { for (int i = 0; i < oneFilter.getSubFilters().size(); i++) {
if (oneFilter.getSubFilters().get(i).equals(otherFilter.getSubFilters().get(i)) == false) { final SubFilterType subFilter = oneFilter.getSubFilters().get(i);
final SubFilterType otherSubFilter = otherFilter.getSubFilters().get(i);
if (subFilter.equals(otherSubFilter) == false
|| subFilter.isDisabled() != otherSubFilter.isDisabled()
|| subFilter.isSelected() != otherSubFilter.isSelected()) {
return false; return false;
} }
} }
return true; return true;
} }
@Override
public int hashCode() {
int hash = 3;
hash = 61 * hash + Objects.hashCode(this.subFilters);
return hash;
}
} }

View File

@ -84,6 +84,4 @@ public class DataSourceFilter extends AbstractFilter {
} }
return isSelected() == other.isSelected(); return isSelected() == other.isSelected();
} }
} }

View File

@ -1,26 +1,45 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Autopsy Forensic Browser
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * Copyright 2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.sleuthkit.autopsy.timeline.filters; package org.sleuthkit.autopsy.timeline.filters;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLOD; import java.util.Objects;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
public class DescriptionFilter extends AbstractFilter { public class DescriptionFilter extends AbstractFilter {
private final DescriptionLOD descriptionLoD; private final DescriptionLoD descriptionLoD;
private final String description; private final String description;
private final FilterMode filterMode;
public DescriptionFilter(DescriptionLOD descriptionLoD, String description) { public FilterMode getFilterMode() {
return filterMode;
}
public DescriptionFilter(DescriptionLoD descriptionLoD, String description, FilterMode filterMode) {
this.descriptionLoD = descriptionLoD; this.descriptionLoD = descriptionLoD;
this.description = description; this.description = description;
this.filterMode = filterMode;
} }
@Override @Override
public DescriptionFilter copyOf() { public DescriptionFilter copyOf() {
DescriptionFilter filterCopy = new DescriptionFilter(getDescriptionLoD(), getDescription()); DescriptionFilter filterCopy = new DescriptionFilter(getDescriptionLoD(), getDescription(), getFilterMode());
filterCopy.setSelected(isSelected()); filterCopy.setSelected(isSelected());
filterCopy.setDisabled(isDisabled()); filterCopy.setDisabled(isDisabled());
return filterCopy; return filterCopy;
@ -28,18 +47,18 @@ public class DescriptionFilter extends AbstractFilter {
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return "description"; return getDescriptionLoD().getDisplayName() + ": " + getDescription();
} }
@Override @Override
public String getHTMLReportString() { public String getHTMLReportString() {
return getDescriptionLoD().getDisplayName() + " " + getDisplayName() + " = " + getDescription(); return getDisplayName() + getStringCheckBox();
} }
/** /**
* @return the descriptionLoD * @return the descriptionLoD
*/ */
public DescriptionLOD getDescriptionLoD() { public DescriptionLoD getDescriptionLoD() {
return descriptionLoD; return descriptionLoD;
} }
@ -50,4 +69,49 @@ public class DescriptionFilter extends AbstractFilter {
return description; return description;
} }
public enum FilterMode {
EXCLUDE("Exclude"),
INCLUDE("Include");
private final String displayName;
private FilterMode(String displayName) {
this.displayName = displayName;
}
private String getDisplayName() {
return displayName;
}
}
@Override
public int hashCode() {
int hash = 7;
hash = 79 * hash + Objects.hashCode(this.descriptionLoD);
hash = 79 * hash + Objects.hashCode(this.description);
hash = 79 * hash + Objects.hashCode(this.filterMode);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DescriptionFilter other = (DescriptionFilter) obj;
if (this.descriptionLoD != other.descriptionLoD) {
return false;
}
if (!Objects.equals(this.description, other.description)) {
return false;
}
if (this.filterMode != other.filterMode) {
return false;
}
return true;
}
} }

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.timeline.filters; package org.sleuthkit.autopsy.timeline.filters;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -66,7 +67,7 @@ public interface Filter {
void setSelected(Boolean act); void setSelected(Boolean act);
SimpleBooleanProperty getSelectedProperty(); SimpleBooleanProperty selectedProperty();
/* /*
* TODO: disabled state only affects the state of the checkboxes in the ui * TODO: disabled state only affects the state of the checkboxes in the ui
@ -79,6 +80,8 @@ public interface Filter {
SimpleBooleanProperty getDisabledProperty(); SimpleBooleanProperty getDisabledProperty();
boolean isDisabled(); boolean isDisabled();
boolean isActive();
BooleanBinding activeProperty();
} }

View File

@ -33,7 +33,7 @@ public class HideKnownFilter extends AbstractFilter {
public HideKnownFilter() { public HideKnownFilter() {
super(); super();
getSelectedProperty().set(false); selectedProperty().set(false);
} }
@Override @Override

View File

@ -88,10 +88,4 @@ public class IntersectionFilter<S extends Filter> extends CompoundFilter<S> {
} }
return true; return true;
} }
@Override
public int hashCode() {
int hash = 7;
return hash;
}
} }

View File

@ -18,6 +18,8 @@
*/ */
package org.sleuthkit.autopsy.timeline.filters; package org.sleuthkit.autopsy.timeline.filters;
import java.util.Set;
import java.util.stream.Collectors;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
/** /**
@ -45,21 +47,46 @@ public class RootFilter extends IntersectionFilter<Filter> {
return hashFilter; return hashFilter;
} }
public RootFilter(HideKnownFilter knownFilter, TagsFilter tagsFilter, HashHitsFilter hashFilter, TextFilter textFilter, TypeFilter typeFilter, DataSourcesFilter dataSourceFilter) { public RootFilter(HideKnownFilter knownFilter, TagsFilter tagsFilter, HashHitsFilter hashFilter, TextFilter textFilter, TypeFilter typeFilter, DataSourcesFilter dataSourceFilter, Set<Filter> annonymousSubFilters) {
super(FXCollections.observableArrayList(knownFilter, tagsFilter, hashFilter, textFilter, dataSourceFilter, typeFilter)); super(FXCollections.observableArrayList(
setSelected(Boolean.TRUE); textFilter,
setDisabled(false); knownFilter,
dataSourceFilter, tagsFilter,
hashFilter,
typeFilter
));
this.knownFilter = knownFilter; this.knownFilter = knownFilter;
this.tagsFilter = tagsFilter; this.tagsFilter = tagsFilter;
this.hashFilter = hashFilter; this.hashFilter = hashFilter;
this.textFilter = textFilter; this.textFilter = textFilter;
this.typeFilter = typeFilter; this.typeFilter = typeFilter;
this.dataSourcesFilter = dataSourceFilter; this.dataSourcesFilter = dataSourceFilter;
getSubFilters().addAll(annonymousSubFilters);
setSelected(Boolean.TRUE);
setDisabled(false);
} }
@Override @Override
public RootFilter copyOf() { public RootFilter copyOf() {
RootFilter filter = new RootFilter(knownFilter.copyOf(), tagsFilter.copyOf(), hashFilter.copyOf(), textFilter.copyOf(), typeFilter.copyOf(), dataSourcesFilter.copyOf()); Set<Filter> annonymousSubFilters = getSubFilters().stream()
.filter(subFilter ->
!(subFilter.equals(knownFilter)
|| subFilter.equals(tagsFilter)
|| subFilter.equals(hashFilter)
|| subFilter.equals(typeFilter)
|| subFilter.equals(textFilter)
|| subFilter.equals(dataSourcesFilter)))
.map(Filter::copyOf)
.collect(Collectors.toSet());
RootFilter filter = new RootFilter(
knownFilter.copyOf(),
tagsFilter.copyOf(),
hashFilter.copyOf(),
textFilter.copyOf(),
typeFilter.copyOf(),
dataSourcesFilter.copyOf(),
annonymousSubFilters);
filter.setSelected(isSelected()); filter.setSelected(isSelected());
filter.setDisabled(isDisabled()); filter.setDisabled(isDisabled());
return filter; return filter;
@ -67,7 +94,7 @@ public class RootFilter extends IntersectionFilter<Filter> {
@Override @Override
public int hashCode() { public int hashCode() {
return 3; return super.hashCode();
} }
@Override @Override

View File

@ -33,4 +33,6 @@ abstract public class UnionFilter<SubFilterType extends Filter> extends Compound
public UnionFilter() { public UnionFilter() {
super(FXCollections.<SubFilterType>observableArrayList()); super(FXCollections.<SubFilterType>observableArrayList());
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

View File

@ -0,0 +1,80 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.timeline.ui;
import java.util.function.Supplier;
import javafx.scene.control.IndexedCell;
import javafx.scene.control.ListCell;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TreeTableCell;
import javafx.scene.control.TreeTableColumn;
/**
* an abstract base class for Cell factories. This class provides the basic
* infrustructure for implementations to be able to create similar cells for
* listview, tableviews or treetableviews via the appropriate method call.
* Implementations need only implement the abstract configureCell method in the
* same spirit as IndexedCell.updateItem
*/
public abstract class AbstractFXCellFactory<X, Y> {
public TreeTableCell< X, Y> forTreeTable(TreeTableColumn< X, Y> column) {
return new AbstractTreeTableCell();
}
public TableCell<X, Y> forTable(TableColumn<X, Y> column) {
return new AbstractTableCell();
}
public ListCell< Y> forList() {
return new AbstractListCell();
}
protected abstract void configureCell(IndexedCell<? extends Y> cell, Y item, boolean empty, Supplier<X> supplier);
private class AbstractTableCell extends TableCell<X, Y> {
@Override
@SuppressWarnings({"unchecked"}) //we know it will be X but there is a flaw in getTableRow return type
protected void updateItem(Y item, boolean empty) {
super.updateItem(item, empty);
configureCell(this, item, empty, (() -> (X) this.getTableRow().getItem()));
}
}
private class AbstractTreeTableCell extends TreeTableCell<X, Y> {
@Override
protected void updateItem(Y item, boolean empty) {
super.updateItem(item, empty);
configureCell(this, item, empty, (() -> this.getTreeTableRow().getItem()));
}
}
private class AbstractListCell extends ListCell< Y> {
@Override
@SuppressWarnings("unchecked") //for a list X should always equal Y
protected void updateItem(Y item, boolean empty) {
super.updateItem(item, empty);
configureCell(this, item, empty, () -> (X) this.getItem());
}
}
}

View File

@ -304,7 +304,7 @@ public abstract class AbstractVisualization<X, Y, N, C extends XYChart<X, Y> & T
//x-positions (pixels) of the current branch and leaf labels //x-positions (pixels) of the current branch and leaf labels
double leafLabelX = 0; double leafLabelX = 0;
if (dateTime.branch.equals("")) { if (dateTime.branch.isEmpty()) {
//if there is only one part to the date (ie only year), just add a label for each tick //if there is only one part to the date (ie only year), just add a label for each tick
for (Axis.TickMark<X> t : tickMarks) { for (Axis.TickMark<X> t : tickMarks) {
assignLeafLabel(new TwoPartDateTime(getTickMarkLabel(t.getValue())).leaf, assignLeafLabel(new TwoPartDateTime(getTickMarkLabel(t.getValue())).leaf,

View File

@ -315,14 +315,14 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
public synchronized void setController(TimeLineController controller) { public synchronized void setController(TimeLineController controller) {
this.controller = controller; this.controller = controller;
setModel(controller.getEventsModel()); setModel(controller.getEventsModel());
setViewMode(controller.getViewMode().get()); setViewMode(controller.viewModeProperty().get());
controller.getNeedsHistogramRebuild().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { controller.getNeedsHistogramRebuild().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
if (newValue) { if (newValue) {
refreshHistorgram(); refreshHistorgram();
} }
}); });
controller.getViewMode().addListener((ObservableValue<? extends VisualizationMode> ov, VisualizationMode t, VisualizationMode t1) -> { controller.viewModeProperty().addListener((ObservableValue<? extends VisualizationMode> ov, VisualizationMode t, VisualizationMode t1) -> {
setViewMode(t1); setViewMode(t1);
}); });
TimeLineController.getTimeZone().addListener(timeRangeInvalidationListener); TimeLineController.getTimeZone().addListener(timeRangeInvalidationListener);
@ -361,7 +361,7 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
} }
} }
private synchronized void setVisualization(final AbstractVisualization<?, ?, ?, ?> newViz) { private synchronized void setVisualization(final AbstractVisualization<?, ?, ?, ?> newViz) {
Platform.runLater(() -> { Platform.runLater(() -> {
synchronized (VisualizationPanel.this) { synchronized (VisualizationPanel.this) {
if (visualization != null) { if (visualization != null) {
@ -375,7 +375,7 @@ public class VisualizationPanel extends BorderPane implements TimeLineView {
visualization.setController(controller); visualization.setController(controller);
notificationPane.setContent(visualization); notificationPane.setContent(visualization);
if (visualization instanceof DetailViewPane) { if (visualization instanceof DetailViewPane) {
navPanel.setChart((DetailViewPane) visualization); navPanel.setDetailViewPane((DetailViewPane) visualization);
} }
visualization.hasEvents.addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { visualization.hasEvents.addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
if (newValue == false) { if (newValue == false) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2014 Basis Technology Corp. * Copyright 2014-15 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");
@ -18,10 +18,9 @@
*/ */
package org.sleuthkit.autopsy.timeline.ui.detailview; package org.sleuthkit.autopsy.timeline.ui.detailview;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.ResourceBundle;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.InvalidationListener; import javafx.beans.InvalidationListener;
@ -62,6 +61,7 @@ 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 javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import org.controlsfx.control.action.Action;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.LoggedTask; import org.sleuthkit.autopsy.coreutils.LoggedTask;
@ -69,41 +69,31 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.timeline.FXMLConstructor; import org.sleuthkit.autopsy.timeline.FXMLConstructor;
import org.sleuthkit.autopsy.timeline.TimeLineController; import org.sleuthkit.autopsy.timeline.TimeLineController;
import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster; import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel; import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.ui.AbstractVisualization; import org.sleuthkit.autopsy.timeline.ui.AbstractVisualization;
import org.sleuthkit.autopsy.timeline.ui.countsview.CountsViewPane;
import org.sleuthkit.autopsy.timeline.ui.detailview.tree.NavTreeNode;
import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo; import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo;
import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
/** /**
* FXML Controller class for a {@link EventDetailChart} based implementation of * Controller class for a {@link EventDetailChart} based implementation of a
* a TimeLineView. * TimeLineView.
* *
* This class listens to changes in the assigned {@link FilteredEventsModel} and * This class listens to changes in the assigned {@link FilteredEventsModel} and
* updates the internal {@link EventDetailChart} to reflect the currently * updates the internal {@link EventDetailChart} to reflect the currently
* requested events. * requested events.
* *
* This class captures input from the user in the form of mouse clicks on graph
* bars, and forwards them to the assigned {@link TimeLineController}
*
* Concurrency Policy: Access to the private members clusterChart, dateAxis, * Concurrency Policy: Access to the private members clusterChart, dateAxis,
* EventTypeMap, and dataSets is all linked directly to the ClusterChart which * EventTypeMap, and dataSets is all linked directly to the ClusterChart which
* must only be manipulated on the JavaFx thread (through {@link Platform#runLater(java.lang.Runnable) * must only be manipulated on the JavaFx thread.
* }
*
* {@link CountsChartPane#filteredEvents} should encapsulate all needed
* synchronization internally.
*
* TODO: refactor common code out of this class and CountsChartPane into
* {@link AbstractVisualization}
*/ */
public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster, EventStripeNode, EventDetailChart> { public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster, EventStripeNode, EventDetailChart> {
private final static Logger LOGGER = Logger.getLogger(CountsViewPane.class.getName()); private final static Logger LOGGER = Logger.getLogger(DetailViewPane.class.getName());
private MultipleSelectionModel<TreeItem<NavTreeNode>> treeSelectionModel; private MultipleSelectionModel<TreeItem<EventBundle>> treeSelectionModel;
//these three could be injected from fxml but it was causing npe's //these three could be injected from fxml but it was causing npe's
private final DateAxis dateAxis = new DateAxis(); private final DateAxis dateAxis = new DateAxis();
@ -117,12 +107,10 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
private final Region region = new Region(); private final Region region = new Region();
private final ObservableList<EventCluster> aggregatedEvents = FXCollections.synchronizedObservableList(FXCollections.observableArrayList());
private final ObservableList<EventStripeNode> highlightedNodes = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); private final ObservableList<EventStripeNode> highlightedNodes = FXCollections.synchronizedObservableList(FXCollections.observableArrayList());
public ObservableList<EventCluster> getAggregatedEvents() { public ObservableList<EventBundle> getEventBundles() {
return aggregatedEvents; return chart.getEventBundles();
} }
public DetailViewPane(Pane partPane, Pane contextPane, Region spacer) { public DetailViewPane(Pane partPane, Pane contextPane, Region spacer) {
@ -149,6 +137,7 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
requestLayout(); requestLayout();
highlightedNodes.addListener((ListChangeListener.Change<? extends EventStripeNode> change) -> { highlightedNodes.addListener((ListChangeListener.Change<? extends EventStripeNode> change) -> {
while (change.next()) { while (change.next()) {
change.getAddedSubList().forEach(node -> { change.getAddedSubList().forEach(node -> {
node.applyHighlightEffect(true); node.applyHighlightEffect(true);
@ -211,6 +200,7 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
selectedNodes.addListener((Observable observable) -> { selectedNodes.addListener((Observable observable) -> {
highlightedNodes.clear(); highlightedNodes.clear();
selectedNodes.stream().forEach((tn) -> { selectedNodes.stream().forEach((tn) -> {
for (EventStripeNode n : chart.getNodes((EventStripeNode t) -> for (EventStripeNode n : chart.getNodes((EventStripeNode t) ->
t.getDescription().equals(tn.getDescription()))) { t.getDescription().equals(tn.getDescription()))) {
highlightedNodes.add(n); highlightedNodes.add(n);
@ -229,12 +219,13 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
vertScrollBar.valueProperty().set(Math.max(0, Math.min(100, vertScrollBar.getValue() + factor * (chart.getHeight() / chart.maxVScrollProperty().get())))); vertScrollBar.valueProperty().set(Math.max(0, Math.min(100, vertScrollBar.getValue() + factor * (chart.getHeight() / chart.maxVScrollProperty().get()))));
} }
public void setSelectionModel(MultipleSelectionModel<TreeItem<NavTreeNode>> selectionModel) { public void setSelectionModel(MultipleSelectionModel<TreeItem<EventBundle>> selectionModel) {
this.treeSelectionModel = selectionModel; this.treeSelectionModel = selectionModel;
treeSelectionModel.getSelectedItems().addListener((Observable observable) -> { treeSelectionModel.getSelectedItems().addListener((Observable observable) -> {
highlightedNodes.clear(); highlightedNodes.clear();
for (TreeItem<NavTreeNode> tn : treeSelectionModel.getSelectedItems()) { for (TreeItem<EventBundle> tn : treeSelectionModel.getSelectedItems()) {
for (EventStripeNode n : chart.getNodes((EventStripeNode t) -> for (EventStripeNode n : chart.getNodes((EventStripeNode t) ->
t.getDescription().equals(tn.getValue().getDescription()))) { t.getDescription().equals(tn.getValue().getDescription()))) {
highlightedNodes.add(n); highlightedNodes.add(n);
@ -297,11 +288,12 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
if (isCancelled()) { if (isCancelled()) {
return null; return null;
} }
Platform.runLater(() -> {
if (isCancelled() == false) { if (isCancelled() == false) {
Platform.runLater(() -> {
setCursor(Cursor.WAIT); setCursor(Cursor.WAIT);
} });
}); }
updateProgress(-1, 1); updateProgress(-1, 1);
updateMessage(NbBundle.getMessage(this.getClass(), "DetailViewPane.loggedTask.preparing")); updateMessage(NbBundle.getMessage(this.getClass(), "DetailViewPane.loggedTask.preparing"));
@ -311,7 +303,6 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
final long upperBound = rangeInfo.getUpperBound(); final long upperBound = rangeInfo.getUpperBound();
updateMessage(NbBundle.getMessage(this.getClass(), "DetailViewPane.loggedTask.queryDb")); updateMessage(NbBundle.getMessage(this.getClass(), "DetailViewPane.loggedTask.queryDb"));
aggregatedEvents.setAll(filteredEvents.getAggregatedEvents());
Platform.runLater(() -> { Platform.runLater(() -> {
if (isCancelled()) { if (isCancelled()) {
@ -323,21 +314,24 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
eventTypeToSeriesMap.clear(); eventTypeToSeriesMap.clear();
dataSets.clear(); dataSets.clear();
}); });
final int size = aggregatedEvents.size();
int i = 0; List<EventCluster> eventClusters = filteredEvents.getEventClusters();
for (final EventCluster e : aggregatedEvents) {
final int size = eventClusters.size();
for (int i = 0; i < size; i++) {
if (isCancelled()) { if (isCancelled()) {
break; break;
} }
updateProgress(i++, size); final EventCluster cluster = eventClusters.get(i);
updateProgress(i, size);
updateMessage(NbBundle.getMessage(this.getClass(), "DetailViewPane.loggedTask.updateUI")); updateMessage(NbBundle.getMessage(this.getClass(), "DetailViewPane.loggedTask.updateUI"));
final XYChart.Data<DateTime, EventCluster> xyData = new BarChart.Data<>(new DateTime(e.getSpan().getStartMillis()), e); final XYChart.Data<DateTime, EventCluster> xyData = new BarChart.Data<>(new DateTime(cluster.getSpan().getStartMillis()), cluster);
Platform.runLater(() -> { if (isCancelled() == false) {
if (isCancelled() == false) { Platform.runLater(() -> {
getSeries(e.getEventType()).getData().add(xyData); getSeries(cluster.getEventType()).getData().add(xyData);
} });
}); }
} }
Platform.runLater(() -> { Platform.runLater(() -> {
@ -345,12 +339,13 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
layoutDateLabels(); layoutDateLabels();
updateProgress(1, 1); updateProgress(1, 1);
}); });
return aggregatedEvents.isEmpty() == false; return eventClusters.isEmpty() == false;
} }
}; };
} }
@Override @Override
protected Effect getSelectionEffect() { protected Effect getSelectionEffect() {
return null; return null;
} }
@ -374,12 +369,6 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
@FXML @FXML
private RadioButton countsRadio; private RadioButton countsRadio;
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML @FXML
private CheckBox bandByTypeBox; private CheckBox bandByTypeBox;
@ -432,7 +421,6 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
assert oneEventPerRowBox != null : "fx:id=\"oneEventPerRowBox\" was not injected: check your FXML file 'DetailViewSettings.fxml'."; // NON-NLS assert oneEventPerRowBox != null : "fx:id=\"oneEventPerRowBox\" was not injected: check your FXML file 'DetailViewSettings.fxml'."; // NON-NLS
assert truncateAllBox != null : "fx:id=\"truncateAllBox\" was not injected: check your FXML file 'DetailViewSettings.fxml'."; // NON-NLS assert truncateAllBox != null : "fx:id=\"truncateAllBox\" was not injected: check your FXML file 'DetailViewSettings.fxml'."; // NON-NLS
assert truncateWidthSlider != null : "fx:id=\"truncateAllSlider\" was not injected: check your FXML file 'DetailViewSettings.fxml'."; // NON-NLS assert truncateWidthSlider != null : "fx:id=\"truncateAllSlider\" was not injected: check your FXML file 'DetailViewSettings.fxml'."; // NON-NLS
bandByTypeBox.selectedProperty().bindBidirectional(chart.bandByTypeProperty()); bandByTypeBox.selectedProperty().bindBidirectional(chart.bandByTypeProperty());
truncateAllBox.selectedProperty().bindBidirectional(chart.truncateAllProperty()); truncateAllBox.selectedProperty().bindBidirectional(chart.truncateAllProperty());
oneEventPerRowBox.selectedProperty().bindBidirectional(chart.oneEventPerRowProperty()); oneEventPerRowBox.selectedProperty().bindBidirectional(chart.oneEventPerRowProperty());
@ -479,4 +467,12 @@ public class DetailViewPane extends AbstractVisualization<DateTime, EventCluster
hiddenRadio.setText(NbBundle.getMessage(this.getClass(), "DetailViewPane.hiddenRadio.text")); hiddenRadio.setText(NbBundle.getMessage(this.getClass(), "DetailViewPane.hiddenRadio.text"));
} }
} }
public Action newUnhideDescriptionAction(String description, DescriptionLoD descriptionLoD) {
return chart.new UnhideDescriptionAction(description, descriptionLoD);
}
public Action newHideDescriptionAction(String description, DescriptionLoD descriptionLoD) {
return chart.new HideDescriptionAction(description, descriptionLoD);
}
} }

View File

@ -6,76 +6,81 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<fx:root alignment="CENTER_LEFT" spacing="5.0" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <fx:root alignment="CENTER_LEFT" spacing="5.0" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children> <children>
<MenuButton fx:id="advancedLayoutOptionsButtonLabel" mnemonicParsing="false"> <MenuButton fx:id="advancedLayoutOptionsButtonLabel" mnemonicParsing="false">
<items> <items>
<CustomMenuItem fx:id="bandByTypeBoxMenuItem" hideOnClick="false" mnemonicParsing="false"> <CustomMenuItem fx:id="bandByTypeBoxMenuItem" hideOnClick="false" mnemonicParsing="false">
<content> <content>
<CheckBox fx:id="bandByTypeBox" mnemonicParsing="false"> <CheckBox fx:id="bandByTypeBox" mnemonicParsing="false">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding></CheckBox> </padding>
</content> </CheckBox>
</CustomMenuItem> </content>
<CustomMenuItem fx:id="oneEventPerRowBoxMenuItem" hideOnClick="false" mnemonicParsing="false"> </CustomMenuItem>
<content> <CustomMenuItem fx:id="oneEventPerRowBoxMenuItem" hideOnClick="false" mnemonicParsing="false">
<CheckBox fx:id="oneEventPerRowBox" mnemonicParsing="false"> <content>
<padding> <CheckBox fx:id="oneEventPerRowBox" mnemonicParsing="false">
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <padding>
</padding></CheckBox> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</content> </padding>
</CustomMenuItem> </CheckBox>
<SeparatorMenuItem mnemonicParsing="false" /> </content>
<CustomMenuItem fx:id="truncateAllBoxMenuItem" hideOnClick="false" mnemonicParsing="false"> </CustomMenuItem>
<content> <SeparatorMenuItem mnemonicParsing="false" />
<CheckBox fx:id="truncateAllBox" mnemonicParsing="false"> <CustomMenuItem fx:id="truncateAllBoxMenuItem" hideOnClick="false" mnemonicParsing="false">
<padding> <content>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <CheckBox fx:id="truncateAllBox" mnemonicParsing="false">
</padding></CheckBox> <padding>
</content> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</CustomMenuItem> </padding>
<CustomMenuItem fx:id="truncateSliderLabelMenuItem" hideOnClick="false" mnemonicParsing="false"> </CheckBox>
<content> </content>
<Label fx:id="truncateSliderLabel" contentDisplay="BOTTOM"> </CustomMenuItem>
<graphic> <CustomMenuItem fx:id="truncateSliderLabelMenuItem" hideOnClick="false" mnemonicParsing="false">
<Slider id="truncateAllSlider" fx:id="truncateWidthSlider" blockIncrement="50.0" disable="false" majorTickUnit="150.0" max="500.0" min="50.0" minorTickCount="0" prefHeight="33.0" prefWidth="150.0" showTickLabels="true" showTickMarks="false" value="200.0" /> <content>
</graphic> <Label fx:id="truncateSliderLabel" contentDisplay="BOTTOM">
</Label> <graphic>
</content> <Slider id="truncateAllSlider" fx:id="truncateWidthSlider" blockIncrement="50.0" disable="false" majorTickUnit="150.0" max="500.0" min="50.0" minorTickCount="0" prefHeight="33.0" prefWidth="150.0" showTickLabels="true" showTickMarks="false" value="200.0" />
</CustomMenuItem> </graphic>
<SeparatorMenuItem fx:id="descVisibilitySeparatorMenuItem" mnemonicParsing="false" /> </Label>
<CustomMenuItem fx:id="showRadioMenuItem" hideOnClick="false" mnemonicParsing="false"> </content>
<content> </CustomMenuItem>
<RadioButton fx:id="showRadio" mnemonicParsing="false" selected="true"> <SeparatorMenuItem fx:id="descVisibilitySeparatorMenuItem" mnemonicParsing="false" />
<toggleGroup> <CustomMenuItem fx:id="showRadioMenuItem" hideOnClick="false" mnemonicParsing="false">
<ToggleGroup fx:id="descrVisibility" /> <content>
</toggleGroup> <RadioButton fx:id="showRadio" mnemonicParsing="false" selected="true">
<padding> <toggleGroup>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <ToggleGroup fx:id="descrVisibility" />
</padding> </toggleGroup>
</RadioButton> <padding>
</content> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</CustomMenuItem> </padding>
<CustomMenuItem fx:id="countsRadioMenuItem" hideOnClick="false" mnemonicParsing="false"> </RadioButton>
<content> </content>
<RadioButton fx:id="countsRadio" mnemonicParsing="false" toggleGroup="$descrVisibility"> </CustomMenuItem>
<padding> <CustomMenuItem fx:id="countsRadioMenuItem" hideOnClick="false" mnemonicParsing="false">
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <content>
</padding></RadioButton> <RadioButton fx:id="countsRadio" mnemonicParsing="false" toggleGroup="$descrVisibility">
</content> <padding>
</CustomMenuItem> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
<CustomMenuItem fx:id="hiddenRadioMenuItem" hideOnClick="false" mnemonicParsing="false"> </padding>
<content> </RadioButton>
<RadioButton fx:id="hiddenRadio" mnemonicParsing="false" toggleGroup="$descrVisibility"> </content>
<padding> </CustomMenuItem>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <CustomMenuItem fx:id="hiddenRadioMenuItem" hideOnClick="false" mnemonicParsing="false">
</padding></RadioButton> <content>
</content> <RadioButton fx:id="hiddenRadio" mnemonicParsing="false" toggleGroup="$descrVisibility">
</CustomMenuItem> <padding>
</items> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</MenuButton> </padding>
</children> </RadioButton>
<padding> </content>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> </CustomMenuItem>
</padding> </items>
</MenuButton>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</fx:root> </fx:root>

View File

@ -29,6 +29,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -37,6 +38,7 @@ import javafx.animation.KeyValue;
import javafx.animation.Timeline; import javafx.animation.Timeline;
import javafx.beans.InvalidationListener; import javafx.beans.InvalidationListener;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.beans.property.Property;
import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.beans.property.ReadOnlyDoubleProperty;
import javafx.beans.property.ReadOnlyDoubleWrapper; import javafx.beans.property.ReadOnlyDoubleWrapper;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
@ -45,6 +47,7 @@ import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.scene.Cursor; import javafx.scene.Cursor;
@ -71,13 +74,15 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.timeline.TimeLineController; import org.sleuthkit.autopsy.timeline.TimeLineController;
import org.sleuthkit.autopsy.timeline.actions.Back; import org.sleuthkit.autopsy.timeline.actions.Back;
import org.sleuthkit.autopsy.timeline.actions.Forward; import org.sleuthkit.autopsy.timeline.actions.Forward;
import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster; import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
import org.sleuthkit.autopsy.timeline.datamodel.EventStripe; import org.sleuthkit.autopsy.timeline.datamodel.EventStripe;
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel; import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.filters.AbstractFilter;
import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter;
import org.sleuthkit.autopsy.timeline.ui.TimeLineChart; import org.sleuthkit.autopsy.timeline.ui.TimeLineChart;
import static org.sleuthkit.autopsy.timeline.ui.detailview.Bundle.EventDetailChart_chartContextMenu_placeMarker_name; import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
import static org.sleuthkit.autopsy.timeline.ui.detailview.Bundle.EventDetailChart_contextMenu_zoomHistory_name;
/** /**
* Custom implementation of {@link XYChart} to graph events on a horizontal * Custom implementation of {@link XYChart} to graph events on a horizontal
@ -95,6 +100,8 @@ import static org.sleuthkit.autopsy.timeline.ui.detailview.Bundle.EventDetailCha
*/ */
public final class EventDetailChart extends XYChart<DateTime, EventCluster> implements TimeLineChart<DateTime> { public final class EventDetailChart extends XYChart<DateTime, EventCluster> implements TimeLineChart<DateTime> {
static final Image HIDE = new Image("/org/sleuthkit/autopsy/timeline/images/eye--minus.png"); // NON-NLS
static final Image SHOW = new Image("/org/sleuthkit/autopsy/timeline/images/eye--plus.png"); // NON-NLS
private static final Image MARKER = new Image("/org/sleuthkit/autopsy/timeline/images/marker.png", 16, 16, true, true, true); private static final Image MARKER = new Image("/org/sleuthkit/autopsy/timeline/images/marker.png", 16, 16, true, true, true);
private static final int PROJECTED_LINE_Y_OFFSET = 5; private static final int PROJECTED_LINE_Y_OFFSET = 5;
private static final int PROJECTED_LINE_STROKE_WIDTH = 5; private static final int PROJECTED_LINE_STROKE_WIDTH = 5;
@ -144,16 +151,18 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
* by allowing a single translation of this group. * by allowing a single translation of this group.
*/ */
private final Group nodeGroup = new Group(); private final Group nodeGroup = new Group();
private final ObservableList<EventBundle> bundles = FXCollections.observableArrayList();
private final Map<ImmutablePair<EventType, String>, EventStripe> stripeDescMap = new HashMap<>(); private final Map<ImmutablePair<EventType, String>, EventStripe> stripeDescMap = new HashMap<>();
private final Map<EventStripe, EventStripeNode> stripeNodeMap = new HashMap<>(); private final Map<EventStripe, EventStripeNode> stripeNodeMap = new HashMap<>();
private final Map<Range<Long>, Line> projectionMap = new HashMap<>(); private final Map<Range<Long>, Line> projectionMap = new HashMap<>();
/** /**
* list of series of data added to this chart TODO: replace this with a map * list of series of data added to this chart
* from name to series? -jm *
* TODO: replace this with a map from name to series? -jm
*/ */
private final ObservableList<Series<DateTime, EventCluster>> seriesList private final ObservableList<Series<DateTime, EventCluster>> seriesList =
= FXCollections.<Series<DateTime, EventCluster>>observableArrayList(); FXCollections.<Series<DateTime, EventCluster>>observableArrayList();
private final ObservableList<Series<DateTime, EventCluster>> sortedSeriesList = seriesList private final ObservableList<Series<DateTime, EventCluster>> sortedSeriesList = seriesList
.sorted((s1, s2) -> { .sorted((s1, s2) -> {
@ -175,8 +184,8 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
/** /**
* how much detail of the description to show in the ui * how much detail of the description to show in the ui
*/ */
private final SimpleObjectProperty<DescriptionVisibility> descrVisibility private final SimpleObjectProperty<DescriptionVisibility> descrVisibility =
= new SimpleObjectProperty<>(DescriptionVisibility.SHOWN); new SimpleObjectProperty<>(DescriptionVisibility.SHOWN);
/** /**
* true == truncate all the labels to the greater of the size of their * true == truncate all the labels to the greater of the size of their
@ -191,12 +200,14 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
* via slider if truncateAll is true * via slider if truncateAll is true
*/ */
private final SimpleDoubleProperty truncateWidth = new SimpleDoubleProperty(200.0); private final SimpleDoubleProperty truncateWidth = new SimpleDoubleProperty(200.0);
private final SimpleBooleanProperty alternateLayout = new SimpleBooleanProperty(true);
EventDetailChart(DateAxis dateAxis, final Axis<EventCluster> verticalAxis, ObservableList<EventStripeNode> selectedNodes) { EventDetailChart(DateAxis dateAxis, final Axis<EventCluster> verticalAxis, ObservableList<EventStripeNode> selectedNodes) {
super(dateAxis, verticalAxis); super(dateAxis, verticalAxis);
dateAxis.setAutoRanging(false); dateAxis.setAutoRanging(false);
verticalAxis.setVisible(false);//TODO: why doesn't this hide the vertical axis, instead we have to turn off all parts individually? -jm verticalAxis.setVisible(false);//TODO: why doesn't this hide the vertical axis, instead we have to turn off all parts individually? -jm
verticalAxis.setTickLabelsVisible(false); verticalAxis.setTickLabelsVisible(false);
verticalAxis.setTickMarkVisible(false); verticalAxis.setTickMarkVisible(false);
@ -248,6 +259,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
while (c.next()) { while (c.next()) {
c.getRemoved().forEach((EventStripeNode t) -> { c.getRemoved().forEach((EventStripeNode t) -> {
t.getEventStripe().getRanges().forEach((Range<Long> t1) -> { t.getEventStripe().getRanges().forEach((Range<Long> t1) -> {
Line removedLine = projectionMap.remove(t1); Line removedLine = projectionMap.remove(t1);
getChartChildren().removeAll(removedLine); getChartChildren().removeAll(removedLine);
}); });
@ -277,6 +289,10 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
requestChartLayout(); requestChartLayout();
} }
ObservableList<EventBundle> getEventBundles() {
return bundles;
}
TimeLineController getController() { TimeLineController getController() {
return controller; return controller;
} }
@ -287,8 +303,9 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
if (chartContextMenu != null) { if (chartContextMenu != null) {
chartContextMenu.hide(); chartContextMenu.hide();
} }
chartContextMenu = ActionUtils.createContextMenu(Arrays.asList(new PlaceMarkerAction(clickEvent), chartContextMenu = ActionUtils.createContextMenu(Arrays.asList(new PlaceMarkerAction(clickEvent),
new ActionGroup(EventDetailChart_contextMenu_zoomHistory_name(), new ActionGroup(Bundle.EventDetailChart_contextMenu_zoomHistory_name(),
new Back(controller), new Back(controller),
new Forward(controller)))); new Forward(controller))));
chartContextMenu.setAutoHide(true); chartContextMenu.setAutoHide(true);
@ -309,6 +326,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
public synchronized void setController(TimeLineController controller) { public synchronized void setController(TimeLineController controller) {
this.controller = controller; this.controller = controller;
setModel(this.controller.getEventsModel()); setModel(this.controller.getEventsModel());
getController().getQuickHideFilters().addListener(layoutInvalidationListener);
} }
@Override @Override
@ -380,7 +398,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
@Override @Override
protected synchronized void dataItemAdded(Series<DateTime, EventCluster> series, int i, Data<DateTime, EventCluster> data) { protected synchronized void dataItemAdded(Series<DateTime, EventCluster> series, int i, Data<DateTime, EventCluster> data) {
final EventCluster eventCluster = data.getYValue(); final EventCluster eventCluster = data.getYValue();
bundles.add(eventCluster);
EventStripe eventStripe = stripeDescMap.merge(ImmutablePair.of(eventCluster.getEventType(), eventCluster.getDescription()), EventStripe eventStripe = stripeDescMap.merge(ImmutablePair.of(eventCluster.getEventType(), eventCluster.getDescription()),
new EventStripe(eventCluster), new EventStripe(eventCluster),
(EventStripe u, EventStripe v) -> { (EventStripe u, EventStripe v) -> {
@ -395,6 +413,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
stripeNodeMap.put(eventStripe, stripeNode); stripeNodeMap.put(eventStripe, stripeNode);
nodeGroup.getChildren().add(stripeNode); nodeGroup.getChildren().add(stripeNode);
data.setNode(stripeNode); data.setNode(stripeNode);
} }
@Override @Override
@ -406,10 +425,11 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
@Override @Override
protected synchronized void dataItemRemoved(Data<DateTime, EventCluster> data, Series<DateTime, EventCluster> series) { protected synchronized void dataItemRemoved(Data<DateTime, EventCluster> data, Series<DateTime, EventCluster> series) {
EventCluster eventCluster = data.getYValue(); EventCluster eventCluster = data.getYValue();
bundles.removeAll(eventCluster);
EventStripe removedStripe = stripeDescMap.remove(ImmutablePair.of(eventCluster.getEventType(), eventCluster.getDescription())); EventStripe removedStripe = stripeDescMap.remove(ImmutablePair.of(eventCluster.getEventType(), eventCluster.getDescription()));
EventStripeNode removedNode = stripeNodeMap.remove(removedStripe); EventStripeNode removedNode = stripeNodeMap.remove(removedStripe);
nodeGroup.getChildren().remove(removedNode); nodeGroup.getChildren().remove(removedNode);
data.setNode(null); data.setNode(null);
} }
@ -448,29 +468,29 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
*/ */
@Override @Override
protected synchronized void layoutPlotChildren() { protected synchronized void layoutPlotChildren() {
if (requiresLayout) { if (requiresLayout) {
setCursor(Cursor.WAIT); setCursor(Cursor.WAIT);
double minY = 0;
maxY.set(0.0); maxY.set(0.0);
if (bandByType.get() == false) { Map<Boolean, List<EventStripeNode>> hiddenPartition;
List<EventStripeNode> nodes = new ArrayList<>(stripeNodeMap.values()); if (bandByType.get()) {
nodes.sort(Comparator.comparing(EventStripeNode::getStartMillis)); double minY = 0;
layoutNodes(nodes, minY, 0); for (Series<DateTime, EventCluster> series : sortedSeriesList) {
} else { hiddenPartition = series.getData().stream().map(Data::getNode).map(EventStripeNode.class::cast)
for (Series<DateTime, EventCluster> s : sortedSeriesList) { .collect(Collectors.partitioningBy(node -> getController().getQuickHideFilters().stream()
List<EventStripeNode> nodes = s.getData().stream() .filter(AbstractFilter::isActive)
.map(Data::getYValue) .anyMatch(filter -> filter.getDescription().equals(node.getDescription()))));
.map(cluster -> stripeDescMap.get(ImmutablePair.of(cluster.getEventType(), cluster.getDescription())))
.distinct() layoutNodesHelper(hiddenPartition.get(true), hiddenPartition.get(false), minY, 0);
.sorted(Comparator.comparing(EventStripe::getStartMillis))
.map(stripeNodeMap::get)
.collect(Collectors.toList());
layoutNodes(nodes, minY, 0);
minY = maxY.get(); minY = maxY.get();
} }
} else {
hiddenPartition = stripeNodeMap.values().stream()
.collect(Collectors.partitioningBy(node -> getController().getQuickHideFilters().stream()
.filter(AbstractFilter::isActive)
.anyMatch(filter -> filter.getDescription().equals(node.getDescription()))));
layoutNodesHelper(hiddenPartition.get(true), hiddenPartition.get(false), 0, 0);
} }
setCursor(null); setCursor(null);
requiresLayout = false; requiresLayout = false;
@ -478,6 +498,36 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
layoutProjectionMap(); layoutProjectionMap();
} }
/**
*
* @param hiddenNodes the value of hiddenNodes
* @param shownNodes the value of shownNodes
* @param minY the value of minY
* @param children the value of children
* @param xOffset the value of xOffset
*
* @return the double
*/
private double layoutNodesHelper(List<EventStripeNode> hiddenNodes, List<EventStripeNode> shownNodes, double minY, final double xOffset) {
hiddenNodes.forEach((EventStripeNode t) -> {
// children.remove(t);
t.setVisible(false);
t.setManaged(false);
});
shownNodes.forEach((EventStripeNode t) -> {
// if (false == children.contains(t)) {
// children.add(t);
// }
t.setVisible(true);
t.setManaged(true);
});
shownNodes.sort(Comparator.comparing(EventStripeNode::getStartMillis));
return layoutNodes(shownNodes, minY, xOffset);
}
@Override @Override
protected synchronized void seriesAdded(Series<DateTime, EventCluster> series, int i) { protected synchronized void seriesAdded(Series<DateTime, EventCluster> series, int i) {
for (int j = 0; j < series.getData().size(); j++) { for (int j = 0; j < series.getData().size(); j++) {
@ -501,17 +551,19 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
} }
Iterable<EventStripeNode> getNodes(Predicate<EventStripeNode> p) { Iterable<EventStripeNode> getNodes(Predicate<EventStripeNode> p) {
Collection<EventStripeNode> values = stripeNodeMap.values(); Function<EventStripeNode, Stream<EventStripeNode>> flattener =
//collapse tree of DetailViewNoeds to list and then filter on given predicate new Function<EventStripeNode, Stream<EventStripeNode>>() {
return values.stream() @Override
.flatMap(EventDetailChart::flatten) public Stream<EventStripeNode> apply(EventStripeNode node) {
.filter(p).collect(Collectors.toList()); return Stream.concat(
} Stream.of(node),
node.getSubNodes().stream().flatMap(this::apply));
}
};
private static Stream<EventStripeNode> flatten(EventStripeNode node) { return stripeNodeMap.values().stream()
return Stream.concat( .flatMap(flattener)
Stream.of(node), .filter(p).collect(Collectors.toList());
node.getSubNodes().stream().flatMap(EventDetailChart::flatten));
} }
Iterable<EventStripeNode> getAllNodes() { Iterable<EventStripeNode> getAllNodes() {
@ -535,31 +587,37 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
* @param nodes * @param nodes
* @param minY * @param minY
*/ */
private synchronized double layoutNodes(final Collection< EventStripeNode> nodes, final double minY, final double xOffset private synchronized double layoutNodes(final Collection< EventStripeNode> nodes, final double minY, final double xOffset) {
) {
//hash map from y value to right most occupied x value. This tells you for a given 'row' what is the first avaialable slot //hash map from y value to right most occupied x value. This tells you for a given 'row' what is the first avaialable slot
Map<Integer, Double> maxXatY = new HashMap<>(); Map<Integer, Double> maxXatY = new HashMap<>();
double localMax = minY; double localMax = minY;
//for each node lay size it and position it in first available slot //for each node lay size it and position it in first available slot
for (EventStripeNode node : nodes) {
node.setDescriptionVisibility(descrVisibility.get()); for (EventStripeNode stripeNode : nodes) {
double rawDisplayPosition = getXAxis().getDisplayPosition(new DateTime(node.getStartMillis()));
stripeNode.setDescriptionVisibility(descrVisibility.get());
double rawDisplayPosition = getXAxis().getDisplayPosition(new DateTime(stripeNode.getStartMillis()));
//position of start and end according to range of axis //position of start and end according to range of axis
double startX = rawDisplayPosition - xOffset; double startX = rawDisplayPosition - xOffset;
double layoutNodesResultHeight = 0; double layoutNodesResultHeight = 0;
double span = 0; double span = 0;
List<EventStripeNode> subNodes = node.getSubNodes();
List<EventStripeNode> subNodes = stripeNode.getSubNodes();
if (subNodes.isEmpty() == false) { if (subNodes.isEmpty() == false) {
subNodes.sort(Comparator.comparing(EventStripeNode::getStartMillis)); Map<Boolean, List<EventStripeNode>> hiddenPartition = subNodes.stream()
layoutNodesResultHeight = layoutNodes(subNodes, 0, rawDisplayPosition); .collect(Collectors.partitioningBy(testNode -> getController().getQuickHideFilters().stream()
.filter(AbstractFilter::isActive)
.anyMatch(filter -> filter.getDescription().equals(testNode.getDescription()))));
layoutNodesResultHeight = layoutNodesHelper(hiddenPartition.get(true), hiddenPartition.get(false), minY, rawDisplayPosition);
} }
List<Double> spanWidths = new ArrayList<>(); List<Double> spanWidths = new ArrayList<>();
double x = getXAxis().getDisplayPosition(new DateTime(node.getStartMillis()));; double x = getXAxis().getDisplayPosition(new DateTime(stripeNode.getStartMillis()));;
double x2; double x2;
Iterator<Range<Long>> ranges = node.getStripe().getRanges().iterator(); Iterator<Range<Long>> ranges = stripeNode.getEventStripe().getRanges().iterator();
Range<Long> range = ranges.next(); Range<Long> range = ranges.next();
do { do {
x2 = getXAxis().getDisplayPosition(new DateTime(range.upperEndpoint())); x2 = getXAxis().getDisplayPosition(new DateTime(range.upperEndpoint()));
@ -582,21 +640,21 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
} while (ranges.hasNext()); } while (ranges.hasNext());
node.setSpanWidths(spanWidths); stripeNode.setSpanWidths(spanWidths);
if (truncateAll.get()) { //if truncate option is selected limit width of description label if (truncateAll.get()) { //if truncate option is selected limit width of description label
node.setDescriptionWidth(Math.max(span, truncateWidth.get())); stripeNode.setDescriptionWidth(Math.max(span, truncateWidth.get()));
} else { //else set it unbounded } else { //else set it unbounded
node.setDescriptionWidth(USE_PREF_SIZE);//20 + new Text(tlNode.getDisplayedDescription()).getLayoutBounds().getWidth()); stripeNode.setDescriptionWidth(USE_PREF_SIZE);//20 + new Text(tlNode.getDisplayedDescription()).getLayoutBounds().getWidth());
} }
node.autosize(); //compute size of tlNode based on constraints and event data stripeNode.autosize(); //compute size of tlNode based on constraints and event data
//get position of right edge of node ( influenced by description label) //get position of right edge of node ( influenced by description label)
double xRight = startX + node.getWidth(); double xRight = startX + stripeNode.getWidth();
//get the height of the node //get the height of the node
final double h = layoutNodesResultHeight == 0 ? node.getHeight() : layoutNodesResultHeight + DEFAULT_ROW_HEIGHT; final double h = layoutNodesResultHeight == 0 ? stripeNode.getHeight() : layoutNodesResultHeight + DEFAULT_ROW_HEIGHT;
//initial test position //initial test position
double yPos = minY; double yPos = minY;
@ -635,8 +693,8 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
localMax = Math.max(yPos2, localMax); localMax = Math.max(yPos2, localMax);
Timeline tm = new Timeline(new KeyFrame(Duration.seconds(1.0), Timeline tm = new Timeline(new KeyFrame(Duration.seconds(1.0),
new KeyValue(node.layoutXProperty(), startX), new KeyValue(stripeNode.layoutXProperty(), startX),
new KeyValue(node.layoutYProperty(), yPos))); new KeyValue(stripeNode.layoutYProperty(), yPos)));
tm.play(); tm.play();
} }
@ -651,6 +709,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
line.setStartX(getParentXForEpochMillis(range.lowerEndpoint())); line.setStartX(getParentXForEpochMillis(range.lowerEndpoint()));
line.setEndX(getParentXForEpochMillis(range.upperEndpoint())); line.setEndX(getParentXForEpochMillis(range.upperEndpoint()));
line.setStartY(getXAxis().getLayoutY() + PROJECTED_LINE_Y_OFFSET); line.setStartY(getXAxis().getLayoutY() + PROJECTED_LINE_Y_OFFSET);
line.setEndY(getXAxis().getLayoutY() + PROJECTED_LINE_Y_OFFSET); line.setEndY(getXAxis().getLayoutY() + PROJECTED_LINE_Y_OFFSET);
} }
@ -661,6 +720,17 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
return getXAxis().localToParent(getXAxis().getDisplayPosition(dateTime), 0).getX(); return getXAxis().localToParent(getXAxis().getDisplayPosition(dateTime), 0).getX();
} }
/**
* @return the filteredEvents
*/
public FilteredEventsModel getFilteredEvents() {
return filteredEvents;
}
Property<Boolean> alternateLayoutProperty() {
return alternateLayout;
}
static private class DetailIntervalSelector extends IntervalSelector<DateTime> { static private class DetailIntervalSelector extends IntervalSelector<DateTime> {
DetailIntervalSelector(double x, double height, Axis<DateTime> axis, TimeLineController controller) { DetailIntervalSelector(double x, double height, Axis<DateTime> axis, TimeLineController controller) {
@ -686,7 +756,7 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
private class PlaceMarkerAction extends Action { private class PlaceMarkerAction extends Action {
PlaceMarkerAction(MouseEvent clickEvent) { PlaceMarkerAction(MouseEvent clickEvent) {
super(EventDetailChart_chartContextMenu_placeMarker_name()); super(Bundle.EventDetailChart_chartContextMenu_placeMarker_name());
setGraphic(new ImageView(MARKER)); // NON-NLS setGraphic(new ImageView(MARKER)); // NON-NLS
setEventHandler(actionEvent -> { setEventHandler(actionEvent -> {
@ -707,4 +777,43 @@ public final class EventDetailChart extends XYChart<DateTime, EventCluster> impl
}); });
} }
} }
class HideDescriptionAction extends Action {
HideDescriptionAction(String description, DescriptionLoD descriptionLoD) {
super("Hide");
setGraphic(new ImageView(HIDE));
setEventHandler((ActionEvent t) -> {
final DescriptionFilter testFilter = new DescriptionFilter(
descriptionLoD,
description,
DescriptionFilter.FilterMode.EXCLUDE);
DescriptionFilter descriptionFilter = getController().getQuickHideFilters().stream()
.filter(testFilter::equals)
.findFirst().orElseGet(() -> {
testFilter.selectedProperty().addListener(layoutInvalidationListener);
getController().getQuickHideFilters().add(testFilter);
return testFilter;
});
descriptionFilter.setSelected(true);
});
}
}
class UnhideDescriptionAction extends Action {
UnhideDescriptionAction(String description, DescriptionLoD descriptionLoD) {
super("Unhide");
setGraphic(new ImageView(SHOW));
setEventHandler((ActionEvent t) ->
getController().getQuickHideFilters().stream()
.filter(descriptionFilter -> descriptionFilter.getDescriptionLoD().equals(descriptionLoD)
&& descriptionFilter.getDescription().equals(description))
.forEach(descriptionfilter -> descriptionfilter.setSelected(false))
);
}
}
} }

View File

@ -1,4 +1,5 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2015 Basis Technology Corp. * Copyright 2015 Basis Technology Corp.
@ -30,6 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
@ -79,8 +81,7 @@ import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter; import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter;
import org.sleuthkit.autopsy.timeline.filters.RootFilter; import org.sleuthkit.autopsy.timeline.filters.RootFilter;
import org.sleuthkit.autopsy.timeline.filters.TypeFilter; 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.DescriptionLOD;
import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel; import org.sleuthkit.autopsy.timeline.zooming.EventTypeZoomLevel;
import org.sleuthkit.autopsy.timeline.zooming.ZoomParams; import org.sleuthkit.autopsy.timeline.zooming.ZoomParams;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
@ -115,7 +116,7 @@ final public class EventStripeNode extends StackPane {
b.setManaged(show); b.setManaged(show);
} }
private final SimpleObjectProperty<DescriptionLOD> descLOD = new SimpleObjectProperty<>(); private final SimpleObjectProperty<DescriptionLoD> descLOD = new SimpleObjectProperty<>();
private DescriptionVisibility descrVis; private DescriptionVisibility descrVis;
private Tooltip tooltip; private Tooltip tooltip;
@ -144,12 +145,13 @@ final public class EventStripeNode extends StackPane {
private final EventStripe eventStripe; private final EventStripe eventStripe;
private final EventStripeNode parentNode; private final EventStripeNode parentNode;
private final FilteredEventsModel eventsModel; private final FilteredEventsModel eventsModel;
private final Button hideButton;
public EventStripeNode(EventDetailChart chart, EventStripe eventStripe, EventStripeNode parentEventNode) { public EventStripeNode(EventDetailChart chart, EventStripe eventStripe, EventStripeNode parentEventNode) {
this.eventStripe = eventStripe; this.eventStripe = eventStripe;
this.parentNode = parentEventNode; this.parentNode = parentEventNode;
this.chart = chart; this.chart = chart;
descLOD.set(eventStripe.getDescriptionLOD()); descLOD.set(eventStripe.getDescriptionLoD());
sleuthkitCase = chart.getController().getAutopsyCase().getSleuthkitCase(); sleuthkitCase = chart.getController().getAutopsyCase().getSleuthkitCase();
eventsModel = chart.getController().getEventsModel(); eventsModel = chart.getController().getEventsModel();
final Color evtColor = getEventType().getColor(); final Color evtColor = getEventType().getColor();
@ -172,10 +174,16 @@ final public class EventStripeNode extends StackPane {
if (eventStripe.getEventIDsWithTags().isEmpty()) { if (eventStripe.getEventIDsWithTags().isEmpty()) {
show(tagIV, false); show(tagIV, false);
} }
EventDetailChart.HideDescriptionAction hideClusterAction = chart.new HideDescriptionAction(getDescription(), eventStripe.getDescriptionLoD());
hideButton = ActionUtils.createButton(hideClusterAction, ActionUtils.ActionTextBehavior.HIDE);
configureLoDButton(hideButton);
configureLoDButton(plusButton); configureLoDButton(plusButton);
configureLoDButton(minusButton); configureLoDButton(minusButton);
//initialize info hbox //initialize info hbox
infoHBox.getChildren().add(4, hideButton);
infoHBox.setMinWidth(USE_PREF_SIZE); infoHBox.setMinWidth(USE_PREF_SIZE);
infoHBox.setPadding(new Insets(2, 5, 2, 5)); infoHBox.setPadding(new Insets(2, 5, 2, 5));
infoHBox.setAlignment(Pos.CENTER_LEFT); infoHBox.setAlignment(Pos.CENTER_LEFT);
@ -227,21 +235,19 @@ final public class EventStripeNode extends StackPane {
}); });
} }
/**
*
* @param showControls the value of par
*/
void showDescriptionLoDControls(final boolean showControls) { void showDescriptionLoDControls(final boolean showControls) {
DropShadow dropShadow = dropShadowMap.computeIfAbsent(getEventType(), DropShadow dropShadow = dropShadowMap.computeIfAbsent(getEventType(),
eventType -> new DropShadow(10, eventType.getColor())); eventType -> new DropShadow(10, eventType.getColor()));
clustersHBox.setEffect(showControls ? dropShadow : null); clustersHBox.setEffect(showControls ? dropShadow : null);
show(minusButton, showControls); show(minusButton, showControls);
show(plusButton, showControls); show(plusButton, showControls);
show(hideButton, showControls);
} }
public void setSpanWidths(List<Double> spanWidths) { public void setSpanWidths(List<Double> spanWidths) {
for (int i = 0; i < spanWidths.size(); i++) { for (int i = 0; i < spanWidths.size(); i++) {
Region spanRegion = (Region) clustersHBox.getChildren().get(i); Region spanRegion = (Region) clustersHBox.getChildren().get(i);
Double w = spanWidths.get(i); Double w = spanWidths.get(i);
spanRegion.setPrefWidth(w); spanRegion.setPrefWidth(w);
spanRegion.setMaxWidth(w); spanRegion.setMaxWidth(w);
@ -249,10 +255,19 @@ final public class EventStripeNode extends StackPane {
} }
} }
EventStripe getStripe() { public EventStripe getEventStripe() {
return eventStripe; return eventStripe;
} }
Collection<EventStripe> makeBundlesFromClusters(List<EventCluster> eventClusters) {
return eventClusters.stream().collect(
Collectors.toMap(
EventCluster::getDescription, //key
EventStripe::new, //value
EventStripe::merge)//merge method
).values();
}
@NbBundle.Messages({"# {0} - counts", @NbBundle.Messages({"# {0} - counts",
"# {1} - event type", "# {1} - event type",
"# {2} - description", "# {2} - description",
@ -266,10 +281,10 @@ final public class EventStripeNode extends StackPane {
@Override @Override
protected String call() throws Exception { protected String call() throws Exception {
HashMap<String, Long> hashSetCounts = new HashMap<>(); HashMap<String, Long> hashSetCounts = new HashMap<>();
if (!getStripe().getEventIDsWithHashHits().isEmpty()) { if (!eventStripe.getEventIDsWithHashHits().isEmpty()) {
hashSetCounts = new HashMap<>(); hashSetCounts = new HashMap<>();
try { try {
for (TimeLineEvent tle : eventsModel.getEventsById(getStripe().getEventIDsWithHashHits())) { for (TimeLineEvent tle : eventsModel.getEventsById(eventStripe.getEventIDsWithHashHits())) {
Set<String> hashSetNames = sleuthkitCase.getAbstractFileById(tle.getFileID()).getHashSetNames(); Set<String> hashSetNames = sleuthkitCase.getAbstractFileById(tle.getFileID()).getHashSetNames();
for (String hashSetName : hashSetNames) { for (String hashSetName : hashSetNames) {
hashSetCounts.merge(hashSetName, 1L, Long::sum); hashSetCounts.merge(hashSetName, 1L, Long::sum);
@ -347,7 +362,7 @@ final public class EventStripeNode extends StackPane {
RootFilter getSubClusterFilter() { RootFilter getSubClusterFilter() {
RootFilter subClusterFilter = eventsModel.filterProperty().get().copyOf(); RootFilter subClusterFilter = eventsModel.filterProperty().get().copyOf();
subClusterFilter.getSubFilters().addAll( subClusterFilter.getSubFilters().addAll(
new DescriptionFilter(eventStripe.getDescriptionLOD(), eventStripe.getDescription()), new DescriptionFilter(eventStripe.getDescriptionLoD(), eventStripe.getDescription(), DescriptionFilter.FilterMode.INCLUDE),
new TypeFilter(getEventType())); new TypeFilter(getEventType()));
return subClusterFilter; return subClusterFilter;
} }
@ -383,7 +398,7 @@ final public class EventStripeNode extends StackPane {
} }
} }
private DescriptionLOD getDescriptionLoD() { private DescriptionLoD getDescriptionLoD() {
return descLOD.get(); return descLOD.get();
} }
@ -394,10 +409,14 @@ final public class EventStripeNode extends StackPane {
* @param expand * @param expand
*/ */
@NbBundle.Messages(value = "EventStripeNode.loggedTask.name=Load sub clusters") @NbBundle.Messages(value = "EventStripeNode.loggedTask.name=Load sub clusters")
private synchronized void loadSubBundles(DescriptionLOD.RelativeDetail relativeDetail) { private synchronized void loadSubBundles(DescriptionLoD.RelativeDetail relativeDetail) {
chart.getEventBundles().removeIf(bundle ->
getSubNodes().stream().anyMatch(subNode ->
bundle.equals(subNode.getEventStripe()))
);
subNodePane.getChildren().clear(); subNodePane.getChildren().clear();
if (descLOD.get().withRelativeDetail(relativeDetail) == eventStripe.getDescriptionLOD()) { if (descLOD.get().withRelativeDetail(relativeDetail) == eventStripe.getDescriptionLoD()) {
descLOD.set(eventStripe.getDescriptionLOD()); descLOD.set(eventStripe.getDescriptionLoD());
clustersHBox.setVisible(true); clustersHBox.setVisible(true);
chart.setRequiresLayout(true); chart.setRequiresLayout(true);
chart.requestChartLayout(); chart.requestChartLayout();
@ -415,24 +434,25 @@ final public class EventStripeNode extends StackPane {
final EventTypeZoomLevel eventTypeZoomLevel = eventsModel.eventTypeZoomProperty().get(); final EventTypeZoomLevel eventTypeZoomLevel = eventsModel.eventTypeZoomProperty().get();
final ZoomParams zoomParams = new ZoomParams(subClusterSpan, eventTypeZoomLevel, subClusterFilter, getDescriptionLoD()); final ZoomParams zoomParams = new ZoomParams(subClusterSpan, eventTypeZoomLevel, subClusterFilter, getDescriptionLoD());
Task<Set<EventStripeNode>> loggedTask = new Task<Set<EventStripeNode>>() { Task<Collection<EventStripe>> loggedTask = new Task<Collection<EventStripe>>() {
private volatile DescriptionLOD loadedDescriptionLoD = getDescriptionLoD().withRelativeDetail(relativeDetail); private volatile DescriptionLoD loadedDescriptionLoD = getDescriptionLoD().withRelativeDetail(relativeDetail);
{ {
updateTitle(EventStripeNode_loggedTask_name()); updateTitle(Bundle.EventStripeNode_loggedTask_name());
} }
@Override @Override
protected Set<EventStripeNode> call() throws Exception { protected Collection<EventStripe> call() throws Exception {
Collection<EventStripe> bundles; Collection<EventStripe> bundles;
DescriptionLOD next = loadedDescriptionLoD; DescriptionLoD next = loadedDescriptionLoD;
do { do {
loadedDescriptionLoD = next; loadedDescriptionLoD = next;
if (loadedDescriptionLoD == eventStripe.getDescriptionLOD()) { if (loadedDescriptionLoD == eventStripe.getDescriptionLoD()) {
return Collections.emptySet(); return Collections.emptySet();
} }
bundles = eventsModel.getEventClusters(zoomParams.withDescrLOD(loadedDescriptionLoD)).stream() bundles = eventsModel.getEventClusters(zoomParams.withDescrLOD(loadedDescriptionLoD)).stream()
.map(cluster -> cluster.withParent(getEventStripe()))
.collect(Collectors.toMap( .collect(Collectors.toMap(
EventCluster::getDescription, //key EventCluster::getDescription, //key
EventStripe::new, //value EventStripe::new, //value
@ -442,24 +462,28 @@ final public class EventStripeNode extends StackPane {
} while (bundles.size() == 1 && nonNull(next)); } while (bundles.size() == 1 && nonNull(next));
// return list of AbstractEventStripeNodes representing sub-bundles // return list of AbstractEventStripeNodes representing sub-bundles
return bundles.stream() return bundles;
.map(EventStripeNode.this::getNodeForBundle)
.collect(Collectors.toSet());
} }
@Override @Override
protected void succeeded() { protected void succeeded() {
chart.setCursor(Cursor.WAIT); chart.setCursor(Cursor.WAIT);
try { try {
Set<EventStripeNode> subBundleNodes = get(); Collection<EventStripe> bundles = get();
if (subBundleNodes.isEmpty()) {
if (bundles.isEmpty()) {
clustersHBox.setVisible(true); clustersHBox.setVisible(true);
} else { } else {
clustersHBox.setVisible(false); clustersHBox.setVisible(false);
chart.getEventBundles().addAll(bundles);
subNodePane.getChildren().setAll(bundles.stream()
.map(EventStripeNode.this::getNodeForBundle)
.collect(Collectors.toSet()));
} }
descLOD.set(loadedDescriptionLoD); descLOD.set(loadedDescriptionLoD);
//assign subNodes and request chart layout //assign subNodes and request chart layout
subNodePane.getChildren().setAll(subBundleNodes);
chart.setRequiresLayout(true); chart.setRequiresLayout(true);
chart.requestChartLayout(); chart.requestChartLayout();
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
@ -504,10 +528,6 @@ final public class EventStripeNode extends StackPane {
} }
} }
public EventStripe getEventStripe() {
return eventStripe;
}
Set<Long> getEventsIDs() { Set<Long> getEventsIDs() {
return eventStripe.getEventIDs(); return eventStripe.getEventIDs();
} }
@ -531,9 +551,9 @@ final public class EventStripeNode extends StackPane {
} else if (t.isShortcutDown()) { } else if (t.isShortcutDown()) {
chart.selectedNodes.removeAll(EventStripeNode.this); chart.selectedNodes.removeAll(EventStripeNode.this);
} else if (t.getClickCount() > 1) { } else if (t.getClickCount() > 1) {
final DescriptionLOD next = descLOD.get().moreDetailed(); final DescriptionLoD next = descLOD.get().moreDetailed();
if (next != null) { if (next != null) {
loadSubBundles(DescriptionLOD.RelativeDetail.MORE); loadSubBundles(DescriptionLoD.RelativeDetail.MORE);
} }
} else { } else {
@ -566,13 +586,13 @@ final public class EventStripeNode extends StackPane {
setGraphic(new ImageView(PLUS)); setGraphic(new ImageView(PLUS));
setEventHandler((ActionEvent t) -> { setEventHandler((ActionEvent t) -> {
final DescriptionLOD next = descLOD.get().moreDetailed(); final DescriptionLoD next = descLOD.get().moreDetailed();
if (next != null) { if (next != null) {
loadSubBundles(DescriptionLOD.RelativeDetail.MORE); loadSubBundles(DescriptionLoD.RelativeDetail.MORE);
} }
}); });
disabledProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL)); disabledProperty().bind(descLOD.isEqualTo(DescriptionLoD.FULL));
} }
} }
@ -584,12 +604,12 @@ final public class EventStripeNode extends StackPane {
setGraphic(new ImageView(MINUS)); setGraphic(new ImageView(MINUS));
setEventHandler((ActionEvent t) -> { setEventHandler((ActionEvent t) -> {
final DescriptionLOD previous = descLOD.get().lessDetailed(); final DescriptionLoD previous = descLOD.get().lessDetailed();
if (previous != null) { if (previous != null) {
loadSubBundles(DescriptionLOD.RelativeDetail.LESS); loadSubBundles(DescriptionLoD.RelativeDetail.LESS);
} }
}); });
disabledProperty().bind(descLOD.isEqualTo(eventStripe.getDescriptionLOD())); disabledProperty().bind(Bindings.createBooleanBinding(() -> nonNull(eventStripe) && descLOD.get() == eventStripe.getDescriptionLoD(), descLOD));
} }
} }
} }

View File

@ -19,8 +19,11 @@
package org.sleuthkit.autopsy.timeline.ui.detailview.tree; package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
import java.util.Comparator; import java.util.Comparator;
import java.util.Deque;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javafx.collections.FXCollections;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
import org.sleuthkit.autopsy.timeline.datamodel.EventBundle; import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
/** /**
@ -28,34 +31,60 @@ import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
*/ */
class EventDescriptionTreeItem extends NavTreeItem { class EventDescriptionTreeItem extends NavTreeItem {
public EventDescriptionTreeItem(EventCluster g) { /**
setValue(new NavTreeNode(g.getEventType().getBaseType(), g.getDescription(), g.getEventIDs().size())); * maps a description to the child item of this item with that description
*/
private final Map<String, EventDescriptionTreeItem> childMap = new ConcurrentHashMap<>();
private final EventBundle bundle;
public EventBundle getEventBundle() {
return bundle;
}
EventDescriptionTreeItem(EventBundle g) {
bundle = g;
setValue(g);
} }
@Override @Override
public int getCount() { public long getCount() {
return getValue().getCount(); return getValue().getCount();
} }
@Override public void insert(Deque<EventBundle> path) {
public void insert(EventCluster g) { EventBundle head = path.removeFirst();
NavTreeNode value = getValue(); EventDescriptionTreeItem treeItem = childMap.get(head.getDescription());
if ((value.getType().getBaseType().equals(g.getEventType().getBaseType()) == false) || ((value.getDescription().equals(g.getDescription()) == false))) { if (treeItem == null) {
throw new IllegalArgumentException(); treeItem = new EventDescriptionTreeItem(head);
treeItem.setExpanded(true);
childMap.put(head.getDescription(), treeItem);
getChildren().add(treeItem);
FXCollections.sort(getChildren(), TreeComparator.Description);
} }
setValue(new NavTreeNode(value.getType().getBaseType(), value.getDescription(), value.getCount() + g.getEventIDs().size())); if (path.isEmpty() == false) {
treeItem.insert(path);
}
} }
@Override @Override
public void resort(Comparator<TreeItem<NavTreeNode>> comp) { public void resort(Comparator<TreeItem<EventBundle>> comp) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. FXCollections.sort(getChildren(), comp);
} }
@Override @Override
public TreeItem<NavTreeNode> findTreeItemForEvent(EventBundle t) { public NavTreeItem findTreeItemForEvent(EventBundle t) {
if (getValue().getType().getBaseType() == t.getEventType().getBaseType() && getValue().getDescription().equals(t.getDescription())) {
if (getValue().getEventType() == t.getEventType()
&& getValue().getDescription().equals(t.getDescription())) {
return this; return this;
} else {
for (EventDescriptionTreeItem child : childMap.values()) {
final NavTreeItem findTreeItemForEvent = child.findTreeItemForEvent(t);
if (findTreeItemForEvent != null) {
return findTreeItemForEvent;
}
}
} }
return null; return null;
} }

View File

@ -19,12 +19,11 @@
package org.sleuthkit.autopsy.timeline.ui.detailview.tree; package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
import java.util.Comparator; import java.util.Comparator;
import java.util.Deque;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import javafx.application.Platform;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
import org.sleuthkit.autopsy.timeline.datamodel.EventBundle; import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
class EventTypeTreeItem extends NavTreeItem { class EventTypeTreeItem extends NavTreeItem {
@ -34,55 +33,39 @@ class EventTypeTreeItem extends NavTreeItem {
*/ */
private final Map<String, EventDescriptionTreeItem> childMap = new ConcurrentHashMap<>(); private final Map<String, EventDescriptionTreeItem> childMap = new ConcurrentHashMap<>();
private final Comparator<TreeItem<NavTreeNode>> comparator = TreeComparator.Description; private final Comparator<TreeItem<EventBundle>> comparator = TreeComparator.Description;
EventTypeTreeItem(EventCluster g) { EventTypeTreeItem(EventBundle g) {
setValue(new NavTreeNode(g.getEventType().getBaseType(), g.getEventType().getBaseType().getDisplayName(), 0)); setValue(g);
} }
@Override @Override
public int getCount() { public long getCount() {
return getValue().getCount(); return getValue().getCount();
} }
/** public void insert(Deque<EventBundle> path) {
* Recursive method to add a grouping at a given path. EventBundle head = path.removeFirst();
* EventDescriptionTreeItem treeItem = childMap.get(head.getDescription());
* @param path Full path (or subset not yet added) to add
* @param g Group to add
* @param tree True if it is part of a tree (versus a list)
*/
@Override
public void insert(EventCluster g) {
EventDescriptionTreeItem treeItem = childMap.get(g.getDescription());
if (treeItem == null) { if (treeItem == null) {
final EventDescriptionTreeItem newTreeItem = new EventDescriptionTreeItem(g); treeItem = new EventDescriptionTreeItem(head);
newTreeItem.setExpanded(true); treeItem.setExpanded(true);
childMap.put(g.getDescription(), newTreeItem); childMap.put(head.getDescription(), treeItem);
getChildren().add(treeItem);
Platform.runLater(() -> { FXCollections.sort(getChildren(), comparator);
synchronized (getChildren()) {
getChildren().add(newTreeItem);
FXCollections.sort(getChildren(), comparator);
}
});
} else {
treeItem.insert(g);
} }
Platform.runLater(() -> {
NavTreeNode value1 = getValue();
setValue(new NavTreeNode(value1.getType().getBaseType(), value1.getType().getBaseType().getDisplayName(), childMap.values().stream().mapToInt(EventDescriptionTreeItem::getCount).sum()));
});
if (path.isEmpty() == false) {
treeItem.insert(path);
}
} }
@Override @Override
public TreeItem<NavTreeNode> findTreeItemForEvent(EventBundle t) { public NavTreeItem findTreeItemForEvent(EventBundle t) {
if (t.getEventType().getBaseType() == getValue().getType().getBaseType()) { if (t.getEventType().getBaseType() == getValue().getEventType().getBaseType()) {
for (TreeItem<NavTreeNode> child : getChildren()) { for (EventDescriptionTreeItem child : childMap.values()) {
final TreeItem<NavTreeNode> findTreeItemForEvent = ((NavTreeItem) child).findTreeItemForEvent(t); final NavTreeItem findTreeItemForEvent = child.findTreeItemForEvent(t);
if (findTreeItemForEvent != null) { if (findTreeItemForEvent != null) {
return findTreeItemForEvent; return findTreeItemForEvent;
} }
@ -92,7 +75,7 @@ class EventTypeTreeItem extends NavTreeItem {
} }
@Override @Override
public void resort(Comparator<TreeItem<NavTreeNode>> comp) { public void resort(Comparator<TreeItem<EventBundle>> comp) {
FXCollections.sort(getChildren(), comp); FXCollections.sort(getChildren(), comp);
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-15 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");
@ -18,15 +18,17 @@
*/ */
package org.sleuthkit.autopsy.timeline.ui.detailview.tree; package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
import java.net.URL; import com.google.common.collect.ImmutableList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator; import java.util.Comparator;
import java.util.ResourceBundle; import java.util.Objects;
import javafx.application.Platform; import javafx.beans.InvalidationListener;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.collections.ObservableList; import javafx.collections.ListChangeListener;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.ComboBox; import javafx.scene.control.ComboBox;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode; import javafx.scene.control.SelectionMode;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
@ -36,19 +38,26 @@ import javafx.scene.control.TreeView;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
import org.apache.commons.lang3.StringUtils;
import org.controlsfx.control.action.ActionUtils;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.timeline.FXMLConstructor; import org.sleuthkit.autopsy.timeline.FXMLConstructor;
import org.sleuthkit.autopsy.timeline.TimeLineController; import org.sleuthkit.autopsy.timeline.TimeLineController;
import org.sleuthkit.autopsy.timeline.TimeLineView; import org.sleuthkit.autopsy.timeline.TimeLineView;
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster; import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel; import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.filters.AbstractFilter;
import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter;
import org.sleuthkit.autopsy.timeline.ui.detailview.DetailViewPane; import org.sleuthkit.autopsy.timeline.ui.detailview.DetailViewPane;
/** /**
* Display two trees. one shows all folders (groups) and calls out folders with * Shows all {@link EventBundles} from the assigned {@link DetailViewPane} in a
* images. the user can select folders with images to see them in the main * tree organized by type and then description. Hidden bundles are shown grayed
* GroupListPane The other shows folders with hash set hits. * out. Right clicking on a item in the tree shows a context menu to show/hide
* it.
*/ */
public class NavPanel extends BorderPane implements TimeLineView { public class NavPanel extends BorderPane implements TimeLineView {
@ -56,59 +65,51 @@ public class NavPanel extends BorderPane implements TimeLineView {
private FilteredEventsModel filteredEvents; private FilteredEventsModel filteredEvents;
@FXML
private ResourceBundle resources;
@FXML
private URL location;
private DetailViewPane detailViewPane; private DetailViewPane detailViewPane;
/**
* TreeView for folders with hash hits
*/
@FXML @FXML
private TreeView< NavTreeNode> eventsTree; private TreeView<EventBundle> eventsTree;
@FXML @FXML
private Label eventsTreeLabel; private Label eventsTreeLabel;
@FXML @FXML
private ComboBox<Comparator<TreeItem<NavTreeNode>>> sortByBox; private ComboBox<Comparator<TreeItem<EventBundle>>> sortByBox;
public NavPanel() { public NavPanel() {
FXMLConstructor.construct(this, "NavPanel.fxml"); // NON-NLS
FXMLConstructor.construct(this, "NavPanel.fxml"); // NON-NLS
} }
public void setChart(DetailViewPane detailViewPane) { public void setDetailViewPane(DetailViewPane detailViewPane) {
this.detailViewPane = detailViewPane; this.detailViewPane = detailViewPane;
detailViewPane.setSelectionModel(eventsTree.getSelectionModel()); detailViewPane.setSelectionModel(eventsTree.getSelectionModel());
setRoot();
detailViewPane.getAggregatedEvents().addListener((Observable observable) -> { detailViewPane.getEventBundles().addListener((Observable observable) -> {
setRoot(); setRoot();
}); });
setRoot();
detailViewPane.getSelectedNodes().addListener((Observable observable) -> { detailViewPane.getSelectedNodes().addListener((Observable observable) -> {
eventsTree.getSelectionModel().clearSelection(); eventsTree.getSelectionModel().clearSelection();
detailViewPane.getSelectedNodes().forEach(eventStripeNode -> { detailViewPane.getSelectedNodes().forEach(eventStripeNode -> {
eventsTree.getSelectionModel().select(((NavTreeItem) eventsTree.getRoot()).findTreeItemForEvent(eventStripeNode.getEventStripe())); eventsTree.getSelectionModel().select(getRoot().findTreeItemForEvent(eventStripeNode.getEventStripe()));
}); });
}); });
} }
private NavTreeItem getRoot() {
return (NavTreeItem) eventsTree.getRoot();
}
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
private void setRoot() { private void setRoot() {
RootItem root = new RootItem(); RootItem root = new RootItem();
final ObservableList<EventCluster> aggregatedEvents = detailViewPane.getAggregatedEvents(); for (EventBundle bundle : detailViewPane.getEventBundles()) {
root.insert(bundle);
synchronized (aggregatedEvents) {
for (EventCluster agg : aggregatedEvents) {
root.insert(agg);
}
} }
Platform.runLater(() -> { eventsTree.setRoot(root);
eventsTree.setRoot(root);
});
} }
@Override @Override
@ -130,40 +131,107 @@ public class NavPanel extends BorderPane implements TimeLineView {
sortByBox.getItems().setAll(Arrays.asList(TreeComparator.Description, TreeComparator.Count)); sortByBox.getItems().setAll(Arrays.asList(TreeComparator.Description, TreeComparator.Count));
sortByBox.getSelectionModel().select(TreeComparator.Description); sortByBox.getSelectionModel().select(TreeComparator.Description);
sortByBox.getSelectionModel().selectedItemProperty().addListener((Observable o) -> { sortByBox.getSelectionModel().selectedItemProperty().addListener((Observable o) -> {
((NavTreeItem) eventsTree.getRoot()).resort(sortByBox.getSelectionModel().getSelectedItem()); getRoot().resort(sortByBox.getSelectionModel().getSelectedItem());
}); });
eventsTree.setShowRoot(false); eventsTree.setShowRoot(false);
eventsTree.setCellFactory((TreeView<NavTreeNode> p) -> new EventTreeCell()); eventsTree.setCellFactory((TreeView<EventBundle> p) -> new EventBundleTreeCell());
eventsTree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); eventsTree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
eventsTreeLabel.setText(NbBundle.getMessage(this.getClass(), "NavPanel.eventsTreeLabel.text")); eventsTreeLabel.setText(NbBundle.getMessage(this.getClass(), "NavPanel.eventsTreeLabel.text"));
} }
/** /**
* A tree cell to display {@link NavTreeNode}s. Shows the description, and * A tree cell to display {@link EventBundle}s. Shows the description, and
* count, as well a a "legend icon" for the event type. * count, as well a a "legend icon" for the event type.
*/ */
private static class EventTreeCell extends TreeCell<NavTreeNode> { private class EventBundleTreeCell extends TreeCell<EventBundle> {
private static final double HIDDEN_MULTIPLIER = .6;
private final Rectangle rect = new Rectangle(24, 24);
private final ImageView imageView = new ImageView();
private InvalidationListener filterStateChangeListener;
EventBundleTreeCell() {
rect.setArcHeight(5);
rect.setArcWidth(5);
rect.setStrokeWidth(2);
}
@Override @Override
protected void updateItem(NavTreeNode item, boolean empty) { protected void updateItem(EventBundle item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null) { if (item == null || empty) {
final String text = item.getDescription() + " (" + item.getCount() + ")"; // NON-NLS
setText(text);
setTooltip(new Tooltip(text));
Rectangle rect = new Rectangle(24, 24);
rect.setArcHeight(5);
rect.setArcWidth(5);
rect.setStrokeWidth(2);
rect.setStroke(item.getType().getColor());
rect.setFill(item.getType().getColor().deriveColor(0, 1, 1, 0.1));
setGraphic(new StackPane(rect, new ImageView(item.getType().getFXImage())));
} else {
setText(null); setText(null);
setTooltip(null); setTooltip(null);
setGraphic(null); setGraphic(null);
setContextMenu(null);
deRegisterListeners(controller.getQuickHideFilters());
} else {
filterStateChangeListener = (filterState) -> updateHiddenState(item);
controller.getQuickHideFilters().addListener((ListChangeListener.Change<? extends DescriptionFilter> listChange) -> {
while (listChange.next()) {
deRegisterListeners(listChange.getRemoved());
registerListeners(listChange.getAddedSubList(), item);
}
updateHiddenState(item);
});
registerListeners(controller.getQuickHideFilters(), item);
String text = item.getDescription() + " (" + item.getCount() + ")"; // NON-NLS
TreeItem<EventBundle> parent = getTreeItem().getParent();
if (parent != null && parent.getValue() != null && (parent instanceof EventDescriptionTreeItem)) {
text = StringUtils.substringAfter(text, parent.getValue().getDescription());
}
setText(text);
setTooltip(new Tooltip(text));
imageView.setImage(item.getEventType().getFXImage());
setGraphic(new StackPane(rect, imageView));
updateHiddenState(item);
} }
} }
private void registerListeners(Collection<? extends DescriptionFilter> filters, EventBundle item) {
for (DescriptionFilter filter : filters) {
if (filter.getDescription().equals(item.getDescription())) {
filter.activeProperty().addListener(filterStateChangeListener);
}
}
}
private void deRegisterListeners(Collection<? extends DescriptionFilter> filters) {
if (Objects.nonNull(filterStateChangeListener)) {
for (DescriptionFilter filter : filters) {
filter.activeProperty().removeListener(filterStateChangeListener);
}
}
}
private void updateHiddenState(EventBundle item) {
TreeItem<EventBundle> treeItem = getTreeItem();
ContextMenu newMenu;
if (controller.getQuickHideFilters().stream().
filter(AbstractFilter::isActive)
.anyMatch(filter -> filter.getDescription().equals(item.getDescription()))) {
if (treeItem != null) {
treeItem.setExpanded(false);
}
setTextFill(Color.gray(0, HIDDEN_MULTIPLIER));
imageView.setOpacity(HIDDEN_MULTIPLIER);
rect.setStroke(item.getEventType().getColor().deriveColor(0, HIDDEN_MULTIPLIER, 1, HIDDEN_MULTIPLIER));
rect.setFill(item.getEventType().getColor().deriveColor(0, HIDDEN_MULTIPLIER, HIDDEN_MULTIPLIER, 0.1));
newMenu = ActionUtils.createContextMenu(ImmutableList.of(detailViewPane.newUnhideDescriptionAction(item.getDescription(), item.getDescriptionLoD())));
} else {
setTextFill(Color.BLACK);
imageView.setOpacity(1);
rect.setStroke(item.getEventType().getColor());
rect.setFill(item.getEventType().getColor().deriveColor(0, 1, 1, 0.1));
newMenu = ActionUtils.createContextMenu(ImmutableList.of(detailViewPane.newHideDescriptionAction(item.getDescription(), item.getDescriptionLoD())));
}
if (treeItem instanceof EventDescriptionTreeItem) {
setContextMenu(newMenu);
} else {
setContextMenu(null);
}
}
} }
} }

View File

@ -21,22 +21,18 @@ package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
import java.util.Comparator; import java.util.Comparator;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import org.sleuthkit.autopsy.timeline.datamodel.EventBundle; import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
/** /**
* A node in the nav tree. Manages inserts and resorts. Has parents and * A node in the nav tree. Manages inserts and resorts. Has parents and
* children. Does not have graphical properties these are configured in * children. Does not have graphical properties these are configured in
* {@link EventTreeCell}. Each GroupTreeItem has a NavTreeNode which has a type, * {@link EventTreeCell}. Each NavTreeItem has a EventBundle which has a type,
* description , and count * description , count, etc.
*/ */
abstract class NavTreeItem extends TreeItem<NavTreeNode> { abstract class NavTreeItem extends TreeItem<EventBundle> {
abstract void insert(EventCluster g); abstract long getCount();
abstract int getCount(); abstract void resort(Comparator<TreeItem<EventBundle>> comp);
abstract void resort(Comparator<TreeItem<NavTreeNode>> comp);
abstract TreeItem<NavTreeNode> findTreeItemForEvent(EventBundle t);
abstract NavTreeItem findTreeItemForEvent(EventBundle t);
} }

View File

@ -1,55 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
import javax.annotation.concurrent.Immutable;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
/**
* The data item for the nav tree. Represents a combination of type and
* description, as well as the corresponding number of events
*/
@Immutable
public class NavTreeNode {
final private EventType type;
final private String Description;
final private int count;
public EventType getType() {
return type;
}
public String getDescription() {
return Description;
}
public int getCount() {
return count;
}
public NavTreeNode(EventType type, String Description, int count) {
this.type = type;
this.Description = Description;
this.count = count;
}
}

View File

@ -18,13 +18,13 @@
*/ */
package org.sleuthkit.autopsy.timeline.ui.detailview.tree; package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
import java.util.ArrayDeque;
import java.util.Comparator; import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javafx.application.Platform; import java.util.Optional;
import javafx.collections.FXCollections;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import org.sleuthkit.autopsy.timeline.datamodel.EventCluster;
import org.sleuthkit.autopsy.timeline.datamodel.EventBundle; import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
@ -47,7 +47,7 @@ class RootItem extends NavTreeItem {
} }
@Override @Override
public int getCount() { public long getCount() {
return getValue().getCount(); return getValue().getCount();
} }
@ -56,39 +56,41 @@ class RootItem extends NavTreeItem {
* *
* @param g Group to add * @param g Group to add
*/ */
@Override public void insert(EventBundle g) {
public void insert(EventCluster g) {
EventTypeTreeItem treeItem = childMap.get(g.getEventType().getBaseType()); EventTypeTreeItem treeItem = childMap.computeIfAbsent(g.getEventType().getBaseType(),
if (treeItem == null) { baseType -> {
final EventTypeTreeItem newTreeItem = new EventTypeTreeItem(g); EventTypeTreeItem newTreeItem = new EventTypeTreeItem(g);
newTreeItem.setExpanded(true); newTreeItem.setExpanded(true);
childMap.put(g.getEventType().getBaseType(), newTreeItem);
newTreeItem.insert(g);
Platform.runLater(() -> {
synchronized (getChildren()) {
getChildren().add(newTreeItem); getChildren().add(newTreeItem);
getChildren().sort(TreeComparator.Type);
return newTreeItem;
});
treeItem.insert(getTreePath(g));
}
FXCollections.sort(getChildren(), TreeComparator.Type); static Deque<EventBundle> getTreePath(EventBundle g) {
} Deque<EventBundle> path = new ArrayDeque<>();
}); Optional<EventBundle> p = Optional.of(g);
} else {
treeItem.insert(g); while (p.isPresent()) {
EventBundle parent = p.get();
path.addFirst(parent);
p = parent.getParentBundle();
} }
return path;
} }
@Override @Override
public void resort(Comparator<TreeItem<NavTreeNode>> comp) { public void resort(Comparator<TreeItem<EventBundle>> comp) {
childMap.values().forEach((ti) -> { childMap.values().forEach(ti -> ti.resort(comp));
ti.resort(comp);
});
} }
@Override @Override
public TreeItem<NavTreeNode> findTreeItemForEvent(EventBundle t) { public NavTreeItem findTreeItemForEvent(EventBundle t) {
for (TreeItem<NavTreeNode> child : getChildren()) { for (EventTypeTreeItem child : childMap.values()) {
final TreeItem<NavTreeNode> findTreeItemForEvent = ((NavTreeItem) child).findTreeItemForEvent(t); final NavTreeItem findTreeItemForEvent = child.findTreeItemForEvent(t);
if (findTreeItemForEvent != null) { if (findTreeItemForEvent != null) {
return findTreeItemForEvent; return findTreeItemForEvent;
} }

View File

@ -20,27 +20,27 @@ package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
import java.util.Comparator; import java.util.Comparator;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import org.sleuthkit.autopsy.timeline.datamodel.EventBundle;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType;
enum TreeComparator implements Comparator<TreeItem<NavTreeNode>> { enum TreeComparator implements Comparator<TreeItem<EventBundle>> {
Description { Description {
@Override @Override
public int compare(TreeItem<NavTreeNode> o1, TreeItem<NavTreeNode> o2) { public int compare(TreeItem<EventBundle> o1, TreeItem<EventBundle> o2) {
return o1.getValue().getDescription().compareTo(o2.getValue().getDescription()); return o1.getValue().getDescription().compareTo(o2.getValue().getDescription());
} }
}, },
Count { Count {
@Override @Override
public int compare(TreeItem<NavTreeNode> o1, TreeItem<NavTreeNode> o2) { public int compare(TreeItem<EventBundle> o1, TreeItem<EventBundle> o2) {
return Long.compare(o2.getValue().getCount(), o1.getValue().getCount());
return -Integer.compare(o1.getValue().getCount(), o2.getValue().getCount());
} }
}, },
Type { Type {
@Override @Override
public int compare(TreeItem<NavTreeNode> o1, TreeItem<NavTreeNode> o2) { public int compare(TreeItem<EventBundle> o1, TreeItem<EventBundle> o2) {
return EventType.getComparator().compare(o1.getValue().getType(), o2.getValue().getType()); return EventType.getComparator().compare(o1.getValue().getEventType(), o2.getValue().getEventType());
} }
}; };

View File

@ -1,56 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.timeline.ui.filtering;
import javafx.application.Platform;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TreeTableCell;
import org.sleuthkit.autopsy.timeline.filters.AbstractFilter;
/**
* A {@link TreeTableCell} that represents the active state of a
* {@link AbstractFilter} as a checkbox
*/
class FilterCheckBoxCell extends TreeTableCell<AbstractFilter, AbstractFilter> {
private final CheckBox checkBox = new CheckBox();
private SimpleBooleanProperty activeProperty;
@Override
protected void updateItem(AbstractFilter item, boolean empty) {
super.updateItem(item, empty);
Platform.runLater(() -> {
if (activeProperty != null) {
checkBox.selectedProperty().unbindBidirectional(activeProperty);
}
checkBox.disableProperty().unbind();
if (item == null) {
setText(null);
setGraphic(null);
} else {
setText(item.getDisplayName());
activeProperty = item.getSelectedProperty();
checkBox.selectedProperty().bindBidirectional(activeProperty);
checkBox.disableProperty().bind(item.getDisabledProperty());
setGraphic(checkBox);
}
});
}
}

View File

@ -0,0 +1,42 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.timeline.ui.filtering;
import java.util.function.Supplier;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.scene.control.CheckBox;
import javafx.scene.control.IndexedCell;
import org.sleuthkit.autopsy.timeline.ui.AbstractFXCellFactory;
import org.sleuthkit.autopsy.timeline.filters.AbstractFilter;
class FilterCheckBoxCellFactory<X extends AbstractFilter> extends AbstractFXCellFactory<X, X> {
private final CheckBox checkBox = new CheckBox();
private SimpleBooleanProperty selectedProperty;
private SimpleBooleanProperty disabledProperty;
@Override
protected void configureCell(IndexedCell<? extends X> cell, X item, boolean empty, Supplier<X> supplier) {
if (selectedProperty != null) {
checkBox.selectedProperty().unbindBidirectional(selectedProperty);
}
if (disabledProperty != null) {
checkBox.disableProperty().unbindBidirectional(disabledProperty);
}
if (item == null) {
cell.setText(null);
cell.setGraphic(null);
} else {
cell.setText(item.getDisplayName());
selectedProperty = item.selectedProperty();
checkBox.selectedProperty().bindBidirectional(selectedProperty);
disabledProperty = item.getDisabledProperty();
checkBox.disableProperty().bindBidirectional(disabledProperty);
cell.setGraphic(checkBox);
}
}
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import org.controlsfx.control.*?>
<?import java.lang.*?> <?import java.lang.*?>
<?import javafx.geometry.*?> <?import javafx.geometry.*?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
@ -26,13 +27,23 @@
</items> </items>
</ToolBar> </ToolBar>
</top> </top>
<center><TreeTableView fx:id="filterTreeTable" editable="true" minWidth="-Infinity" showRoot="false" BorderPane.alignment="CENTER"> <center>
<columns> <SplitPane fx:id="splitPane" dividerPositions="0.5" orientation="VERTICAL">
<TreeTableColumn fx:id="treeColumn" minWidth="100.0" prefWidth="200.0" sortable="false" /> <items>
<TreeTableColumn fx:id="legendColumn" editable="false" minWidth="50.0" prefWidth="50.0" sortable="false" /> <TreeTableView fx:id="filterTreeTable" editable="true" minHeight="50.0" showRoot="false" BorderPane.alignment="CENTER">
</columns> <columns>
<columnResizePolicy> <TreeTableColumn fx:id="treeColumn" minWidth="100.0" prefWidth="200.0" sortable="false" />
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> <TreeTableColumn fx:id="legendColumn" editable="false" minWidth="50.0" prefWidth="50.0" sortable="false" />
</columnResizePolicy> </columns>
</TreeTableView> <columnResizePolicy>
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TreeTableView>
<TitledPane fx:id="hiddenDescriptionsPane" collapsible="false" disable="true" expanded="false" minHeight="25.0" text="Hidden Descriptions">
<content>
<ListView fx:id="hiddenDescriptionsListView" />
</content>
</TitledPane>
</items>
</SplitPane>
</center></fx:root> </center></fx:root>

View File

@ -22,25 +22,36 @@ import javafx.application.Platform;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableMap; import javafx.collections.ObservableMap;
import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ContextMenu; import javafx.scene.control.ContextMenu;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.Menu; import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem; import javafx.scene.control.MenuItem;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TitledPane;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableColumn; import javafx.scene.control.TreeTableColumn;
import javafx.scene.control.TreeTableRow; import javafx.scene.control.TreeTableRow;
import javafx.scene.control.TreeTableView; import javafx.scene.control.TreeTableView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import org.controlsfx.control.action.Action; import org.controlsfx.control.action.Action;
import org.controlsfx.control.action.ActionUtils;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.timeline.FXMLConstructor; import org.sleuthkit.autopsy.timeline.FXMLConstructor;
import org.sleuthkit.autopsy.timeline.TimeLineController; import org.sleuthkit.autopsy.timeline.TimeLineController;
import org.sleuthkit.autopsy.timeline.TimeLineView; import org.sleuthkit.autopsy.timeline.TimeLineView;
import org.sleuthkit.autopsy.timeline.VisualizationMode;
import org.sleuthkit.autopsy.timeline.actions.ResetFilters; import org.sleuthkit.autopsy.timeline.actions.ResetFilters;
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel; import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.datamodel.eventtype.RootEventType; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.RootEventType;
import org.sleuthkit.autopsy.timeline.filters.AbstractFilter; import org.sleuthkit.autopsy.timeline.filters.AbstractFilter;
import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter;
import org.sleuthkit.autopsy.timeline.filters.Filter; import org.sleuthkit.autopsy.timeline.filters.Filter;
import org.sleuthkit.autopsy.timeline.filters.RootFilter; import org.sleuthkit.autopsy.timeline.filters.RootFilter;
import org.sleuthkit.autopsy.timeline.filters.TypeFilter; import org.sleuthkit.autopsy.timeline.filters.TypeFilter;
@ -54,7 +65,7 @@ import static org.sleuthkit.autopsy.timeline.ui.filtering.Bundle.Timeline_ui_fil
* This also implements {@link TimeLineView} since it dynamically updates its * This also implements {@link TimeLineView} since it dynamically updates its
* filters based on the contents of a {@link FilteredEventsModel} * filters based on the contents of a {@link FilteredEventsModel}
*/ */
public class FilterSetPanel extends BorderPane implements TimeLineView { final public class FilterSetPanel extends BorderPane implements TimeLineView {
@FXML @FXML
private Button applyButton; private Button applyButton;
@ -71,14 +82,22 @@ public class FilterSetPanel extends BorderPane implements TimeLineView {
@FXML @FXML
private TreeTableColumn<AbstractFilter, AbstractFilter> legendColumn; private TreeTableColumn<AbstractFilter, AbstractFilter> legendColumn;
@FXML
private ListView<DescriptionFilter> hiddenDescriptionsListView;
@FXML
private TitledPane hiddenDescriptionsPane;
@FXML
private SplitPane splitPane;
private FilteredEventsModel filteredEvents; private FilteredEventsModel filteredEvents;
private TimeLineController controller; private TimeLineController controller;
private final ObservableMap<String, Boolean> expansionMap = FXCollections.observableHashMap(); private final ObservableMap<String, Boolean> expansionMap = FXCollections.observableHashMap();
private double position;
@FXML @FXML
@NbBundle.Messages({"FilterSetPanel.applyButton.text=Apply", @NbBundle.Messages({
"Timeline.ui.filtering.menuItem.all=all", "Timeline.ui.filtering.menuItem.all=all",
"FilterSetPanel.defaultButton.text=Default", "FilterSetPanel.defaultButton.text=Default",
"Timeline.ui.filtering.menuItem.none=none", "Timeline.ui.filtering.menuItem.none=none",
@ -88,10 +107,7 @@ public class FilterSetPanel extends BorderPane implements TimeLineView {
void initialize() { void initialize() {
assert applyButton != null : "fx:id=\"applyButton\" was not injected: check your FXML file 'FilterSetPanel.fxml'."; // NON-NLS assert applyButton != null : "fx:id=\"applyButton\" was not injected: check your FXML file 'FilterSetPanel.fxml'."; // NON-NLS
applyButton.setOnAction(e -> { ActionUtils.configureButton(new ApplyFiltersAction(), applyButton);
controller.pushFilters((RootFilter) filterTreeTable.getRoot().getValue().copyOf());
});
applyButton.setText(Bundle.FilterSetPanel_applyButton_text());
defaultButton.setText(Bundle.FilterSetPanel_defaultButton_text()); defaultButton.setText(Bundle.FilterSetPanel_defaultButton_text());
//remove column headers via css. //remove column headers via css.
@ -148,7 +164,7 @@ public class FilterSetPanel extends BorderPane implements TimeLineView {
//configure tree column to show name of filter and checkbox //configure tree column to show name of filter and checkbox
treeColumn.setCellValueFactory(param -> param.getValue().valueProperty()); treeColumn.setCellValueFactory(param -> param.getValue().valueProperty());
treeColumn.setCellFactory(col -> new FilterCheckBoxCell()); treeColumn.setCellFactory(col -> new FilterCheckBoxCellFactory().forTreeTable(col));
//configure legend column to show legend (or othe supplamantal ui, eg, text field for text filter) //configure legend column to show legend (or othe supplamantal ui, eg, text field for text filter)
legendColumn.setCellValueFactory(param -> param.getValue().valueProperty()); legendColumn.setCellValueFactory(param -> param.getValue().valueProperty());
@ -158,7 +174,23 @@ public class FilterSetPanel extends BorderPane implements TimeLineView {
public FilterSetPanel() { public FilterSetPanel() {
FXMLConstructor.construct(this, "FilterSetPanel.fxml"); // NON-NLS FXMLConstructor.construct(this, "FilterSetPanel.fxml"); // NON-NLS
expansionMap.put(new TypeFilter(RootEventType.getInstance()).getDisplayName(), Boolean.TRUE); expansionMap.put(new TypeFilter(RootEventType.getInstance()).getDisplayName(), true);
}
static class ListCellImpl extends ListCell<DescriptionFilter> {
@Override
protected void updateItem(DescriptionFilter item, boolean empty) {
super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates.
if (item == null || empty) {
setText(null);
setGraphic(null);
} else {
setGraphic(new CheckBox());
setText(item.getDisplayName());
}
}
} }
@Override @Override
@ -168,20 +200,106 @@ public class FilterSetPanel extends BorderPane implements TimeLineView {
defaultButton.setOnAction(defaultFiltersAction); defaultButton.setOnAction(defaultFiltersAction);
defaultButton.disableProperty().bind(defaultFiltersAction.disabledProperty()); defaultButton.disableProperty().bind(defaultFiltersAction.disabledProperty());
this.setModel(timeLineController.getEventsModel()); this.setModel(timeLineController.getEventsModel());
hiddenDescriptionsListView.setItems(controller.getQuickHideFilters());
hiddenDescriptionsListView.setCellFactory((ListView<DescriptionFilter> param) -> {
final ListCell<DescriptionFilter> forList = new FilterCheckBoxCellFactory<DescriptionFilter>().forList();
forList.itemProperty().addListener((Observable observable) -> {
if (forList.getItem() == null) {
forList.setContextMenu(null);
} else {
forList.setContextMenu(new ContextMenu(new MenuItem() {
{
forList.getItem().selectedProperty().addListener((observable, wasSelected, isSelected) -> {
configureText(isSelected);
});
configureText(forList.getItem().selectedProperty().get());
setOnAction((ActionEvent event) -> {
controller.getQuickHideFilters().remove(forList.getItem());
});
}
private void configureText(Boolean newValue) {
if (newValue) {
setText("Unhide and remove from list");
} else {
setText("Remove from list");
}
}
}));
}
});
return forList;
});
// hiddenDescriptionsPane.setContent(null);
controller.viewModeProperty().addListener(observable -> {
applyFilters();
if (controller.viewModeProperty().get() == VisualizationMode.COUNTS) {
position = splitPane.getDividerPositions()[0];
splitPane.setDividerPositions(1);
hiddenDescriptionsPane.setExpanded(false);
hiddenDescriptionsPane.setCollapsible(false);
hiddenDescriptionsPane.setDisable(true);
} else {
splitPane.setDividerPositions(position);
hiddenDescriptionsPane.setDisable(false);
hiddenDescriptionsPane.setCollapsible(true);
hiddenDescriptionsPane.setExpanded(true);
hiddenDescriptionsPane.setCollapsible(false);
}
});
} }
@Override @Override
public void setModel(FilteredEventsModel filteredEvents) { public void setModel(FilteredEventsModel filteredEvents) {
this.filteredEvents = filteredEvents; this.filteredEvents = filteredEvents;
refresh(); this.filteredEvents.eventTypeZoomProperty().addListener((Observable observable) -> {
applyFilters();
});
this.filteredEvents.descriptionLODProperty().addListener((Observable observable) -> {
applyFilters();
});
this.filteredEvents.timeRangeProperty().addListener((Observable observable) -> {
applyFilters();
});
this.filteredEvents.filterProperty().addListener((Observable o) -> { this.filteredEvents.filterProperty().addListener((Observable o) -> {
refresh(); refresh();
}); });
refresh();
} }
private void refresh() { private void refresh() {
Platform.runLater(() -> { Platform.runLater(() -> {
filterTreeTable.setRoot(new FilterTreeItem(filteredEvents.filterProperty().get().copyOf(), expansionMap)); filterTreeTable.setRoot(new FilterTreeItem(filteredEvents.getFilter().copyOf(), expansionMap));
}); });
} }
@NbBundle.Messages({"FilterSetPanel.applyButton.text=Apply"})
private class ApplyFiltersAction extends Action {
ApplyFiltersAction() {
super(Bundle.FilterSetPanel_applyButton_text());
setLongText("(Re)Apply filters");
setGraphic(new ImageView(TICK));
setEventHandler((ActionEvent t) -> {
applyFilters();
});
}
}
private void applyFilters() {
Platform.runLater(() -> {
controller.pushFilters((RootFilter) filterTreeTable.getRoot().getValue());
});
}
private static final Image TICK = new Image("org/sleuthkit/autopsy/timeline/images/tick.png");
} }

View File

@ -11,7 +11,7 @@ import org.sleuthkit.autopsy.timeline.filters.Filter;
/** /**
* A TreeItem for a filter. * A TreeItem for a filter.
*/ */
public class FilterTreeItem extends TreeItem<Filter> { final public class FilterTreeItem extends TreeItem<Filter> {
/** /**
* recursively construct a tree of treeitems to parallel the filter tree of * recursively construct a tree of treeitems to parallel the filter tree of
@ -40,16 +40,17 @@ public class FilterTreeItem extends TreeItem<Filter> {
}); });
if (f instanceof CompoundFilter<?>) { if (f instanceof CompoundFilter<?>) {
CompoundFilter<?> cf = (CompoundFilter<?>) f; CompoundFilter<?> compoundFilter = (CompoundFilter<?>) f;
for (Filter af : cf.getSubFilters()) { for (Filter subFilter : compoundFilter.getSubFilters()) {
getChildren().add(new FilterTreeItem(af, expansionMap)); getChildren().add(new FilterTreeItem(subFilter, expansionMap));
} }
cf.getSubFilters().addListener((ListChangeListener.Change<? extends Filter> c) -> { compoundFilter.getSubFilters().addListener((ListChangeListener.Change<? extends Filter> c) -> {
while (c.next()) { while (c.next()) {
for (Filter af : c.getAddedSubList()) { for (Filter subfFilter : c.getAddedSubList()) {
getChildren().add(new FilterTreeItem(af, expansionMap)); setExpanded(true);
getChildren().add(new FilterTreeItem(subfFilter, expansionMap));
} }
} }
}); });

View File

@ -23,11 +23,11 @@ import org.openide.util.NbBundle;
/** /**
* Enumeration of all description levels of detail. * Enumeration of all description levels of detail.
*/ */
public enum DescriptionLOD { public enum DescriptionLoD {
SHORT(NbBundle.getMessage(DescriptionLOD.class, "DescriptionLOD.short")), SHORT(NbBundle.getMessage(DescriptionLoD.class, "DescriptionLOD.short")),
MEDIUM(NbBundle.getMessage(DescriptionLOD.class, "DescriptionLOD.medium")), MEDIUM(NbBundle.getMessage(DescriptionLoD.class, "DescriptionLOD.medium")),
FULL(NbBundle.getMessage(DescriptionLOD.class, "DescriptionLOD.full")); FULL(NbBundle.getMessage(DescriptionLoD.class, "DescriptionLOD.full"));
private final String displayName; private final String displayName;
@ -35,11 +35,11 @@ public enum DescriptionLOD {
return displayName; return displayName;
} }
private DescriptionLOD(String displayName) { private DescriptionLoD(String displayName) {
this.displayName = displayName; this.displayName = displayName;
} }
public DescriptionLOD moreDetailed() { public DescriptionLoD moreDetailed() {
try { try {
return values()[ordinal() + 1]; return values()[ordinal() + 1];
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
@ -47,7 +47,7 @@ public enum DescriptionLOD {
} }
} }
public DescriptionLOD lessDetailed() { public DescriptionLoD lessDetailed() {
try { try {
return values()[ordinal() - 1]; return values()[ordinal() - 1];
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
@ -55,7 +55,7 @@ public enum DescriptionLOD {
} }
} }
public DescriptionLOD withRelativeDetail(RelativeDetail relativeDetail) { public DescriptionLoD withRelativeDetail(RelativeDetail relativeDetail) {
switch (relativeDetail) { switch (relativeDetail) {
case EQUAL: case EQUAL:
return this; return this;
@ -68,6 +68,17 @@ public enum DescriptionLOD {
} }
} }
public RelativeDetail getDetailLevelRelativeTo(DescriptionLoD other) {
int compareTo = this.compareTo(other);
if (compareTo < 0) {
return RelativeDetail.LESS;
} else if (compareTo == 0) {
return RelativeDetail.EQUAL;
} else {
return RelativeDetail.MORE;
}
}
public enum RelativeDetail { public enum RelativeDetail {
EQUAL, EQUAL,

View File

@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.timeline.zooming;
import java.util.Objects; import java.util.Objects;
import org.joda.time.Interval; import org.joda.time.Interval;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.timeline.filters.Filter;
import org.sleuthkit.autopsy.timeline.filters.RootFilter; import org.sleuthkit.autopsy.timeline.filters.RootFilter;
/** /**
@ -36,7 +35,7 @@ public class ZoomParams {
private final RootFilter filter; private final RootFilter filter;
private final DescriptionLOD descrLOD; private final DescriptionLoD descrLOD;
public Interval getTimeRange() { public Interval getTimeRange() {
return timeRange; return timeRange;
@ -50,16 +49,15 @@ public class ZoomParams {
return filter; return filter;
} }
public DescriptionLOD getDescriptionLOD() { public DescriptionLoD getDescriptionLOD() {
return descrLOD; return descrLOD;
} }
public ZoomParams(Interval timeRange, EventTypeZoomLevel zoomLevel, RootFilter filter, DescriptionLOD descrLOD) { public ZoomParams(Interval timeRange, EventTypeZoomLevel zoomLevel, RootFilter filter, DescriptionLoD descrLOD) {
this.timeRange = timeRange; this.timeRange = timeRange;
this.typeZoomLevel = zoomLevel; this.typeZoomLevel = zoomLevel;
this.filter = filter; this.filter = filter;
this.descrLOD = descrLOD; this.descrLOD = descrLOD;
} }
public ZoomParams withTimeAndType(Interval timeRange, EventTypeZoomLevel zoomLevel) { public ZoomParams withTimeAndType(Interval timeRange, EventTypeZoomLevel zoomLevel) {
@ -74,7 +72,7 @@ public class ZoomParams {
return new ZoomParams(timeRange, typeZoomLevel, filter, descrLOD); return new ZoomParams(timeRange, typeZoomLevel, filter, descrLOD);
} }
public ZoomParams withDescrLOD(DescriptionLOD descrLOD) { public ZoomParams withDescrLOD(DescriptionLoD descrLOD) {
return new ZoomParams(timeRange, typeZoomLevel, filter, descrLOD); return new ZoomParams(timeRange, typeZoomLevel, filter, descrLOD);
} }
@ -82,7 +80,7 @@ public class ZoomParams {
return new ZoomParams(timeRange, typeZoomLevel, filter, descrLOD); return new ZoomParams(timeRange, typeZoomLevel, filter, descrLOD);
} }
public boolean hasFilter(Filter filterSet) { public boolean hasFilter(RootFilter filterSet) {
return this.filter.equals(filterSet); return this.filter.equals(filterSet);
} }
@ -94,7 +92,7 @@ public class ZoomParams {
return this.timeRange == null ? false : this.timeRange.equals(timeRange); return this.timeRange == null ? false : this.timeRange.equals(timeRange);
} }
public boolean hasDescrLOD(DescriptionLOD newLOD) { public boolean hasDescrLOD(DescriptionLoD newLOD) {
return this.descrLOD.equals(newLOD); return this.descrLOD.equals(newLOD);
} }

View File

@ -97,7 +97,7 @@ public class ZoomSettingsPane extends TitledPane implements TimeLineView {
typeZoomSlider.setMin(1); typeZoomSlider.setMin(1);
typeZoomSlider.setMax(2); typeZoomSlider.setMax(2);
typeZoomSlider.setLabelFormatter(new TypeZoomConverter()); typeZoomSlider.setLabelFormatter(new TypeZoomConverter());
descrLODSlider.setMax(DescriptionLOD.values().length - 1); descrLODSlider.setMax(DescriptionLoD.values().length - 1);
descrLODSlider.setLabelFormatter(new DescrLODConverter()); descrLODSlider.setLabelFormatter(new DescrLODConverter());
descrLODLabel.setText( descrLODLabel.setText(
NbBundle.getMessage(this.getClass(), "ZoomSettingsPane.descrLODLabel.text")); NbBundle.getMessage(this.getClass(), "ZoomSettingsPane.descrLODLabel.text"));
@ -115,7 +115,7 @@ public class ZoomSettingsPane extends TitledPane implements TimeLineView {
synchronized public void setController(TimeLineController controller) { synchronized public void setController(TimeLineController controller) {
this.controller = controller; this.controller = controller;
setModel(controller.getEventsModel()); setModel(controller.getEventsModel());
descrLODSlider.disableProperty().bind(controller.getViewMode().isEqualTo(VisualizationMode.COUNTS)); descrLODSlider.disableProperty().bind(controller.viewModeProperty().isEqualTo(VisualizationMode.COUNTS));
Back back = new Back(controller); Back back = new Back(controller);
backButton.disableProperty().bind(back.disabledProperty()); backButton.disableProperty().bind(back.disabledProperty());
backButton.setOnAction(back); backButton.setOnAction(back);
@ -154,7 +154,7 @@ public class ZoomSettingsPane extends TitledPane implements TimeLineView {
initializeSlider(descrLODSlider, initializeSlider(descrLODSlider,
() -> { () -> {
DescriptionLOD newLOD = DescriptionLOD.values()[Math.round(descrLODSlider.valueProperty().floatValue())]; DescriptionLoD newLOD = DescriptionLoD.values()[Math.round(descrLODSlider.valueProperty().floatValue())];
if (controller.pushDescrLOD(newLOD) == false) { if (controller.pushDescrLOD(newLOD) == false) {
descrLODSlider.setValue(new DescrLODConverter().fromString(filteredEvents.getDescriptionLOD().toString())); descrLODSlider.setValue(new DescrLODConverter().fromString(filteredEvents.getDescriptionLOD().toString()));
} }
@ -244,12 +244,12 @@ public class ZoomSettingsPane extends TitledPane implements TimeLineView {
@Override @Override
public String toString(Double object) { public String toString(Double object) {
return DescriptionLOD.values()[object.intValue()].getDisplayName(); return DescriptionLoD.values()[object.intValue()].getDisplayName();
} }
@Override @Override
public Double fromString(String string) { public Double fromString(String string) {
return new Integer(DescriptionLOD.valueOf(string).ordinal()).doubleValue(); return new Integer(DescriptionLoD.valueOf(string).ordinal()).doubleValue();
} }
} }
} }

View File

@ -31,7 +31,6 @@
<package>com.apple.eio</package> <package>com.apple.eio</package>
<package>com.google.common.annotations</package> <package>com.google.common.annotations</package>
<package>com.google.common.base</package> <package>com.google.common.base</package>
<package>com.google.common.base.internal</package>
<package>com.google.common.cache</package> <package>com.google.common.cache</package>
<package>com.google.common.collect</package> <package>com.google.common.collect</package>
<package>com.google.common.escape</package> <package>com.google.common.escape</package>