Autopsy  4.15.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
FilterCheckBoxCellFactory.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2015-18 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.timeline.ui.filtering;
20 
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;
28 
29 class FilterCheckBoxCellFactory< X extends FilterState< ?>> extends AbstractFXCellFactory<X, X> {
30 
31  private final CheckBox checkBox = new CheckBox();
32  private Property<Boolean> selectedProperty;
33  private ReadOnlyBooleanProperty disabledProperty;
34 
35  @Override
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;
40  }
41  if (disabledProperty != null) {
42  checkBox.disableProperty().unbind();
43  disabledProperty = null;
44  }
45 
46  if (item == null) {
47  cell.setGraphic(null);
48  } else {
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);
55  }
56 
57  cell.setGraphic(checkBox);
58  }
59  }
60 }
abstract void configureCell(IndexedCell<?extends Y > cell, Y item, boolean empty, Supplier< X > supplier)

Copyright © 2012-2020 Basis Technology. Generated on: Mon Jul 6 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.