Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
CTOptionsPanelController.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2023 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 com.basistech.df.cybertriage.autopsy.ctoptions;
20
21import java.beans.PropertyChangeEvent;
22import java.beans.PropertyChangeListener;
23import java.beans.PropertyChangeSupport;
24import javax.swing.JComponent;
25import org.netbeans.spi.options.OptionsPanelController;
26import org.openide.util.HelpCtx;
27import org.openide.util.Lookup;
28
32@OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_CyberTriage",
33 iconBase = "com/basistech/df/cybertriage/autopsy/images/logo.png",
34 position = 999999,
35 keywords = "#OptionsCategory_Keywords_CyberTriage",
36 keywordsCategory = "CyberTriage")
37public final class CTOptionsPanelController extends OptionsPanelController {
38
40 private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
41 private boolean changed;
42
46 @Override
47 public void update() {
49 changed = false;
50 }
51
57 @Override
58 public void applyChanges() {
59 if (changed) {
61 changed = false;
62 }
63 }
64
70 @Override
71 public void cancel() {
72 }
73
74 @Override
75 public boolean isValid() {
76 return getPanel().valid();
77 }
78
85 @Override
86 public boolean isChanged() {
87 return changed;
88 }
89
90 @Override
91 public HelpCtx getHelpCtx() {
92 return null;
93 }
94
95 @Override
96 public JComponent getComponent(Lookup masterLookup) {
97 return getPanel();
98 }
99
100 @Override
101 public void addPropertyChangeListener(PropertyChangeListener l) {
102 pcs.addPropertyChangeListener(l);
103 }
104
105 @Override
106 public void removePropertyChangeListener(PropertyChangeListener l) {
107 pcs.removePropertyChangeListener(l);
108 }
109
111 if (panel == null) {
112 panel = new CTOptionsPanel();
113 panel.addPropertyChangeListener(new PropertyChangeListener() {
114 @Override
115 public void propertyChange(PropertyChangeEvent evt) {
116 if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) {
117 changed();
118 }
119 }
120 });
121 }
122 return panel;
123 }
124
125 void changed() {
126 if (!changed) {
127 changed = true;
128 pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
129 }
130 pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
131
132 }
133}

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