19 package org.sleuthkit.autopsy.modules.interestingitems;
 
   21 import org.openide.DialogDisplayer;
 
   22 import org.openide.NotifyDescriptor;
 
   23 import org.openide.util.NbBundle;
 
   30 @SuppressWarnings(
"PMD.SingularField") 
 
   33     @NbBundle.Messages({
"FilesSetPanel.filter.title=File Filter", 
"FilesSetPanel.rule.title=File Filter Rule", 
"FilesSetPanel.ingest.createNewFilter=Create/edit file ingest filters...", 
"FilesSetPanel.ingest.messages.filtersMustBeNamed=File ingest filters must be named."})
 
   35     private static final String CREATE_NEW_FILE_INGEST_FILTER = Bundle.FilesSetPanel_ingest_createNewFilter();
 
   42         return CREATE_NEW_FILE_INGEST_FILTER;
 
   51             ignoreKnownFilesCheckbox.setVisible(
false);
 
   52             mustBeNamedErrorText = NbBundle.getMessage(
FilesSetPanel.class, 
"FilesSetPanel.ingest.messages.filtersMustBeNamed");
 
   53             org.openide.awt.Mnemonics.setLocalizedText(nameLabel, 
org.openide.util.NbBundle.getMessage(
FilesSetPanel.class, 
"FilesSetPanel.ingest.nameLabel.text")); 
 
   55             mustBeNamedErrorText = NbBundle.getMessage(FilesSetPanel.class, 
"FilesSetPanel.interesting.messages.filesSetsMustBeNamed");
 
   56             ignoreUnallocCheckbox.setVisible(
false);
 
   65     FilesSetPanel(FilesSet filesSet, PANEL_TYPE panelType) {
 
   67         if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
 
   68             ignoreKnownFilesCheckbox.setVisible(
false);
 
   69             mustBeNamedErrorText = NbBundle.getMessage(FilesSetPanel.class, 
"FilesSetPanel.ingest.messages.filtersMustBeNamed");
 
   71             ignoreUnallocCheckbox.setVisible(
false);
 
   72             mustBeNamedErrorText = NbBundle.getMessage(FilesSetPanel.class, 
"FilesSetPanel.interesting.messages.filesSetsMustBeNamed");
 
   74         this.nameTextField.setText(filesSet.getName());
 
   75         this.descTextArea.setText(filesSet.getDescription());
 
   76         this.ignoreKnownFilesCheckbox.setSelected(filesSet.ignoresKnownFiles());
 
   77         this.ignoreUnallocCheckbox.setSelected(filesSet.ingoresUnallocatedSpace());
 
   87     boolean isValidDefinition() {
 
   88         if (this.nameTextField.getText().isEmpty()) {
 
   89             NotifyDescriptor notifyDesc = 
new NotifyDescriptor.Message(
 
   91                     NotifyDescriptor.WARNING_MESSAGE);
 
   92             DialogDisplayer.getDefault().notify(notifyDesc);
 
   97             for (FilesSet filesSet : FilesSetsManager.getStandardFileIngestFilters()) {
 
   98                 if (this.nameTextField.getText().equals(filesSet.getName())) {
 
   99                     NotifyDescriptor notifyDesc = 
new NotifyDescriptor.Message(
 
  100                             NbBundle.getMessage(FilesSetPanel.class, 
"FilesSetPanel.messages.filesSetsReservedName"),
 
  101                             NotifyDescriptor.WARNING_MESSAGE);
 
  102                     DialogDisplayer.getDefault().notify(notifyDesc);
 
  106             if (this.nameTextField.getText().equals(getCreateNewFileIngestFilterString())) {
 
  107                 NotifyDescriptor notifyDesc = 
new NotifyDescriptor.Message(
 
  108                         NbBundle.getMessage(FilesSetPanel.class, 
"FilesSetPanel.messages.filesSetsReservedName"),
 
  109                         NotifyDescriptor.WARNING_MESSAGE);
 
  110                 DialogDisplayer.getDefault().notify(notifyDesc);
 
  122     String getFilesSetName() {
 
  123         String returnValue = this.nameTextField.getText();
 
  133     String getFilesSetDescription() {
 
  134         return this.descTextArea.getText();
 
  143     boolean getFileSetIgnoresKnownFiles() {
 
  144         return this.ignoreKnownFilesCheckbox.isSelected();
 
  150     boolean getFileSetIgnoresUnallocatedSpace() {
 
  151         return ignoreUnallocCheckbox.isSelected();
 
  159     @SuppressWarnings(
"unchecked")
 
  161     private 
void initComponents() {
 
  163         nameLabel = 
new javax.swing.JLabel();
 
  164         nameTextField = 
new javax.swing.JTextField();
 
  165         descPanel = 
new javax.swing.JPanel();
 
  166         descScrollPanel = 
new javax.swing.JScrollPane();
 
  167         descTextArea = 
new javax.swing.JTextArea();
 
  168         ignoreKnownFilesCheckbox = 
new javax.swing.JCheckBox();
 
  169         ignoreUnallocCheckbox = 
new javax.swing.JCheckBox();
 
  171         org.openide.awt.Mnemonics.setLocalizedText(nameLabel, 
org.openide.util.NbBundle.getMessage(
FilesSetPanel.class, 
"FilesSetPanel.interesting.nameLabel.text")); 
 
  173         descPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(
FilesSetPanel.class, 
"FilesSetPanel.descPanel.border.title"))); 
 
  175         descTextArea.setColumns(20);
 
  176         descTextArea.setLineWrap(
true);
 
  177         descTextArea.setRows(5);
 
  178         descTextArea.setWrapStyleWord(
true);
 
  179         descScrollPanel.setViewportView(descTextArea);
 
  181         javax.swing.GroupLayout descPanelLayout = 
new javax.swing.GroupLayout(descPanel);
 
  182         descPanel.setLayout(descPanelLayout);
 
  183         descPanelLayout.setHorizontalGroup(
 
  184             descPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  185             .addGroup(descPanelLayout.createSequentialGroup()
 
  187                 .addComponent(descScrollPanel)
 
  190         descPanelLayout.setVerticalGroup(
 
  191             descPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  192             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, descPanelLayout.createSequentialGroup()
 
  193                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 
  194                 .addComponent(descScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  198         org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, 
org.openide.util.NbBundle.getMessage(
FilesSetPanel.class, 
"FilesSetPanel.ignoreKnownFilesCheckbox.text")); 
 
  200         org.openide.awt.Mnemonics.setLocalizedText(ignoreUnallocCheckbox, 
org.openide.util.NbBundle.getMessage(
FilesSetPanel.class, 
"FilesSetPanel.ignoreUnallocCheckbox.text")); 
 
  201         ignoreUnallocCheckbox.setToolTipText(
org.openide.util.NbBundle.getMessage(
FilesSetPanel.class, 
"FilesSetPanel.ignoreUnallocCheckbox.toolTipText")); 
 
  203         javax.swing.GroupLayout layout = 
new javax.swing.GroupLayout(
this);
 
  204         this.setLayout(layout);
 
  205         layout.setHorizontalGroup(
 
  206             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  207             .addGroup(layout.createSequentialGroup()
 
  209                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  210                     .addComponent(descPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 
  211                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
 
  212                         .addGap(0, 0, Short.MAX_VALUE)
 
  213                         .addComponent(nameLabel)
 
  214                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 
  215                         .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  216                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
 
  217                         .addComponent(ignoreKnownFilesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 
  218                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 
  219                         .addComponent(ignoreUnallocCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
 
  222         layout.setVerticalGroup(
 
  223             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  224             .addGroup(layout.createSequentialGroup()
 
  226                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 
  227                     .addComponent(nameLabel)
 
  228                     .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  229                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 
  230                 .addComponent(descPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  231                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 
  232                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 
  233                     .addComponent(ignoreKnownFilesCheckbox)
 
  234                     .addComponent(ignoreUnallocCheckbox))
 
final String mustBeNamedErrorText
javax.swing.JPanel descPanel
javax.swing.JLabel nameLabel
javax.swing.JTextArea descTextArea
javax.swing.JCheckBox ignoreUnallocCheckbox
javax.swing.JTextField nameTextField
javax.swing.JCheckBox ignoreKnownFilesCheckbox
javax.swing.JScrollPane descScrollPanel
static String getCreateNewFileIngestFilterString()