Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
IngestOptionsPanelController.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 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.ingest;
20 
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.beans.PropertyChangeSupport;
24 import javax.swing.JComponent;
25 import javax.swing.SwingUtilities;
26 import org.netbeans.spi.options.OptionsPanelController;
27 import org.openide.util.HelpCtx;
28 import org.openide.util.Lookup;
29 
30 @OptionsPanelController.TopLevelRegistration(
31  categoryName = "#OptionsCategory_Name_IngestOptions",
32  iconBase = "org/sleuthkit/autopsy/images/file_ingest_filter32x32.png",
33  position = 3,
34  keywords = "#OptionsCategory_Keywords_IngestOptions",
35  keywordsCategory = "IngestOptions")
36 
37 public class IngestOptionsPanelController extends OptionsPanelController {
38 
40  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
41  private boolean changed;
42 
43  @Override
44  public void update() {
45  getPanel().load();
46  changed = false;
47  }
48 
55  if (panel == null) {
56  panel = new IngestOptionsPanel();
57  panel.addPropertyChangeListener(new PropertyChangeListener() {
58  @Override
59  public void propertyChange(PropertyChangeEvent evt) {
60  if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) {
61  changed();
62  }
63  }
64  });
65  }
66  return panel;
67  }
68 
69  @Override
70  public void applyChanges() {
71  if (changed) {
72  SwingUtilities.invokeLater(new Runnable() {
73  @Override
74  public void run() {
75  getPanel().store();
76  changed = false;
77  }
78  });
79  }
80  }
81 
82  @Override
83  public void cancel() {
84  getPanel().cancel();
85  }
86 
87  @Override
88  public boolean isValid() {
89  return getPanel().valid();
90  }
91 
92  @Override
93  public boolean isChanged() {
94  return changed;
95  }
96 
97  @Override
98  public JComponent getComponent(Lookup lkp) {
99  return getPanel();
100  }
101 
102  @Override
103  public HelpCtx getHelpCtx() {
104  return null;
105  }
106 
107  @Override
108  public void addPropertyChangeListener(PropertyChangeListener pl) {
109  pcs.addPropertyChangeListener(pl);
110  }
111 
112  @Override
113  public void removePropertyChangeListener(PropertyChangeListener pl) {
114  pcs.removePropertyChangeListener(pl);
115  }
116 
117  void changed() {
118  if (!changed) {
119  changed = true;
120  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
121  }
122  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
123  }
124 }
void addPropertyChangeListener(PropertyChangeListener l)

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