Autopsy  4.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-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.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;
31 
32 @OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_Multi_User_Settings",
33  iconBase = "org/sleuthkit/autopsy/images/User-Group-icon-green32.png",
34  position = 2,
35  keywords = "#OptionsCategory_Keywords_Multi_User_Options",
36  keywordsCategory = "Multi-user")
37 public final class MultiUserSettingsPanelController extends OptionsPanelController {
38 
40  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
41  private boolean changed;
42  private static final Logger logger = Logger.getLogger(MultiUserSettingsPanelController.class.getName());
43 
44  @Override
45  public void update() {
46  getPanel().load();
47  changed = false;
48  }
49 
50  @Override
51  public void applyChanges() {
52  getPanel().store();
53  changed = false;
54  }
55 
56  @Override
57  public void cancel() {
58  }
59 
60  @Override
61  public boolean isValid() {
62  return getPanel().valid();
63  }
64 
65  @Override
66  public boolean isChanged() {
67  return changed;
68  }
69 
70  @Override
71  public HelpCtx getHelpCtx() {
72  return null;
73  }
74 
75  @Override
76  public JComponent getComponent(Lookup masterLookup) {
77  return getPanel();
78  }
79 
80  @Override
81  public void addPropertyChangeListener(PropertyChangeListener l) {
82  if (pcs.getPropertyChangeListeners().length == 0) {
83  pcs.addPropertyChangeListener(l);
84  }
85  }
86 
87  @Override
88  public void removePropertyChangeListener(PropertyChangeListener l) {
96  }
97 
99  if (panel == null) {
100  panel = new MultiUserSettingsPanel(this);
101  }
102  return panel;
103  }
104 
105  void changed() {
106  if (!changed) {
107  changed = true;
108 
109  try {
110  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
111  } catch (Exception e) {
112  logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
113  MessageNotifyUtil.Notify.show(
114  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
115  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
116  MessageNotifyUtil.MessageType.ERROR);
117  }
118  }
119 
120  try {
121  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
122  } catch (Exception e) {
123  logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
124  MessageNotifyUtil.Notify.show(
125  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
126  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
127  MessageNotifyUtil.MessageType.ERROR);
128  }
129  }
130 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:161

Copyright © 2012-2016 Basis Technology. Generated on: Tue Oct 25 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.