Autopsy  4.20.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  changed = false;
47  }
48 
49  @Override
50  public void applyChanges() {
51  changed = false;
52  }
53 
54  @Override
55  public void cancel() {
56  }
57 
58  @Override
59  public boolean isValid() {
60  return true;
61  }
62 
63  @Override
64  public boolean isChanged() {
65  return changed;
66  }
67 
68  @Override
69  public HelpCtx getHelpCtx() {
70  return null;
71  }
72 
73  @Override
74  public JComponent getComponent(Lookup masterLookup) {
75  return getPanel();
76  }
77 
78  @Override
79  public void addPropertyChangeListener(PropertyChangeListener l) {
80  if (pcs.getPropertyChangeListeners().length == 0) {
81  pcs.addPropertyChangeListener(l);
82  }
83  }
84 
85  @Override
86  public void removePropertyChangeListener(PropertyChangeListener l) {
94  }
95 
97  if (panel == null) {
98  panel = new CommandLineIngestSettingsPanel(this);
99  panel.setSize(750, 600); //makes the panel large enough to hide the scroll bar
100  }
101  return panel;
102  }
103 
104  void changed() {
105  if (!changed) {
106  changed = true;
107 
108  try {
109  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
110  } catch (Exception e) {
111  logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
112  MessageNotifyUtil.Notify.show(
113  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
114  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
115  MessageNotifyUtil.MessageType.ERROR);
116  }
117  }
118 
119  try {
120  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
121  } catch (Exception e) {
122  logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
123  MessageNotifyUtil.Notify.show(
124  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
125  NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
126  MessageNotifyUtil.MessageType.ERROR);
127  }
128  }
129 }
130 
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

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