Merge pull request #2058 from millmanorama/TL-fix-filter-copying

fix copying of filters
This commit is contained in:
Richard Cordovano 2016-04-07 14:00:24 -04:00
commit e0e2616b62
7 changed files with 46 additions and 27 deletions

View File

@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import javafx.beans.Observable; import javafx.beans.Observable;
@ -150,11 +149,7 @@ public final class FilteredEventsModel {
final ZoomParams zoomParams = requestedZoomParamters.get(); final ZoomParams zoomParams = requestedZoomParamters.get();
if (zoomParams != null) { if (zoomParams != null) {
if (zoomParams.getTypeZoomLevel().equals(requestedTypeZoom.get()) == false synchronized (FilteredEventsModel.this) {
|| zoomParams.getDescriptionLOD().equals(requestedLOD.get()) == false
|| zoomParams.getFilter().equals(requestedFilter.get()) == false
|| Objects.equals(zoomParams.getTimeRange(), requestedTimeRange.get()) == false) {
requestedTypeZoom.set(zoomParams.getTypeZoomLevel()); requestedTypeZoom.set(zoomParams.getTypeZoomLevel());
requestedFilter.set(zoomParams.getFilter()); requestedFilter.set(zoomParams.getFilter());
requestedTimeRange.set(zoomParams.getTimeRange()); requestedTimeRange.set(zoomParams.getTimeRange());

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2014-15 Basis Technology Corp. * Copyright 2014-16 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");
@ -33,10 +33,7 @@ import javafx.collections.ObservableList;
* a {@link CompoundFilter} uses listeners to enforce the following * a {@link CompoundFilter} uses listeners to enforce the following
* relationships between it and its sub-filters: * relationships between it and its sub-filters:
* <ol> * <ol>
* <le>if a filter becomes active, and all its sub-filters were inactive, make * <le>if a filter becomes inactive disable all of its subfilters</le>
* them all active</le>
* <le>if a filter becomes inactive and all its sub-filters were active, make
* them all inactive</le>
* <le>if a sub-filter changes active state set the parent filter active if any * <le>if a sub-filter changes active state set the parent filter active if any
* of its sub-filters are active.</le> * of its sub-filters are active.</le>
* </ol> * </ol>
@ -93,9 +90,7 @@ public abstract class CompoundFilter<SubFilterType extends Filter> extends Abstr
for (int i = 0; i < oneFilter.getSubFilters().size(); i++) { for (int i = 0; i < oneFilter.getSubFilters().size(); i++) {
final SubFilterType subFilter = oneFilter.getSubFilters().get(i); final SubFilterType subFilter = oneFilter.getSubFilters().get(i);
final SubFilterType otherSubFilter = otherFilter.getSubFilters().get(i); final SubFilterType otherSubFilter = otherFilter.getSubFilters().get(i);
if (subFilter.equals(otherSubFilter) == false if (subFilter.equals(otherSubFilter) == false) {
|| subFilter.isDisabled() != otherSubFilter.isDisabled()
|| subFilter.isSelected() != otherSubFilter.isSelected()) {
return false; return false;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2015 Basis Technology Corp. * Copyright 2015-16 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");
@ -37,6 +37,7 @@ public class DataSourcesFilter extends UnionFilter<DataSourceFilter> {
public DataSourcesFilter copyOf() { public DataSourcesFilter copyOf() {
final DataSourcesFilter filterCopy = new DataSourcesFilter(); final DataSourcesFilter filterCopy = new DataSourcesFilter();
filterCopy.setSelected(isSelected()); filterCopy.setSelected(isSelected());
filterCopy.setDisabled(isDisabled());
//add a copy of each subfilter //add a copy of each subfilter
this.getSubFilters().forEach((DataSourceFilter t) -> { this.getSubFilters().forEach((DataSourceFilter t) -> {
filterCopy.addSubFilter(t.copyOf()); filterCopy.addSubFilter(t.copyOf());
@ -87,7 +88,7 @@ public class DataSourcesFilter extends UnionFilter<DataSourceFilter> {
} }
final DataSourcesFilter other = (DataSourcesFilter) obj; final DataSourcesFilter other = (DataSourcesFilter) obj;
if (isSelected() != other.isSelected()) { if (isActive() != other.isActive()) {
return false; return false;
} }

View File

@ -1,7 +1,20 @@
/* /*
* 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-16 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;
@ -30,6 +43,7 @@ public class HashHitsFilter extends UnionFilter<HashSetFilter> {
public HashHitsFilter copyOf() { public HashHitsFilter copyOf() {
HashHitsFilter filterCopy = new HashHitsFilter(); HashHitsFilter filterCopy = new HashHitsFilter();
filterCopy.setSelected(isSelected()); filterCopy.setSelected(isSelected());
filterCopy.setDisabled(isDisabled());
//add a copy of each subfilter //add a copy of each subfilter
this.getSubFilters().forEach((HashSetFilter t) -> { this.getSubFilters().forEach((HashSetFilter t) -> {
filterCopy.addSubFilter(t.copyOf()); filterCopy.addSubFilter(t.copyOf());
@ -65,7 +79,7 @@ public class HashHitsFilter extends UnionFilter<HashSetFilter> {
} }
final HashHitsFilter other = (HashHitsFilter) obj; final HashHitsFilter other = (HashHitsFilter) obj;
if (isSelected() != other.isSelected()) { if (isActive() != other.isActive()) {
return false; return false;
} }

View File

@ -1,7 +1,20 @@
/* /*
* 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-16 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;
@ -31,6 +44,7 @@ public class TagsFilter extends UnionFilter<TagNameFilter> {
public TagsFilter copyOf() { public TagsFilter copyOf() {
TagsFilter filterCopy = new TagsFilter(); TagsFilter filterCopy = new TagsFilter();
filterCopy.setSelected(isSelected()); filterCopy.setSelected(isSelected());
filterCopy.setDisabled(isDisabled());
//add a copy of each subfilter //add a copy of each subfilter
this.getSubFilters().forEach((TagNameFilter t) -> { this.getSubFilters().forEach((TagNameFilter t) -> {
filterCopy.addSubFilter(t.copyOf()); filterCopy.addSubFilter(t.copyOf());
@ -66,7 +80,7 @@ public class TagsFilter extends UnionFilter<TagNameFilter> {
} }
final TagsFilter other = (TagsFilter) obj; final TagsFilter other = (TagsFilter) obj;
if (isSelected() != other.isSelected()) { if (isActive() != other.isActive()) {
return false; return false;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013-15 Basis Technology Corp. * Copyright 2013-16 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");
@ -126,7 +126,7 @@ public class TypeFilter extends UnionFilter<TypeFilter> {
} }
final TypeFilter other = (TypeFilter) obj; final TypeFilter other = (TypeFilter) obj;
if (isSelected() != other.isSelected()) { if (isActive() != other.isActive()) {
return false; return false;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2014-15 Basis Technology Corp. * Copyright 2014-16 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");