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

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.