Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
MultiUserSettingsPanelController.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-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  */
19 package org.sleuthkit.autopsy.corecomponents;
20 
21 import java.beans.PropertyChangeListener;
22 import java.beans.PropertyChangeSupport;
23 import javax.swing.JComponent;
24 import org.netbeans.spi.options.OptionsPanelController;
25 import org.openide.util.HelpCtx;
26 import org.openide.util.Lookup;
27 import org.openide.util.NbBundle;
29 import java.util.logging.Level;
32 
33 @OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_Multi_User_Settings",
34  iconBase = "org/sleuthkit/autopsy/images/User-Group-icon-green32.png",
35  position = 4,
36  keywords = "#OptionsCategory_Keywords_Multi_User_Options",
37  keywordsCategory = "Multi-User")
38 public final class MultiUserSettingsPanelController extends OptionsPanelController {
39 
41  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
42  private boolean changed;
43  private static final Logger logger = Logger.getLogger(MultiUserSettingsPanelController.class.getName());
44 
45  @Override
46  public void update() {
47  getPanel().load(Case.isCaseOpen());
48  changed = false;
49  }
50 
51  @Override
52  public void applyChanges() {
53  getPanel().store();
54  changed = false;
55  }
56 
57  @Override
58  public void cancel() {
59  }
60 
61  @Override
62  public boolean isValid() {
63  return getPanel().valid(Case.isCaseOpen());
64  }
65 
66  @Override
67  public boolean isChanged() {
68  return changed;
69  }
70 
71  @Override
72  public HelpCtx getHelpCtx() {
73  return null;
74  }
75 
76  @Override
77  public JComponent getComponent(Lookup masterLookup) {
78  return getPanel();
79  }
80 
81  @Override
82  public void addPropertyChangeListener(PropertyChangeListener l) {
83  if (pcs.getPropertyChangeListeners().length == 0) {
84  pcs.addPropertyChangeListener(l);
85  }
86  }
87 
88  @Override
89  public void removePropertyChangeListener(PropertyChangeListener l) {
97  }
98 
100  if (panel == null) {
101  panel = new MultiUserSettingsPanel(this);
102  }
103  return panel;
104  }
105 
106  void changed() {
107  if (!changed) {
108  changed = true;
109 
110  try {
111  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
112  } catch (Exception e) {
113  logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
114  MessageNotifyUtil.Notify.show(
115  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
116  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
117  MessageNotifyUtil.MessageType.ERROR);
118  }
119  }
120 
121  try {
122  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
123  } catch (Exception e) {
124  logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
125  MessageNotifyUtil.Notify.show(
126  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
127  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
128  MessageNotifyUtil.MessageType.ERROR);
129  }
130  }
131 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2021 Basis Technology. Generated on: Thu Sep 30 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.