19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.image.BufferedImage;
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.logging.Level;
33 import java.util.regex.Matcher;
34 import java.util.regex.Pattern;
35 import java.util.stream.Collectors;
36 import java.util.stream.Stream;
37 import javax.imageio.ImageIO;
38 import javax.swing.ImageIcon;
39 import javax.swing.JFileChooser;
40 import javax.swing.JOptionPane;
41 import javax.swing.SwingUtilities;
42 import javax.swing.event.DocumentEvent;
43 import javax.swing.event.DocumentListener;
44 import org.apache.commons.io.FileUtils;
45 import org.apache.commons.lang3.StringUtils;
46 import org.apache.tools.ant.types.Commandline;
47 import org.netbeans.spi.options.OptionsPanelController;
48 import org.openide.util.NbBundle;
50 import org.openide.util.NbBundle.Messages;
66 "AutopsyOptionsPanel.invalidImageFile.msg=The selected file was not able to be used as an agency logo.",
67 "AutopsyOptionsPanel.invalidImageFile.title=Invalid Image File",
68 "AutopsyOptionsPanel.memFieldValidationLabel.not64BitInstall.text=JVM memory settings only enabled for 64 bit version",
69 "AutopsyOptionsPanel.memFieldValidationLabel.noValueEntered.text=No value entered",
70 "AutopsyOptionsPanel.memFieldValidationLabel.invalidCharacters.text=Invalid characters, value must be a positive integer",
71 "# {0} - minimumMemory",
72 "AutopsyOptionsPanel.memFieldValidationLabel.underMinMemory.text=Value must be at least {0}GB",
73 "# {0} - systemMemory",
74 "AutopsyOptionsPanel.memFieldValidationLabel.overMaxMemory.text=Value must be less than the total system memory of {0}GB",
75 "AutopsyOptionsPanel.memFieldValidationLabel.developerMode.text=Memory settings are not available while running in developer mode",
76 "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.invalidPath.text=Path is not valid.",
77 "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.invalidImageSpecified.text=Invalid image file specified.",
78 "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.pathNotSet.text=Agency logo path must be set.",
79 "AutopsyOptionsPanel.logNumAlert.invalidInput.text=A positive integer is required here."
81 @SuppressWarnings(
"PMD.SingularField")
82 final class AutopsyOptionsPanel extends javax.swing.JPanel {
84 private static final long serialVersionUID = 1L;
85 private static final String DEFAULT_HEAP_DUMP_FILE_FIELD =
"";
86 private JFileChooser logoFileChooser;
87 private JFileChooser tempDirChooser;
88 private static final String ETC_FOLDER_NAME =
"etc";
89 private static final String CONFIG_FILE_EXTENSION =
".conf";
90 private static final long ONE_BILLION = 1000000000L;
91 private static final int MEGA_IN_GIGA = 1024;
92 private static final int JVM_MEMORY_STEP_SIZE_MB = 512;
93 private static final int MIN_MEMORY_IN_GB = 2;
94 private static final Logger logger = Logger.getLogger(AutopsyOptionsPanel.class.getName());
95 private String initialMemValue = Long.toString(Runtime.getRuntime().maxMemory() / ONE_BILLION);
97 private final ReportBranding reportBranding;
98 private JFileChooser heapFileChooser;
100 private final JFileChooserFactory logoChooserHelper =
new JFileChooserFactory();
101 private final JFileChooserFactory heapChooserHelper =
new JFileChooserFactory();
102 private final JFileChooserFactory tempChooserHelper =
new JFileChooserFactory();
107 AutopsyOptionsPanel() {
109 if (!isJVMHeapSettingsCapable()) {
114 memField.setEnabled(
false);
115 heapDumpFileField.setEnabled(
false);
116 heapDumpBrowseButton.setEnabled(
false);
117 solrMaxHeapSpinner.setEnabled(
false);
119 systemMemoryTotal.setText(Long.toString(getSystemMemoryInGB()));
122 solrMaxHeapSpinner.setModel(
new javax.swing.SpinnerNumberModel(UserPreferences.getMaxSolrVMSize(),
123 JVM_MEMORY_STEP_SIZE_MB, ((int) getSystemMemoryInGB()) * MEGA_IN_GIGA, JVM_MEMORY_STEP_SIZE_MB));
125 agencyLogoPathField.getDocument().addDocumentListener(
new TextFieldListener(null));
126 heapDumpFileField.getDocument().addDocumentListener(
new TextFieldListener(this::isHeapPathValid));
127 tempCustomField.getDocument().addDocumentListener(
new TextFieldListener(this::evaluateTempDirState));
128 logFileCount.setText(String.valueOf(UserPreferences.getLogFileCount()));
130 reportBranding =
new ReportBranding();
137 private static boolean isJVMHeapSettingsCapable() {
138 return PlatformUtil.is64BitJVM() && Version.getBuildType() != Version.Type.DEVELOPMENT;
147 private long getSystemMemoryInGB() {
148 long memorySize = ((
com.sun.management.OperatingSystemMXBean) ManagementFactory
149 .getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
150 return memorySize / ONE_BILLION;
160 private long getCurrentJvmMaxMemoryInGB(String confFileMemValue)
throws IOException {
163 if (confFileMemValue.length() > 1) {
164 units = confFileMemValue.charAt(confFileMemValue.length() - 1);
166 value = Long.parseLong(confFileMemValue.substring(0, confFileMemValue.length() - 1));
167 }
catch (NumberFormatException ex) {
168 throw new IOException(
"Unable to properly parse memory number.", ex);
171 throw new IOException(
"No memory setting found in String: " + confFileMemValue);
180 return value / MEGA_IN_GIGA;
182 throw new IOException(
"Units were not recognized as parsed: " + units);
195 private static File getInstallFolderConfFile() throws IOException {
196 String confFileName = UserPreferences.getAppName() + CONFIG_FILE_EXTENSION;
197 String installFolder = PlatformUtil.getInstallPath();
198 File installFolderEtc =
new File(installFolder, ETC_FOLDER_NAME);
199 File installFolderConfigFile =
new File(installFolderEtc, confFileName);
200 if (!installFolderConfigFile.exists()) {
201 throw new IOException(
"Conf file could not be found" + installFolderConfigFile.toString());
203 return installFolderConfigFile;
213 private static File getUserFolderConfFile() {
214 String confFileName = UserPreferences.getAppName() + CONFIG_FILE_EXTENSION;
215 File userFolder = PlatformUtil.getUserDirectory();
216 File userEtcFolder =
new File(userFolder, ETC_FOLDER_NAME);
217 if (!userEtcFolder.exists()) {
218 userEtcFolder.mkdir();
220 return new File(userEtcFolder, confFileName);
223 private static final String JVM_SETTINGS_REGEX_PARAM =
"options";
224 private static final String JVM_SETTINGS_REGEX_STR =
"^\\s*default_options\\s*=\\s*\"?(?<" + JVM_SETTINGS_REGEX_PARAM +
">.+?)\"?\\s*$";
225 private static final Pattern JVM_SETTINGS_REGEX = Pattern.compile(JVM_SETTINGS_REGEX_STR);
226 private static final String XMX_REGEX_PARAM =
"mem";
227 private static final String XMX_REGEX_STR =
"^\\s*\\-J\\-Xmx(?<" + XMX_REGEX_PARAM +
">.+?)\\s*$";
228 private static final Pattern XMX_REGEX = Pattern.compile(XMX_REGEX_STR);
229 private static final String HEAP_DUMP_REGEX_PARAM =
"path";
230 private static final String HEAP_DUMP_REGEX_STR =
"^\\s*\\-J\\-XX:HeapDumpPath=(\\\")?\\s*(?<" + HEAP_DUMP_REGEX_PARAM +
">.+?)\\s*(\\\")?$";
231 private static final Pattern HEAP_DUMP_REGEX = Pattern.compile(HEAP_DUMP_REGEX_STR);
244 private static String updateConfLine(String line, String memText, String heapText) {
245 Matcher match = JVM_SETTINGS_REGEX.matcher(line);
248 String[] parsedArgs = Commandline.translateCommandline(match.group(JVM_SETTINGS_REGEX_PARAM));
250 String memString =
"-J-Xmx" + memText.replaceAll(
"[^\\d]",
"") +
"g";
253 String heapString = null;
254 if (StringUtils.isNotBlank(heapText)) {
255 while (heapText.endsWith(
"\\") && heapText.length() > 0) {
256 heapText = heapText.substring(0, heapText.length() - 1);
259 heapString = String.format(
"-J-XX:HeapDumpPath=\"%s\"", heapText);
262 Stream<String> argsNoMemHeap = Stream.of(parsedArgs)
264 .filter(s -> !s.matches(XMX_REGEX_STR) && !s.matches(HEAP_DUMP_REGEX_STR));
266 String newArgs = Stream.concat(argsNoMemHeap, Stream.of(memString, heapString))
267 .filter(s -> s != null)
268 .collect(Collectors.joining(
" "));
270 return String.format(
"default_options=\"%s\"", newArgs);
285 private void writeEtcConfFile() throws IOException {
286 String fileText = readConfFile(getInstallFolderConfFile()).stream()
287 .map((line) -> updateConfLine(line, memField.getText(), heapDumpFileField.getText()))
288 .collect(Collectors.joining(
"\n"));
290 FileUtils.writeStringToFile(getUserFolderConfFile(), fileText,
"UTF-8");
306 ConfValues(String XmxVal, String heapDumpPath) {
307 this.XmxVal = XmxVal;
308 this.heapDumpPath = heapDumpPath;
323 String getHeapDumpPath() {
333 private ConfValues getEtcConfValues() throws IOException {
334 File userConfFile = getUserFolderConfFile();
335 String[] args = userConfFile.exists() ?
336 getDefaultsFromFileContents(readConfFile(userConfFile)) :
337 getDefaultsFromFileContents(readConfFile(getInstallFolderConfFile()));
339 String heapFile =
"";
342 for (String arg : args) {
343 Matcher memMatch = XMX_REGEX.matcher(arg);
344 if (memMatch.find()) {
345 memSize = memMatch.group(XMX_REGEX_PARAM);
349 Matcher heapFileMatch = HEAP_DUMP_REGEX.matcher(arg);
350 if (heapFileMatch.find()) {
351 heapFile = heapFileMatch.group(HEAP_DUMP_REGEX_PARAM);
356 return new ConfValues(memSize, heapFile);
366 "AutopsyOptionsPanel_isHeapPathValid_selectValidDirectory=Please select an existing directory.",
367 "AutopsyOptionsPanel_isHeapPathValid_developerMode=Cannot change heap dump path while in developer mode.",
368 "AutopsyOptionsPanel_isHeapPathValid_not64BitMachine=Changing heap dump path settings only enabled for 64 bit version.",
369 "AutopsyOPtionsPanel_isHeapPathValid_illegalCharacters=Please select a path with no quotes."
371 private boolean isHeapPathValid() {
372 if (Version.getBuildType() == Version.Type.DEVELOPMENT) {
373 heapFieldValidationLabel.setVisible(
true);
374 heapFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_isHeapPathValid_developerMode());
378 if (!PlatformUtil.is64BitJVM()) {
379 heapFieldValidationLabel.setVisible(
true);
380 heapFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_isHeapPathValid_not64BitMachine());
385 if (StringUtils.isNotBlank(heapDumpFileField.getText())) {
386 String heapText = heapDumpFileField.getText().trim();
387 if (heapText.contains(
"\"") || heapText.contains(
"'")) {
388 heapFieldValidationLabel.setVisible(
true);
389 heapFieldValidationLabel.setText(Bundle.AutopsyOPtionsPanel_isHeapPathValid_illegalCharacters());
393 File curHeapFile =
new File(heapText);
394 if (!curHeapFile.exists() || !curHeapFile.isDirectory()) {
395 heapFieldValidationLabel.setVisible(
true);
396 heapFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_isHeapPathValid_selectValidDirectory());
401 heapFieldValidationLabel.setVisible(
false);
402 heapFieldValidationLabel.setText(
"");
415 private static List<String> readConfFile(File configFile) {
416 List<String> lines =
new ArrayList<>();
417 if (null != configFile) {
418 Path filePath = configFile.toPath();
419 Charset charset = Charset.forName(
"UTF-8");
421 lines = Files.readAllLines(filePath, charset);
422 }
catch (IOException e) {
423 logger.log(Level.SEVERE,
"Error reading config file contents. {}", configFile.getAbsolutePath());
440 private static String[] getDefaultsFromFileContents(List<String> list) {
441 Optional<String> defaultSettings = list.stream()
442 .filter(line -> line.matches(JVM_SETTINGS_REGEX_STR))
445 if (defaultSettings.isPresent()) {
446 Matcher match = JVM_SETTINGS_REGEX.matcher(defaultSettings.get());
448 return Commandline.translateCommandline(match.group(JVM_SETTINGS_REGEX_PARAM));
452 return new String[]{};
455 private void evaluateTempDirState() {
456 boolean caseOpen = Case.isCaseOpen();
457 boolean customSelected = tempCustomRadio.isSelected();
459 tempDirectoryBrowseButton.setEnabled(!caseOpen && customSelected);
460 tempCustomField.setEnabled(!caseOpen && customSelected);
462 tempOnCustomNoPath.setVisible(customSelected && StringUtils.isBlank(tempCustomField.getText()));
469 String path = reportBranding.getAgencyLogoPath();
470 boolean useDefault = (path == null || path.isEmpty());
471 defaultLogoRB.setSelected(useDefault);
472 specifyLogoRB.setSelected(!useDefault);
473 agencyLogoPathField.setEnabled(!useDefault);
474 browseLogosButton.setEnabled(!useDefault);
476 tempCustomField.setText(UserMachinePreferences.getCustomTempDirectory());
477 switch (UserMachinePreferences.getTempDirChoice()) {
479 tempCaseRadio.setSelected(
true);
482 tempCustomRadio.setSelected(
true);
486 tempLocalRadio.setSelected(
true);
490 evaluateTempDirState();
492 logFileCount.setText(String.valueOf(UserPreferences.getLogFileCount()));
493 solrMaxHeapSpinner.setValue(UserPreferences.getMaxSolrVMSize());
495 updateAgencyLogo(path);
496 }
catch (IOException ex) {
497 logger.log(Level.WARNING,
"Error loading image from previously saved agency logo path", ex);
500 boolean confLoaded =
false;
501 if (isJVMHeapSettingsCapable()) {
503 ConfValues confValues = getEtcConfValues();
504 heapDumpFileField.setText(confValues.getHeapDumpPath());
505 initialMemValue = Long.toString(getCurrentJvmMaxMemoryInGB(confValues.getXmxVal()));
507 }
catch (IOException ex) {
508 logger.log(Level.SEVERE,
"Can't read current Jvm max memory setting from file", ex);
509 heapDumpFileField.setText(DEFAULT_HEAP_DUMP_FILE_FIELD);
511 memField.setText(initialMemValue);
514 heapDumpBrowseButton.setEnabled(confLoaded);
515 heapDumpFileField.setEnabled(confLoaded);
521 private void setTempDirEnabled() {
522 boolean enabled = !Case.isCaseOpen();
524 this.tempCaseRadio.setEnabled(enabled);
525 this.tempCustomRadio.setEnabled(enabled);
526 this.tempLocalRadio.setEnabled(enabled);
528 this.tempDirectoryWarningLabel.setVisible(!enabled);
529 evaluateTempDirState();
539 private void updateAgencyLogo(String path)
throws IOException {
540 agencyLogoPathField.setText(path);
541 ImageIcon agencyLogoIcon =
new ImageIcon();
542 agencyLogoPreview.setText(NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.agencyLogoPreview.text"));
543 if (!agencyLogoPathField.getText().isEmpty()) {
544 File file =
new File(agencyLogoPathField.getText());
546 BufferedImage image = ImageIO.read(file);
548 throw new IOException(
"Unable to read file as a BufferedImage for file " + file.toString());
550 agencyLogoIcon =
new ImageIcon(image.getScaledInstance(64, 64, 4));
551 agencyLogoPreview.setText(
"");
554 agencyLogoPreview.setIcon(agencyLogoIcon);
555 agencyLogoPreview.repaint();
559 "AutopsyOptionsPanel_storeTempDir_onError_title=Error Saving Temporary Directory",
561 "AutopsyOptionsPanel_storeTempDir_onError_description=There was an error creating the temporary directory on the filesystem at: {0}.",
562 "AutopsyOptionsPanel_storeTempDir_onChoiceError_title=Error Saving Temporary Directory Choice",
563 "AutopsyOptionsPanel_storeTempDir_onChoiceError_description=There was an error updating temporary directory choice selection.",})
564 private void storeTempDir() {
565 String tempDirectoryPath = tempCustomField.getText();
566 if (!UserMachinePreferences.getCustomTempDirectory().equals(tempDirectoryPath)) {
568 UserMachinePreferences.setCustomTempDirectory(tempDirectoryPath);
569 }
catch (UserMachinePreferencesException ex) {
570 logger.log(Level.WARNING,
"There was an error creating the temporary directory defined by the user: " + tempDirectoryPath, ex);
571 SwingUtilities.invokeLater(() -> {
572 JOptionPane.showMessageDialog(
this,
573 String.format(
"<html>%s</html>", Bundle.AutopsyOptionsPanel_storeTempDir_onError_description(tempDirectoryPath)),
574 Bundle.AutopsyOptionsPanel_storeTempDir_onError_title(),
575 JOptionPane.ERROR_MESSAGE);
580 TempDirChoice choice;
581 if (tempCaseRadio.isSelected()) {
582 choice = TempDirChoice.CASE;
583 }
else if (tempCustomRadio.isSelected()) {
584 choice = TempDirChoice.CUSTOM;
586 choice = TempDirChoice.SYSTEM;
589 if (!choice.equals(UserMachinePreferences.getTempDirChoice())) {
591 UserMachinePreferences.setTempDirChoice(choice);
592 }
catch (UserMachinePreferencesException ex) {
593 logger.log(Level.WARNING,
"There was an error updating choice to: " + choice.name(), ex);
594 SwingUtilities.invokeLater(() -> {
595 JOptionPane.showMessageDialog(
this,
596 String.format(
"<html>%s</html>", Bundle.AutopsyOptionsPanel_storeTempDir_onChoiceError_description()),
597 Bundle.AutopsyOptionsPanel_storeTempDir_onChoiceError_title(),
598 JOptionPane.ERROR_MESSAGE);
608 UserPreferences.setLogFileCount(Integer.parseInt(logFileCount.getText()));
611 if (!agencyLogoPathField.getText().isEmpty()) {
612 File file =
new File(agencyLogoPathField.getText());
614 reportBranding.setAgencyLogoPath(agencyLogoPathField.getText());
617 reportBranding.setAgencyLogoPath(
"");
619 UserPreferences.setMaxSolrVMSize((
int) solrMaxHeapSpinner.getValue());
620 if (isJVMHeapSettingsCapable()) {
623 }
catch (IOException ex) {
624 logger.log(Level.WARNING,
"Unable to save config file to " + PlatformUtil.getUserDirectory() +
"\\" + ETC_FOLDER_NAME, ex);
635 boolean agencyValid = isAgencyLogoPathValid();
636 boolean memFieldValid = isMemFieldValid();
637 boolean logNumValid = isLogNumFieldValid();
638 boolean heapPathValid = isHeapPathValid();
640 return agencyValid && memFieldValid && logNumValid && heapPathValid;
649 boolean isAgencyLogoPathValid() {
650 boolean valid =
true;
652 if (defaultLogoRB.isSelected()) {
653 agencyLogoPathFieldValidationLabel.setText(
"");
655 String agencyLogoPath = agencyLogoPathField.getText();
656 if (agencyLogoPath.isEmpty()) {
657 agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_pathNotSet_text());
660 File file =
new File(agencyLogoPathField.getText());
661 if (file.exists() && file.isFile()) {
664 image = ImageIO.read(file);
666 throw new IOException(
"Unable to read file as a BufferedImage for file " + file.toString());
668 agencyLogoPathFieldValidationLabel.setText(
"");
669 }
catch (IOException | IndexOutOfBoundsException ignored) {
670 agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_invalidImageSpecified_text());
674 agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_invalidPath_text());
688 private boolean isMemFieldValid() {
689 String memText = memField.getText();
690 memFieldValidationLabel.setText(
"");
691 if (!PlatformUtil.is64BitJVM()) {
692 memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_not64BitInstall_text());
696 if (Version.getBuildType() == Version.Type.DEVELOPMENT) {
697 memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_developerMode_text());
701 if (memText.length() == 0) {
702 memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_noValueEntered_text());
705 if (memText.replaceAll(
"[^\\d]",
"").length() != memText.length()) {
706 memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_invalidCharacters_text());
709 int parsedInt = Integer.parseInt(memText);
710 if (parsedInt < MIN_MEMORY_IN_GB) {
711 memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_underMinMemory_text(MIN_MEMORY_IN_GB));
714 if (parsedInt > getSystemMemoryInGB()) {
715 memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_overMaxMemory_text(getSystemMemoryInGB()));
726 private boolean isLogNumFieldValid() {
727 String count = logFileCount.getText();
728 logNumAlert.setText(
"");
730 int count_num = Integer.parseInt(count);
732 logNumAlert.setText(Bundle.AutopsyOptionsPanel_logNumAlert_invalidInput_text());
735 }
catch (NumberFormatException e) {
736 logNumAlert.setText(Bundle.AutopsyOptionsPanel_logNumAlert_invalidInput_text());
755 this.onChange = onChange;
759 if (onChange != null) {
763 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
790 private void initComponents() {
791 java.awt.GridBagConstraints gridBagConstraints;
793 fileSelectionButtonGroup =
new javax.swing.ButtonGroup();
794 displayTimesButtonGroup =
new javax.swing.ButtonGroup();
795 logoSourceButtonGroup =
new javax.swing.ButtonGroup();
796 tempDirChoiceGroup =
new javax.swing.ButtonGroup();
797 jScrollPane1 =
new javax.swing.JScrollPane();
798 javax.swing.JPanel mainPanel =
new javax.swing.JPanel();
799 logoPanel =
new javax.swing.JPanel();
800 agencyLogoPathField =
new javax.swing.JTextField();
801 browseLogosButton =
new javax.swing.JButton();
802 agencyLogoPreview =
new javax.swing.JLabel();
803 defaultLogoRB =
new javax.swing.JRadioButton();
804 specifyLogoRB =
new javax.swing.JRadioButton();
805 agencyLogoPathFieldValidationLabel =
new javax.swing.JLabel();
806 runtimePanel =
new javax.swing.JPanel();
807 maxMemoryLabel =
new javax.swing.JLabel();
808 maxMemoryUnitsLabel =
new javax.swing.JLabel();
809 totalMemoryLabel =
new javax.swing.JLabel();
810 systemMemoryTotal =
new javax.swing.JLabel();
811 restartNecessaryWarning =
new javax.swing.JLabel();
812 memField =
new javax.swing.JTextField();
813 memFieldValidationLabel =
new javax.swing.JLabel();
814 maxMemoryUnitsLabel1 =
new javax.swing.JLabel();
815 maxLogFileCount =
new javax.swing.JLabel();
816 logFileCount =
new javax.swing.JTextField();
817 logNumAlert =
new javax.swing.JTextField();
818 maxSolrMemoryLabel =
new javax.swing.JLabel();
819 maxMemoryUnitsLabel2 =
new javax.swing.JLabel();
820 solrMaxHeapSpinner =
new javax.swing.JSpinner();
821 solrJVMHeapWarning =
new javax.swing.JLabel();
822 heapFileLabel =
new javax.swing.JLabel();
823 heapDumpFileField =
new javax.swing.JTextField();
824 heapDumpBrowseButton =
new javax.swing.JButton();
825 heapFieldValidationLabel =
new javax.swing.JLabel();
826 tempDirectoryPanel =
new javax.swing.JPanel();
827 tempCustomField =
new javax.swing.JTextField();
828 tempDirectoryBrowseButton =
new javax.swing.JButton();
829 tempDirectoryWarningLabel =
new javax.swing.JLabel();
830 tempLocalRadio =
new javax.swing.JRadioButton();
831 tempCaseRadio =
new javax.swing.JRadioButton();
832 tempCustomRadio =
new javax.swing.JRadioButton();
833 tempOnCustomNoPath =
new javax.swing.JLabel();
834 rdpPanel =
new javax.swing.JPanel();
835 javax.swing.JScrollPane sizingScrollPane =
new javax.swing.JScrollPane();
836 javax.swing.JTextPane sizingTextPane =
new javax.swing.JTextPane();
837 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));
838 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));
840 jScrollPane1.setBorder(null);
842 mainPanel.setMinimumSize(
new java.awt.Dimension(648, 382));
843 mainPanel.setLayout(
new java.awt.GridBagLayout());
845 logoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.logoPanel.border.title")));
847 agencyLogoPathField.setText(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.agencyLogoPathField.text"));
849 org.openide.awt.Mnemonics.setLocalizedText(browseLogosButton,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.browseLogosButton.text"));
850 browseLogosButton.addActionListener(
new java.awt.event.ActionListener() {
851 public void actionPerformed(java.awt.event.ActionEvent evt) {
852 browseLogosButtonActionPerformed(evt);
856 agencyLogoPreview.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
857 org.openide.awt.Mnemonics.setLocalizedText(agencyLogoPreview,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.agencyLogoPreview.text"));
858 agencyLogoPreview.setBorder(javax.swing.BorderFactory.createEtchedBorder());
859 agencyLogoPreview.setMaximumSize(
new java.awt.Dimension(64, 64));
860 agencyLogoPreview.setMinimumSize(
new java.awt.Dimension(64, 64));
861 agencyLogoPreview.setPreferredSize(
new java.awt.Dimension(64, 64));
863 logoSourceButtonGroup.add(defaultLogoRB);
864 org.openide.awt.Mnemonics.setLocalizedText(defaultLogoRB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.defaultLogoRB.text"));
865 defaultLogoRB.addActionListener(
new java.awt.event.ActionListener() {
866 public void actionPerformed(java.awt.event.ActionEvent evt) {
867 defaultLogoRBActionPerformed(evt);
871 logoSourceButtonGroup.add(specifyLogoRB);
872 org.openide.awt.Mnemonics.setLocalizedText(specifyLogoRB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.specifyLogoRB.text"));
873 specifyLogoRB.addActionListener(
new java.awt.event.ActionListener() {
874 public void actionPerformed(java.awt.event.ActionEvent evt) {
875 specifyLogoRBActionPerformed(evt);
879 agencyLogoPathFieldValidationLabel.setForeground(
new java.awt.Color(255, 0, 0));
880 org.openide.awt.Mnemonics.setLocalizedText(agencyLogoPathFieldValidationLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.text"));
882 javax.swing.GroupLayout logoPanelLayout =
new javax.swing.GroupLayout(logoPanel);
883 logoPanel.setLayout(logoPanelLayout);
884 logoPanelLayout.setHorizontalGroup(
885 logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
886 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup()
888 .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
889 .addComponent(specifyLogoRB)
890 .addComponent(defaultLogoRB))
891 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
892 .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
893 .addComponent(agencyLogoPathFieldValidationLabel)
894 .addGroup(logoPanelLayout.createSequentialGroup()
895 .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
896 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
897 .addComponent(browseLogosButton)))
898 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
899 .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
900 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
902 logoPanelLayout.setVerticalGroup(
903 logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
904 .addGroup(logoPanelLayout.createSequentialGroup()
906 .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
907 .addComponent(defaultLogoRB)
908 .addComponent(agencyLogoPathFieldValidationLabel))
909 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
910 .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
911 .addComponent(specifyLogoRB)
912 .addComponent(agencyLogoPathField)
913 .addComponent(browseLogosButton)))
914 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup()
915 .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
916 .addGap(0, 0, Short.MAX_VALUE))
919 gridBagConstraints =
new java.awt.GridBagConstraints();
920 gridBagConstraints.gridx = 0;
921 gridBagConstraints.gridy = 2;
922 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
923 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
924 mainPanel.add(logoPanel, gridBagConstraints);
926 runtimePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.runtimePanel.border.title")));
928 org.openide.awt.Mnemonics.setLocalizedText(maxMemoryLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.maxMemoryLabel.text"));
930 org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.maxMemoryUnitsLabel.text"));
932 org.openide.awt.Mnemonics.setLocalizedText(totalMemoryLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.totalMemoryLabel.text"));
934 systemMemoryTotal.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
936 restartNecessaryWarning.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/warning16.png")));
937 org.openide.awt.Mnemonics.setLocalizedText(restartNecessaryWarning,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.restartNecessaryWarning.text"));
939 memField.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
940 memField.addKeyListener(
new java.awt.event.KeyAdapter() {
941 public void keyReleased(java.awt.event.KeyEvent evt) {
942 memFieldKeyReleased(evt);
946 memFieldValidationLabel.setForeground(
new java.awt.Color(255, 0, 0));
948 org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel1,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.maxMemoryUnitsLabel.text"));
950 org.openide.awt.Mnemonics.setLocalizedText(maxLogFileCount,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.maxLogFileCount.text"));
952 logFileCount.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
953 logFileCount.addKeyListener(
new java.awt.event.KeyAdapter() {
954 public void keyReleased(java.awt.event.KeyEvent evt) {
955 logFileCountKeyReleased(evt);
959 logNumAlert.setEditable(
false);
960 logNumAlert.setForeground(
new java.awt.Color(255, 0, 0));
961 logNumAlert.setText(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.logNumAlert.text"));
962 logNumAlert.setBorder(null);
964 org.openide.awt.Mnemonics.setLocalizedText(maxSolrMemoryLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.maxSolrMemoryLabel.text"));
966 org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel2,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.maxMemoryUnitsLabel2.text"));
968 solrMaxHeapSpinner.addChangeListener(
new javax.swing.event.ChangeListener() {
969 public void stateChanged(javax.swing.event.ChangeEvent evt) {
970 solrMaxHeapSpinnerStateChanged(evt);
974 org.openide.awt.Mnemonics.setLocalizedText(solrJVMHeapWarning,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.solrJVMHeapWarning.text"));
976 org.openide.awt.Mnemonics.setLocalizedText(heapFileLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.heapFileLabel.text"));
978 heapDumpFileField.setText(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.heapDumpFileField.text"));
980 org.openide.awt.Mnemonics.setLocalizedText(heapDumpBrowseButton,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.heapDumpBrowseButton.text"));
981 heapDumpBrowseButton.addActionListener(
new java.awt.event.ActionListener() {
982 public void actionPerformed(java.awt.event.ActionEvent evt) {
983 heapDumpBrowseButtonActionPerformed(evt);
987 heapFieldValidationLabel.setForeground(
new java.awt.Color(255, 0, 0));
988 org.openide.awt.Mnemonics.setLocalizedText(heapFieldValidationLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.heapFieldValidationLabel.text"));
990 javax.swing.GroupLayout runtimePanelLayout =
new javax.swing.GroupLayout(runtimePanel);
991 runtimePanel.setLayout(runtimePanelLayout);
992 runtimePanelLayout.setHorizontalGroup(
993 runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
994 .addGroup(runtimePanelLayout.createSequentialGroup()
996 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
997 .addGroup(runtimePanelLayout.createSequentialGroup()
998 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
999 .addComponent(totalMemoryLabel)
1000 .addComponent(maxSolrMemoryLabel)
1001 .addComponent(maxMemoryLabel)
1002 .addComponent(maxLogFileCount))
1004 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1005 .addComponent(logFileCount, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
1006 .addComponent(solrMaxHeapSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1007 .addComponent(memField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
1008 .addComponent(systemMemoryTotal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
1010 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1011 .addComponent(maxMemoryUnitsLabel1)
1012 .addComponent(maxMemoryUnitsLabel)
1013 .addComponent(maxMemoryUnitsLabel2))
1014 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1015 .addGroup(runtimePanelLayout.createSequentialGroup()
1017 .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 478, javax.swing.GroupLayout.PREFERRED_SIZE)
1018 .addContainerGap(117, Short.MAX_VALUE))
1019 .addGroup(runtimePanelLayout.createSequentialGroup()
1021 .addComponent(solrJVMHeapWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 331, javax.swing.GroupLayout.PREFERRED_SIZE)
1023 .addComponent(logNumAlert)
1024 .addContainerGap())))
1025 .addGroup(runtimePanelLayout.createSequentialGroup()
1026 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1027 .addComponent(restartNecessaryWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 615, javax.swing.GroupLayout.PREFERRED_SIZE)
1028 .addGroup(runtimePanelLayout.createSequentialGroup()
1029 .addComponent(heapFileLabel)
1030 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1031 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1032 .addComponent(heapFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 478, javax.swing.GroupLayout.PREFERRED_SIZE)
1033 .addGroup(runtimePanelLayout.createSequentialGroup()
1034 .addComponent(heapDumpFileField, javax.swing.GroupLayout.PREFERRED_SIZE, 415, javax.swing.GroupLayout.PREFERRED_SIZE)
1035 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1036 .addComponent(heapDumpBrowseButton)))))
1037 .addGap(0, 0, Short.MAX_VALUE))))
1040 runtimePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {maxLogFileCount, maxMemoryLabel, totalMemoryLabel});
1042 runtimePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {logFileCount, memField});
1044 runtimePanelLayout.setVerticalGroup(
1045 runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1046 .addGroup(runtimePanelLayout.createSequentialGroup()
1048 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
1049 .addComponent(totalMemoryLabel)
1050 .addComponent(maxMemoryUnitsLabel1)
1051 .addComponent(systemMemoryTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1052 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1053 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1054 .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
1055 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1056 .addComponent(maxMemoryLabel)
1057 .addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1058 .addComponent(maxMemoryUnitsLabel)))
1059 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1060 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1061 .addComponent(logNumAlert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1062 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1063 .addComponent(maxSolrMemoryLabel)
1064 .addComponent(maxMemoryUnitsLabel2)
1065 .addComponent(solrMaxHeapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1066 .addComponent(solrJVMHeapWarning)))
1067 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1068 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1069 .addComponent(maxLogFileCount)
1070 .addComponent(logFileCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1071 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1072 .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1073 .addComponent(heapFileLabel)
1074 .addComponent(heapDumpFileField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1075 .addComponent(heapDumpBrowseButton))
1076 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1077 .addComponent(heapFieldValidationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
1078 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1079 .addComponent(restartNecessaryWarning)
1083 gridBagConstraints =
new java.awt.GridBagConstraints();
1084 gridBagConstraints.gridx = 0;
1085 gridBagConstraints.gridy = 0;
1086 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1087 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1088 mainPanel.add(runtimePanel, gridBagConstraints);
1090 tempDirectoryPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempDirectoryPanel.border.title")));
1091 tempDirectoryPanel.setName(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempDirectoryPanel.name"));
1093 tempCustomField.setText(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempCustomField.text"));
1095 org.openide.awt.Mnemonics.setLocalizedText(tempDirectoryBrowseButton,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempDirectoryBrowseButton.text"));
1096 tempDirectoryBrowseButton.addActionListener(
new java.awt.event.ActionListener() {
1097 public void actionPerformed(java.awt.event.ActionEvent evt) {
1098 tempDirectoryBrowseButtonActionPerformed(evt);
1102 tempDirectoryWarningLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/warning16.png")));
1103 org.openide.awt.Mnemonics.setLocalizedText(tempDirectoryWarningLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempDirectoryWarningLabel.text"));
1105 tempDirChoiceGroup.add(tempLocalRadio);
1106 org.openide.awt.Mnemonics.setLocalizedText(tempLocalRadio,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempLocalRadio.text"));
1107 tempLocalRadio.addActionListener(
new java.awt.event.ActionListener() {
1108 public void actionPerformed(java.awt.event.ActionEvent evt) {
1109 tempLocalRadioActionPerformed(evt);
1113 tempDirChoiceGroup.add(tempCaseRadio);
1114 org.openide.awt.Mnemonics.setLocalizedText(tempCaseRadio,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempCaseRadio.text"));
1115 tempCaseRadio.addActionListener(
new java.awt.event.ActionListener() {
1116 public void actionPerformed(java.awt.event.ActionEvent evt) {
1117 tempCaseRadioActionPerformed(evt);
1121 tempDirChoiceGroup.add(tempCustomRadio);
1122 org.openide.awt.Mnemonics.setLocalizedText(tempCustomRadio,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempCustomRadio.text"));
1123 tempCustomRadio.addActionListener(
new java.awt.event.ActionListener() {
1124 public void actionPerformed(java.awt.event.ActionEvent evt) {
1125 tempCustomRadioActionPerformed(evt);
1129 tempOnCustomNoPath.setForeground(java.awt.Color.RED);
1130 org.openide.awt.Mnemonics.setLocalizedText(tempOnCustomNoPath,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempOnCustomNoPath.text"));
1132 javax.swing.GroupLayout tempDirectoryPanelLayout =
new javax.swing.GroupLayout(tempDirectoryPanel);
1133 tempDirectoryPanel.setLayout(tempDirectoryPanelLayout);
1134 tempDirectoryPanelLayout.setHorizontalGroup(
1135 tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1136 .addGroup(tempDirectoryPanelLayout.createSequentialGroup()
1138 .addGroup(tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1139 .addComponent(tempLocalRadio)
1140 .addComponent(tempCaseRadio)
1141 .addComponent(tempDirectoryWarningLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 615, javax.swing.GroupLayout.PREFERRED_SIZE)
1142 .addGroup(tempDirectoryPanelLayout.createSequentialGroup()
1143 .addComponent(tempCustomRadio)
1144 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1145 .addGroup(tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1146 .addComponent(tempOnCustomNoPath)
1147 .addGroup(tempDirectoryPanelLayout.createSequentialGroup()
1148 .addComponent(tempCustomField, javax.swing.GroupLayout.PREFERRED_SIZE, 459, javax.swing.GroupLayout.PREFERRED_SIZE)
1149 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1150 .addComponent(tempDirectoryBrowseButton)))))
1151 .addContainerGap(269, Short.MAX_VALUE))
1153 tempDirectoryPanelLayout.setVerticalGroup(
1154 tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1155 .addGroup(tempDirectoryPanelLayout.createSequentialGroup()
1157 .addComponent(tempLocalRadio)
1158 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1159 .addComponent(tempCaseRadio)
1160 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1161 .addGroup(tempDirectoryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1162 .addComponent(tempCustomRadio)
1163 .addComponent(tempCustomField)
1164 .addComponent(tempDirectoryBrowseButton))
1165 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1166 .addComponent(tempOnCustomNoPath)
1167 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1168 .addComponent(tempDirectoryWarningLabel)
1169 .addGap(14, 14, 14))
1172 gridBagConstraints =
new java.awt.GridBagConstraints();
1173 gridBagConstraints.gridx = 0;
1174 gridBagConstraints.gridy = 1;
1175 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1176 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1177 mainPanel.add(tempDirectoryPanel, gridBagConstraints);
1178 tempDirectoryPanel.getAccessibleContext().setAccessibleName(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.tempDirectoryPanel.AccessibleContext.accessibleName"));
1180 rdpPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.rdpPanel.border.title")));
1181 rdpPanel.setMaximumSize(
new java.awt.Dimension(300, 175));
1182 rdpPanel.setMinimumSize(
new java.awt.Dimension(300, 175));
1183 rdpPanel.setPreferredSize(
new java.awt.Dimension(300, 175));
1184 rdpPanel.setLayout(
new java.awt.GridBagLayout());
1186 sizingScrollPane.setBorder(null);
1188 sizingTextPane.setEditable(
false);
1189 sizingTextPane.setBorder(null);
1190 sizingTextPane.setText(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.sizingTextPane.text"));
1191 sizingTextPane.setAutoscrolls(
false);
1192 sizingTextPane.setMinimumSize(
new java.awt.Dimension(453, 220));
1193 sizingTextPane.setOpaque(
false);
1194 sizingTextPane.setPreferredSize(
new java.awt.Dimension(453, 220));
1195 sizingTextPane.setSelectionStart(0);
1196 sizingScrollPane.setViewportView(sizingTextPane);
1198 gridBagConstraints =
new java.awt.GridBagConstraints();
1199 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1200 gridBagConstraints.weightx = 1.0;
1201 gridBagConstraints.weighty = 1.0;
1202 rdpPanel.add(sizingScrollPane, gridBagConstraints);
1204 gridBagConstraints =
new java.awt.GridBagConstraints();
1205 gridBagConstraints.gridy = 3;
1206 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1207 mainPanel.add(rdpPanel, gridBagConstraints);
1208 gridBagConstraints =
new java.awt.GridBagConstraints();
1209 gridBagConstraints.gridx = 1;
1210 gridBagConstraints.gridy = 0;
1211 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1212 gridBagConstraints.weightx = 1.0;
1213 mainPanel.add(filler1, gridBagConstraints);
1214 gridBagConstraints =
new java.awt.GridBagConstraints();
1215 gridBagConstraints.gridx = 0;
1216 gridBagConstraints.gridy = 4;
1217 gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
1218 gridBagConstraints.weighty = 1.0;
1219 mainPanel.add(filler2, gridBagConstraints);
1221 jScrollPane1.setViewportView(mainPanel);
1223 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
1224 this.setLayout(layout);
1225 layout.setHorizontalGroup(
1226 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1227 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 955, Short.MAX_VALUE)
1229 layout.setVerticalGroup(
1230 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1231 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 699, Short.MAX_VALUE)
1236 "AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_title=Path cannot be used",
1238 "AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_description=Unable to create temporary directory within specified path: {0}",})
1239 private void tempDirectoryBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {
1240 if(tempDirChooser == null) {
1241 tempDirChooser = tempChooserHelper.getChooser();
1242 tempDirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1243 tempDirChooser.setMultiSelectionEnabled(
false);
1245 int returnState = tempDirChooser.showOpenDialog(
this);
1246 if (returnState == JFileChooser.APPROVE_OPTION) {
1247 String specifiedPath = tempDirChooser.getSelectedFile().getPath();
1249 File f =
new File(specifiedPath);
1250 if (!f.exists() && !f.mkdirs()) {
1251 throw new InvalidPathException(specifiedPath,
"Unable to create parent directories leading to " + specifiedPath);
1253 tempCustomField.setText(specifiedPath);
1254 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1255 }
catch (InvalidPathException ex) {
1256 logger.log(Level.WARNING,
"Unable to create temporary directory in " + specifiedPath, ex);
1257 JOptionPane.showMessageDialog(
this,
1258 Bundle.AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_description(specifiedPath),
1259 Bundle.AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_title(),
1260 JOptionPane.ERROR_MESSAGE);
1265 private void solrMaxHeapSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {
1266 int value = (int) solrMaxHeapSpinner.getValue();
1267 if (value == UserPreferences.getMaxSolrVMSize()) {
1271 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1274 private void logFileCountKeyReleased(java.awt.event.KeyEvent evt) {
1275 String count = logFileCount.getText();
1276 if (count.equals(String.valueOf(UserPreferences.getDefaultLogFileCount()))) {
1280 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1283 private void memFieldKeyReleased(java.awt.event.KeyEvent evt) {
1284 String memText = memField.getText();
1285 if (memText.equals(initialMemValue)) {
1289 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1292 private void specifyLogoRBActionPerformed(java.awt.event.ActionEvent evt) {
1293 agencyLogoPathField.setEnabled(
true);
1294 browseLogosButton.setEnabled(
true);
1296 if (agencyLogoPathField.getText().isEmpty()) {
1297 String path = reportBranding.getAgencyLogoPath();
1298 if (path != null && !path.isEmpty()) {
1299 updateAgencyLogo(path);
1302 }
catch (IOException ex) {
1303 logger.log(Level.WARNING,
"Error loading image from previously saved agency logo path.", ex);
1305 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1308 private void defaultLogoRBActionPerformed(java.awt.event.ActionEvent evt) {
1309 agencyLogoPathField.setEnabled(
false);
1310 browseLogosButton.setEnabled(
false);
1312 updateAgencyLogo(
"");
1313 }
catch (IOException ex) {
1315 logger.log(Level.SEVERE,
"Unexpected error occurred while updating the agency logo.", ex);
1317 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1320 private void browseLogosButtonActionPerformed(java.awt.event.ActionEvent evt) {
1321 if(logoFileChooser == null) {
1322 logoFileChooser = logoChooserHelper.getChooser();
1323 logoFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1324 logoFileChooser.setMultiSelectionEnabled(
false);
1325 logoFileChooser.setAcceptAllFileFilterUsed(
false);
1326 logoFileChooser.setFileFilter(
new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR));
1328 String oldLogoPath = agencyLogoPathField.getText();
1329 int returnState = logoFileChooser.showOpenDialog(
this);
1330 if (returnState == JFileChooser.APPROVE_OPTION) {
1331 String path = logoFileChooser.getSelectedFile().getPath();
1333 updateAgencyLogo(path);
1334 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1335 }
catch (IOException | IndexOutOfBoundsException ex) {
1336 JOptionPane.showMessageDialog(
this,
1337 NbBundle.getMessage(
this.getClass(),
1338 "AutopsyOptionsPanel.invalidImageFile.msg"),
1339 NbBundle.getMessage(
this.getClass(),
"AutopsyOptionsPanel.invalidImageFile.title"),
1340 JOptionPane.ERROR_MESSAGE);
1342 updateAgencyLogo(oldLogoPath);
1343 }
catch (IOException ex1) {
1344 logger.log(Level.WARNING,
"Error loading image from previously saved agency logo path", ex1);
1350 private void tempLocalRadioActionPerformed(java.awt.event.ActionEvent evt) {
1351 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1352 evaluateTempDirState();
1355 private void tempCaseRadioActionPerformed(java.awt.event.ActionEvent evt) {
1356 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1357 evaluateTempDirState();
1360 private void tempCustomRadioActionPerformed(java.awt.event.ActionEvent evt) {
1361 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1362 evaluateTempDirState();
1366 "AutopsyOptionsPanel_heapDumpBrowseButtonActionPerformed_fileAlreadyExistsTitle=File Already Exists",
1367 "AutopsyOptionsPanel_heapDumpBrowseButtonActionPerformed_fileAlreadyExistsMessage=File already exists. Please select a new location."
1369 private void heapDumpBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {
1370 if(heapFileChooser == null) {
1371 heapFileChooser = heapChooserHelper.getChooser();
1372 heapFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1373 heapFileChooser.setMultiSelectionEnabled(
false);
1375 String oldHeapPath = heapDumpFileField.getText();
1376 if (!StringUtils.isBlank(oldHeapPath)) {
1377 heapFileChooser.setCurrentDirectory(
new File(oldHeapPath));
1380 int returnState = heapFileChooser.showOpenDialog(
this);
1381 if (returnState == JFileChooser.APPROVE_OPTION) {
1382 File selectedDirectory = heapFileChooser.getSelectedFile();
1383 heapDumpFileField.setText(selectedDirectory.getAbsolutePath());
1384 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1389 private javax.swing.JTextField agencyLogoPathField;
1390 private javax.swing.JLabel agencyLogoPathFieldValidationLabel;
1391 private javax.swing.JLabel agencyLogoPreview;
1392 private javax.swing.JButton browseLogosButton;
1393 private javax.swing.JRadioButton defaultLogoRB;
1394 private javax.swing.ButtonGroup displayTimesButtonGroup;
1395 private javax.swing.ButtonGroup fileSelectionButtonGroup;
1396 private javax.swing.JButton heapDumpBrowseButton;
1397 private javax.swing.JTextField heapDumpFileField;
1398 private javax.swing.JLabel heapFieldValidationLabel;
1399 private javax.swing.JLabel heapFileLabel;
1400 private javax.swing.JScrollPane jScrollPane1;
1401 private javax.swing.JTextField logFileCount;
1402 private javax.swing.JTextField logNumAlert;
1403 private javax.swing.JPanel logoPanel;
1404 private javax.swing.ButtonGroup logoSourceButtonGroup;
1405 private javax.swing.JLabel maxLogFileCount;
1406 private javax.swing.JLabel maxMemoryLabel;
1407 private javax.swing.JLabel maxMemoryUnitsLabel;
1408 private javax.swing.JLabel maxMemoryUnitsLabel1;
1409 private javax.swing.JLabel maxMemoryUnitsLabel2;
1410 private javax.swing.JLabel maxSolrMemoryLabel;
1411 private javax.swing.JTextField memField;
1412 private javax.swing.JLabel memFieldValidationLabel;
1413 private javax.swing.JPanel rdpPanel;
1414 private javax.swing.JLabel restartNecessaryWarning;
1415 private javax.swing.JPanel runtimePanel;
1416 private javax.swing.JLabel solrJVMHeapWarning;
1417 private javax.swing.JSpinner solrMaxHeapSpinner;
1418 private javax.swing.JRadioButton specifyLogoRB;
1419 private javax.swing.JLabel systemMemoryTotal;
1420 private javax.swing.JRadioButton tempCaseRadio;
1421 private javax.swing.JTextField tempCustomField;
1422 private javax.swing.JRadioButton tempCustomRadio;
1423 private javax.swing.ButtonGroup tempDirChoiceGroup;
1424 private javax.swing.JButton tempDirectoryBrowseButton;
1425 private javax.swing.JPanel tempDirectoryPanel;
1426 private javax.swing.JLabel tempDirectoryWarningLabel;
1427 private javax.swing.JRadioButton tempLocalRadio;
1428 private javax.swing.JLabel tempOnCustomNoPath;
1429 private javax.swing.JLabel totalMemoryLabel;
final String heapDumpPath
void insertUpdate(DocumentEvent e)
void removeUpdate(DocumentEvent e)
void changedUpdate(DocumentEvent e)