Autopsy  4.11.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CommandLineIngestSettingsPanelController.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019-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.commandlineingest;
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_Command_Line_Ingest",
33  iconBase = "org/sleuthkit/autopsy/images/command_line_icon.png",
34  position = 17,
35  keywords = "#OptionsCategory_Keywords_Command_Line_Ingest_Settings",
36  keywordsCategory = "Command Line Ingest")
37 public final class CommandLineIngestSettingsPanelController extends OptionsPanelController {
38 
40  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
41  private boolean changed;
42  private static final Logger logger = Logger.getLogger(CommandLineIngestSettingsPanelController.class.getName());
43 
44  @Override
45  public void update() {
46  getPanel().load(false);
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 CommandLineIngestSettingsPanel(this);
101  panel.setSize(750, 600); //makes the panel large enough to hide the scroll bar
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 }
132 
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2018 Basis Technology. Generated on: Fri Jun 21 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.