Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
InterestingItemDefsOptionsPanelController.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 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.modules.interestingitems;
20 
21 import java.beans.PropertyChangeListener;
22 import java.beans.PropertyChangeSupport;
23 import javax.swing.JComponent;
24 import javax.swing.SwingUtilities;
25 import org.netbeans.spi.options.OptionsPanelController;
26 import org.openide.util.HelpCtx;
27 import org.openide.util.Lookup;
28 
29 @OptionsPanelController.TopLevelRegistration(
30  categoryName = "#OptionsCategory_Name_InterestingItemDefinitions",
31  iconBase = "org/sleuthkit/autopsy/images/interesting_item_32x32.png",
32  keywords = "#OptionsCategory_Keywords_InterestingItemDefinitions",
33  keywordsCategory = "InterestingItemDefinitions",
34  position = 7
35 )
36 public final class InterestingItemDefsOptionsPanelController extends OptionsPanelController {
37 
38  private InterestingItemDefsPanel panel;
39  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
40  private boolean changed;
41 
42  @Override
43  public void update() {
44  getPanel().load();
45  changed = false;
46  }
47 
48  @Override
49  public void applyChanges() {
50  SwingUtilities.invokeLater(new Runnable() {
51  @Override
52  public void run() {
53  getPanel().store();
54  changed = false;
55  }
56  });
57  }
58 
59  @Override
60  public void cancel() {
61  // need not do anything special, if no changes have been persisted yet
62  }
63 
64  @Override
65  public boolean isValid() {
66  return true;
67  }
68 
69  @Override
70  public boolean isChanged() {
71  return changed;
72  }
73 
74  @Override
75  public HelpCtx getHelpCtx() {
76  return null;
77  }
78 
79  @Override
80  public JComponent getComponent(Lookup masterLookup) {
81  return getPanel();
82  }
83 
84  @Override
85  public void addPropertyChangeListener(PropertyChangeListener l) {
86  pcs.addPropertyChangeListener(l);
87  }
88 
89  @Override
90  public void removePropertyChangeListener(PropertyChangeListener l) {
91  pcs.removePropertyChangeListener(l);
92  }
93 
94  private InterestingItemDefsPanel getPanel() {
95  if (panel == null) {
96  panel = new InterestingItemDefsPanel();
97  }
98  return panel;
99  }
100 
101  void changed() {
102  if (!changed) {
103  changed = true;
104  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
105  }
106  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
107  }
108 
109 }

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.