Autopsy  4.6.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
KeywordSearchGlobalSettingsPanel.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.keywordsearch;
20 
21 import java.beans.PropertyChangeListener;
22 import org.openide.util.NbBundle;
25 
29 final class KeywordSearchGlobalSettingsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
30 
31  private static final long serialVersionUID = 1L;
32  private final GlobalListSettingsPanel listsPanel = new GlobalListSettingsPanel();
33  private final KeywordSearchGlobalLanguageSettingsPanel languagesPanel = new KeywordSearchGlobalLanguageSettingsPanel();
34  private final KeywordSearchGlobalSearchSettingsPanel generalPanel = new KeywordSearchGlobalSearchSettingsPanel();
35 
36  KeywordSearchGlobalSettingsPanel() {
37  initComponents();
38  customizeComponents();
39  }
40 
41  @NbBundle.Messages({"KeywordSearchGlobalSettingsPanel.Title=Global Keyword Search Settings"})
42  private void customizeComponents() {
43  setName(Bundle.KeywordSearchGlobalSettingsPanel_Title());
44  tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.listTabTitle"), null,
45  listsPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.listLabToolTip"), 0);
46  tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.stringExtTitle"), null,
47  languagesPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.stringExtToolTip"), 1);
48  tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.genTabTitle"), null,
49  generalPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.genTabToolTip"), 2);
50  }
51 
52  @Override
53  public void addPropertyChangeListener(PropertyChangeListener l) {
54  super.addPropertyChangeListener(l);
55  /*
56  * There is at least one look and feel library that follows the bad
57  * practice of calling overrideable methods in a constructor, e.g.:
58  *
59  * at
60  * javax.swing.plaf.synth.SynthPanelUI.installListeners(SynthPanelUI.java:83)
61  * at
62  * javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:63)
63  * at javax.swing.JComponent.setUI(JComponent.java:666) at
64  * javax.swing.JPanel.setUI(JPanel.java:153) at
65  * javax.swing.JPanel.updateUI(JPanel.java:126) at
66  * javax.swing.JPanel.<init>(JPanel.java:86) at
67  * javax.swing.JPanel.<init>(JPanel.java:109) at
68  * javax.swing.JPanel.<init>(JPanel.java:117)
69  *
70  * When this happens, the following child components of this JPanel
71  * subclass have not been constructed yet, since this panel's
72  * constructor has not been called yet.
73  */
74  if (null != listsPanel) {
75  listsPanel.addPropertyChangeListener(l);
76  }
77  if (null != languagesPanel) {
78  languagesPanel.addPropertyChangeListener(l);
79  }
80  if (null != generalPanel) {
81  generalPanel.addPropertyChangeListener(l);
82  }
83  }
84 
85  @Override
86  public void removePropertyChangeListener(PropertyChangeListener l) {
87  super.removePropertyChangeListener(l);
88  listsPanel.removePropertyChangeListener(l);
89  languagesPanel.removePropertyChangeListener(l);
90  generalPanel.removePropertyChangeListener(l);
91  }
92 
98  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
99  private void initComponents() {
100 
101  tabbedPane = new javax.swing.JTabbedPane();
102 
103  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
104  this.setLayout(layout);
105  layout.setHorizontalGroup(
106  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
107  .addGroup(layout.createSequentialGroup()
108  .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 824, Short.MAX_VALUE)
109  .addGap(0, 0, 0))
110  );
111  layout.setVerticalGroup(
112  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
113  .addGroup(layout.createSequentialGroup()
114  .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE)
115  .addGap(0, 0, 0))
116  );
117  }// </editor-fold>//GEN-END:initComponents
118 
119  @Override
120  public void load() {
121  // This calls actually clears the component.
122  listsPanel.load();
123 
124  languagesPanel.load();
125  generalPanel.load();
126 
127  // Reload the XML to avoid 'ghost' vars
128  XmlKeywordSearchList.getCurrent().reload();
129  }
130 
131  @Override
132  public void saveSettings() {
133  listsPanel.store();
134  languagesPanel.store();
135  generalPanel.store();
136  }
137 
138  @Override
139  public void store() {
140  saveSettings();
141  }
142 
143  public void cancel() {
144  XmlKeywordSearchList.getCurrent().reload();
145  }
146 
147  boolean valid() {
148  return true;
149  }
150  // Variables declaration - do not modify//GEN-BEGIN:variables
151  private javax.swing.JTabbedPane tabbedPane;
152  // End of variables declaration//GEN-END:variables
153 }

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