19 package org.sleuthkit.autopsy.timeline.ui.filtering;
21 import java.util.function.Supplier;
22 import javafx.beans.property.Property;
23 import javafx.beans.property.ReadOnlyBooleanProperty;
24 import javafx.scene.control.CheckBox;
25 import javafx.scene.control.IndexedCell;
29 class FilterCheckBoxCellFactory< X
extends FilterState< ?>> extends AbstractFXCellFactory<X, X> {
31 private final CheckBox checkBox =
new CheckBox();
32 private Property<Boolean> selectedProperty;
33 private ReadOnlyBooleanProperty disabledProperty;
36 protected void configureCell(IndexedCell<? extends X> cell, X item,
boolean empty, Supplier<X> supplier) {
37 if (selectedProperty != null) {
38 checkBox.selectedProperty().unbindBidirectional(selectedProperty);
39 selectedProperty = null;
41 if (disabledProperty != null) {
42 checkBox.disableProperty().unbind();
43 disabledProperty = null;
47 cell.setGraphic(null);
49 checkBox.setText(item.getDisplayName());
50 disabledProperty = item.disabledProperty();
51 checkBox.disableProperty().bind(disabledProperty);
52 if (item.selectedProperty() instanceof Property<?>) {
53 selectedProperty = item.selectedProperty();
54 checkBox.selectedProperty().bindBidirectional(selectedProperty);
57 cell.setGraphic(checkBox);
abstract void configureCell(IndexedCell<?extends Y > cell, Y item, boolean empty, Supplier< X > supplier)