forked from rajwitt/SmutDetect4Autopsy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmutDetectIngestJobSettingsPanel.java
172 lines (153 loc) · 8.63 KB
/
SmutDetectIngestJobSettingsPanel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/**
* SmutDetect4Autopsy
* Copyright (C) 2014 Rajmund Witt
*
* Derived from Sample Module provided with Autopsy 3.1.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package uk.co.smutdetect.autopsy;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
/**
* UI component used to make per ingest job settings for sample ingest modules.
*/
public class SmutDetectIngestJobSettingsPanel extends IngestModuleIngestJobSettingsPanel {
int minSizeTextFieldIsInt;
/**
* Creates new form SampleIngestModuleIngestJobSettings
*/
public SmutDetectIngestJobSettingsPanel(SmutDetectIngestJobSettings settings) {
this.minSizeTextFieldIsInt = 100;
initComponents();
customizeComponents(settings);
}
private void customizeComponents(SmutDetectIngestJobSettings settings) {
skipKnownFilesCheckBox.setSelected(settings.skipKnownFiles());
useThumbnailCheckBox.setSelected(settings.useThumbnail());
}
/**
* Gets the ingest job settings for an ingest module.
*
* @return The ingest settings.
*/
@Override
public IngestModuleIngestJobSettings getSettings() {
return new SmutDetectIngestJobSettings(skipKnownFilesCheckBox.isSelected(), useThumbnailCheckBox.isSelected(), Integer.parseInt(minSizeTextField.getText()));
}
/**
* 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
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
skipKnownFilesCheckBox = new javax.swing.JCheckBox();
minSizeTextField = new javax.swing.JTextField();
minSizeLabel = new javax.swing.JLabel();
useThumbnailCheckBox = new javax.swing.JCheckBox();
org.openide.awt.Mnemonics.setLocalizedText(skipKnownFilesCheckBox, org.openide.util.NbBundle.getMessage(SmutDetectIngestJobSettingsPanel.class, "SmutDetectIngestJobSettingsPanel.skipKnownFilesCheckBox.text")); // NOI18N
skipKnownFilesCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
skipKnownFilesCheckBoxActionPerformed(evt);
}
});
minSizeTextField.setText(org.openide.util.NbBundle.getMessage(SmutDetectIngestJobSettingsPanel.class, "SmutDetectIngestJobSettingsPanel.minSizeTextField.text")); // NOI18N
minSizeTextField.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseExited(java.awt.event.MouseEvent evt) {
minSizeTextFieldMouseExited(evt);
}
});
minSizeTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
minSizeTextFieldActionPerformed(evt);
}
});
minSizeTextField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
minSizeTextFieldKeyPressed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(minSizeLabel, org.openide.util.NbBundle.getMessage(SmutDetectIngestJobSettingsPanel.class, "SmutDetectIngestJobSettingsPanel.minSizeLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(useThumbnailCheckBox, org.openide.util.NbBundle.getMessage(SmutDetectIngestJobSettingsPanel.class, "SmutDetectIngestJobSettingsPanel.useThumbnailCheckBox.text")); // NOI18N
useThumbnailCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
useThumbnailCheckBoxActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(useThumbnailCheckBox, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(minSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(minSizeLabel))
.addComponent(skipKnownFilesCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(skipKnownFilesCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(minSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(minSizeLabel))
.addGap(1, 1, 1)
.addComponent(useThumbnailCheckBox)
.addContainerGap(221, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void skipKnownFilesCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipKnownFilesCheckBoxActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_skipKnownFilesCheckBoxActionPerformed
private void minSizeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_minSizeTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_minSizeTextFieldActionPerformed
private void useThumbnailCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useThumbnailCheckBoxActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_useThumbnailCheckBoxActionPerformed
private void minSizeTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_minSizeTextFieldKeyPressed
// TODO add your handling code here:
}//GEN-LAST:event_minSizeTextFieldKeyPressed
private void minSizeTextFieldMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minSizeTextFieldMouseExited
try {
minSizeTextFieldIsInt = Integer.parseInt(minSizeTextField.getText());
if (minSizeTextFieldIsInt < 100 || minSizeTextFieldIsInt > 2147483647) throw NumberFormatException();
} catch (Exception e) {
minSizeTextField.setText("100");
}
}//GEN-LAST:event_minSizeTextFieldMouseExited
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel minSizeLabel;
private javax.swing.JTextField minSizeTextField;
private javax.swing.JCheckBox skipKnownFilesCheckBox;
private javax.swing.JCheckBox useThumbnailCheckBox;
// End of variables declaration//GEN-END:variables
private Exception NumberFormatException() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
}