Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
HideDescriptionAction.java
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 package org.sleuthkit.autopsy.timeline.ui.detailview;
7 
8 import javafx.scene.image.Image;
9 import javafx.scene.image.ImageView;
10 import org.controlsfx.control.action.Action;
11 import org.openide.util.NbBundle;
14 
19 @NbBundle.Messages(value = {"HideDescriptionAction.displayName=Hide",
20  "HideDescriptionAction.displayMsg=Hide this group from the details view."})
21 class HideDescriptionAction extends Action {
22 
23  private static final Image HIDE = new Image("/org/sleuthkit/autopsy/timeline/images/eye--minus.png"); // NON-NLS
24 
25  HideDescriptionAction(String description, DescriptionLoD descriptionLoD, DetailsChart chart) {
26  super(Bundle.HideDescriptionAction_displayName());
27  setLongText(Bundle.HideDescriptionAction_displayMsg());
28  setGraphic(new ImageView(HIDE));
29 
30  setEventHandler(actionEvent -> {
31  /*
32  * See if there is already a quick-hide-filter for the given
33  * description by making a test one and checking all the existing
34  * filters against it. If there is not already an existing filter,
35  * hook up the listeners on the test filter and add the test filter
36  * as the new filter for the given description. Set the (new) filter
37  * active.
38  */
39  final DescriptionFilter testFilter = new DescriptionFilter(descriptionLoD, description, DescriptionFilter.FilterMode.EXCLUDE);
40  DescriptionFilter descriptionFilter = chart.getController().getQuickHideFilters().stream()
41  .filter(testFilter::equals).findFirst()
42  .orElseGet(() -> {
43  //if the selected state of the filter changes, do chart layout
44  testFilter.selectedProperty().addListener(selectedProperty -> chart.requestLayout());
45  chart.getController().getQuickHideFilters().add(testFilter);
46  return testFilter;
47  });
48  descriptionFilter.setSelected(true);
49  });
50  }
51 }

Copyright © 2012-2016 Basis Technology. Generated on: Tue Oct 25 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.