Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
HideDescriptionAction.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.detailview;
20 
21 import javafx.scene.image.Image;
22 import javafx.scene.image.ImageView;
23 import org.controlsfx.control.action.Action;
24 import org.openide.util.NbBundle;
27 import org.sleuthkit.datamodel.TimelineLevelOfDetail;
28 
33 @NbBundle.Messages(value = {"HideDescriptionAction.displayName=Hide",
34  "HideDescriptionAction.displayMsg=Hide this group from the details view."})
35 class HideDescriptionAction extends Action {
36 
37  private static final Image HIDE = new Image("/org/sleuthkit/autopsy/timeline/images/eye--minus.png"); // NON-NLS
38 
39  HideDescriptionAction(String description, TimelineLevelOfDetail descriptionLoD, DetailsChart chart) {
40  super(Bundle.HideDescriptionAction_displayName());
41  setLongText(Bundle.HideDescriptionAction_displayMsg());
42  setGraphic(new ImageView(HIDE));
43 
44  setEventHandler(actionEvent -> {
45  /*
46  * See if there is already a quick-hide-filter for the given
47  * description by making a test one and checking all the existing
48  * filters against it. If there is not already an existing filter,
49  * hook up the listeners on the test filter and add the test filter
50  * as the new filter for the given description. Set the (new) filter
51  * active.
52  */
53  final DescriptionFilterState testFilter
54  = new DescriptionFilterState(
55  new DescriptionFilter(descriptionLoD, description));
56 
57  DescriptionFilterState descriptionFilter = chart.getController().getQuickHideFilters().stream()
58  .filter(otherFilterState -> testFilter.getFilter().equals(otherFilterState.getFilter()))
59  .findFirst()
60  .orElseGet(() -> {
61  //if the selected state of the filter changes, do chart layout
62  testFilter.selectedProperty().addListener(selectedProperty -> chart.requestLayout());
63  chart.getController().getQuickHideFilters().add(testFilter);
64  return testFilter;
65  });
66  descriptionFilter.setSelected(true);
67  });
68  }
69 }

Copyright © 2012-2021 Basis Technology. Generated on: Thu Sep 30 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.