mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
`fix RootFilterState intersection
This commit is contained in:
parent
02ce6ee62c
commit
16c73d45b0
@ -23,6 +23,7 @@ import com.google.common.cache.LoadingCache;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -89,7 +90,6 @@ import org.sleuthkit.datamodel.timeline.TimelineFilter.TagsFilter;
|
|||||||
import org.sleuthkit.datamodel.timeline.TimelineFilter.TextFilter;
|
import org.sleuthkit.datamodel.timeline.TimelineFilter.TextFilter;
|
||||||
import org.sleuthkit.datamodel.timeline.TimelineFilter.TypeFilter;
|
import org.sleuthkit.datamodel.timeline.TimelineFilter.TypeFilter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class acts as the model for a TimelineView
|
* This class acts as the model for a TimelineView
|
||||||
*
|
*
|
||||||
@ -192,7 +192,7 @@ public final class FilteredEventsModel {
|
|||||||
* the EvenType of the level specified in the zoomState
|
* the EvenType of the level specified in the zoomState
|
||||||
*
|
*
|
||||||
* @param zoomState The params that control what events to count and how to
|
* @param zoomState The params that control what events to count and how to
|
||||||
* organize the returned map
|
* organize the returned map
|
||||||
*
|
*
|
||||||
* @return a map from event type( of the requested level) to event counts
|
* @return a map from event type( of the requested level) to event counts
|
||||||
*
|
*
|
||||||
@ -286,7 +286,6 @@ public final class FilteredEventsModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a read only view of the time range currently in view.
|
* Get a read only view of the time range currently in view.
|
||||||
*
|
*
|
||||||
@ -407,13 +406,13 @@ public final class FilteredEventsModel {
|
|||||||
public List<Long> getEventIDs(Interval timeRange, TimelineFilter filter) throws TskCoreException {
|
public List<Long> getEventIDs(Interval timeRange, TimelineFilter filter) throws TskCoreException {
|
||||||
|
|
||||||
final Interval overlap;
|
final Interval overlap;
|
||||||
final RootFilterState intersect;
|
RootFilterState intersection;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
overlap = getSpanningInterval().overlap(timeRange);
|
overlap = getSpanningInterval().overlap(timeRange);
|
||||||
intersect = getFilterState().copyOf();
|
intersection = getFilterState().intersect(filter);
|
||||||
}
|
}
|
||||||
intersect.getFilter().getSubFilters().add(filter);
|
|
||||||
return eventManager.getEventIDs(overlap, intersect.getActiveFilter());
|
return eventManager.getEventIDs(overlap, intersection.getActiveFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,8 +286,7 @@ final class EventCountsChart extends StackedBarChart<String, Number> implements
|
|||||||
* stacked bar chart.
|
* stacked bar chart.
|
||||||
*
|
*
|
||||||
* Concurrency Policy: This only accesses immutable state or javafx nodes
|
* Concurrency Policy: This only accesses immutable state or javafx nodes
|
||||||
* (from the jfx thread) and the internally synchronized
|
* (from the jfx thread) and the internally synchronized TimeLineController
|
||||||
* {@link TimeLineController}
|
|
||||||
*
|
*
|
||||||
* TODO: review for thread safety -jm
|
* TODO: review for thread safety -jm
|
||||||
*/
|
*/
|
||||||
|
@ -33,9 +33,9 @@ import org.sleuthkit.datamodel.timeline.TimelineFilter.CompoundFilter;
|
|||||||
*/
|
*/
|
||||||
public interface CompoundFilterState<SubFilterType extends TimelineFilter, C extends CompoundFilter<SubFilterType>> extends FilterState<C> {
|
public interface CompoundFilterState<SubFilterType extends TimelineFilter, C extends CompoundFilter<SubFilterType>> extends FilterState<C> {
|
||||||
|
|
||||||
ObservableList<? extends FilterState< ? extends SubFilterType>> getSubFilterStates();
|
ObservableList<? extends FilterState<? extends SubFilterType>> getSubFilterStates();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundFilterState<SubFilterType, C> copyOf();
|
public CompoundFilterState<SubFilterType, C> copyOf();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class CompoundFilterStateImpl<SubFilterType extends TimelineFilter, C extends Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addSubFilterState(FilterState<SubFilterType> newFilterModel) {
|
private void addSubFilterState(FilterState<SubFilterType> newFilterModel) {
|
||||||
subFilterStates.add(newFilterModel);
|
getSubFilterStates().add(newFilterModel);
|
||||||
newFilterModel.selectedProperty().addListener(selectedProperty -> {
|
newFilterModel.selectedProperty().addListener(selectedProperty -> {
|
||||||
//set this compound filter model selected af any of the subfilters are selected.
|
//set this compound filter model selected af any of the subfilters are selected.
|
||||||
setSelected(getSubFilterStates().stream().anyMatch(FilterState::isSelected));
|
setSelected(getSubFilterStates().stream().anyMatch(FilterState::isSelected));
|
||||||
|
@ -22,7 +22,9 @@ import java.util.Collections;
|
|||||||
import javafx.beans.property.ReadOnlyBooleanProperty;
|
import javafx.beans.property.ReadOnlyBooleanProperty;
|
||||||
import javafx.beans.property.ReadOnlyBooleanWrapper;
|
import javafx.beans.property.ReadOnlyBooleanWrapper;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import org.python.google.common.collect.Lists;
|
||||||
import org.sleuthkit.datamodel.TimelineManager;
|
import org.sleuthkit.datamodel.TimelineManager;
|
||||||
import org.sleuthkit.datamodel.timeline.TimelineFilter;
|
import org.sleuthkit.datamodel.timeline.TimelineFilter;
|
||||||
import org.sleuthkit.datamodel.timeline.TimelineFilter.DataSourceFilter;
|
import org.sleuthkit.datamodel.timeline.TimelineFilter.DataSourceFilter;
|
||||||
@ -83,6 +85,33 @@ public class RootFilterState implements FilterState<RootFilter>, CompoundFilterS
|
|||||||
dataSourcesFilterState, typeFilterState);
|
dataSourcesFilterState, typeFilterState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a new root filter that intersects the given filter with this one.
|
||||||
|
*
|
||||||
|
* @param otherFilter
|
||||||
|
*
|
||||||
|
* @return A new RootFilter model that intersects the given filter with this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
public RootFilterState intersect(TimelineFilter otherFilter) {
|
||||||
|
RootFilterState copyOf = copyOf();
|
||||||
|
copyOf.addSubFilterState(otherFilter);
|
||||||
|
return copyOf;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSubFilterState(TimelineFilter subFilter) {
|
||||||
|
|
||||||
|
if (subFilter instanceof TimelineFilter.CompoundFilter<?>) {
|
||||||
|
CompoundFilterStateImpl<? extends TimelineFilter, ? extends TimelineFilter.CompoundFilter<? extends TimelineFilter>> compoundFilterStateImpl = new CompoundFilterStateImpl<>((TimelineFilter.CompoundFilter<?>) subFilter);
|
||||||
|
getSubFilterStates().add(compoundFilterStateImpl);
|
||||||
|
compoundFilterStateImpl.setSelected(Boolean.TRUE);
|
||||||
|
} else {
|
||||||
|
DefaultFilterState<TimelineFilter> defaultFilterState = new DefaultFilterState<>(subFilter);
|
||||||
|
getSubFilterStates().add(defaultFilterState);
|
||||||
|
defaultFilterState.setSelected(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RootFilterState copyOf() {
|
public RootFilterState copyOf() {
|
||||||
return new RootFilterState(getFilter().copyOf(),
|
return new RootFilterState(getFilter().copyOf(),
|
||||||
@ -126,7 +155,7 @@ public class RootFilterState implements FilterState<RootFilter>, CompoundFilterS
|
|||||||
textFilterState.getActiveFilter(),
|
textFilterState.getActiveFilter(),
|
||||||
typeFilterState.getActiveFilter(),
|
typeFilterState.getActiveFilter(),
|
||||||
dataSourcesFilterState.getActiveFilter(),
|
dataSourcesFilterState.getActiveFilter(),
|
||||||
Collections.emptySet());
|
Lists.transform(subFilterStates, FilterState::getActiveFilter));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user