Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AutopsyOptionsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2019 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.corecomponents;
20 
21 import java.awt.image.BufferedImage;
22 import java.io.File;
23 import java.io.IOException;
24 import java.lang.management.ManagementFactory;
25 import java.nio.charset.Charset;
26 import java.nio.file.Files;
27 import java.nio.file.InvalidPathException;
28 import java.nio.file.Path;
29 import java.util.ArrayList;
30 import java.util.List;
31 import java.util.Optional;
32 import java.util.StringJoiner;
33 import java.util.logging.Level;
34 import javax.imageio.ImageIO;
35 import javax.swing.ImageIcon;
36 import javax.swing.JFileChooser;
37 import javax.swing.JOptionPane;
38 import javax.swing.SwingUtilities;
39 import javax.swing.event.DocumentEvent;
40 import javax.swing.event.DocumentListener;
41 import org.netbeans.spi.options.OptionsPanelController;
42 import org.openide.util.NbBundle;
44 import org.openide.util.NbBundle.Messages;
54 
58 @Messages({
59  "AutopsyOptionsPanel.invalidImageFile.msg=The selected file was not able to be used as an agency logo.",
60  "AutopsyOptionsPanel.invalidImageFile.title=Invalid Image File",
61  "AutopsyOptionsPanel.memFieldValidationLabel.not64BitInstall.text=JVM memory settings only enabled for 64 bit version",
62  "AutopsyOptionsPanel.memFieldValidationLabel.noValueEntered.text=No value entered",
63  "AutopsyOptionsPanel.memFieldValidationLabel.invalidCharacters.text=Invalid characters, value must be a positive integer",
64  "# {0} - minimumMemory",
65  "AutopsyOptionsPanel.memFieldValidationLabel.underMinMemory.text=Value must be at least {0}GB",
66  "# {0} - systemMemory",
67  "AutopsyOptionsPanel.memFieldValidationLabel.overMaxMemory.text=Value must be less than the total system memory of {0}GB",
68  "AutopsyOptionsPanel.memFieldValidationLabel.developerMode.text=Memory settings are not available while running in developer mode",
69  "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.invalidPath.text=Path is not valid.",
70  "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.invalidImageSpecified.text=Invalid image file specified.",
71  "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.pathNotSet.text=Agency logo path must be set.",
72  "AutopsyOptionsPanel.logNumAlert.invalidInput.text=A positive integer is required here."
73 })
74 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
75 final class AutopsyOptionsPanel extends javax.swing.JPanel {
76 
77  private static final long serialVersionUID = 1L;
78  private final JFileChooser logoFileChooser;
79  private final JFileChooser tempDirChooser;
80  private final TextFieldListener textFieldListener;
81  private static final String ETC_FOLDER_NAME = "etc";
82  private static final String CONFIG_FILE_EXTENSION = ".conf";
83  private static final long ONE_BILLION = 1000000000L; //used to roughly convert system memory from bytes to gigabytes
84  private static final int MEGA_IN_GIGA = 1024; //used to convert memory settings saved as megabytes to gigabytes
85  private static final int DEFAULT_SOLR_HEAP_SIZE_MB = 2048;
86  private static final int MIN_MEMORY_IN_GB = 2; //the enforced minimum memory in gigabytes
87  private static final Logger logger = Logger.getLogger(AutopsyOptionsPanel.class.getName());
88  private String initialMemValue = Long.toString(Runtime.getRuntime().maxMemory() / ONE_BILLION);
89 
93  AutopsyOptionsPanel() {
94  initComponents();
95  logoFileChooser = new JFileChooser();
96  logoFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
97  logoFileChooser.setMultiSelectionEnabled(false);
98  logoFileChooser.setAcceptAllFileFilterUsed(false);
99  logoFileChooser.setFileFilter(new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR));
100 
101  tempDirChooser = new JFileChooser();
102  tempDirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
103  tempDirChooser.setMultiSelectionEnabled(false);
104 
105  if (!PlatformUtil.is64BitJVM() || Version.getBuildType() == Version.Type.DEVELOPMENT) {
106  //32 bit JVM has a max heap size of 1.4 gb to 4 gb depending on OS
107  //So disabling the setting of heap size when the JVM is not 64 bit
108  //Is the safest course of action
109  //And the file won't exist in the install folder when running through netbeans
110  memField.setEnabled(false);
111  solrMaxHeapSpinner.setEnabled(false);
112  }
113  systemMemoryTotal.setText(Long.toString(getSystemMemoryInGB()));
114  // The cast to int in the following is to ensure that the correct SpinnerNumberModel
115  // constructor is called.
116  solrMaxHeapSpinner.setModel(new javax.swing.SpinnerNumberModel(UserPreferences.getMaxSolrVMSize(),
117  DEFAULT_SOLR_HEAP_SIZE_MB, ((int) getSystemMemoryInGB()) * MEGA_IN_GIGA, DEFAULT_SOLR_HEAP_SIZE_MB));
118 
119  textFieldListener = new TextFieldListener();
120  agencyLogoPathField.getDocument().addDocumentListener(textFieldListener);
121  tempDirectoryField.getDocument().addDocumentListener(textFieldListener);
122  logFileCount.setText(String.valueOf(UserPreferences.getLogFileCount()));
123  }
124 
131  private long getSystemMemoryInGB() {
132  long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory
133  .getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
134  return memorySize / ONE_BILLION;
135  }
136 
142  private long getCurrentJvmMaxMemoryInGB() throws IOException {
143  String currentXmx = getCurrentXmxValue();
144  char units = '-';
145  Long value = 0L;
146  if (currentXmx.length() > 1) {
147  units = currentXmx.charAt(currentXmx.length() - 1);
148  value = Long.parseLong(currentXmx.substring(0, currentXmx.length() - 1));
149  } else {
150  throw new IOException("No memory setting found in String: " + currentXmx);
151  }
152  //some older .conf files might have the units as megabytes instead of gigabytes
153  switch (units) {
154  case 'g':
155  case 'G':
156  return value;
157  case 'm':
158  case 'M':
159  return value / MEGA_IN_GIGA;
160  default:
161  throw new IOException("Units were not recognized as parsed: " + units);
162  }
163  }
164 
165  /*
166  * The value currently saved in the conf file as the max java heap space
167  * available to this application. Form will be an integer followed by a
168  * character indicating units. Helper method for
169  * getCurrentJvmMaxMemoryInGB()
170  *
171  * @return the saved value for the max java heap space
172  *
173  * @throws IOException if the conf file does not exist in either the user
174  * directory or the install directory
175  */
176  private String getCurrentXmxValue() throws IOException {
177  String[] settings;
178  String currentSetting = "";
179  File userConfFile = getUserFolderConfFile();
180  if (!userConfFile.exists()) {
181  settings = getDefaultsFromFileContents(readConfFile(getInstallFolderConfFile()));
182  } else {
183  settings = getDefaultsFromFileContents(readConfFile(userConfFile));
184  }
185  for (String option : settings) {
186  if (option.startsWith("-J-Xmx")) {
187  currentSetting = option.replace("-J-Xmx", "").trim();
188  }
189  }
190  return currentSetting;
191  }
192 
201  private static File getInstallFolderConfFile() throws IOException {
202  String confFileName = UserPreferences.getAppName() + CONFIG_FILE_EXTENSION;
203  String installFolder = PlatformUtil.getInstallPath();
204  File installFolderEtc = new File(installFolder, ETC_FOLDER_NAME);
205  File installFolderConfigFile = new File(installFolderEtc, confFileName);
206  if (!installFolderConfigFile.exists()) {
207  throw new IOException("Conf file could not be found" + installFolderConfigFile.toString());
208  }
209  return installFolderConfigFile;
210  }
211 
219  private static File getUserFolderConfFile() {
220  String confFileName = UserPreferences.getAppName() + CONFIG_FILE_EXTENSION;
221  File userFolder = PlatformUtil.getUserDirectory();
222  File userEtcFolder = new File(userFolder, ETC_FOLDER_NAME);
223  if (!userEtcFolder.exists()) {
224  userEtcFolder.mkdir();
225  }
226  return new File(userEtcFolder, confFileName);
227  }
228 
237  private void writeEtcConfFile() throws IOException {
238  StringBuilder content = new StringBuilder();
239  List<String> confFile = readConfFile(getInstallFolderConfFile());
240  for (String line : confFile) {
241  if (line.contains("-J-Xmx")) {
242  String[] splitLine = line.split(" ");
243  StringJoiner modifiedLine = new StringJoiner(" ");
244  for (String piece : splitLine) {
245  if (piece.contains("-J-Xmx")) {
246  piece = "-J-Xmx" + memField.getText() + "g";
247  }
248  modifiedLine.add(piece);
249  }
250  content.append(modifiedLine.toString());
251  } else {
252  content.append(line);
253  }
254  content.append("\n");
255  }
256  Files.write(getUserFolderConfFile().toPath(), content.toString().getBytes());
257  }
258 
268  private static List<String> readConfFile(File configFile) {
269  List<String> lines = new ArrayList<>();
270  if (null != configFile) {
271  Path filePath = configFile.toPath();
272  Charset charset = Charset.forName("UTF-8");
273  try {
274  lines = Files.readAllLines(filePath, charset);
275  } catch (IOException e) {
276  logger.log(Level.SEVERE, "Error reading config file contents. {}", configFile.getAbsolutePath());
277  }
278  }
279  return lines;
280  }
281 
293  private static String[] getDefaultsFromFileContents(List<String> list) {
294  Optional<String> defaultSettings = list.stream().filter(line -> line.startsWith("default_options=")).findFirst();
295 
296  if (defaultSettings.isPresent()) {
297  return defaultSettings.get().replace("default_options=", "").replaceAll("\"", "").split(" ");
298  }
299  return new String[]{};
300  }
301 
305  void load() {
306  String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP);
307  boolean useDefault = (path == null || path.isEmpty());
308  defaultLogoRB.setSelected(useDefault);
309  specifyLogoRB.setSelected(!useDefault);
310  agencyLogoPathField.setEnabled(!useDefault);
311  browseLogosButton.setEnabled(!useDefault);
312  tempDirectoryField.setText(UserMachinePreferences.getBaseTempDirectory());
313  logFileCount.setText(String.valueOf(UserPreferences.getLogFileCount()));
314  solrMaxHeapSpinner.setValue(UserPreferences.getMaxSolrVMSize());
315  tempDirectoryField.setText(UserMachinePreferences.getBaseTempDirectory());
316  try {
317  updateAgencyLogo(path);
318  } catch (IOException ex) {
319  logger.log(Level.WARNING, "Error loading image from previously saved agency logo path", ex);
320  }
321  if (memField.isEnabled()) {
322  try {
323  initialMemValue = Long.toString(getCurrentJvmMaxMemoryInGB());
324  } catch (IOException ex) {
325  logger.log(Level.SEVERE, "Can't read current Jvm max memory setting from file", ex);
326  memField.setEnabled(false);
327  }
328  memField.setText(initialMemValue);
329  }
330  setTempDirEnabled();
331  valid(); //ensure the error messages are up to date
332  }
333 
334  private void setTempDirEnabled() {
335  boolean enabled = !Case.isCaseOpen();
336  this.tempDirectoryBrowseButton.setEnabled(enabled);
337  this.tempDirectoryField.setEnabled(enabled);
338  this.tempDirectoryWarningLabel.setVisible(!enabled);
339  }
340 
348  private void updateAgencyLogo(String path) throws IOException {
349  agencyLogoPathField.setText(path);
350  ImageIcon agencyLogoIcon = new ImageIcon();
351  agencyLogoPreview.setText(NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPreview.text"));
352  if (!agencyLogoPathField.getText().isEmpty()) {
353  File file = new File(agencyLogoPathField.getText());
354  if (file.exists()) {
355  BufferedImage image = ImageIO.read(file); //create it as an image first to support BMP files
356  if (image == null) {
357  throw new IOException("Unable to read file as a BufferedImage for file " + file.toString());
358  }
359  agencyLogoIcon = new ImageIcon(image.getScaledInstance(64, 64, 4));
360  agencyLogoPreview.setText("");
361  }
362  }
363  agencyLogoPreview.setIcon(agencyLogoIcon);
364  agencyLogoPreview.repaint();
365  }
366 
367  @Messages({
368  "AutopsyOptionsPanel_storeTempDir_onError_title=Error Saving Temporary Directory",
369  "# {0} - path",
370  "AutopsyOptionsPanel_storeTempDir_onError_description=There was an error creating the temporary directory on the filesystem at: {0}.",})
371  private void storeTempDir() {
372  String tempDirectoryPath = tempDirectoryField.getText();
373  if (!UserMachinePreferences.getBaseTempDirectory().equals(tempDirectoryPath)) {
374  try {
375  UserMachinePreferences.setBaseTempDirectory(tempDirectoryPath);
376  } catch (UserMachinePreferencesException ex) {
377  logger.log(Level.WARNING, "There was an error creating the temporary directory defined by the user: " + tempDirectoryPath, ex);
378  SwingUtilities.invokeLater(() -> {
379  JOptionPane.showMessageDialog(this,
380  String.format("<html>%s</html>", Bundle.AutopsyOptionsPanel_storeTempDir_onError_description(tempDirectoryPath)),
381  Bundle.AutopsyOptionsPanel_storeTempDir_onError_title(),
382  JOptionPane.ERROR_MESSAGE);
383  });
384  }
385  }
386  }
387 
391  void store() {
392  UserPreferences.setLogFileCount(Integer.parseInt(logFileCount.getText()));
393  storeTempDir();
394 
395  if (!agencyLogoPathField.getText().isEmpty()) {
396  File file = new File(agencyLogoPathField.getText());
397  if (file.exists()) {
398  ModuleSettings.setConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP, agencyLogoPathField.getText());
399  }
400  } else {
401  ModuleSettings.setConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP, "");
402  }
403  UserPreferences.setMaxSolrVMSize((int) solrMaxHeapSpinner.getValue());
404  if (memField.isEnabled()) { //if the field could of been changed we need to try and save it
405  try {
406  writeEtcConfFile();
407  } catch (IOException ex) {
408  logger.log(Level.WARNING, "Unable to save config file to " + PlatformUtil.getUserDirectory() + "\\" + ETC_FOLDER_NAME, ex);
409  }
410  }
411  }
412 
418  boolean valid() {
419  boolean valid = true;
420  if (!isAgencyLogoPathValid()) {
421  valid = false;
422  }
423  if (!isMemFieldValid()) {
424  valid = false;
425  }
426  if (!isLogNumFieldValid()) {
427  valid = false;
428  }
429 
430  return valid;
431  }
432 
439  boolean isAgencyLogoPathValid() {
440  boolean valid = true;
441 
442  if (defaultLogoRB.isSelected()) {
443  agencyLogoPathFieldValidationLabel.setText("");
444  } else {
445  String agencyLogoPath = agencyLogoPathField.getText();
446  if (agencyLogoPath.isEmpty()) {
447  agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_pathNotSet_text());
448  valid = false;
449  } else {
450  File file = new File(agencyLogoPathField.getText());
451  if (file.exists() && file.isFile()) {
452  BufferedImage image;
453  try { //ensure the image can be read
454  image = ImageIO.read(file); //create it as an image first to support BMP files
455  if (image == null) {
456  throw new IOException("Unable to read file as a BufferedImage for file " + file.toString());
457  }
458  agencyLogoPathFieldValidationLabel.setText("");
459  } catch (IOException | IndexOutOfBoundsException ignored) {
460  agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_invalidImageSpecified_text());
461  valid = false;
462  }
463  } else {
464  agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_invalidPath_text());
465  valid = false;
466  }
467  }
468  }
469 
470  return valid;
471  }
472 
478  private boolean isMemFieldValid() {
479  String memText = memField.getText();
480  memFieldValidationLabel.setText("");
481  if (!PlatformUtil.is64BitJVM()) {
482  memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_not64BitInstall_text());
483  //the panel should be valid when it is a 32 bit jvm because the memfield will be disabled.
484  return true;
485  }
486  if (Version.getBuildType() == Version.Type.DEVELOPMENT) {
487  memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_developerMode_text());
488  //the panel should be valid when you are running in developer mode because the memfield will be disabled
489  return true;
490  }
491  if (memText.length() == 0) {
492  memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_noValueEntered_text());
493  return false;
494  }
495  if (memText.replaceAll("[^\\d]", "").length() != memText.length()) {
496  memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_invalidCharacters_text());
497  return false;
498  }
499  int parsedInt = Integer.parseInt(memText);
500  if (parsedInt < MIN_MEMORY_IN_GB) {
501  memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_underMinMemory_text(MIN_MEMORY_IN_GB));
502  return false;
503  }
504  if (parsedInt > getSystemMemoryInGB()) {
505  memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_overMaxMemory_text(getSystemMemoryInGB()));
506  return false;
507  }
508  return true;
509  }
510 
516  private boolean isLogNumFieldValid() {
517  String count = logFileCount.getText();
518  logNumAlert.setText("");
519  try {
520  int count_num = Integer.parseInt(count);
521  if (count_num < 1) {
522  logNumAlert.setText(Bundle.AutopsyOptionsPanel_logNumAlert_invalidInput_text());
523  return false;
524  }
525  } catch (NumberFormatException e) {
526  logNumAlert.setText(Bundle.AutopsyOptionsPanel_logNumAlert_invalidInput_text());
527  return false;
528  }
529  return true;
530  }
531 
536  private class TextFieldListener implements DocumentListener {
537 
538  @Override
539  public void insertUpdate(DocumentEvent e) {
540  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
541  }
542 
543  @Override
544  public void removeUpdate(DocumentEvent e) {
545  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
546  }
547 
548  @Override
549  public void changedUpdate(DocumentEvent e) {
550  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
551  }
552  }
553 
559  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
560  private void initComponents() {
561  java.awt.GridBagConstraints gridBagConstraints;
562 
563  fileSelectionButtonGroup = new javax.swing.ButtonGroup();
564  displayTimesButtonGroup = new javax.swing.ButtonGroup();
565  logoSourceButtonGroup = new javax.swing.ButtonGroup();
566  jScrollPane1 = new javax.swing.JScrollPane();
567  javax.swing.JPanel mainPanel = new javax.swing.JPanel();
568  logoPanel = new javax.swing.JPanel();
569  agencyLogoPathField = new javax.swing.JTextField();
570  browseLogosButton = new javax.swing.JButton();
571  agencyLogoPreview = new javax.swing.JLabel();
572  defaultLogoRB = new javax.swing.JRadioButton();
573  specifyLogoRB = new javax.swing.JRadioButton();
574  agencyLogoPathFieldValidationLabel = new javax.swing.JLabel();
575  runtimePanel = new javax.swing.JPanel();
576  maxMemoryLabel = new javax.swing.JLabel();
577  maxMemoryUnitsLabel = new javax.swing.JLabel();
578  totalMemoryLabel = new javax.swing.JLabel();
579  systemMemoryTotal = new javax.swing.JLabel();
580  restartNecessaryWarning = new javax.swing.JLabel();
581  memField = new javax.swing.JTextField();
582  memFieldValidationLabel = new javax.swing.JLabel();
583  maxMemoryUnitsLabel1 = new javax.swing.JLabel();
584  maxLogFileCount = new javax.swing.JLabel();
585  logFileCount = new javax.swing.JTextField();
586  logNumAlert = new javax.swing.JTextField();
587  maxSolrMemoryLabel = new javax.swing.JLabel();
588  maxMemoryUnitsLabel2 = new javax.swing.JLabel();
589  solrMaxHeapSpinner = new javax.swing.JSpinner();
590  solrJVMHeapWarning = new javax.swing.JLabel();
591  tempDirectoryPanel = new javax.swing.JPanel();
592  tempDirectoryField = new javax.swing.JTextField();
593  tempDirectoryBrowseButton = new javax.swing.JButton();
594  tempDirectoryWarningLabel = new javax.swing.JLabel();
595  rdpPanel = new javax.swing.JPanel();
596  javax.swing.JScrollPane sizingScrollPane = new javax.swing.JScrollPane();
597  javax.swing.JTextPane sizingTextPane = new javax.swing.JTextPane();
598  javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
599  javax.swing.Box.Filler filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
600 
601  jScrollPane1.setBorder(null);
602 
603  mainPanel.setMinimumSize(new java.awt.Dimension(648, 382));
604  mainPanel.setLayout(new java.awt.GridBagLayout());
605 
606  logoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.logoPanel.border.title"))); // NOI18N
607 
608  agencyLogoPathField.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPathField.text")); // NOI18N
609 
610  org.openide.awt.Mnemonics.setLocalizedText(browseLogosButton, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.browseLogosButton.text")); // NOI18N
611  browseLogosButton.addActionListener(new java.awt.event.ActionListener() {
612  public void actionPerformed(java.awt.event.ActionEvent evt) {
613  browseLogosButtonActionPerformed(evt);
614  }
615  });
616 
617  agencyLogoPreview.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
618  org.openide.awt.Mnemonics.setLocalizedText(agencyLogoPreview, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPreview.text")); // NOI18N
619  agencyLogoPreview.setBorder(javax.swing.BorderFactory.createEtchedBorder());
620  agencyLogoPreview.setMaximumSize(new java.awt.Dimension(64, 64));
621  agencyLogoPreview.setMinimumSize(new java.awt.Dimension(64, 64));
622  agencyLogoPreview.setPreferredSize(new java.awt.Dimension(64, 64));
623 
624  logoSourceButtonGroup.add(defaultLogoRB);
625  org.openide.awt.Mnemonics.setLocalizedText(defaultLogoRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.defaultLogoRB.text")); // NOI18N
626  defaultLogoRB.addActionListener(new java.awt.event.ActionListener() {
627  public void actionPerformed(java.awt.event.ActionEvent evt) {
628  defaultLogoRBActionPerformed(evt);
629  }
630  });
631 
632  logoSourceButtonGroup.add(specifyLogoRB);
633  org.openide.awt.Mnemonics.setLocalizedText(specifyLogoRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.specifyLogoRB.text")); // NOI18N
634  specifyLogoRB.addActionListener(new java.awt.event.ActionListener() {
635  public void actionPerformed(java.awt.event.ActionEvent evt) {
636  specifyLogoRBActionPerformed(evt);
637  }
638  });
639 
640  agencyLogoPathFieldValidationLabel.setForeground(new java.awt.Color(255, 0, 0));
641  org.openide.awt.Mnemonics.setLocalizedText(agencyLogoPathFieldValidationLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.text")); // NOI18N
642 
643  javax.swing.GroupLayout logoPanelLayout = new javax.swing.GroupLayout(logoPanel);
644  logoPanel.setLayout(logoPanelLayout);
645  logoPanelLayout.setHorizontalGroup(
646  logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
647  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup()
648  .addContainerGap()
649  .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
650  .addComponent(specifyLogoRB)
651  .addComponent(defaultLogoRB))
652  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
653  .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
654  .addComponent(agencyLogoPathFieldValidationLabel)
655  .addGroup(logoPanelLayout.createSequentialGroup()
656  .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
657  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
658  .addComponent(browseLogosButton)))
659  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
660  .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
661  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
662  );
663  logoPanelLayout.setVerticalGroup(
664  logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
665  .addGroup(logoPanelLayout.createSequentialGroup()
666  .addGap(6, 6, 6)
667  .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
668  .addComponent(defaultLogoRB)
669  .addComponent(agencyLogoPathFieldValidationLabel))
670  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
671  .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
672  .addComponent(specifyLogoRB)
673  .addComponent(agencyLogoPathField)
674  .addComponent(browseLogosButton)))
675  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup()
676  .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
677  .addGap(0, 0, Short.MAX_VALUE))
678  );
679 
680  gridBagConstraints = new java.awt.GridBagConstraints();
681  gridBagConstraints.gridx = 0;
682  gridBagConstraints.gridy = 2;
683  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
684  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
685  mainPanel.add(logoPanel, gridBagConstraints);
686 
687  runtimePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.runtimePanel.border.title"))); // NOI18N
688 
689  org.openide.awt.Mnemonics.setLocalizedText(maxMemoryLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxMemoryLabel.text")); // NOI18N
690 
691  org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxMemoryUnitsLabel.text")); // NOI18N
692 
693  org.openide.awt.Mnemonics.setLocalizedText(totalMemoryLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.totalMemoryLabel.text")); // NOI18N
694 
695  systemMemoryTotal.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
696 
697  restartNecessaryWarning.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/warning16.png"))); // NOI18N
698  org.openide.awt.Mnemonics.setLocalizedText(restartNecessaryWarning, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.restartNecessaryWarning.text")); // NOI18N
699 
700  memField.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
701  memField.addKeyListener(new java.awt.event.KeyAdapter() {
702  public void keyReleased(java.awt.event.KeyEvent evt) {
703  memFieldKeyReleased(evt);
704  }
705  });
706 
707  memFieldValidationLabel.setForeground(new java.awt.Color(255, 0, 0));
708 
709  org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel1, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxMemoryUnitsLabel.text")); // NOI18N
710 
711  org.openide.awt.Mnemonics.setLocalizedText(maxLogFileCount, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxLogFileCount.text")); // NOI18N
712 
713  logFileCount.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
714  logFileCount.addKeyListener(new java.awt.event.KeyAdapter() {
715  public void keyReleased(java.awt.event.KeyEvent evt) {
716  logFileCountKeyReleased(evt);
717  }
718  });
719 
720  logNumAlert.setEditable(false);
721  logNumAlert.setForeground(new java.awt.Color(255, 0, 0));
722  logNumAlert.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.logNumAlert.text")); // NOI18N
723  logNumAlert.setBorder(null);
724 
725  org.openide.awt.Mnemonics.setLocalizedText(maxSolrMemoryLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxSolrMemoryLabel.text")); // NOI18N
726 
727  org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel2, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxMemoryUnitsLabel2.text")); // NOI18N
728 
729  solrMaxHeapSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
730  public void stateChanged(javax.swing.event.ChangeEvent evt) {
731  solrMaxHeapSpinnerStateChanged(evt);
732  }
733  });
734 
735  org.openide.awt.Mnemonics.setLocalizedText(solrJVMHeapWarning, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.solrJVMHeapWarning.text")); // NOI18N
736 
737  javax.swing.GroupLayout runtimePanelLayout = new javax.swing.GroupLayout(runtimePanel);
738  runtimePanel.setLayout(runtimePanelLayout);
739  runtimePanelLayout.setHorizontalGroup(
740  runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
741  .addGroup(runtimePanelLayout.createSequentialGroup()
742  .addContainerGap()
743  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
744  .addGroup(runtimePanelLayout.createSequentialGroup()
745  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
746  .addComponent(totalMemoryLabel)
747  .addComponent(maxSolrMemoryLabel)
748  .addComponent(maxMemoryLabel)
749  .addComponent(maxLogFileCount))
750  .addGap(12, 12, 12)
751  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
752  .addComponent(logFileCount, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
753  .addComponent(solrMaxHeapSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
754  .addComponent(memField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
755  .addComponent(systemMemoryTotal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
756  .addGap(18, 18, 18)
757  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
758  .addComponent(maxMemoryUnitsLabel1)
759  .addComponent(maxMemoryUnitsLabel)
760  .addComponent(maxMemoryUnitsLabel2))
761  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
762  .addGroup(runtimePanelLayout.createSequentialGroup()
763  .addGap(23, 23, 23)
764  .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 478, javax.swing.GroupLayout.PREFERRED_SIZE)
765  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
766  .addGroup(runtimePanelLayout.createSequentialGroup()
767  .addGap(18, 18, 18)
768  .addComponent(solrJVMHeapWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 331, javax.swing.GroupLayout.PREFERRED_SIZE)
769  .addGap(44, 44, 44)
770  .addComponent(logNumAlert)
771  .addContainerGap())))
772  .addComponent(restartNecessaryWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 615, javax.swing.GroupLayout.PREFERRED_SIZE)))
773  );
774 
775  runtimePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {maxLogFileCount, maxMemoryLabel, totalMemoryLabel});
776 
777  runtimePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {logFileCount, memField});
778 
779  runtimePanelLayout.setVerticalGroup(
780  runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
781  .addGroup(runtimePanelLayout.createSequentialGroup()
782  .addContainerGap()
783  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
784  .addComponent(totalMemoryLabel)
785  .addComponent(maxMemoryUnitsLabel1)
786  .addComponent(systemMemoryTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
787  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
788  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
789  .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
790  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
791  .addComponent(maxMemoryLabel)
792  .addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
793  .addComponent(maxMemoryUnitsLabel)))
794  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
795  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
796  .addComponent(logNumAlert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
797  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
798  .addComponent(maxSolrMemoryLabel)
799  .addComponent(maxMemoryUnitsLabel2)
800  .addComponent(solrMaxHeapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
801  .addComponent(solrJVMHeapWarning)))
802  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
803  .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
804  .addComponent(maxLogFileCount)
805  .addComponent(logFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
806  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
807  .addComponent(restartNecessaryWarning)
808  .addContainerGap())
809  );
810 
811  gridBagConstraints = new java.awt.GridBagConstraints();
812  gridBagConstraints.gridx = 0;
813  gridBagConstraints.gridy = 0;
814  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
815  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
816  mainPanel.add(runtimePanel, gridBagConstraints);
817 
818  tempDirectoryPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tempDirectoryPanel.border.title"))); // NOI18N
819  tempDirectoryPanel.setName(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tempDirectoryPanel.name")); // NOI18N
820 
821  tempDirectoryField.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tempDirectoryField.text")); // NOI18N
822 
823  org.openide.awt.Mnemonics.setLocalizedText(tempDirectoryBrowseButton, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tempDirectoryBrowseButton.text")); // NOI18N
824  tempDirectoryBrowseButton.addActionListener(new java.awt.event.ActionListener() {
825  public void actionPerformed(java.awt.event.ActionEvent evt) {
826  tempDirectoryBrowseButtonActionPerformed(evt);
827  }
828  });
829 
830  tempDirectoryWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/warning16.png"))); // NOI18N
831  org.openide.awt.Mnemonics.setLocalizedText(tempDirectoryWarningLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tempDirectoryWarningLabel.text")); // NOI18N
832 
833  javax.swing.GroupLayout tempDirectoryPanelLayout = new javax.swing.GroupLayout(tempDirectoryPanel);
834  tempDirectoryPanel.setLayout(tempDirectoryPanelLayout);
835  tempDirectoryPanelLayout.setHorizontalGroup(
836  tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
837  .addGroup(tempDirectoryPanelLayout.createSequentialGroup()
838  .addContainerGap()
839  .addGroup(tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
840  .addComponent(tempDirectoryWarningLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 615, javax.swing.GroupLayout.PREFERRED_SIZE)
841  .addGroup(tempDirectoryPanelLayout.createSequentialGroup()
842  .addComponent(tempDirectoryField, javax.swing.GroupLayout.PREFERRED_SIZE, 367, javax.swing.GroupLayout.PREFERRED_SIZE)
843  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
844  .addComponent(tempDirectoryBrowseButton)))
845  .addGap(0, 0, Short.MAX_VALUE))
846  );
847  tempDirectoryPanelLayout.setVerticalGroup(
848  tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
849  .addGroup(tempDirectoryPanelLayout.createSequentialGroup()
850  .addContainerGap()
851  .addGroup(tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
852  .addComponent(tempDirectoryField)
853  .addComponent(tempDirectoryBrowseButton))
854  .addGap(18, 18, 18)
855  .addComponent(tempDirectoryWarningLabel)
856  .addContainerGap())
857  );
858 
859  gridBagConstraints = new java.awt.GridBagConstraints();
860  gridBagConstraints.gridx = 0;
861  gridBagConstraints.gridy = 1;
862  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
863  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
864  mainPanel.add(tempDirectoryPanel, gridBagConstraints);
865  tempDirectoryPanel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tempDirectoryPanel.AccessibleContext.accessibleName")); // NOI18N
866 
867  rdpPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.rdpPanel.border.title"))); // NOI18N
868  rdpPanel.setMinimumSize(new java.awt.Dimension(33, 100));
869  rdpPanel.setPreferredSize(new java.awt.Dimension(100, 150));
870  rdpPanel.setLayout(new java.awt.GridBagLayout());
871 
872  sizingScrollPane.setBorder(null);
873 
874  sizingTextPane.setEditable(false);
875  sizingTextPane.setBorder(null);
876  sizingTextPane.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.sizingTextPane.text")); // NOI18N
877  sizingTextPane.setOpaque(false);
878  sizingScrollPane.setViewportView(sizingTextPane);
879 
880  gridBagConstraints = new java.awt.GridBagConstraints();
881  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
882  gridBagConstraints.weightx = 1.0;
883  gridBagConstraints.weighty = 1.0;
884  rdpPanel.add(sizingScrollPane, gridBagConstraints);
885 
886  gridBagConstraints = new java.awt.GridBagConstraints();
887  gridBagConstraints.gridy = 3;
888  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
889  mainPanel.add(rdpPanel, gridBagConstraints);
890  gridBagConstraints = new java.awt.GridBagConstraints();
891  gridBagConstraints.gridx = 1;
892  gridBagConstraints.gridy = 0;
893  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
894  gridBagConstraints.weightx = 1.0;
895  mainPanel.add(filler1, gridBagConstraints);
896  gridBagConstraints = new java.awt.GridBagConstraints();
897  gridBagConstraints.gridx = 0;
898  gridBagConstraints.gridy = 4;
899  gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
900  gridBagConstraints.weighty = 1.0;
901  mainPanel.add(filler2, gridBagConstraints);
902 
903  jScrollPane1.setViewportView(mainPanel);
904 
905  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
906  this.setLayout(layout);
907  layout.setHorizontalGroup(
908  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
909  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 648, Short.MAX_VALUE)
910  );
911  layout.setVerticalGroup(
912  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
913  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE)
914  );
915  }// </editor-fold>//GEN-END:initComponents
916 
917  @Messages({
918  "AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_title=Path cannot be used",
919  "# {0} - path",
920  "AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_description=Unable to create temporary directory within specified path: {0}",})
921  private void tempDirectoryBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tempDirectoryBrowseButtonActionPerformed
922  int returnState = tempDirChooser.showOpenDialog(this);
923  if (returnState == JFileChooser.APPROVE_OPTION) {
924  String specifiedPath = tempDirChooser.getSelectedFile().getPath();
925  try {
926  File f = new File(specifiedPath);
927  if (!f.exists() && !f.mkdirs()) {
928  throw new InvalidPathException(specifiedPath, "Unable to create parent directories leading to " + specifiedPath);
929  }
930  tempDirectoryField.setText(specifiedPath);
931  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
932  } catch (InvalidPathException ex) {
933  logger.log(Level.WARNING, "Unable to create temporary directory in " + specifiedPath, ex);
934  JOptionPane.showMessageDialog(this,
935  Bundle.AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_description(specifiedPath),
936  Bundle.AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_title(),
937  JOptionPane.ERROR_MESSAGE);
938  }
939  }
940  }//GEN-LAST:event_tempDirectoryBrowseButtonActionPerformed
941 
942  private void solrMaxHeapSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_solrMaxHeapSpinnerStateChanged
943  int value = (int) solrMaxHeapSpinner.getValue();
944  if (value == UserPreferences.getMaxSolrVMSize()) {
945  // if the value hasn't changed there's nothing to do.
946  return;
947  }
948  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
949  }//GEN-LAST:event_solrMaxHeapSpinnerStateChanged
950 
951  private void logFileCountKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_logFileCountKeyReleased
952  String count = logFileCount.getText();
953  if (count.equals(String.valueOf(UserPreferences.getDefaultLogFileCount()))) {
954  //if it is still the default value don't fire change
955  return;
956  }
957  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
958  }//GEN-LAST:event_logFileCountKeyReleased
959 
960  private void memFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_memFieldKeyReleased
961  String memText = memField.getText();
962  if (memText.equals(initialMemValue)) {
963  //if it is still the initial value don't fire change
964  return;
965  }
966  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
967  }//GEN-LAST:event_memFieldKeyReleased
968 
969  private void specifyLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_specifyLogoRBActionPerformed
970  agencyLogoPathField.setEnabled(true);
971  browseLogosButton.setEnabled(true);
972  try {
973  if (agencyLogoPathField.getText().isEmpty()) {
974  String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP);
975  if (path != null && !path.isEmpty()) {
976  updateAgencyLogo(path);
977  }
978  }
979  } catch (IOException ex) {
980  logger.log(Level.WARNING, "Error loading image from previously saved agency logo path.", ex);
981  }
982  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
983  }//GEN-LAST:event_specifyLogoRBActionPerformed
984 
985  private void defaultLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultLogoRBActionPerformed
986  agencyLogoPathField.setEnabled(false);
987  browseLogosButton.setEnabled(false);
988  try {
989  updateAgencyLogo("");
990  } catch (IOException ex) {
991  // This should never happen since we're not reading from a file.
992  logger.log(Level.SEVERE, "Unexpected error occurred while updating the agency logo.", ex);
993  }
994  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
995  }//GEN-LAST:event_defaultLogoRBActionPerformed
996 
997  private void browseLogosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLogosButtonActionPerformed
998  String oldLogoPath = agencyLogoPathField.getText();
999  int returnState = logoFileChooser.showOpenDialog(this);
1000  if (returnState == JFileChooser.APPROVE_OPTION) {
1001  String path = logoFileChooser.getSelectedFile().getPath();
1002  try {
1003  updateAgencyLogo(path);
1004  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1005  } catch (IOException | IndexOutOfBoundsException ex) {
1006  JOptionPane.showMessageDialog(this,
1007  NbBundle.getMessage(this.getClass(),
1008  "AutopsyOptionsPanel.invalidImageFile.msg"),
1009  NbBundle.getMessage(this.getClass(), "AutopsyOptionsPanel.invalidImageFile.title"),
1010  JOptionPane.ERROR_MESSAGE);
1011  try {
1012  updateAgencyLogo(oldLogoPath); //restore previous setting if new one is invalid
1013  } catch (IOException ex1) {
1014  logger.log(Level.WARNING, "Error loading image from previously saved agency logo path", ex1);
1015  }
1016  }
1017  }
1018  }//GEN-LAST:event_browseLogosButtonActionPerformed
1019 
1020  // Variables declaration - do not modify//GEN-BEGIN:variables
1021  private javax.swing.JTextField agencyLogoPathField;
1022  private javax.swing.JLabel agencyLogoPathFieldValidationLabel;
1023  private javax.swing.JLabel agencyLogoPreview;
1024  private javax.swing.JButton browseLogosButton;
1025  private javax.swing.JRadioButton defaultLogoRB;
1026  private javax.swing.ButtonGroup displayTimesButtonGroup;
1027  private javax.swing.ButtonGroup fileSelectionButtonGroup;
1028  private javax.swing.JScrollPane jScrollPane1;
1029  private javax.swing.JTextField logFileCount;
1030  private javax.swing.JTextField logNumAlert;
1031  private javax.swing.JPanel logoPanel;
1032  private javax.swing.ButtonGroup logoSourceButtonGroup;
1033  private javax.swing.JLabel maxLogFileCount;
1034  private javax.swing.JLabel maxMemoryLabel;
1035  private javax.swing.JLabel maxMemoryUnitsLabel;
1036  private javax.swing.JLabel maxMemoryUnitsLabel1;
1037  private javax.swing.JLabel maxMemoryUnitsLabel2;
1038  private javax.swing.JLabel maxSolrMemoryLabel;
1039  private javax.swing.JTextField memField;
1040  private javax.swing.JLabel memFieldValidationLabel;
1041  private javax.swing.JPanel rdpPanel;
1042  private javax.swing.JLabel restartNecessaryWarning;
1043  private javax.swing.JPanel runtimePanel;
1044  private javax.swing.JLabel solrJVMHeapWarning;
1045  private javax.swing.JSpinner solrMaxHeapSpinner;
1046  private javax.swing.JRadioButton specifyLogoRB;
1047  private javax.swing.JLabel systemMemoryTotal;
1048  private javax.swing.JButton tempDirectoryBrowseButton;
1049  private javax.swing.JTextField tempDirectoryField;
1050  private javax.swing.JPanel tempDirectoryPanel;
1051  private javax.swing.JLabel tempDirectoryWarningLabel;
1052  private javax.swing.JLabel totalMemoryLabel;
1053  // End of variables declaration//GEN-END:variables
1054 
1055 }

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.