fix updating of datasource filter when new datasources are added

This commit is contained in:
jmillman 2015-07-24 14:03:54 -04:00
parent bf41e5b523
commit 2f64f75dfa
3 changed files with 15 additions and 4 deletions

View File

@ -98,7 +98,7 @@ public class EventsRepository {
private final ObservableMap<Long, String> datasourcesMap = FXCollections.observableHashMap(); private final ObservableMap<Long, String> datasourcesMap = FXCollections.observableHashMap();
private final Case autoCase; private final Case autoCase;
public ObservableMap<Long, String> getDatasourcesMap() { synchronized public ObservableMap<Long, String> getDatasourcesMap() {
return datasourcesMap; return datasourcesMap;
} }
@ -405,7 +405,7 @@ public class EventsRepository {
* *
* @param skCase * @param skCase
*/ */
private void populateDataSourceMap(SleuthkitCase skCase) { synchronized private void populateDataSourceMap(SleuthkitCase skCase) {
//because there is no way to remove a datasource we only add to this map. //because there is no way to remove a datasource we only add to this map.
for (Long id : eventDB.getDataSourceIDs()) { for (Long id : eventDB.getDataSourceIDs()) {
try { try {

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.timeline.ui.filtering; package org.sleuthkit.autopsy.timeline.ui.filtering;
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;
@ -177,7 +178,8 @@ public class FilterSetPanel extends BorderPane implements TimeLineView {
} }
private void refresh() { private void refresh() {
filterTreeTable.setRoot(new FilterTreeItem(this.filteredEvents.filter().get().copyOf(), expansionMap)); Platform.runLater(() -> {
filterTreeTable.setRoot(new FilterTreeItem(filteredEvents.filter().get().copyOf(), expansionMap));
});
} }
} }

View File

@ -1,6 +1,7 @@
package org.sleuthkit.autopsy.timeline.ui.filtering; package org.sleuthkit.autopsy.timeline.ui.filtering;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.collections.ListChangeListener;
import javafx.collections.MapChangeListener; import javafx.collections.MapChangeListener;
import javafx.collections.ObservableMap; import javafx.collections.ObservableMap;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
@ -42,6 +43,14 @@ public class FilterTreeItem extends TreeItem<Filter> {
for (Filter af : cf.getSubFilters()) { for (Filter af : cf.getSubFilters()) {
getChildren().add(new FilterTreeItem(af, expansionMap)); getChildren().add(new FilterTreeItem(af, expansionMap));
} }
cf.getSubFilters().addListener((ListChangeListener.Change<? extends Filter> c) -> {
while (c.next()) {
for (Filter af : c.getAddedSubList()) {
getChildren().add(new FilterTreeItem(af, expansionMap));
}
}
});
} }
} }
} }