Autopsy  4.18.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
KeywordSearchGlobalSearchSettingsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2012-2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.keywordsearch;
20 
21 import java.awt.EventQueue;
22 import java.beans.PropertyChangeEvent;
23 import java.beans.PropertyChangeListener;
24 import java.util.logging.Level;
25 import org.netbeans.spi.options.OptionsPanelController;
26 import org.openide.util.NbBundle;
32 
36 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
37 class KeywordSearchGlobalSearchSettingsPanel extends javax.swing.JPanel implements OptionsPanel {
38 
39  private static final long serialVersionUID = 1L;
40  private final Logger logger = Logger.getLogger(KeywordSearchGlobalSearchSettingsPanel.class.getName());
41 
45  KeywordSearchGlobalSearchSettingsPanel() {
46  initComponents();
47  customizeComponents();
48  }
49 
50  private void activateWidgets() {
51  skipNSRLCheckBox.setSelected(KeywordSearchSettings.getSkipKnown());
52  showSnippetsCB.setSelected(KeywordSearchSettings.getShowSnippets());
53  ocrCheckBox.setSelected(KeywordSearchSettings.getOcrOption());
54  limitedOcrCheckbox.setSelected(KeywordSearchSettings.getLimitedOcrOption());
55  boolean ingestRunning = IngestManager.getInstance().isIngestRunning();
56  ingestWarningLabel.setVisible(ingestRunning);
57  skipNSRLCheckBox.setEnabled(!ingestRunning);
58  ocrCheckBox.setEnabled(!ingestRunning);
59  limitedOcrCheckbox.setEnabled(ocrCheckBox.isSelected() && !ingestRunning);
60  setTimeSettingEnabled(!ingestRunning);
61 
62  final UpdateFrequency curFreq = KeywordSearchSettings.getUpdateFrequency();
63  switch (curFreq) {
64  case FAST:
65  timeRadioButton1.setSelected(true);
66  break;
67  case AVG:
68  timeRadioButton2.setSelected(true);
69  break;
70  case SLOW:
71  timeRadioButton3.setSelected(true);
72  break;
73  case SLOWEST:
74  timeRadioButton4.setSelected(true);
75  break;
76  case NONE:
77  timeRadioButton5.setSelected(true);
78  break;
79  case DEFAULT:
80  default:
81  // default value
82  timeRadioButton3.setSelected(true);
83  break;
84  }
85  }
86 
92  @SuppressWarnings("unchecked")
93  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
94  private void initComponents() {
95 
96  timeGroup = new javax.swing.ButtonGroup();
97  skipNSRLCheckBox = new javax.swing.JCheckBox();
98  filesIndexedLabel = new javax.swing.JLabel();
99  filesIndexedValue = new javax.swing.JLabel();
100  chunksLabel = new javax.swing.JLabel();
101  chunksValLabel = new javax.swing.JLabel();
102  settingsLabel = new javax.swing.JLabel();
103  informationLabel = new javax.swing.JLabel();
104  settingsSeparator = new javax.swing.JSeparator();
105  informationSeparator = new javax.swing.JSeparator();
106  frequencyLabel = new javax.swing.JLabel();
107  timeRadioButton1 = new javax.swing.JRadioButton();
108  timeRadioButton2 = new javax.swing.JRadioButton();
109  timeRadioButton3 = new javax.swing.JRadioButton();
110  timeRadioButton4 = new javax.swing.JRadioButton();
111  showSnippetsCB = new javax.swing.JCheckBox();
112  timeRadioButton5 = new javax.swing.JRadioButton();
113  ingestWarningLabel = new javax.swing.JLabel();
114  ocrCheckBox = new javax.swing.JCheckBox();
115  limitedOcrCheckbox = new javax.swing.JCheckBox();
116 
117  skipNSRLCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.skipNSRLCheckBox.text")); // NOI18N
118  skipNSRLCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.skipNSRLCheckBox.toolTipText")); // NOI18N
119  skipNSRLCheckBox.addActionListener(new java.awt.event.ActionListener() {
120  public void actionPerformed(java.awt.event.ActionEvent evt) {
121  skipNSRLCheckBoxActionPerformed(evt);
122  }
123  });
124 
125  filesIndexedLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.filesIndexedLabel.text")); // NOI18N
126 
127  filesIndexedValue.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.filesIndexedValue.text")); // NOI18N
128 
129  chunksLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.chunksLabel.text")); // NOI18N
130 
131  chunksValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.chunksValLabel.text")); // NOI18N
132 
133  settingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.settingsLabel.text")); // NOI18N
134 
135  informationLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.informationLabel.text")); // NOI18N
136 
137  frequencyLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.frequencyLabel.text")); // NOI18N
138 
139  timeRadioButton1.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton1.text")); // NOI18N
140  timeRadioButton1.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton1.toolTipText")); // NOI18N
141  timeRadioButton1.addActionListener(new java.awt.event.ActionListener() {
142  public void actionPerformed(java.awt.event.ActionEvent evt) {
143  timeRadioButton1ActionPerformed(evt);
144  }
145  });
146 
147  timeRadioButton2.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton2.text")); // NOI18N
148  timeRadioButton2.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton2.toolTipText")); // NOI18N
149  timeRadioButton2.addActionListener(new java.awt.event.ActionListener() {
150  public void actionPerformed(java.awt.event.ActionEvent evt) {
151  timeRadioButton2ActionPerformed(evt);
152  }
153  });
154 
155  timeRadioButton3.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton3.text")); // NOI18N
156  timeRadioButton3.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton3.toolTipText")); // NOI18N
157  timeRadioButton3.addActionListener(new java.awt.event.ActionListener() {
158  public void actionPerformed(java.awt.event.ActionEvent evt) {
159  timeRadioButton3ActionPerformed(evt);
160  }
161  });
162 
163  timeRadioButton4.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton4.text_1")); // NOI18N
164  timeRadioButton4.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton4.toolTipText")); // NOI18N
165  timeRadioButton4.addActionListener(new java.awt.event.ActionListener() {
166  public void actionPerformed(java.awt.event.ActionEvent evt) {
167  timeRadioButton4ActionPerformed(evt);
168  }
169  });
170 
171  showSnippetsCB.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.showSnippetsCB.text")); // NOI18N
172  showSnippetsCB.addActionListener(new java.awt.event.ActionListener() {
173  public void actionPerformed(java.awt.event.ActionEvent evt) {
174  showSnippetsCBActionPerformed(evt);
175  }
176  });
177 
178  timeRadioButton5.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.text")); // NOI18N
179  timeRadioButton5.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.toolTipText")); // NOI18N
180  timeRadioButton5.addActionListener(new java.awt.event.ActionListener() {
181  public void actionPerformed(java.awt.event.ActionEvent evt) {
182  timeRadioButton5ActionPerformed(evt);
183  }
184  });
185 
186  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
187  ingestWarningLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.ingestWarningLabel.text")); // NOI18N
188 
189  ocrCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.ocrCheckBox.text")); // NOI18N
190  ocrCheckBox.addActionListener(new java.awt.event.ActionListener() {
191  public void actionPerformed(java.awt.event.ActionEvent evt) {
192  ocrCheckBoxActionPerformed(evt);
193  }
194  });
195 
196  limitedOcrCheckbox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.limitedOcrCheckbox.text")); // NOI18N
197  limitedOcrCheckbox.addActionListener(new java.awt.event.ActionListener() {
198  public void actionPerformed(java.awt.event.ActionEvent evt) {
199  limitedOcrCheckboxActionPerformed(evt);
200  }
201  });
202 
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()
208  .addContainerGap()
209  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
210  .addComponent(ingestWarningLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
211  .addGroup(layout.createSequentialGroup()
212  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
213  .addGroup(layout.createSequentialGroup()
214  .addComponent(settingsLabel)
215  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
216  .addComponent(settingsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE))
217  .addGroup(layout.createSequentialGroup()
218  .addComponent(informationLabel)
219  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
220  .addComponent(informationSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE))
221  .addGroup(layout.createSequentialGroup()
222  .addGap(16, 16, 16)
223  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
224  .addComponent(skipNSRLCheckBox)
225  .addComponent(showSnippetsCB)
226  .addComponent(ocrCheckBox)
227  .addGroup(layout.createSequentialGroup()
228  .addComponent(filesIndexedLabel)
229  .addGap(18, 18, 18)
230  .addComponent(filesIndexedValue))
231  .addComponent(frequencyLabel)
232  .addGroup(layout.createSequentialGroup()
233  .addGap(16, 16, 16)
234  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
235  .addComponent(timeRadioButton2)
236  .addComponent(timeRadioButton1)
237  .addComponent(timeRadioButton3)
238  .addComponent(timeRadioButton4)
239  .addComponent(timeRadioButton5)))
240  .addGroup(layout.createSequentialGroup()
241  .addComponent(chunksLabel)
242  .addGap(18, 18, 18)
243  .addComponent(chunksValLabel))
244  .addGroup(layout.createSequentialGroup()
245  .addGap(16, 16, 16)
246  .addComponent(limitedOcrCheckbox)))))
247  .addGap(0, 0, Short.MAX_VALUE)))
248  .addContainerGap())
249  );
250 
251  layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {chunksLabel, filesIndexedLabel});
252 
253  layout.setVerticalGroup(
254  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
255  .addGroup(layout.createSequentialGroup()
256  .addContainerGap()
257  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
258  .addComponent(settingsLabel)
259  .addComponent(settingsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))
260  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
261  .addComponent(skipNSRLCheckBox)
262  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
263  .addComponent(showSnippetsCB)
264  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
265  .addComponent(ocrCheckBox)
266  .addGap(0, 0, 0)
267  .addComponent(limitedOcrCheckbox)
268  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
269  .addComponent(frequencyLabel)
270  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
271  .addComponent(timeRadioButton1)
272  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
273  .addComponent(timeRadioButton2)
274  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
275  .addComponent(timeRadioButton3)
276  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
277  .addComponent(timeRadioButton4)
278  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
279  .addComponent(timeRadioButton5)
280  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
281  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
282  .addComponent(informationLabel)
283  .addComponent(informationSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE))
284  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
285  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
286  .addComponent(filesIndexedLabel)
287  .addComponent(filesIndexedValue))
288  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
289  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
290  .addComponent(chunksLabel)
291  .addComponent(chunksValLabel))
292  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
293  .addComponent(ingestWarningLabel)
294  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
295  );
296  }// </editor-fold>//GEN-END:initComponents
297 
298  private void timeRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton5ActionPerformed
299  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
300  }//GEN-LAST:event_timeRadioButton5ActionPerformed
301 
302  private void skipNSRLCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipNSRLCheckBoxActionPerformed
303  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
304  }//GEN-LAST:event_skipNSRLCheckBoxActionPerformed
305 
306  private void showSnippetsCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showSnippetsCBActionPerformed
307  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
308  }//GEN-LAST:event_showSnippetsCBActionPerformed
309 
310  private void timeRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton1ActionPerformed
311  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
312  }//GEN-LAST:event_timeRadioButton1ActionPerformed
313 
314  private void timeRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton2ActionPerformed
315  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
316  }//GEN-LAST:event_timeRadioButton2ActionPerformed
317 
318  private void timeRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton3ActionPerformed
319  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
320  }//GEN-LAST:event_timeRadioButton3ActionPerformed
321 
322  private void timeRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton4ActionPerformed
323  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
324  }//GEN-LAST:event_timeRadioButton4ActionPerformed
325 
326  private void ocrCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ocrCheckBoxActionPerformed
327  limitedOcrCheckbox.setEnabled(ocrCheckBox.isSelected());
328  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
329  }//GEN-LAST:event_ocrCheckBoxActionPerformed
330 
331  private void limitedOcrCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limitedOcrCheckboxActionPerformed
332  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
333  }//GEN-LAST:event_limitedOcrCheckboxActionPerformed
334 
335  // Variables declaration - do not modify//GEN-BEGIN:variables
336  private javax.swing.JLabel chunksLabel;
337  private javax.swing.JLabel chunksValLabel;
338  private javax.swing.JLabel filesIndexedLabel;
339  private javax.swing.JLabel filesIndexedValue;
340  private javax.swing.JLabel frequencyLabel;
341  private javax.swing.JLabel informationLabel;
342  private javax.swing.JSeparator informationSeparator;
343  private javax.swing.JLabel ingestWarningLabel;
344  private javax.swing.JCheckBox limitedOcrCheckbox;
345  private javax.swing.JCheckBox ocrCheckBox;
346  private javax.swing.JLabel settingsLabel;
347  private javax.swing.JSeparator settingsSeparator;
348  private javax.swing.JCheckBox showSnippetsCB;
349  private javax.swing.JCheckBox skipNSRLCheckBox;
350  private javax.swing.ButtonGroup timeGroup;
351  private javax.swing.JRadioButton timeRadioButton1;
352  private javax.swing.JRadioButton timeRadioButton2;
353  private javax.swing.JRadioButton timeRadioButton3;
354  private javax.swing.JRadioButton timeRadioButton4;
355  private javax.swing.JRadioButton timeRadioButton5;
356  // End of variables declaration//GEN-END:variables
357 
358  @Override
359  public void store() {
360  KeywordSearchSettings.setSkipKnown(skipNSRLCheckBox.isSelected());
361  KeywordSearchSettings.setUpdateFrequency(getSelectedTimeValue());
362  KeywordSearchSettings.setShowSnippets(showSnippetsCB.isSelected());
363  KeywordSearchSettings.setOcrOption(ocrCheckBox.isSelected());
364  KeywordSearchSettings.setLimitedOcrOption(limitedOcrCheckbox.isSelected());
365  }
366 
367  @Override
368  public void load() {
369  activateWidgets();
370  }
371 
372  private void setTimeSettingEnabled(boolean enabled) {
373  timeRadioButton1.setEnabled(enabled);
374  timeRadioButton2.setEnabled(enabled);
375  timeRadioButton3.setEnabled(enabled);
376  timeRadioButton4.setEnabled(enabled);
377  timeRadioButton5.setEnabled(enabled);
378  frequencyLabel.setEnabled(enabled);
379  }
380 
381  private UpdateFrequency getSelectedTimeValue() {
382  if (timeRadioButton1.isSelected()) {
383  return UpdateFrequency.FAST;
384  } else if (timeRadioButton2.isSelected()) {
385  return UpdateFrequency.AVG;
386  } else if (timeRadioButton3.isSelected()) {
387  return UpdateFrequency.SLOW;
388  } else if (timeRadioButton4.isSelected()) {
389  return UpdateFrequency.SLOWEST;
390  } else if (timeRadioButton5.isSelected()) {
391  return UpdateFrequency.NONE;
392  }
393  return UpdateFrequency.DEFAULT;
394  }
395 
396  @NbBundle.Messages({"KeywordSearchGlobalSearchSettingsPanel.customizeComponents.windowsOCR=Enable Optical Character Recognition (OCR) (Requires Windows 64-bit)",
397  "KeywordSearchGlobalSearchSettingsPanel.customizeComponents.windowsLimitedOCR=Only process images which are over 100KB in size or extracted from a document. (Beta) (Requires Windows 64-bit)"})
398  private void customizeComponents() {
399 
400  timeGroup.add(timeRadioButton1);
401  timeGroup.add(timeRadioButton2);
402  timeGroup.add(timeRadioButton3);
403  timeGroup.add(timeRadioButton4);
404  timeGroup.add(timeRadioButton5);
405 
406  this.skipNSRLCheckBox.setSelected(KeywordSearchSettings.getSkipKnown());
407 
408  try {
409  filesIndexedValue.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedFiles()));
410  chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks()));
411  } catch (KeywordSearchModuleException | NoOpenCoreException ex) {
412  logger.log(Level.WARNING, "Could not get number of indexed files/chunks"); //NON-NLS
413  }
414 
415  if (!PlatformUtil.isWindowsOS() || !PlatformUtil.is64BitOS()) {
416  ocrCheckBox.setText(Bundle.KeywordSearchGlobalSearchSettingsPanel_customizeComponents_windowsOCR());
417  ocrCheckBox.setSelected(false);
418  ocrCheckBox.setEnabled(false);
419  limitedOcrCheckbox.setSelected(false);
420  limitedOcrCheckbox.setEnabled(false);
421  limitedOcrCheckbox.setText(Bundle.KeywordSearchGlobalSearchSettingsPanel_customizeComponents_windowsLimitedOCR());
422  }
423 
424  KeywordSearch.addNumIndexedFilesChangeListener(
425  new PropertyChangeListener() {
426  @Override
427  public void propertyChange(PropertyChangeEvent evt) {
428  String changed = evt.getPropertyName();
429  Object newValue = evt.getNewValue();
430 
431  if (changed.equals(KeywordSearch.NUM_FILES_CHANGE_EVT)) {
432  int newFilesIndexed = ((Integer) newValue);
433  filesIndexedValue.setText(Integer.toString(newFilesIndexed));
434  try {
435  chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks()));
436  } catch (KeywordSearchModuleException | NoOpenCoreException ex) {
437  logger.log(Level.WARNING, "Could not get number of indexed chunks"); //NON-NLS
438 
439  }
440  }
441  }
442  });
443 
444  //allow panel to toggle its enabled status while it is open based on ingest events
445  IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
446  @Override
447  public void propertyChange(PropertyChangeEvent evt) {
448  Object source = evt.getSource();
449  if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
450  EventQueue.invokeLater(() -> {
451  activateWidgets();
452  });
453  }
454  }
455  });
456  }
457 }

Copyright © 2012-2021 Basis Technology. Generated on: Thu Jul 8 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.