Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
GeolocationOptionPanelController.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 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.geolocation;
20 
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.beans.PropertyChangeSupport;
24 import javax.swing.JComponent;
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_Geolocation",
31  iconBase = "org/sleuthkit/autopsy/images/blueGeo32.png",
32  keywords = "#OptionsCategory_Keywords_Geolocation",
33  keywordsCategory = "Geolcoation",
34  position = 18
35 )
39 public final class GeolocationOptionPanelController extends OptionsPanelController {
40 
41  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
42  private boolean changed;
43  private GeolocationSettingsPanel panel;
44 
50  GeolocationSettingsPanel getPanel() {
51  if (panel == null) {
52  panel = new GeolocationSettingsPanel();
53  panel.addPropertyChangeListener(new PropertyChangeListener() {
54  @Override
55  public void propertyChange(PropertyChangeEvent evt) {
56  if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) {
57  updateChanged();
58  }
59  }
60 
61  });
62  }
63  return panel;
64  }
65 
66  @Override
67  public void update() {
68  getPanel().load();
69  changed = false;
70  }
71 
72  @Override
73  public void applyChanges() {
74  getPanel().store();
75  changed = false;
76  }
77 
78  @Override
79  public boolean isValid() {
80  return true;
81  }
82 
83  @Override
84  public boolean isChanged() {
85  return changed;
86  }
87 
88  @Override
89  public JComponent getComponent(Lookup masterLookup) {
90  return getPanel();
91  }
92 
93  @Override
94  public HelpCtx getHelpCtx() {
95  return null;
96  }
97 
98  @Override
99  public void addPropertyChangeListener(PropertyChangeListener listener) {
100  pcs.addPropertyChangeListener(listener);
101  }
102 
103  @Override
104  public void removePropertyChangeListener(PropertyChangeListener listener) {
105  pcs.removePropertyChangeListener(listener);
106  }
107 
111  void updateChanged() {
112  if (!changed) {
113  changed = true;
114  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
115  }
116  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
117  }
118 
119  @Override
120  public void cancel() {
121  getPanel().cancelChanges();
122  }
123 
124 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.