Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
IngestOptionsPanelController.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-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.ingest;
20 
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.beans.PropertyChangeSupport;
24 import javax.swing.JComponent;
25 import javax.swing.SwingUtilities;
26 import org.netbeans.spi.options.OptionsPanelController;
27 import org.openide.util.HelpCtx;
28 import org.openide.util.Lookup;
29 
30 @OptionsPanelController.TopLevelRegistration(
31  categoryName = "#OptionsCategory_Name_IngestOptions",
32  iconBase = "org/sleuthkit/autopsy/images/file_ingest_filter32x32.png",
33  position = 2,
34  keywords = "#OptionsCategory_Keywords_IngestOptions",
35  keywordsCategory = "IngestOptions")
36 
37 public class IngestOptionsPanelController extends OptionsPanelController {
38 
40  private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
41  private boolean changed;
42 
46  @Override
47  public void update() {
48  getPanel().load();
49  changed = false;
50  }
51 
58  if (panel == null) {
59  panel = new IngestOptionsPanel();
60  panel.addPropertyChangeListener(new PropertyChangeListener() {
61  @Override
62  public void propertyChange(PropertyChangeEvent evt) {
63  if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) {
64  changed();
65  }
66  }
67  });
68  }
69  return panel;
70  }
71 
75  @Override
76  public void applyChanges() {
77  if (changed) {
78  SwingUtilities.invokeLater(new Runnable() {
79  @Override
80  public void run() {
81  getPanel().store();
82  changed = false;
83  }
84  });
85  }
86  }
87 
91  @Override
92  public void cancel() {
93  getPanel().cancel();
94  }
95 
99  @Override
100  public boolean isValid() {
101  return getPanel().valid();
102  }
103 
107  @Override
108  public boolean isChanged() {
109  return changed;
110  }
111 
115  @Override
116  public JComponent getComponent(Lookup lkp) {
117  return getPanel();
118  }
119 
123  @Override
124  public HelpCtx getHelpCtx() {
125  return null;
126  }
127 
131  @Override
132  public void addPropertyChangeListener(PropertyChangeListener pl) {
133  pcs.addPropertyChangeListener(pl);
134  }
135 
139  @Override
140  public void removePropertyChangeListener(PropertyChangeListener pl) {
141  pcs.removePropertyChangeListener(pl);
142  }
143 
144  void changed() {
145  if (!changed) {
146  changed = true;
147  pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
148  }
149  pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
150  }
151 }
void addPropertyChangeListener(PropertyChangeListener l)

Copyright © 2012-2016 Basis Technology. Generated on: Mon Apr 24 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.