Autopsy  4.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 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.SimpleBooleanProperty;
23 import javafx.beans.value.ObservableBooleanValue;
24 import javafx.scene.control.CheckBox;
25 import javafx.scene.control.IndexedCell;
28 
29 class FilterCheckBoxCellFactory<X extends AbstractFilter> extends AbstractFXCellFactory<X, X> {
30 
31  private final CheckBox checkBox = new CheckBox();
32  private SimpleBooleanProperty selectedProperty;
33  private ObservableBooleanValue 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  }
40  if (disabledProperty != null) {
41  checkBox.disableProperty().unbind();//disabledProperty);
42  }
43 
44  if (item == null) {
45  cell.setGraphic(null);
46  } else {
47  checkBox.setText(item.getDisplayName());
48  selectedProperty = item.selectedProperty();
49  checkBox.selectedProperty().bindBidirectional(selectedProperty);
50  disabledProperty = item.disabledProperty();
51  checkBox.disableProperty().bind(disabledProperty);
52  cell.setGraphic(checkBox);
53  }
54  }
55 }

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.