Autopsy 4.22.1
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 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 */
19package org.sleuthkit.autopsy.modules.interestingitems;
20
21import java.beans.PropertyChangeEvent;
22import java.beans.PropertyChangeListener;
23import java.beans.PropertyChangeSupport;
24import javax.swing.JComponent;
25import javax.swing.SwingUtilities;
26import org.netbeans.spi.options.OptionsPanelController;
27import org.openide.util.HelpCtx;
28import org.openide.util.Lookup;
29
30@OptionsPanelController.TopLevelRegistration(
31 categoryName = "#OptionsCategory_Name_InterestingItemDefinitions",
32 iconBase = "org/sleuthkit/autopsy/images/interesting_item_32x32.png",
33 keywords = "#OptionsCategory_Keywords_InterestingItemDefinitions",
34 keywordsCategory = "InterestingItemDefinitions",
35 position = 11
36)
37public final class InterestingItemDefsOptionsPanelController extends OptionsPanelController {
38
40 private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
41 private boolean changed;
42
46 @Override
47 public void update() {
48 getPanel().load();
49 changed = false;
50 }
51
57 @Override
58 public void applyChanges() {
59 if (changed) {
60 SwingUtilities.invokeLater(new Runnable() {
61 @Override
62 public void run() {
63 getPanel().store();
64 changed = false;
65 }
66 });
67 }
68 }
69
75 @Override
76 public void cancel() {
77 // need not do anything special, if no changes have been persisted yet
78 }
79
80 @Override
81 public boolean isValid() {
82 return true;
83 }
84
91 @Override
92 public boolean isChanged() {
93 return changed;
94 }
95
96 @Override
97 public HelpCtx getHelpCtx() {
98 return null;
99 }
100
101 @Override
102 public JComponent getComponent(Lookup masterLookup) {
103 return getPanel();
104 }
105
106 @Override
107 public void addPropertyChangeListener(PropertyChangeListener l) {
108 pcs.addPropertyChangeListener(l);
109 }
110
111 @Override
112 public void removePropertyChangeListener(PropertyChangeListener l) {
113 pcs.removePropertyChangeListener(l);
114 }
115
117 if (panel == null) {
119 panel.addPropertyChangeListener(new PropertyChangeListener() {
120 @Override
121 public void propertyChange(PropertyChangeEvent evt) {
122 if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) {
123 changed();
124 }
125 }
126 });
127 }
128 return panel;
129 }
130
131 void changed() {
132 if (!changed) {
133 changed = true;
134 pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
135 }
136 pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
137 }
138
139}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.