mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #902 from millmanorama/develop
put FilterCheckBoxCell update on JFX thread; some minor cleanup
This commit is contained in:
commit
c3953a195e
@ -1,53 +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.filtering;
|
||||
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.TreeTableCell;
|
||||
import org.sleuthkit.autopsy.timeline.filters.AbstractFilter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class FilterCheckBoxCell extends TreeTableCell<AbstractFilter, AbstractFilter> {
|
||||
|
||||
private CheckBox checkBox;
|
||||
|
||||
public FilterCheckBoxCell() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateItem(AbstractFilter item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item == null) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
checkBox = null;
|
||||
} else {
|
||||
setText(item.getDisplayName());
|
||||
|
||||
checkBox = new CheckBox();
|
||||
checkBox.selectedProperty().bindBidirectional(item.getActiveProperty());
|
||||
checkBox.disableProperty().bind(item.getDisabledProperty());
|
||||
setGraphic(checkBox);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -18,15 +18,16 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.timeline.ui.filtering;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ContextMenu;
|
||||
import javafx.scene.control.Menu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.control.TreeTableCell;
|
||||
import javafx.scene.control.TreeTableColumn;
|
||||
import javafx.scene.control.TreeTableRow;
|
||||
import javafx.scene.control.TreeTableView;
|
||||
@ -47,12 +48,6 @@ import org.sleuthkit.autopsy.timeline.filters.Filter;
|
||||
*/
|
||||
public class FilterSetPanel extends BorderPane implements TimeLineView {
|
||||
|
||||
@FXML
|
||||
private ResourceBundle resources;
|
||||
|
||||
@FXML
|
||||
private URL location;
|
||||
|
||||
@FXML
|
||||
private Button applyButton;
|
||||
|
||||
@ -163,10 +158,36 @@ public class FilterSetPanel extends BorderPane implements TimeLineView {
|
||||
this.filteredEvents.filter().addListener((Observable o) -> {
|
||||
refresh();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
private void refresh() {
|
||||
filterTreeTable.setRoot(new FilterTreeItem(this.filteredEvents.filter().get().copyOf()));
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link TreeTableCell} that represents the active state of a
|
||||
* {@link AbstractFilter} as a checkbox
|
||||
*/
|
||||
private static class FilterCheckBoxCell extends TreeTableCell<AbstractFilter, AbstractFilter> {
|
||||
|
||||
private final CheckBox checkBox = new CheckBox();
|
||||
|
||||
@Override
|
||||
protected void updateItem(AbstractFilter item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
Platform.runLater(() -> {
|
||||
if (item == null) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
checkBox.selectedProperty().unbind();
|
||||
checkBox.disableProperty().unbind();
|
||||
} else {
|
||||
setText(item.getDisplayName());
|
||||
checkBox.selectedProperty().bindBidirectional(item.getActiveProperty());
|
||||
checkBox.disableProperty().bind(item.getDisabledProperty());
|
||||
setGraphic(checkBox);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user