Autopsy  4.17.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 final Logger logger = Logger.getLogger(KeywordSearchGlobalSearchSettingsPanel.class.getName());
40 
44  KeywordSearchGlobalSearchSettingsPanel() {
45  initComponents();
46  customizeComponents();
47  }
48 
49  private void activateWidgets() {
50  skipNSRLCheckBox.setSelected(KeywordSearchSettings.getSkipKnown());
51  showSnippetsCB.setSelected(KeywordSearchSettings.getShowSnippets());
52  ocrCheckBox.setSelected(KeywordSearchSettings.getOcrOption());
53  boolean ingestRunning = IngestManager.getInstance().isIngestRunning();
54  ingestWarningLabel.setVisible(ingestRunning);
55  skipNSRLCheckBox.setEnabled(!ingestRunning);
56  ocrCheckBox.setEnabled(!ingestRunning);
57  setTimeSettingEnabled(!ingestRunning);
58 
59  final UpdateFrequency curFreq = KeywordSearchSettings.getUpdateFrequency();
60  switch (curFreq) {
61  case FAST:
62  timeRadioButton1.setSelected(true);
63  break;
64  case AVG:
65  timeRadioButton2.setSelected(true);
66  break;
67  case SLOW:
68  timeRadioButton3.setSelected(true);
69  break;
70  case SLOWEST:
71  timeRadioButton4.setSelected(true);
72  break;
73  case NONE:
74  timeRadioButton5.setSelected(true);
75  break;
76  case DEFAULT:
77  default:
78  // default value
79  timeRadioButton3.setSelected(true);
80  break;
81  }
82  }
83 
89  @SuppressWarnings("unchecked")
90  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
91  private void initComponents() {
92 
93  timeGroup = new javax.swing.ButtonGroup();
94  skipNSRLCheckBox = new javax.swing.JCheckBox();
95  filesIndexedLabel = new javax.swing.JLabel();
96  filesIndexedValue = new javax.swing.JLabel();
97  chunksLabel = new javax.swing.JLabel();
98  chunksValLabel = new javax.swing.JLabel();
99  settingsLabel = new javax.swing.JLabel();
100  informationLabel = new javax.swing.JLabel();
101  settingsSeparator = new javax.swing.JSeparator();
102  informationSeparator = new javax.swing.JSeparator();
103  frequencyLabel = new javax.swing.JLabel();
104  timeRadioButton1 = new javax.swing.JRadioButton();
105  timeRadioButton2 = new javax.swing.JRadioButton();
106  timeRadioButton3 = new javax.swing.JRadioButton();
107  timeRadioButton4 = new javax.swing.JRadioButton();
108  showSnippetsCB = new javax.swing.JCheckBox();
109  timeRadioButton5 = new javax.swing.JRadioButton();
110  ingestWarningLabel = new javax.swing.JLabel();
111  ocrCheckBox = new javax.swing.JCheckBox();
112 
113  skipNSRLCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.skipNSRLCheckBox.text")); // NOI18N
114  skipNSRLCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.skipNSRLCheckBox.toolTipText")); // NOI18N
115  skipNSRLCheckBox.addActionListener(new java.awt.event.ActionListener() {
116  public void actionPerformed(java.awt.event.ActionEvent evt) {
117  skipNSRLCheckBoxActionPerformed(evt);
118  }
119  });
120 
121  filesIndexedLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.filesIndexedLabel.text")); // NOI18N
122 
123  filesIndexedValue.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.filesIndexedValue.text")); // NOI18N
124 
125  chunksLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.chunksLabel.text")); // NOI18N
126 
127  chunksValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.chunksValLabel.text")); // NOI18N
128 
129  settingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.settingsLabel.text")); // NOI18N
130 
131  informationLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.informationLabel.text")); // NOI18N
132 
133  frequencyLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.frequencyLabel.text")); // NOI18N
134 
135  timeRadioButton1.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton1.text")); // NOI18N
136  timeRadioButton1.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton1.toolTipText")); // NOI18N
137  timeRadioButton1.addActionListener(new java.awt.event.ActionListener() {
138  public void actionPerformed(java.awt.event.ActionEvent evt) {
139  timeRadioButton1ActionPerformed(evt);
140  }
141  });
142 
143  timeRadioButton2.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton2.text")); // NOI18N
144  timeRadioButton2.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton2.toolTipText")); // NOI18N
145  timeRadioButton2.addActionListener(new java.awt.event.ActionListener() {
146  public void actionPerformed(java.awt.event.ActionEvent evt) {
147  timeRadioButton2ActionPerformed(evt);
148  }
149  });
150 
151  timeRadioButton3.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton3.text")); // NOI18N
152  timeRadioButton3.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton3.toolTipText")); // NOI18N
153  timeRadioButton3.addActionListener(new java.awt.event.ActionListener() {
154  public void actionPerformed(java.awt.event.ActionEvent evt) {
155  timeRadioButton3ActionPerformed(evt);
156  }
157  });
158 
159  timeRadioButton4.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton4.text_1")); // NOI18N
160  timeRadioButton4.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton4.toolTipText")); // NOI18N
161  timeRadioButton4.addActionListener(new java.awt.event.ActionListener() {
162  public void actionPerformed(java.awt.event.ActionEvent evt) {
163  timeRadioButton4ActionPerformed(evt);
164  }
165  });
166 
167  showSnippetsCB.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.showSnippetsCB.text")); // NOI18N
168  showSnippetsCB.addActionListener(new java.awt.event.ActionListener() {
169  public void actionPerformed(java.awt.event.ActionEvent evt) {
170  showSnippetsCBActionPerformed(evt);
171  }
172  });
173 
174  timeRadioButton5.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.text")); // NOI18N
175  timeRadioButton5.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.toolTipText")); // NOI18N
176  timeRadioButton5.addActionListener(new java.awt.event.ActionListener() {
177  public void actionPerformed(java.awt.event.ActionEvent evt) {
178  timeRadioButton5ActionPerformed(evt);
179  }
180  });
181 
182  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
183  ingestWarningLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.ingestWarningLabel.text")); // NOI18N
184 
185  ocrCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchGlobalSearchSettingsPanel.class, "KeywordSearchGlobalSearchSettingsPanel.ocrCheckBox.text")); // NOI18N
186  ocrCheckBox.addActionListener(new java.awt.event.ActionListener() {
187  public void actionPerformed(java.awt.event.ActionEvent evt) {
188  ocrCheckBoxActionPerformed(evt);
189  }
190  });
191 
192  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
193  this.setLayout(layout);
194  layout.setHorizontalGroup(
195  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
196  .addGroup(layout.createSequentialGroup()
197  .addContainerGap()
198  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
199  .addComponent(ingestWarningLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
200  .addGroup(layout.createSequentialGroup()
201  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
202  .addGroup(layout.createSequentialGroup()
203  .addComponent(settingsLabel)
204  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
205  .addComponent(settingsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE))
206  .addGroup(layout.createSequentialGroup()
207  .addGap(10, 10, 10)
208  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
209  .addComponent(skipNSRLCheckBox)
210  .addComponent(showSnippetsCB)
211  .addComponent(ocrCheckBox)))
212  .addGroup(layout.createSequentialGroup()
213  .addComponent(informationLabel)
214  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
215  .addComponent(informationSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE))
216  .addGroup(layout.createSequentialGroup()
217  .addGap(10, 10, 10)
218  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
219  .addGroup(layout.createSequentialGroup()
220  .addComponent(filesIndexedLabel)
221  .addGap(18, 18, 18)
222  .addComponent(filesIndexedValue))
223  .addComponent(frequencyLabel)
224  .addGroup(layout.createSequentialGroup()
225  .addGap(10, 10, 10)
226  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
227  .addComponent(timeRadioButton2)
228  .addComponent(timeRadioButton1)
229  .addComponent(timeRadioButton3)
230  .addComponent(timeRadioButton4)
231  .addComponent(timeRadioButton5)))
232  .addGroup(layout.createSequentialGroup()
233  .addComponent(chunksLabel)
234  .addGap(18, 18, 18)
235  .addComponent(chunksValLabel)))))
236  .addGap(0, 0, Short.MAX_VALUE)))
237  .addContainerGap())
238  );
239 
240  layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {chunksLabel, filesIndexedLabel});
241 
242  layout.setVerticalGroup(
243  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
244  .addGroup(layout.createSequentialGroup()
245  .addContainerGap()
246  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
247  .addComponent(settingsLabel)
248  .addComponent(settingsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))
249  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
250  .addComponent(skipNSRLCheckBox)
251  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
252  .addComponent(showSnippetsCB)
253  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
254  .addComponent(ocrCheckBox)
255  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
256  .addComponent(frequencyLabel)
257  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
258  .addComponent(timeRadioButton1)
259  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
260  .addComponent(timeRadioButton2)
261  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
262  .addComponent(timeRadioButton3)
263  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
264  .addComponent(timeRadioButton4)
265  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
266  .addComponent(timeRadioButton5)
267  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
268  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
269  .addComponent(informationLabel)
270  .addComponent(informationSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE))
271  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
272  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
273  .addComponent(filesIndexedLabel)
274  .addComponent(filesIndexedValue))
275  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
276  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
277  .addComponent(chunksLabel)
278  .addComponent(chunksValLabel))
279  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
280  .addComponent(ingestWarningLabel)
281  .addContainerGap(43, Short.MAX_VALUE))
282  );
283  }// </editor-fold>//GEN-END:initComponents
284 
285  private void timeRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton5ActionPerformed
286  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
287  }//GEN-LAST:event_timeRadioButton5ActionPerformed
288 
289  private void skipNSRLCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipNSRLCheckBoxActionPerformed
290  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
291  }//GEN-LAST:event_skipNSRLCheckBoxActionPerformed
292 
293  private void showSnippetsCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showSnippetsCBActionPerformed
294  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
295  }//GEN-LAST:event_showSnippetsCBActionPerformed
296 
297  private void timeRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton1ActionPerformed
298  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
299  }//GEN-LAST:event_timeRadioButton1ActionPerformed
300 
301  private void timeRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton2ActionPerformed
302  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
303  }//GEN-LAST:event_timeRadioButton2ActionPerformed
304 
305  private void timeRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton3ActionPerformed
306  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
307  }//GEN-LAST:event_timeRadioButton3ActionPerformed
308 
309  private void timeRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeRadioButton4ActionPerformed
310  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
311  }//GEN-LAST:event_timeRadioButton4ActionPerformed
312 
313  private void ocrCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ocrCheckBoxActionPerformed
314  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
315  }//GEN-LAST:event_ocrCheckBoxActionPerformed
316 
317  // Variables declaration - do not modify//GEN-BEGIN:variables
318  private javax.swing.JLabel chunksLabel;
319  private javax.swing.JLabel chunksValLabel;
320  private javax.swing.JLabel filesIndexedLabel;
321  private javax.swing.JLabel filesIndexedValue;
322  private javax.swing.JLabel frequencyLabel;
323  private javax.swing.JLabel informationLabel;
324  private javax.swing.JSeparator informationSeparator;
325  private javax.swing.JLabel ingestWarningLabel;
326  private javax.swing.JCheckBox ocrCheckBox;
327  private javax.swing.JLabel settingsLabel;
328  private javax.swing.JSeparator settingsSeparator;
329  private javax.swing.JCheckBox showSnippetsCB;
330  private javax.swing.JCheckBox skipNSRLCheckBox;
331  private javax.swing.ButtonGroup timeGroup;
332  private javax.swing.JRadioButton timeRadioButton1;
333  private javax.swing.JRadioButton timeRadioButton2;
334  private javax.swing.JRadioButton timeRadioButton3;
335  private javax.swing.JRadioButton timeRadioButton4;
336  private javax.swing.JRadioButton timeRadioButton5;
337  // End of variables declaration//GEN-END:variables
338 
339  @Override
340  public void store() {
341  KeywordSearchSettings.setSkipKnown(skipNSRLCheckBox.isSelected());
342  KeywordSearchSettings.setUpdateFrequency(getSelectedTimeValue());
343  KeywordSearchSettings.setShowSnippets(showSnippetsCB.isSelected());
344  KeywordSearchSettings.setOcrOption(ocrCheckBox.isSelected());
345  }
346 
347  @Override
348  public void load() {
349  activateWidgets();
350  }
351 
352  private void setTimeSettingEnabled(boolean enabled) {
353  timeRadioButton1.setEnabled(enabled);
354  timeRadioButton2.setEnabled(enabled);
355  timeRadioButton3.setEnabled(enabled);
356  timeRadioButton4.setEnabled(enabled);
357  timeRadioButton5.setEnabled(enabled);
358  frequencyLabel.setEnabled(enabled);
359  }
360 
361  private UpdateFrequency getSelectedTimeValue() {
362  if (timeRadioButton1.isSelected()) {
363  return UpdateFrequency.FAST;
364  } else if (timeRadioButton2.isSelected()) {
365  return UpdateFrequency.AVG;
366  } else if (timeRadioButton3.isSelected()) {
367  return UpdateFrequency.SLOW;
368  } else if (timeRadioButton4.isSelected()) {
369  return UpdateFrequency.SLOWEST;
370  } else if (timeRadioButton5.isSelected()) {
371  return UpdateFrequency.NONE;
372  }
373  return UpdateFrequency.DEFAULT;
374  }
375 
376  @NbBundle.Messages({"KeywordSearchGlobalSearchSettingsPanel.customizeComponents.windowsOCR=Enable Optical Character Recognition (OCR) (Requires Windows 64-bit)"})
377  private void customizeComponents() {
378 
379  timeGroup.add(timeRadioButton1);
380  timeGroup.add(timeRadioButton2);
381  timeGroup.add(timeRadioButton3);
382  timeGroup.add(timeRadioButton4);
383  timeGroup.add(timeRadioButton5);
384 
385  this.skipNSRLCheckBox.setSelected(KeywordSearchSettings.getSkipKnown());
386 
387  try {
388  filesIndexedValue.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedFiles()));
389  chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks()));
390  } catch (KeywordSearchModuleException | NoOpenCoreException ex) {
391  logger.log(Level.WARNING, "Could not get number of indexed files/chunks"); //NON-NLS
392  }
393 
394  if (!PlatformUtil.isWindowsOS() || !PlatformUtil.is64BitOS()) {
395  ocrCheckBox.setText(Bundle.KeywordSearchGlobalSearchSettingsPanel_customizeComponents_windowsOCR());
396  ocrCheckBox.setSelected(false);
397  ocrCheckBox.setEnabled(false);
398  }
399 
400  KeywordSearch.addNumIndexedFilesChangeListener(
401  new PropertyChangeListener() {
402  @Override
403  public void propertyChange(PropertyChangeEvent evt) {
404  String changed = evt.getPropertyName();
405  Object newValue = evt.getNewValue();
406 
407  if (changed.equals(KeywordSearch.NUM_FILES_CHANGE_EVT)) {
408  int newFilesIndexed = ((Integer) newValue);
409  filesIndexedValue.setText(Integer.toString(newFilesIndexed));
410  try {
411  chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks()));
412  } catch (KeywordSearchModuleException | NoOpenCoreException ex) {
413  logger.log(Level.WARNING, "Could not get number of indexed chunks"); //NON-NLS
414 
415  }
416  }
417  }
418  });
419 
420  //allow panel to toggle its enabled status while it is open based on ingest events
421  IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
422  @Override
423  public void propertyChange(PropertyChangeEvent evt) {
424  Object source = evt.getSource();
425  if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
426  EventQueue.invokeLater(() -> {
427  activateWidgets();
428  });
429  }
430  }
431  });
432  }
433 }

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