mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Made search button disable based upon whether a filter is enabled.
This commit is contained in:
parent
6fdf0e3463
commit
0b01073232
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
/**
|
||||
@ -39,4 +40,9 @@ abstract class AbstractFileSearchFilter<T extends JComponent> implements FileSea
|
||||
public T getComponent() {
|
||||
return this.component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
||||
this.getComponent().addPropertyChangeListener(listener);
|
||||
}
|
||||
}
|
||||
|
@ -205,6 +205,11 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
||||
getComponent().addActionListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
||||
getComponent().addPropertyChangeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inner class to put the separator inside the combo box.
|
||||
*/
|
||||
|
@ -20,6 +20,8 @@ package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
@ -37,6 +39,7 @@ class DateSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
DateFormat dateFormat;
|
||||
List<String> timeZones;
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
DateSearchPanel(DateFormat dateFormat, List<String> timeZones) {
|
||||
this.dateFormat = dateFormat;
|
||||
@ -133,6 +136,16 @@ class DateSearchPanel extends javax.swing.JPanel {
|
||||
this.changedCheckBox.setEnabled(enable);
|
||||
this.createdCheckBox.setEnabled(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.addPropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.removePropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
@ -349,6 +362,7 @@ class DateSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
private void dateCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateCheckBoxActionPerformed
|
||||
this.setComponentsEnabled();
|
||||
pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||
}//GEN-LAST:event_dateCheckBoxActionPerformed
|
||||
|
||||
/**
|
||||
|
@ -19,12 +19,13 @@
|
||||
package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
/**
|
||||
* Provides a filter and the panel to display it to the FileSearchTopComponent
|
||||
*/
|
||||
interface FileSearchFilter {
|
||||
interface FileSearchFilter {
|
||||
|
||||
/**
|
||||
* Gets the panel to put in the File Search pane.
|
||||
@ -55,6 +56,8 @@ interface FileSearchFilter {
|
||||
* Add an action listener to the fields of this panel
|
||||
*/
|
||||
void addActionListener(ActionListener l);
|
||||
|
||||
void addPropertyChangeListener(PropertyChangeListener listener);
|
||||
|
||||
/**
|
||||
* Thrown if a filter's inputs are invalid
|
||||
|
@ -17,38 +17,35 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* FileSearchPanel.java
|
||||
*
|
||||
* Created on Mar 5, 2012, 1:51:50 PM
|
||||
*/
|
||||
package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent;
|
||||
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.autopsy.filesearch.FileSearchFilter.FilterValidationException;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
@ -64,6 +61,10 @@ class FileSearchPanel extends javax.swing.JPanel {
|
||||
private static int resultWindowCount = 0; //keep track of result windows so they get unique names
|
||||
private static final String EMPTY_WHERE_CLAUSE = NbBundle.getMessage(DateSearchFilter.class, "FileSearchPanel.emptyWhereClause.text");
|
||||
|
||||
enum EVENT {
|
||||
CHECKED
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new form FileSearchPanel
|
||||
*/
|
||||
@ -100,12 +101,22 @@ class FileSearchPanel extends javax.swing.JPanel {
|
||||
filterPanel.add(fa);
|
||||
}
|
||||
|
||||
for (FileSearchFilter filter : this.getFilters()) {
|
||||
filter.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
searchButton.setEnabled(anyFiltersEnabled());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addListenerToAll(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
search();
|
||||
}
|
||||
});
|
||||
searchButton.setEnabled(anyFiltersEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,6 +301,7 @@ class FileSearchPanel extends javax.swing.JPanel {
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel filterPanel;
|
||||
private javax.swing.JButton searchButton;
|
||||
|
@ -19,7 +19,6 @@
|
||||
package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.datamodel.TskData.FileKnown;
|
||||
|
||||
|
@ -17,13 +17,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* KnownStatusSearchPanel.java
|
||||
*
|
||||
* Created on Oct 19, 2011, 11:45:44 AM
|
||||
*/
|
||||
package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
/**
|
||||
@ -32,6 +34,8 @@ import javax.swing.JCheckBox;
|
||||
*/
|
||||
class KnownStatusSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
/**
|
||||
* Creates new form KnownStatusSearchPanel
|
||||
*/
|
||||
@ -55,7 +59,7 @@ class KnownStatusSearchPanel extends javax.swing.JPanel {
|
||||
JCheckBox getUnknownOptionCheckBox() {
|
||||
return unknownOptionCheckBox;
|
||||
}
|
||||
|
||||
|
||||
private void setComponentsEnabled() {
|
||||
boolean enabled = this.knownCheckBox.isSelected();
|
||||
this.unknownOptionCheckBox.setEnabled(enabled);
|
||||
@ -63,6 +67,16 @@ class KnownStatusSearchPanel extends javax.swing.JPanel {
|
||||
this.knownBadOptionCheckBox.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.addPropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.removePropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -132,6 +146,7 @@ class KnownStatusSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
private void knownCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownCheckBoxActionPerformed
|
||||
setComponentsEnabled();
|
||||
pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||
}//GEN-LAST:event_knownCheckBoxActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
@ -40,5 +40,7 @@ class MimeTypeFilter extends AbstractFileSearchFilter<MimeTypePanel> {
|
||||
@Override
|
||||
public void addActionListener(ActionListener l) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="298" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" pref="246" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
|
@ -5,12 +5,16 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import org.apache.tika.mime.MediaType;
|
||||
import org.apache.tika.mime.MimeTypes;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
@ -25,6 +29,7 @@ public class MimeTypePanel extends javax.swing.JPanel {
|
||||
private static final SortedSet<MediaType> mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes();
|
||||
private static final Logger logger = Logger.getLogger(MimeTypePanel.class.getName());
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
/**
|
||||
* Creates new form MimeTypePanel
|
||||
@ -32,6 +37,12 @@ public class MimeTypePanel extends javax.swing.JPanel {
|
||||
public MimeTypePanel() {
|
||||
initComponents();
|
||||
setComponentsEnabled();
|
||||
this.mimeTypeList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String[] getMimeTypeArray() {
|
||||
@ -75,6 +86,16 @@ public class MimeTypePanel extends javax.swing.JPanel {
|
||||
this.mimeTypeList.setEnabled(enabled);
|
||||
this.jLabel1.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.addPropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.removePropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
@ -141,6 +162,8 @@ public class MimeTypePanel extends javax.swing.JPanel {
|
||||
|
||||
private void mimeTypeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeTypeCheckBoxActionPerformed
|
||||
setComponentsEnabled();
|
||||
pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||
this.mimeTypeList.setSelectedIndices(new int[0]);
|
||||
}//GEN-LAST:event_mimeTypeCheckBoxActionPerformed
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* NameSearchPanel.java
|
||||
*
|
||||
* Created on Oct 19, 2011, 11:58:53 AM
|
||||
@ -26,6 +26,8 @@ package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JTextField;
|
||||
@ -36,6 +38,8 @@ import javax.swing.JTextField;
|
||||
*/
|
||||
class NameSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
/**
|
||||
* Creates new form NameSearchPanel
|
||||
*/
|
||||
@ -77,12 +81,22 @@ class NameSearchPanel extends javax.swing.JPanel {
|
||||
JTextField getSearchTextField() {
|
||||
return searchTextField;
|
||||
}
|
||||
|
||||
|
||||
void setComponentsEnabled() {
|
||||
boolean enabled = nameCheckBox.isSelected();
|
||||
this.searchTextField.setEnabled(enabled);
|
||||
this.noteNameLabel.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.addPropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.removePropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
@ -168,6 +182,7 @@ class NameSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
private void nameCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameCheckBoxActionPerformed
|
||||
setComponentsEnabled();
|
||||
pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||
}//GEN-LAST:event_nameCheckBoxActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
@ -20,6 +20,8 @@ package org.sleuthkit.autopsy.filesearch;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.text.NumberFormat;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
@ -32,6 +34,8 @@ import javax.swing.JMenuItem;
|
||||
*/
|
||||
class SizeSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
/**
|
||||
* Creates new form SizeSearchPanel
|
||||
*/
|
||||
@ -81,13 +85,23 @@ class SizeSearchPanel extends javax.swing.JPanel {
|
||||
JComboBox<String> getSizeUnitComboBox() {
|
||||
return sizeUnitComboBox;
|
||||
}
|
||||
|
||||
|
||||
void setComponentsEnabled() {
|
||||
boolean enabled = this.sizeCheckBox.isSelected();
|
||||
this.sizeCompareComboBox.setEnabled(enabled);
|
||||
this.sizeUnitComboBox.setEnabled(enabled);
|
||||
this.sizeTextField.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.addPropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener pcl) {
|
||||
pcs.removePropertyChangeListener(pcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
@ -168,6 +182,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
|
||||
|
||||
private void sizeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sizeCheckBoxActionPerformed
|
||||
setComponentsEnabled();
|
||||
pcs.firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||
}//GEN-LAST:event_sizeCheckBoxActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
Loading…
x
Reference in New Issue
Block a user