mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-06 17:26:20 +00:00
Merge pull request #2302 from wishdasher/AUT-2212_property_change_listener
Updated use of PropertyChangeListener in KeywordSearchGlobalLanguageS…
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.casemodule;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@@ -47,7 +45,6 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
||||
|
||||
private final String PROP_LASTIMAGE_PATH = "LBL_LastImage_PATH"; //NON-NLS
|
||||
private static final Logger logger = Logger.getLogger(ImageFilePanel.class.getName());
|
||||
private PropertyChangeSupport pcs = null;
|
||||
private JFileChooser fc = new JFileChooser();
|
||||
|
||||
// Externally supplied name is used to store settings
|
||||
@@ -80,7 +77,6 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
||||
}
|
||||
|
||||
this.contextName = context;
|
||||
pcs = new PropertyChangeSupport(this);
|
||||
|
||||
createTimeZoneList();
|
||||
}
|
||||
@@ -207,7 +203,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
||||
}
|
||||
|
||||
try {
|
||||
pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true);
|
||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", e); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
|
||||
@@ -357,7 +353,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
|
||||
try {
|
||||
pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
} catch (Exception ee) {
|
||||
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", ee); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
|
||||
@@ -369,7 +365,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
try {
|
||||
pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
} catch (Exception ee) {
|
||||
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", ee); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
|
||||
@@ -382,7 +378,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
|
||||
try {
|
||||
pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
} catch (Exception ee) {
|
||||
logger.log(Level.SEVERE, "ImageFilePanel listener threw exception", ee); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "ImageFilePanel.moduleErr"),
|
||||
@@ -397,23 +393,4 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
||||
public void select() {
|
||||
pathTextField.requestFocusInWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void addPropertyChangeListener(PropertyChangeListener pcl) {
|
||||
super.addPropertyChangeListener(pcl);
|
||||
|
||||
if (pcs == null) {
|
||||
pcs = new PropertyChangeSupport(this);
|
||||
}
|
||||
|
||||
pcs.addPropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener pcl) {
|
||||
super.removePropertyChangeListener(pcl);
|
||||
|
||||
pcs.removePropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package org.sleuthkit.autopsy.casemodule;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -46,7 +44,6 @@ import org.sleuthkit.autopsy.coreutils.PathValidator;
|
||||
*/
|
||||
class LocalFilesPanel extends JPanel {
|
||||
|
||||
private PropertyChangeSupport pcs = null;
|
||||
private Set<File> currentFiles = new TreeSet<File>(); //keep currents in a set to disallow duplicates per add
|
||||
private boolean enableNext = false;
|
||||
private static LocalFilesPanel instance;
|
||||
@@ -148,24 +145,6 @@ class LocalFilesPanel extends JPanel {
|
||||
this.displayNameLabel.setText(NbBundle.getMessage(this.getClass(), "LocalFilesPanel.displayNameLabel.text"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void addPropertyChangeListener(PropertyChangeListener pcl) {
|
||||
super.addPropertyChangeListener(pcl);
|
||||
|
||||
if (pcs == null) {
|
||||
pcs = new PropertyChangeSupport(this);
|
||||
}
|
||||
|
||||
pcs.addPropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener pcl) {
|
||||
super.removePropertyChangeListener(pcl);
|
||||
|
||||
pcs.removePropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
public String getFileSetName() {
|
||||
return this.displayName;
|
||||
}
|
||||
@@ -312,7 +291,7 @@ class LocalFilesPanel extends JPanel {
|
||||
}
|
||||
|
||||
try {
|
||||
pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "LocalFilesPanel listener threw exception", e); //NON-NLS
|
||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "LocalFilesPanel.moduleErr"),
|
||||
|
||||
+3
-15
@@ -22,7 +22,6 @@ import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -42,7 +41,6 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem
|
||||
private final Map<String, StringExtract.StringExtractUnicodeTable.SCRIPT> scripts = new HashMap<>();
|
||||
private ActionListener updateLanguagesAction;
|
||||
private List<SCRIPT> toUpdate;
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
KeywordSearchGlobalLanguageSettingsPanel() {
|
||||
initComponents();
|
||||
@@ -69,16 +67,6 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem
|
||||
reloadScriptsCheckBoxes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
private void activateScriptsCheckboxes(boolean activate) {
|
||||
final int components = checkPanel.getComponentCount();
|
||||
for (int i = 0; i < components; ++i) {
|
||||
@@ -104,7 +92,7 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem
|
||||
ch.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}
|
||||
});
|
||||
ch.addActionListener(updateLanguagesAction);
|
||||
@@ -247,7 +235,7 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem
|
||||
boolean selected = this.enableUTF8Checkbox.isSelected();
|
||||
|
||||
activateScriptsCheckboxes(selected || this.enableUTF16Checkbox.isSelected());
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
|
||||
}//GEN-LAST:event_enableUTF8CheckboxActionPerformed
|
||||
|
||||
@@ -256,7 +244,7 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem
|
||||
boolean selected = this.enableUTF16Checkbox.isSelected();
|
||||
|
||||
activateScriptsCheckboxes(selected || this.enableUTF8Checkbox.isSelected());
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_enableUTF16CheckboxActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
||||
+7
-19
@@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.util.logging.Level;
|
||||
import org.netbeans.spi.options.OptionsPanelController;
|
||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||
@@ -34,7 +33,6 @@ import org.sleuthkit.autopsy.keywordsearch.KeywordSearchIngestModule.UpdateFrequ
|
||||
class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implements OptionsPanel {
|
||||
|
||||
private final Logger logger = Logger.getLogger(KeywordSearchGlobalSearchSettingsPanel.class.getName());
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
/**
|
||||
* Creates new form KeywordSearchConfigurationPanel2
|
||||
@@ -76,16 +74,6 @@ class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implemen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.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
|
||||
@@ -262,31 +250,31 @@ class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implemen
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void timeRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton5ActionPerformed
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_timeRadioButton5ActionPerformed
|
||||
|
||||
private void skipNSRLCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipNSRLCheckBoxActionPerformed
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_skipNSRLCheckBoxActionPerformed
|
||||
|
||||
private void showSnippetsCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showSnippetsCBActionPerformed
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_showSnippetsCBActionPerformed
|
||||
|
||||
private void timeRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton1ActionPerformed
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_timeRadioButton1ActionPerformed
|
||||
|
||||
private void timeRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton2ActionPerformed
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_timeRadioButton2ActionPerformed
|
||||
|
||||
private void timeRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton3ActionPerformed
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_timeRadioButton3ActionPerformed
|
||||
|
||||
private void timeRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton4ActionPerformed
|
||||
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
}//GEN-LAST:event_timeRadioButton4ActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
||||
Reference in New Issue
Block a user