19 package org.sleuthkit.autopsy.modules.interestingitems;
21 import java.awt.EventQueue;
23 import java.util.HashMap;
25 import java.util.TreeMap;
26 import javax.swing.DefaultListModel;
27 import javax.swing.JOptionPane;
28 import javax.swing.event.ListSelectionEvent;
29 import javax.swing.event.ListSelectionListener;
30 import org.openide.util.NbBundle;
38 final class InterestingItemDefsPanel
extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
40 private final DefaultListModel<FilesSet> setsListModel =
new DefaultListModel<>();
41 private final DefaultListModel<FilesSet.Rule> rulesListModel =
new DefaultListModel<>();
50 private TreeMap<String, FilesSet> filesSets;
55 InterestingItemDefsPanel() {
56 this.initComponents();
57 this.setsList.setModel(setsListModel);
58 this.setsList.addListSelectionListener(
new InterestingItemDefsPanel.SetsListSelectionListener());
59 this.rulesList.setModel(rulesListModel);
60 this.rulesList.addListSelectionListener(
new InterestingItemDefsPanel.RulesListSelectionListener());
67 public void saveSettings() {
68 InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets);
84 this.resetComponents();
88 this.filesSets =
new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets());
92 for (FilesSet set : this.filesSets.values()) {
93 this.setsListModel.addElement(set);
96 if (!this.filesSets.isEmpty()) {
99 EventQueue.invokeLater(() -> {
100 InterestingItemDefsPanel.this.setsList.setSelectedIndex(0);
108 private void resetComponents() {
109 this.resetRuleComponents();
110 this.setsListModel.clear();
111 this.setDescriptionTextArea.setText(
"");
112 this.ignoreKnownFilesCheckbox.setSelected(
true);
113 this.newSetButton.setEnabled(
true);
114 this.editSetButton.setEnabled(
false);
115 this.deleteSetButton.setEnabled(
false);
122 private void resetRuleComponents() {
123 this.fileNameTextField.setText(
"");
124 this.fileNameRadioButton.setSelected(
true);
125 this.fileNameRegexCheckbox.setSelected(
false);
126 this.filesRadioButton.setSelected(
true);
127 this.rulePathFilterTextField.setText(
"");
128 this.rulePathFilterRegexCheckBox.setSelected(
false);
129 this.newRuleButton.setEnabled(!this.setsListModel.isEmpty());
130 this.editRuleButton.setEnabled(
false);
131 this.deleteRuleButton.setEnabled(
false);
141 if (e.getValueIsAdjusting()) {
145 InterestingItemDefsPanel.this.rulesListModel.clear();
146 InterestingItemDefsPanel.this.resetRuleComponents();
150 FilesSet selectedSet = InterestingItemDefsPanel.this.setsList.getSelectedValue();
151 if (selectedSet != null) {
154 InterestingItemDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription());
155 InterestingItemDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles());
158 InterestingItemDefsPanel.this.newSetButton.setEnabled(
true);
159 InterestingItemDefsPanel.this.editSetButton.setEnabled(
true);
160 InterestingItemDefsPanel.this.deleteSetButton.setEnabled(
true);
163 TreeMap<String, FilesSet.Rule> rules =
new TreeMap<>(selectedSet.getRules());
164 for (FilesSet.Rule rule : rules.values()) {
165 InterestingItemDefsPanel.this.rulesListModel.addElement(rule);
169 if (!InterestingItemDefsPanel.this.rulesListModel.isEmpty()) {
170 InterestingItemDefsPanel.this.rulesList.setSelectedIndex(0);
185 if (e.getValueIsAdjusting()) {
190 FilesSet.Rule rule = InterestingItemDefsPanel.this.rulesList.getSelectedValue();
193 FilesSet.Rule.FileNameFilter nameFilter = rule.getFileNameFilter();
194 FilesSet.Rule.MetaTypeFilter typeFilter = rule.getMetaTypeFilter();
195 FilesSet.Rule.ParentPathFilter pathFilter = rule.getPathFilter();
199 InterestingItemDefsPanel.this.fileNameTextField.setText(nameFilter.getTextToMatch());
200 InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameFilter instanceof FilesSet.Rule.FullNameFilter);
201 InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameFilter instanceof FilesSet.Rule.ExtensionFilter);
202 InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameFilter.isRegex());
203 switch (typeFilter.getMetaType()) {
205 InterestingItemDefsPanel.this.filesRadioButton.setSelected(
true);
208 InterestingItemDefsPanel.this.dirsRadioButton.setSelected(
true);
210 case FILES_AND_DIRECTORIES:
211 InterestingItemDefsPanel.this.bothRadioButton.setSelected(
true);
214 if (pathFilter != null) {
215 InterestingItemDefsPanel.this.rulePathFilterTextField.setText(pathFilter.getTextToMatch());
216 InterestingItemDefsPanel.this.rulePathFilterRegexCheckBox.setSelected(pathFilter.isRegex());
218 InterestingItemDefsPanel.this.rulePathFilterTextField.setText(
"");
219 InterestingItemDefsPanel.this.rulePathFilterRegexCheckBox.setSelected(
false);
223 InterestingItemDefsPanel.this.newRuleButton.setEnabled(
true);
224 InterestingItemDefsPanel.this.editRuleButton.setEnabled(
true);
225 InterestingItemDefsPanel.this.deleteRuleButton.setEnabled(
true);
227 InterestingItemDefsPanel.this.resetRuleComponents();
240 private void doFileSetsDialog(FilesSet selectedSet) {
243 if (selectedSet != null) {
248 panel =
new FilesSetPanel();
254 int option = JOptionPane.OK_OPTION;
256 option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class,
"FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
257 }
while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition());
261 if(this.filesSets.containsKey(panel.getFilesSetName()) && selectedSet == null) {
262 MessageNotifyUtil.Message.error(NbBundle.getMessage(
this.getClass(),
263 "InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text",
264 panel.getFilesSetName()));
268 if (option == JOptionPane.OK_OPTION) {
269 Map<String, FilesSet.Rule> rules =
new HashMap<>();
270 if (selectedSet != null) {
274 rules.putAll(selectedSet.getRules());
276 this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), rules);
287 private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) {
289 FilesSetRulePanel panel;
290 if (selectedRule != null) {
292 panel =
new FilesSetRulePanel(selectedRule);
295 panel =
new FilesSetRulePanel();
301 int option = JOptionPane.OK_OPTION;
303 option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetRulePanel.class,
"FilesSetRulePanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
304 }
while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition());
306 if (option == JOptionPane.OK_OPTION) {
310 FilesSet selectedSet = this.setsList.getSelectedValue();
311 Map<String, FilesSet.Rule> rules =
new HashMap<>(selectedSet.getRules());
315 if (selectedRule != null) {
316 rules.remove(selectedRule.getUuid());
318 FilesSet.Rule newRule =
new FilesSet.Rule(panel.getRuleName(), panel.getFileNameFilter(), panel.getMetaTypeFilter(), panel.getPathFilter());
319 rules.put(newRule.getUuid(), newRule);
323 this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), rules);
328 EventQueue.invokeLater(() -> {
329 this.rulesList.setSelectedValue(newRule,
true);
346 void replaceFilesSet(FilesSet oldSet, String name, String description,
boolean ignoresKnownFiles, Map<String, FilesSet.Rule> rules) {
347 if (oldSet != null) {
350 this.filesSets.remove(oldSet.getName());
355 FilesSet newSet =
new FilesSet(name, description, ignoresKnownFiles, rules);
356 this.filesSets.put(newSet.getName(), newSet);
360 InterestingItemDefsPanel.this.setsListModel.clear();
361 for (FilesSet set : this.filesSets.values()) {
362 this.setsListModel.addElement(set);
368 this.setsList.setSelectedValue(newSet,
true);
376 @SuppressWarnings(
"unchecked")
378 private
void initComponents() {
380 fileNameButtonGroup =
new javax.swing.ButtonGroup();
381 jScrollPane1 =
new javax.swing.JScrollPane();
382 jPanel1 =
new javax.swing.JPanel();
383 jLabel6 =
new javax.swing.JLabel();
384 newRuleButton =
new javax.swing.JButton();
385 filesRadioButton =
new javax.swing.JRadioButton();
386 editRuleButton =
new javax.swing.JButton();
387 rulesListLabel =
new javax.swing.JLabel();
388 rulesListScrollPane =
new javax.swing.JScrollPane();
389 rulesList =
new javax.swing.JList<FilesSet.Rule>();
390 setDescScrollPanel =
new javax.swing.JScrollPane();
391 setDescriptionTextArea =
new javax.swing.JTextArea();
392 editSetButton =
new javax.swing.JButton();
393 setsListScrollPane =
new javax.swing.JScrollPane();
394 setsList =
new javax.swing.JList<FilesSet>();
395 fileNameExtensionRadioButton =
new javax.swing.JRadioButton();
396 jLabel3 =
new javax.swing.JLabel();
397 fileNameTextField =
new javax.swing.JTextField();
398 jLabel5 =
new javax.swing.JLabel();
399 fileNameRadioButton =
new javax.swing.JRadioButton();
400 rulePathFilterTextField =
new javax.swing.JTextField();
401 ignoreKnownFilesCheckbox =
new javax.swing.JCheckBox();
402 fileNameRegexCheckbox =
new javax.swing.JCheckBox();
403 separator =
new javax.swing.JSeparator();
404 setsListLabel =
new javax.swing.JLabel();
405 bothRadioButton =
new javax.swing.JRadioButton();
406 deleteSetButton =
new javax.swing.JButton();
407 deleteRuleButton =
new javax.swing.JButton();
408 newSetButton =
new javax.swing.JButton();
409 jLabel2 =
new javax.swing.JLabel();
410 dirsRadioButton =
new javax.swing.JRadioButton();
411 jLabel1 =
new javax.swing.JLabel();
412 jLabel4 =
new javax.swing.JLabel();
413 rulePathFilterRegexCheckBox =
new javax.swing.JCheckBox();
414 jScrollPane2 =
new javax.swing.JScrollPane();
415 jTextArea1 =
new javax.swing.JTextArea();
417 org.openide.awt.Mnemonics.setLocalizedText(jLabel6,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.jLabel6.text"));
419 newRuleButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/add16.png")));
420 org.openide.awt.Mnemonics.setLocalizedText(newRuleButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.newRuleButton.text"));
421 newRuleButton.setEnabled(
false);
422 newRuleButton.addActionListener(
new java.awt.event.ActionListener() {
423 public void actionPerformed(java.awt.event.ActionEvent evt) {
424 newRuleButtonActionPerformed(evt);
428 filesRadioButton.setSelected(
true);
429 org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.filesRadioButton.text"));
430 filesRadioButton.setEnabled(
false);
432 editRuleButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/edit16.png")));
433 org.openide.awt.Mnemonics.setLocalizedText(editRuleButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.editRuleButton.text"));
434 editRuleButton.setEnabled(
false);
435 editRuleButton.addActionListener(
new java.awt.event.ActionListener() {
436 public void actionPerformed(java.awt.event.ActionEvent evt) {
437 editRuleButtonActionPerformed(evt);
441 org.openide.awt.Mnemonics.setLocalizedText(rulesListLabel,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.rulesListLabel.text"));
443 rulesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
444 rulesListScrollPane.setViewportView(rulesList);
446 setDescriptionTextArea.setEditable(
false);
447 setDescriptionTextArea.setBackground(
new java.awt.Color(240, 240, 240));
448 setDescriptionTextArea.setColumns(20);
449 setDescriptionTextArea.setLineWrap(
true);
450 setDescriptionTextArea.setRows(2);
451 setDescScrollPanel.setViewportView(setDescriptionTextArea);
453 editSetButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/edit16.png")));
454 org.openide.awt.Mnemonics.setLocalizedText(editSetButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.editSetButton.text"));
455 editSetButton.setEnabled(
false);
456 editSetButton.addActionListener(
new java.awt.event.ActionListener() {
457 public void actionPerformed(java.awt.event.ActionEvent evt) {
458 editSetButtonActionPerformed(evt);
462 setsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
463 setsListScrollPane.setViewportView(setsList);
465 fileNameButtonGroup.add(fileNameExtensionRadioButton);
466 org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.fileNameExtensionRadioButton.text"));
467 fileNameExtensionRadioButton.setEnabled(
false);
469 org.openide.awt.Mnemonics.setLocalizedText(jLabel3,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.jLabel3.text"));
471 fileNameTextField.setEditable(
false);
472 fileNameTextField.setText(
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.fileNameTextField.text"));
474 org.openide.awt.Mnemonics.setLocalizedText(jLabel5,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.jLabel5.text"));
476 fileNameButtonGroup.add(fileNameRadioButton);
477 org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.fileNameRadioButton.text"));
478 fileNameRadioButton.setEnabled(
false);
480 rulePathFilterTextField.setEditable(
false);
481 rulePathFilterTextField.setText(
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.rulePathFilterTextField.text"));
483 org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text"));
484 ignoreKnownFilesCheckbox.setEnabled(
false);
485 ignoreKnownFilesCheckbox.addActionListener(
new java.awt.event.ActionListener() {
486 public void actionPerformed(java.awt.event.ActionEvent evt) {
487 ignoreKnownFilesCheckboxActionPerformed(evt);
491 org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.fileNameRegexCheckbox.text"));
492 fileNameRegexCheckbox.setEnabled(
false);
494 separator.setOrientation(javax.swing.SwingConstants.VERTICAL);
496 org.openide.awt.Mnemonics.setLocalizedText(setsListLabel,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.setsListLabel.text"));
498 org.openide.awt.Mnemonics.setLocalizedText(bothRadioButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.bothRadioButton.text"));
499 bothRadioButton.setEnabled(
false);
501 deleteSetButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/delete16.png")));
502 org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.deleteSetButton.text"));
503 deleteSetButton.setEnabled(
false);
504 deleteSetButton.addActionListener(
new java.awt.event.ActionListener() {
505 public void actionPerformed(java.awt.event.ActionEvent evt) {
506 deleteSetButtonActionPerformed(evt);
510 deleteRuleButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/delete16.png")));
511 org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.deleteRuleButton.text"));
512 deleteRuleButton.setEnabled(
false);
513 deleteRuleButton.addActionListener(
new java.awt.event.ActionListener() {
514 public void actionPerformed(java.awt.event.ActionEvent evt) {
515 deleteRuleButtonActionPerformed(evt);
519 newSetButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/add16.png")));
520 org.openide.awt.Mnemonics.setLocalizedText(newSetButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.newSetButton.text"));
521 newSetButton.addActionListener(
new java.awt.event.ActionListener() {
522 public void actionPerformed(java.awt.event.ActionEvent evt) {
523 newSetButtonActionPerformed(evt);
527 org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.jLabel2.text"));
529 org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.dirsRadioButton.text"));
530 dirsRadioButton.setEnabled(
false);
531 dirsRadioButton.addActionListener(
new java.awt.event.ActionListener() {
532 public void actionPerformed(java.awt.event.ActionEvent evt) {
533 dirsRadioButtonActionPerformed(evt);
537 org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.jLabel1.text"));
539 org.openide.awt.Mnemonics.setLocalizedText(jLabel4,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.jLabel4.text"));
541 org.openide.awt.Mnemonics.setLocalizedText(rulePathFilterRegexCheckBox,
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text"));
542 rulePathFilterRegexCheckBox.setEnabled(
false);
544 jTextArea1.setBackground(
new java.awt.Color(240, 240, 240));
545 jTextArea1.setColumns(20);
546 jTextArea1.setFont(jTextArea1.getFont().deriveFont(Font.PLAIN, 11));
547 jTextArea1.setLineWrap(
true);
548 jTextArea1.setRows(3);
549 jTextArea1.setText(
org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class,
"InterestingItemDefsPanel.jTextArea1.text"));
550 jTextArea1.setWrapStyleWord(
true);
551 jScrollPane2.setViewportView(jTextArea1);
553 javax.swing.GroupLayout jPanel1Layout =
new javax.swing.GroupLayout(jPanel1);
554 jPanel1.setLayout(jPanel1Layout);
555 jPanel1Layout.setHorizontalGroup(
556 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
557 .addGroup(jPanel1Layout.createSequentialGroup()
559 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
560 .addComponent(setsListLabel)
561 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
562 .addComponent(setsListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
563 .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING))
564 .addGroup(jPanel1Layout.createSequentialGroup()
565 .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
566 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
567 .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
568 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
569 .addComponent(deleteSetButton)))
570 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
571 .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)
573 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
574 .addComponent(rulesListLabel)
575 .addComponent(jLabel5)
576 .addComponent(ignoreKnownFilesCheckbox)
577 .addGroup(jPanel1Layout.createSequentialGroup()
578 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
579 .addComponent(jLabel2)
580 .addComponent(jLabel1))
582 .addComponent(filesRadioButton)
583 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
584 .addComponent(dirsRadioButton)
585 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
586 .addComponent(bothRadioButton))
587 .addGroup(jPanel1Layout.createSequentialGroup()
589 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
590 .addGroup(jPanel1Layout.createSequentialGroup()
592 .addComponent(jLabel3)
593 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
594 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
595 .addGroup(jPanel1Layout.createSequentialGroup()
596 .addComponent(fileNameRadioButton)
597 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
598 .addComponent(fileNameExtensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
599 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
600 .addComponent(fileNameRegexCheckbox))
601 .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)))
602 .addGroup(jPanel1Layout.createSequentialGroup()
603 .addComponent(jLabel4)
604 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
605 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
606 .addComponent(rulePathFilterRegexCheckBox)
607 .addComponent(rulePathFilterTextField)))))
608 .addGroup(jPanel1Layout.createSequentialGroup()
609 .addComponent(newRuleButton)
610 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
611 .addComponent(editRuleButton)
612 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
613 .addComponent(deleteRuleButton))
614 .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)
615 .addComponent(jLabel6)
616 .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE))
619 jPanel1Layout.setVerticalGroup(
620 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
621 .addGroup(jPanel1Layout.createSequentialGroup()
623 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
624 .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE)
625 .addGroup(jPanel1Layout.createSequentialGroup()
626 .addComponent(jLabel6)
627 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
628 .addComponent(jLabel5)
629 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
630 .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
631 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
632 .addComponent(ignoreKnownFilesCheckbox)
633 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
634 .addComponent(rulesListLabel)
635 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
636 .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
637 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
638 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
639 .addComponent(newRuleButton)
640 .addComponent(editRuleButton)
641 .addComponent(deleteRuleButton))
642 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
643 .addComponent(jLabel1)
645 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
646 .addComponent(jLabel2)
647 .addComponent(filesRadioButton)
648 .addComponent(dirsRadioButton)
649 .addComponent(bothRadioButton))
650 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
651 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
652 .addComponent(jLabel3)
653 .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
654 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
655 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
656 .addComponent(fileNameRadioButton)
657 .addComponent(fileNameExtensionRadioButton)
658 .addComponent(fileNameRegexCheckbox))
659 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
660 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
661 .addComponent(jLabel4)
662 .addComponent(rulePathFilterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
663 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
664 .addComponent(rulePathFilterRegexCheckBox))
665 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
666 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
668 .addComponent(setsListLabel)
669 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
670 .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
671 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
672 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
673 .addComponent(newSetButton)
674 .addComponent(editSetButton)
675 .addComponent(deleteSetButton))))
679 jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL,
new java.awt.Component[] {deleteRuleButton, deleteSetButton, editRuleButton, editSetButton, newRuleButton, newSetButton});
681 jScrollPane1.setViewportView(jPanel1);
683 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
684 this.setLayout(layout);
685 layout.setHorizontalGroup(
686 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
687 .addGroup(layout.createSequentialGroup()
689 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 710, javax.swing.GroupLayout.PREFERRED_SIZE)
690 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
692 layout.setVerticalGroup(
693 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
694 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
695 .addGap(0, 11, Short.MAX_VALUE)
696 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 468, javax.swing.GroupLayout.PREFERRED_SIZE))
700 private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {
701 this.doFileSetsDialog(null);
704 private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {
705 this.doFileSetsDialog(this.setsList.getSelectedValue());
708 private void newRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {
709 this.doFilesSetRuleDialog(null);
712 private void editRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {
713 this.doFilesSetRuleDialog(this.rulesList.getSelectedValue());
716 private void deleteSetButtonActionPerformed(java.awt.event.ActionEvent evt) {
717 FilesSet selectedSet = this.setsList.getSelectedValue();
718 this.filesSets.remove(selectedSet.getName());
719 this.setsListModel.removeElement(selectedSet);
723 if (!this.filesSets.isEmpty()) {
724 this.setsList.setSelectedIndex(0);
726 this.resetComponents();
730 private void deleteRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {
735 FilesSet oldSet = this.setsList.getSelectedValue();
736 Map<String, FilesSet.Rule> rules =
new HashMap<>(oldSet.getRules());
737 FilesSet.Rule selectedRule = this.rulesList.getSelectedValue();
738 rules.remove(selectedRule.getUuid());
739 this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), rules);
742 private void ignoreKnownFilesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {
746 private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
751 private javax.swing.JRadioButton bothRadioButton;
752 private javax.swing.JButton deleteRuleButton;
753 private javax.swing.JButton deleteSetButton;
754 private javax.swing.JRadioButton dirsRadioButton;
755 private javax.swing.JButton editRuleButton;
756 private javax.swing.JButton editSetButton;
757 private javax.swing.ButtonGroup fileNameButtonGroup;
758 private javax.swing.JRadioButton fileNameExtensionRadioButton;
759 private javax.swing.JRadioButton fileNameRadioButton;
760 private javax.swing.JCheckBox fileNameRegexCheckbox;
761 private javax.swing.JTextField fileNameTextField;
762 private javax.swing.JRadioButton filesRadioButton;
763 private javax.swing.JCheckBox ignoreKnownFilesCheckbox;
764 private javax.swing.JLabel jLabel1;
765 private javax.swing.JLabel jLabel2;
766 private javax.swing.JLabel jLabel3;
767 private javax.swing.JLabel jLabel4;
768 private javax.swing.JLabel jLabel5;
769 private javax.swing.JLabel jLabel6;
770 private javax.swing.JPanel jPanel1;
771 private javax.swing.JScrollPane jScrollPane1;
772 private javax.swing.JScrollPane jScrollPane2;
773 private javax.swing.JTextArea jTextArea1;
774 private javax.swing.JButton newRuleButton;
775 private javax.swing.JButton newSetButton;
776 private javax.swing.JCheckBox rulePathFilterRegexCheckBox;
777 private javax.swing.JTextField rulePathFilterTextField;
778 private javax.swing.JList<FilesSet.Rule> rulesList;
779 private javax.swing.JLabel rulesListLabel;
780 private javax.swing.JScrollPane rulesListScrollPane;
781 private javax.swing.JSeparator separator;
782 private javax.swing.JScrollPane setDescScrollPanel;
783 private javax.swing.JTextArea setDescriptionTextArea;
784 private javax.swing.JList<FilesSet> setsList;
785 private javax.swing.JLabel setsListLabel;
786 private javax.swing.JScrollPane setsListScrollPane;
void valueChanged(ListSelectionEvent e)
void valueChanged(ListSelectionEvent e)