/*
 * Autopsy Forensic Browser
 *
 * Copyright 2011-2017 Basis Technology Corp.
 * Contact: carrier <at> sleuthkit <dot> org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.sleuthkit.autopsy.keywordsearch;

import java.beans.PropertyChangeListener;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;

/**
 * Global options panel for keyword searching.
 */
final class KeywordSearchGlobalSettingsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {

    private static final long serialVersionUID = 1L;
    private GlobalListSettingsPanel listsPanel;
    private KeywordSearchGlobalLanguageSettingsPanel languagesPanel;
    private KeywordSearchGlobalSearchSettingsPanel generalPanel;

    KeywordSearchGlobalSettingsPanel() {
        initComponents();
        customizeComponents();
    }

    @NbBundle.Messages({"KeywordSearchGlobalSettingsPanel.Title=Global Keyword Search Settings"})
    private void customizeComponents() {
        setName(Bundle.KeywordSearchGlobalSettingsPanel_Title());
        listsPanel = new GlobalListSettingsPanel();
        languagesPanel = new KeywordSearchGlobalLanguageSettingsPanel();
        generalPanel = new KeywordSearchGlobalSearchSettingsPanel();
        tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.listTabTitle"), null,
                listsPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.listLabToolTip"), 0);
        tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.stringExtTitle"), null,
                languagesPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.stringExtToolTip"), 1);
        tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.genTabTitle"), null,
                generalPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.genTabToolTip"), 2);
    }

    @Override
    public void addPropertyChangeListener(PropertyChangeListener l) {
        super.addPropertyChangeListener(l);
        listsPanel.addPropertyChangeListener(l);
        languagesPanel.addPropertyChangeListener(l);
        generalPanel.addPropertyChangeListener(l);
    }

    @Override
    public void removePropertyChangeListener(PropertyChangeListener l) {
        super.removePropertyChangeListener(l);
        listsPanel.removePropertyChangeListener(l);
        languagesPanel.removePropertyChangeListener(l);
        generalPanel.removePropertyChangeListener(l);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabbedPane = new javax.swing.JTabbedPane();

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 824, Short.MAX_VALUE)
                .addGap(0, 0, 0))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE)
                .addGap(0, 0, 0))
        );
    }// </editor-fold>//GEN-END:initComponents

    @Override
    public void load() {
        // This calls actually clears the component.
        listsPanel.load();

        languagesPanel.load();
        generalPanel.load();

        // Reload the XML to avoid 'ghost' vars
        XmlKeywordSearchList.getCurrent().reload();
    }

    @Override
    public void saveSettings() {
        listsPanel.store();
        languagesPanel.store();
        generalPanel.store();
    }

    @Override
    public void store() {
        saveSettings();
    }

    public void cancel() {
        XmlKeywordSearchList.getCurrent().reload();
    }

    boolean valid() {
        return true;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane tabbedPane;
    // End of variables declaration//GEN-END:variables
}

@@ -1162,16 +1162,22 @@
 private 
+final 
 GlobalLi
@@ -1198,24 +1198,56 @@
 l listsPanel
+ = new GlobalListSettingsPanel()
 ;%0A    privat
@@ -1240,32 +1240,38 @@
 ();%0A    private 
+final 
 KeywordSearchGlo
@@ -1309,16 +1309,65 @@
 gesPanel
+ = new KeywordSearchGlobalLanguageSettingsPanel()
 ;%0A    pr
@@ -1372,16 +1372,22 @@
 private 
+final 
 KeywordS
@@ -1429,16 +1429,63 @@
 ralPanel
+ = new KeywordSearchGlobalSearchSettingsPanel()
 ;%0A%0A    K
@@ -1793,202 +1793,8 @@
 ));%0A
-        listsPanel = new GlobalListSettingsPanel();%0A        languagesPanel = new KeywordSearchGlobalLanguageSettingsPanel();%0A        generalPanel = new KeywordSearchGlobalSearchSettingsPanel();%0A
     

Modify construction of KeywordSearchGlobalSettingsPanel