Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
FileExtMismatchOptionsPanelController.java
Go to the documentation of this file.
1 /*
2  * To change this template, choose Tools | Templates
3  * and open the template in the editor.
4  */
5 package org.sleuthkit.autopsy.modules.fileextmismatch;
6 
7 import java.beans.PropertyChangeEvent;
8 import java.beans.PropertyChangeListener;
9 import java.beans.PropertyChangeSupport;
10 import javax.swing.JComponent;
11 import org.netbeans.spi.options.OptionsPanelController;
12 import org.openide.util.HelpCtx;
13 import org.openide.util.Lookup;
15 
16 @OptionsPanelController.TopLevelRegistration(
17  categoryName = "#OptionsCategory_Name_FileExtMismatchOptions",
18  iconBase = "org/sleuthkit/autopsy/modules/fileextmismatch/options-icon.png",
19  position = 5,
20  keywords = "#OptionsCategory_FileExtMismatch",
21  keywordsCategory = "KeywordSearchOptions")
22 public final class FileExtMismatchOptionsPanelController extends OptionsPanelController {
23 
24  private FileExtMismatchSettingsPanel panel;
25  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
26  private boolean changed;
27  private static final Logger logger = Logger.getLogger(FileExtMismatchOptionsPanelController.class.getName());
28 
32  @Override
33  public void update() {
34  getPanel().load();
35  changed = false;
36  }
37 
43  @Override
44  public void applyChanges() {
45  if (changed) {
46  getPanel().ok();
47  changed = false;
48  }
49  }
50 
56  @Override
57  public void cancel() {
58  getPanel().cancel();
59  }
60 
61  @Override
62  public boolean isValid() {
63  return getPanel().valid();
64  }
65 
72  @Override
73  public boolean isChanged() {
74  return changed;
75  }
76 
77  @Override
78  public HelpCtx getHelpCtx() {
79  return null; // new HelpCtx("...ID") if you have a help set
80  }
81 
82  @Override
83  public JComponent getComponent(Lookup masterLookup) {
84  return getPanel();
85  }
86 
87  @Override
88  public void addPropertyChangeListener(PropertyChangeListener l) {
89  pcs.addPropertyChangeListener(l);
90  }
91 
92  @Override
93  public void removePropertyChangeListener(PropertyChangeListener l) {
94  pcs.removePropertyChangeListener(l);
95  }
96 
97  private FileExtMismatchSettingsPanel getPanel() {
98  if (panel == null) {
99  panel = new FileExtMismatchSettingsPanel();
100  panel.addPropertyChangeListener(new PropertyChangeListener() {
101  @Override
102  public void propertyChange(PropertyChangeEvent evt) {
103  if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) {
104  changed();
105  }
106  }
107  });
108  }
109  return panel;
110  }
111 
112  void changed() {
113  if (!changed) {
114  changed = true;
115 
116  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
117  }
118 
119  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
120  }
121 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:161

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.