Merge pull request #7164 from wschaeferB/5316-PreserveSettingsBetweenSearches

5316 preserve settings between searches
This commit is contained in:
Richard Cordovano 2021-08-04 14:24:14 -04:00 committed by GitHub
commit 2395e9c054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 141 additions and 54 deletions

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2018 Basis Technology Corp. * Copyright 2018-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -28,16 +28,18 @@ class DataSourceFilter extends AbstractFileSearchFilter<DataSourcePanel> {
/** /**
* Construct DataSourceFilter with the DataSourcePanel * Construct DataSourceFilter with the DataSourcePanel
*
* @param component A DataSourcePanel * @param component A DataSourcePanel
*/ */
public DataSourceFilter(DataSourcePanel component) { DataSourceFilter(DataSourcePanel component) {
super(component); super(component);
} }
/** /**
* Default constructor to construct a new DataSourceFilter with a new DataSourcePanel * Default constructor to construct a new DataSourceFilter with a new
* DataSourcePanel
*/ */
public DataSourceFilter() { DataSourceFilter() {
this(new DataSourcePanel()); this(new DataSourcePanel());
} }
@ -46,6 +48,13 @@ class DataSourceFilter extends AbstractFileSearchFilter<DataSourcePanel> {
return this.getComponent().isSelected(); return this.getComponent().isSelected();
} }
/**
* Reset the data source filter to be up to date with the current case.
*/
void resetDataSourceFilter() {
this.getComponent().resetDataSourcePanel();
}
@Override @Override
public String getPredicate() throws FilterValidationException { public String getPredicate() throws FilterValidationException {
String predicate = ""; String predicate = "";
@ -64,11 +73,11 @@ class DataSourceFilter extends AbstractFileSearchFilter<DataSourcePanel> {
} }
@Override @Override
@Messages ({ @Messages({
"DataSourceFilter.errorMessage.emptyDataSource=At least one data source must be selected." "DataSourceFilter.errorMessage.emptyDataSource=At least one data source must be selected."
}) })
public boolean isValid() { public boolean isValid() {
if(this.getComponent().getDataSourcesSelected().isEmpty()){ if (this.getComponent().getDataSourcesSelected().isEmpty()) {
setLastError(Bundle.DataSourceFilter_errorMessage_emptyDataSource()); setLastError(Bundle.DataSourceFilter_errorMessage_emptyDataSource());
return false; return false;
} }

View File

@ -65,7 +65,7 @@
<Component class="javax.swing.JList" name="dataSourceList"> <Component class="javax.swing.JList" name="dataSourceList">
<Properties> <Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.AbstractListModel&lt;String&gt;() {&#xa; List&lt;String&gt; strings = getDataSourceArray();&#xa; public int getSize() { return strings.size(); }&#xa; public String getElementAt(int idx) { return strings.get(idx); }&#xa;}" type="code"/> <Connection code="new DefaultListModel&lt;String&gt;()" type="code"/>
</Property> </Property>
<Property name="enabled" type="boolean" value="false"/> <Property name="enabled" type="boolean" value="false"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">

View File

@ -27,7 +27,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.DefaultListModel;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -50,17 +52,38 @@ public class DataSourcePanel extends javax.swing.JPanel {
*/ */
public DataSourcePanel() { public DataSourcePanel() {
initComponents(); initComponents();
if (this.dataSourceList.getModel().getSize() > 1) { resetDataSourcePanel();
this.dataSourceList.addListSelectionListener((ListSelectionEvent evt) -> { }
/**
* Reset the data source panel to be up to date with the current case.
*
*/
final void resetDataSourcePanel() {
dataSourceList.clearSelection();
//remove all list selection listeners
for (ListSelectionListener listener : dataSourceList.getListSelectionListeners()){
dataSourceList.removeListSelectionListener(listener);
}
((DefaultListModel<String>) dataSourceList.getModel()).clear();
List<String> strings = getDataSourceArray();
for (String dataSource : strings) {
((DefaultListModel<String>) dataSourceList.getModel()).addElement(dataSource);
}
dataSourceList.setEnabled(false);
dataSourceCheckBox.setSelected(false);
dataSourceNoteLabel.setEnabled(false);
if (dataSourceList.getModel().getSize() > 1) {
dataSourceList.addListSelectionListener((ListSelectionEvent evt) -> {
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null); firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
}); });
dataSourceCheckBox.setEnabled(true);
} else { } else {
/* /*
* Disable data source filtering since there aren't multiple data * Disable data source filtering since there aren't multiple data
* sources to choose from. * sources to choose from.
*/ */
this.dataSourceCheckBox.setEnabled(false); this.dataSourceCheckBox.setEnabled(false);
this.dataSourceList.setEnabled(false);
} }
} }
@ -98,9 +121,10 @@ public class DataSourcePanel extends javax.swing.JPanel {
*/ */
Set<Long> getDataSourcesSelected() { Set<Long> getDataSourcesSelected() {
Set<Long> dataSourceObjIdSet = new HashSet<>(); Set<Long> dataSourceObjIdSet = new HashSet<>();
List<String> dataSources = dataSourceList.getSelectedValuesList();
for (Long key : dataSourceMap.keySet()) { for (Long key : dataSourceMap.keySet()) {
String value = dataSourceMap.get(key); String value = dataSourceMap.get(key);
for (String dataSource : this.dataSourceList.getSelectedValuesList()) { for (String dataSource : dataSources) {
if (value.equals(dataSource)) { if (value.equals(dataSource)) {
dataSourceObjIdSet.add(key); dataSourceObjIdSet.add(key);
} }
@ -145,11 +169,7 @@ public class DataSourcePanel extends javax.swing.JPanel {
setMinimumSize(new java.awt.Dimension(150, 150)); setMinimumSize(new java.awt.Dimension(150, 150));
setPreferredSize(new java.awt.Dimension(150, 150)); setPreferredSize(new java.awt.Dimension(150, 150));
dataSourceList.setModel(new javax.swing.AbstractListModel<String>() { dataSourceList.setModel(new DefaultListModel<String>());
List<String> strings = getDataSourceArray();
public int getSize() { return strings.size(); }
public String getElementAt(int idx) { return strings.get(idx); }
});
dataSourceList.setEnabled(false); dataSourceList.setEnabled(false);
dataSourceList.setMinimumSize(new java.awt.Dimension(0, 200)); dataSourceList.setMinimumSize(new java.awt.Dimension(0, 200));
jScrollPane1.setViewportView(dataSourceList); jScrollPane1.setViewportView(dataSourceList);

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -31,6 +31,7 @@ final class FileSearchAction extends CallableSystemAction implements FileSearchP
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static FileSearchAction instance = null; private static FileSearchAction instance = null;
private static FileSearchDialog searchDialog;
FileSearchAction() { FileSearchAction() {
super(); super();
@ -38,6 +39,9 @@ final class FileSearchAction extends CallableSystemAction implements FileSearchP
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> { Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) { if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) {
setEnabled(evt.getNewValue() != null); setEnabled(evt.getNewValue() != null);
if (searchDialog != null && evt.getNewValue() != null){
searchDialog.resetCaseDependentFilters();
}
} }
}); });
} }
@ -51,12 +55,18 @@ final class FileSearchAction extends CallableSystemAction implements FileSearchP
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
new FileSearchDialog().setVisible(true); if (searchDialog == null) {
searchDialog = new FileSearchDialog();
}
searchDialog.setVisible(true);
} }
@Override @Override
public void performAction() { public void performAction() {
new FileSearchDialog().setVisible(true); if (searchDialog == null) {
searchDialog = new FileSearchDialog();
}
searchDialog.setVisible(true);
} }
@Override @Override

View File

@ -27,12 +27,12 @@ import org.openide.windows.WindowManager;
* File search dialog * File search dialog
*/ */
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
class FileSearchDialog extends javax.swing.JDialog { final class FileSearchDialog extends javax.swing.JDialog {
/** /**
* Creates new form FileSearchDialog * Creates new form FileSearchDialog
*/ */
public FileSearchDialog() { FileSearchDialog() {
super(WindowManager.getDefault().getMainWindow(), super(WindowManager.getDefault().getMainWindow(),
NbBundle.getMessage(FileSearchDialog.class, "FileSearchDialog.frame.msg"), true); NbBundle.getMessage(FileSearchDialog.class, "FileSearchDialog.frame.msg"), true);
initComponents(); initComponents();
@ -43,11 +43,19 @@ class FileSearchDialog extends javax.swing.JDialog {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
dispose(); setVisible(false);
} }
}); });
} }
/**
* Reset the filters which are populated with options based on the contents
* of the current case.
*/
void resetCaseDependentFilters() {
fileSearchPanel1.resetCaseDependentFilters();
}
/** /**
* This method is called from within the constructor to initialize the form. * 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 * WARNING: Do NOT modify this code. The content of this method is always
@ -79,4 +87,3 @@ class FileSearchDialog extends javax.swing.JDialog {
private org.sleuthkit.autopsy.filesearch.FileSearchPanel fileSearchPanel1; private org.sleuthkit.autopsy.filesearch.FileSearchPanel fileSearchPanel1;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2019 Basis Technology Corp. * Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -40,8 +40,6 @@ import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor; import org.openide.NotifyDescriptor;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent;
@ -64,6 +62,8 @@ class FileSearchPanel extends javax.swing.JPanel {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final List<FileSearchFilter> filters = new ArrayList<>(); private final List<FileSearchFilter> filters = new ArrayList<>();
private static int resultWindowCount = 0; //keep track of result windows so they get unique names private static int resultWindowCount = 0; //keep track of result windows so they get unique names
private static MimeTypeFilter mimeTypeFilter = new MimeTypeFilter();
private static DataSourceFilter dataSourceFilter = new DataSourceFilter();
private static final String EMPTY_WHERE_CLAUSE = NbBundle.getMessage(DateSearchFilter.class, "FileSearchPanel.emptyWhereClause.text"); private static final String EMPTY_WHERE_CLAUSE = NbBundle.getMessage(DateSearchFilter.class, "FileSearchPanel.emptyWhereClause.text");
private static SwingWorker<TableFilterNode, Void> searchWorker = null; private static SwingWorker<TableFilterNode, Void> searchWorker = null;
@ -77,7 +77,6 @@ class FileSearchPanel extends javax.swing.JPanel {
FileSearchPanel() { FileSearchPanel() {
initComponents(); initComponents();
customizeComponents(); customizeComponents();
} }
/** /**
@ -107,8 +106,6 @@ class FileSearchPanel extends javax.swing.JPanel {
DateSearchFilter dateFilter = new DateSearchFilter(); DateSearchFilter dateFilter = new DateSearchFilter();
KnownStatusSearchFilter knowStatusFilter = new KnownStatusSearchFilter(); KnownStatusSearchFilter knowStatusFilter = new KnownStatusSearchFilter();
HashSearchFilter hashFilter = new HashSearchFilter(); HashSearchFilter hashFilter = new HashSearchFilter();
MimeTypeFilter mimeTypeFilter = new MimeTypeFilter();
DataSourceFilter dataSourceFilter = new DataSourceFilter();
panel2.add(new FilterArea(NbBundle.getMessage(this.getClass(), "FileSearchPanel.filterTitle.name"), nameFilter)); panel2.add(new FilterArea(NbBundle.getMessage(this.getClass(), "FileSearchPanel.filterTitle.name"), nameFilter));
@ -166,7 +163,6 @@ class FileSearchPanel extends javax.swing.JPanel {
} }
} }
} }
errorLabel.setText(""); errorLabel.setText("");
return enabled; return enabled;
} }
@ -187,7 +183,7 @@ class FileSearchPanel extends javax.swing.JPanel {
if (this.isValidSearch()) { if (this.isValidSearch()) {
// try to get the number of matches first // try to get the number of matches first
Case currentCase = Case.getCurrentCaseThrows(); // get the most updated case Case currentCase = Case.getCurrentCaseThrows(); // get the most updated case
Node emptyNode = new TableFilterNode(new EmptyNode(Bundle.FileSearchPanel_searchingNode_display_text()), true); Node emptyNode = new TableFilterNode(new EmptyNode(Bundle.FileSearchPanel_searchingNode_display_text()), true);
String title = NbBundle.getMessage(this.getClass(), "FileSearchPanel.search.results.title", ++resultWindowCount); String title = NbBundle.getMessage(this.getClass(), "FileSearchPanel.search.results.title", ++resultWindowCount);
String pathText = Bundle.FileSearchPanel_searchingPath_text(); String pathText = Bundle.FileSearchPanel_searchingPath_text();
final DataResultTopComponent searchResultWin = DataResultTopComponent.createInstance(title, pathText, final DataResultTopComponent searchResultWin = DataResultTopComponent.createInstance(title, pathText,
@ -339,6 +335,15 @@ class FileSearchPanel extends javax.swing.JPanel {
return enabledFilters; return enabledFilters;
} }
/**
* Reset the filters which are populated with options based on the contents
* of the current case.
*/
void resetCaseDependentFilters() {
dataSourceFilter.resetDataSourceFilter();
mimeTypeFilter.resetMimeTypeFilter();
}
void addListenerToAll(ActionListener l) { void addListenerToAll(ActionListener l) {
searchButton.addActionListener(l); searchButton.addActionListener(l);
for (FileSearchFilter fsf : getFilters()) { for (FileSearchFilter fsf : getFilters()) {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Autopsy Forensic Browser
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * Copyright 2021 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.filesearch; package org.sleuthkit.autopsy.filesearch;
@ -13,11 +26,11 @@ import org.openide.util.NbBundle.Messages;
*/ */
class MimeTypeFilter extends AbstractFileSearchFilter<MimeTypePanel> { class MimeTypeFilter extends AbstractFileSearchFilter<MimeTypePanel> {
public MimeTypeFilter(MimeTypePanel component) { MimeTypeFilter(MimeTypePanel component) {
super(component); super(component);
} }
public MimeTypeFilter() { MimeTypeFilter() {
this(new MimeTypePanel()); this(new MimeTypePanel());
} }
@ -43,14 +56,21 @@ class MimeTypeFilter extends AbstractFileSearchFilter<MimeTypePanel> {
} }
@Override @Override
@Messages ({ @Messages({
"MimeTypeFilter.errorMessage.emptyMimeType=At least one MIME type must be selected." "MimeTypeFilter.errorMessage.emptyMimeType=At least one MIME type must be selected."
}) })
public boolean isValid() { public boolean isValid() {
if(this.getComponent().getMimeTypesSelected().isEmpty()){ if (this.getComponent().getMimeTypesSelected().isEmpty()) {
setLastError(Bundle.MimeTypeFilter_errorMessage_emptyMimeType()); setLastError(Bundle.MimeTypeFilter_errorMessage_emptyMimeType());
return false; return false;
} }
return true; return true;
} }
/**
* Reset the mime type filter to be up to date with the current case.
*/
void resetMimeTypeFilter() {
this.getComponent().resetMimeTypePanel();
}
} }

View File

@ -65,7 +65,7 @@
<Component class="javax.swing.JList" name="mimeTypeList"> <Component class="javax.swing.JList" name="mimeTypeList">
<Properties> <Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.AbstractListModel&lt;String&gt;() {&#xa; String[] strings = getMimeTypeArray();&#xa; public int getSize() { return strings.length; }&#xa; public String getElementAt(int i) { return strings[i]; }&#xa;}" type="code"/> <Connection code="new DefaultListModel&lt;String&gt;()" type="code"/>
</Property> </Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 200]"/> <Dimension value="[0, 200]"/>

View File

@ -21,7 +21,9 @@ package org.sleuthkit.autopsy.filesearch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.DefaultListModel;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
@ -29,7 +31,7 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
* Enter MIME types for search. * Enter MIME types for search.
*/ */
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
public class MimeTypePanel extends javax.swing.JPanel { public final class MimeTypePanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(MimeTypePanel.class.getName()); private static final Logger logger = Logger.getLogger(MimeTypePanel.class.getName());
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -39,10 +41,7 @@ public class MimeTypePanel extends javax.swing.JPanel {
*/ */
public MimeTypePanel() { public MimeTypePanel() {
initComponents(); initComponents();
setComponentsEnabled(); resetMimeTypePanel();
this.mimeTypeList.addListSelectionListener((ListSelectionEvent e) -> {
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
});
} }
private String[] getMimeTypeArray() { private String[] getMimeTypeArray() {
@ -65,7 +64,7 @@ public class MimeTypePanel extends javax.swing.JPanel {
} }
void setComponentsEnabled() { void setComponentsEnabled() {
boolean enabled = this.isSelected(); boolean enabled = isSelected();
this.mimeTypeList.setEnabled(enabled); this.mimeTypeList.setEnabled(enabled);
this.noteLabel.setEnabled(enabled); this.noteLabel.setEnabled(enabled);
} }
@ -87,11 +86,7 @@ public class MimeTypePanel extends javax.swing.JPanel {
setMinimumSize(new java.awt.Dimension(150, 150)); setMinimumSize(new java.awt.Dimension(150, 150));
setPreferredSize(new java.awt.Dimension(150, 150)); setPreferredSize(new java.awt.Dimension(150, 150));
mimeTypeList.setModel(new javax.swing.AbstractListModel<String>() { mimeTypeList.setModel(new DefaultListModel<String>());
String[] strings = getMimeTypeArray();
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
mimeTypeList.setMinimumSize(new java.awt.Dimension(0, 200)); mimeTypeList.setMinimumSize(new java.awt.Dimension(0, 200));
jScrollPane1.setViewportView(mimeTypeList); jScrollPane1.setViewportView(mimeTypeList);
@ -146,4 +141,25 @@ public class MimeTypePanel extends javax.swing.JPanel {
private javax.swing.JList<String> mimeTypeList; private javax.swing.JList<String> mimeTypeList;
private javax.swing.JLabel noteLabel; private javax.swing.JLabel noteLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
/**
* Reset the mime type panel to be up to date with the current case.
*/
void resetMimeTypePanel() {
//remove all list selection listeners
for (ListSelectionListener listener : mimeTypeList.getListSelectionListeners()) {
mimeTypeList.removeListSelectionListener(listener);
}
mimeTypeList.clearSelection();
((DefaultListModel<String>) mimeTypeList.getModel()).clear();
for (String dataSource : getMimeTypeArray()) {
((DefaultListModel<String>) mimeTypeList.getModel()).addElement(dataSource);
}
mimeTypeList.addListSelectionListener((ListSelectionEvent e) -> {
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
});
mimeTypeList.setEnabled(false);
mimeTypeCheckBox.setSelected(false);
noteLabel.setEnabled(false);
}
} }