From 757da3ae624e53fabdbd2a91f6f701a851c69d9f Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Fri, 8 Dec 2017 16:14:54 -0500 Subject: [PATCH 1/4] Implemented feature to remove logo. --- .../corecomponents/AutopsyOptionsPanel.form | 94 ++++++----- .../corecomponents/AutopsyOptionsPanel.java | 154 +++++++++++++----- .../autopsy/corecomponents/Bundle.properties | 3 +- 3 files changed, 168 insertions(+), 83 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form index 00881c2ca7..789438198a 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form @@ -2,9 +2,11 @@
- + - + + + @@ -22,10 +24,7 @@ - - - - + @@ -69,7 +68,7 @@ - + @@ -92,15 +91,14 @@ - - - - - - - + + + + + + @@ -109,42 +107,32 @@ - - - - - - - - - - - + + + + + + + - + + + + + - - - - - - - - - - @@ -179,6 +167,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -276,7 +290,7 @@ - + @@ -292,7 +306,7 @@ - + @@ -369,7 +383,7 @@ - + @@ -382,7 +396,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java index a62ae4400c..bd88015ce8 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java @@ -76,9 +76,12 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { private static final long ONE_BILLION = 1000000000L; //used to roughly convert system memory from bytes to gigabytes private static final long MEGA_IN_GIGA = 1024; //used to convert memory settings saved as megabytes to gigabytes private static final int MIN_MEMORY_IN_GB = 2; //the enforced minimum memory in gigabytes - private static final Logger logger = Logger.getLogger(AutopsyOptionsPanel.class.getName()); + private static final Logger LOGGER = Logger.getLogger(AutopsyOptionsPanel.class.getName()); private String initialMemValue = Long.toString(Runtime.getRuntime().maxMemory() / ONE_BILLION); + /** + * Instantiate the Autopsy options panel. + */ AutopsyOptionsPanel() { initComponents(); fc = new JFileChooser(); @@ -86,7 +89,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { fc.setMultiSelectionEnabled(false); fc.setAcceptAllFileFilterUsed(false); fc.setFileFilter(new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR)); - if (!PlatformUtil.is64BitJVM() || Version.getBuildType() == Version.Type.DEVELOPMENT) { + if (!PlatformUtil.is64BitJVM() || Version.getBuildType() == Version.Type.DEVELOPMENT) { //32 bit JVM has a max heap size of 1.4 gb to 4 gb depending on OS //So disabling the setting of heap size when the JVM is not 64 bit //Is the safest course of action @@ -247,7 +250,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { try { lines = Files.readAllLines(filePath, charset); } catch (IOException e) { - logger.log(Level.SEVERE, "Error reading config file contents. {}", configFile.getAbsolutePath()); + LOGGER.log(Level.SEVERE, "Error reading config file contents. {}", configFile.getAbsolutePath()); } } return lines; @@ -273,6 +276,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { return new String[]{}; } + /** + * Load the saved user preferences. + */ void load() { boolean keepPreferredViewer = UserPreferences.keepPreferredContentViewer(); keepCurrentViewerRB.setSelected(keepPreferredViewer); @@ -286,15 +292,20 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { useGMTTimeRB.setSelected(!useLocalTime); String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP); try { + boolean useDefault = (path == null || path.isEmpty()); + defaultLogoRB.setSelected(useDefault); + specifyLogoRB.setSelected(!useDefault); + agencyLogoPathField.setEnabled(!useDefault); + browseLogosButton.setEnabled(!useDefault); updateAgencyLogo(path); } catch (IOException ex) { - logger.log(Level.WARNING, "Error loading image from previously saved agency logo path", ex); + LOGGER.log(Level.WARNING, "Error loading image from previously saved agency logo path", ex); } if (memField.isEnabled()) { try { initialMemValue = Long.toString(getCurrentJvmMaxMemoryInGB()); } catch (IOException ex) { - logger.log(Level.SEVERE, "Can't read current Jvm max memory setting from file", ex); + LOGGER.log(Level.SEVERE, "Can't read current Jvm max memory setting from file", ex); memField.setEnabled(false); } memField.setText(initialMemValue); @@ -302,6 +313,13 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { isMemFieldValid(); //ensure the error message is up to date } + /** + * Update the agency logo with the image specified by the path. + * + * @param path The path to the image. + * + * @throws IOException Thrown when there is a problem reading the file. + */ private void updateAgencyLogo(String path) throws IOException { agencyLogoPathField.setText(path); ImageIcon agencyLogoIcon = new ImageIcon(); @@ -321,6 +339,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { agencyLogoPreview.repaint(); } + /** + * Store the current user preferences. + */ void store() { UserPreferences.setKeepPreferredContentViewer(keepCurrentViewerRB.isSelected()); UserPreferences.setHideKnownFilesInDataSourcesTree(dataSourcesHideKnownCB.isSelected()); @@ -333,16 +354,23 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { if (file.exists()) { ModuleSettings.setConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP, agencyLogoPathField.getText()); } + } else { + ModuleSettings.setConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP, ""); } if (memField.isEnabled()) { //if the field could of been changed we need to try and save it try { writeEtcConfFile(); } catch (IOException ex) { - logger.log(Level.WARNING, "Unable to save config file to " + PlatformUtil.getUserDirectory() + "\\" + ETC_FOLDER_NAME, ex); + LOGGER.log(Level.WARNING, "Unable to save config file to " + PlatformUtil.getUserDirectory() + "\\" + ETC_FOLDER_NAME, ex); } } } + /** + * Checks to see if the memory field value is valid. + * + * @return True if valid; false otherwise. + */ boolean valid() { return isMemFieldValid(); } @@ -355,15 +383,17 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { // //GEN-BEGIN:initComponents private void initComponents() { - buttonGroup1 = new javax.swing.ButtonGroup(); - buttonGroup3 = new javax.swing.ButtonGroup(); + fileSelectionButtonGroup = new javax.swing.ButtonGroup(); + displayTimesButtonGroup = new javax.swing.ButtonGroup(); + logoSourceButtonGroup = new javax.swing.ButtonGroup(); jScrollPane1 = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(); logoPanel = new javax.swing.JPanel(); - agencyLogoImageLabel = new javax.swing.JLabel(); agencyLogoPathField = new javax.swing.JTextField(); browseLogosButton = new javax.swing.JButton(); agencyLogoPreview = new javax.swing.JLabel(); + defaultLogoRB = new javax.swing.JRadioButton(); + specifyLogoRB = new javax.swing.JRadioButton(); viewPanel = new javax.swing.JPanel(); jLabelSelectFile = new javax.swing.JLabel(); useBestViewerRB = new javax.swing.JRadioButton(); @@ -391,13 +421,8 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { logoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.logoPanel.border.title"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(agencyLogoImageLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoImageLabel.text")); // NOI18N - - agencyLogoPathField.setEditable(false); agencyLogoPathField.setBackground(new java.awt.Color(255, 255, 255)); agencyLogoPathField.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPathField.text")); // NOI18N - agencyLogoPathField.setFocusable(false); - agencyLogoPathField.setRequestFocusEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(browseLogosButton, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.browseLogosButton.text")); // NOI18N browseLogosButton.addActionListener(new java.awt.event.ActionListener() { @@ -413,6 +438,22 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { agencyLogoPreview.setMinimumSize(new java.awt.Dimension(64, 64)); agencyLogoPreview.setPreferredSize(new java.awt.Dimension(64, 64)); + logoSourceButtonGroup.add(defaultLogoRB); + org.openide.awt.Mnemonics.setLocalizedText(defaultLogoRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.defaultLogoRB.text")); // NOI18N + defaultLogoRB.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + defaultLogoRBActionPerformed(evt); + } + }); + + logoSourceButtonGroup.add(specifyLogoRB); + org.openide.awt.Mnemonics.setLocalizedText(specifyLogoRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.specifyLogoRB.text")); // NOI18N + specifyLogoRB.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + specifyLogoRBActionPerformed(evt); + } + }); + javax.swing.GroupLayout logoPanelLayout = new javax.swing.GroupLayout(logoPanel); logoPanel.setLayout(logoPanelLayout); logoPanelLayout.setHorizontalGroup( @@ -420,12 +461,12 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(agencyLogoImageLabel) - .addGroup(logoPanelLayout.createSequentialGroup() - .addGap(10, 10, 10) - .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(browseLogosButton))) + .addComponent(specifyLogoRB) + .addComponent(defaultLogoRB)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(browseLogosButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) @@ -433,23 +474,24 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { logoPanelLayout.setVerticalGroup( logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(logoPanelLayout.createSequentialGroup() - .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(agencyLogoPreview, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(logoPanelLayout.createSequentialGroup() - .addContainerGap() - .addComponent(agencyLogoImageLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(agencyLogoPathField) - .addComponent(browseLogosButton)))) - .addGap(0, 0, 0)) + .addGap(6, 6, 6) + .addComponent(defaultLogoRB) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(specifyLogoRB) + .addComponent(agencyLogoPathField) + .addComponent(browseLogosButton)) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup() + .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) ); viewPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.viewPanel.border.title"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabelSelectFile, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelSelectFile.text")); // NOI18N - buttonGroup1.add(useBestViewerRB); + fileSelectionButtonGroup.add(useBestViewerRB); org.openide.awt.Mnemonics.setLocalizedText(useBestViewerRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useBestViewerRB.text")); // NOI18N useBestViewerRB.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useBestViewerRB.toolTipText")); // NOI18N useBestViewerRB.addActionListener(new java.awt.event.ActionListener() { @@ -458,7 +500,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { } }); - buttonGroup1.add(keepCurrentViewerRB); + fileSelectionButtonGroup.add(keepCurrentViewerRB); org.openide.awt.Mnemonics.setLocalizedText(keepCurrentViewerRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.keepCurrentViewerRB.text")); // NOI18N keepCurrentViewerRB.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.keepCurrentViewerRB.toolTipText")); // NOI18N keepCurrentViewerRB.addActionListener(new java.awt.event.ActionListener() { @@ -501,7 +543,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(jLabelTimeDisplay, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelTimeDisplay.text")); // NOI18N - buttonGroup3.add(useLocalTimeRB); + displayTimesButtonGroup.add(useLocalTimeRB); org.openide.awt.Mnemonics.setLocalizedText(useLocalTimeRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useLocalTimeRB.text")); // NOI18N useLocalTimeRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -509,7 +551,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { } }); - buttonGroup3.add(useGMTTimeRB); + displayTimesButtonGroup.add(useGMTTimeRB); org.openide.awt.Mnemonics.setLocalizedText(useGMTTimeRB, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.useGMTTimeRB.text")); // NOI18N useGMTTimeRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -665,7 +707,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addComponent(runtimePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(logoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, 0)) + .addContainerGap()) ); jScrollPane1.setViewportView(jPanel1); @@ -674,9 +716,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jScrollPane1) - .addGap(0, 0, 0)) + .addComponent(jScrollPane1) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -733,7 +773,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { try { updateAgencyLogo(oldLogoPath); //restore previous setting if new one is invalid } catch (IOException ex1) { - logger.log(Level.WARNING, "Error loading image from previously saved agency logo path", ex1); + LOGGER.log(Level.WARNING, "Error loading image from previously saved agency logo path", ex1); } } } @@ -748,6 +788,34 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_memFieldKeyReleased + private void defaultLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultLogoRBActionPerformed + agencyLogoPathField.setEnabled(false); + browseLogosButton.setEnabled(false); + try { + updateAgencyLogo(""); + } catch (IOException ex) { + // This should never happen since we're not reading from a file. + LOGGER.log(Level.SEVERE, "Unexpected error occurred while updating the agency logo.", ex); + } + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + }//GEN-LAST:event_defaultLogoRBActionPerformed + + private void specifyLogoRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_specifyLogoRBActionPerformed + agencyLogoPathField.setEnabled(true); + browseLogosButton.setEnabled(true); + try { + if (agencyLogoPathField.getText().isEmpty()) { + String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP); + if (path != null && !path.isEmpty()) { + updateAgencyLogo(path); + } + } + } catch (IOException ex) { + LOGGER.log(Level.WARNING, "Error loading image from previously saved agency logo path.", ex); + } + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + }//GEN-LAST:event_specifyLogoRBActionPerformed + /** * Checks that if the mem field is enabled it has a valid value. * @@ -786,14 +854,14 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { return true; } // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel agencyLogoImageLabel; private javax.swing.JTextField agencyLogoPathField; private javax.swing.JLabel agencyLogoPreview; private javax.swing.JButton browseLogosButton; - private javax.swing.ButtonGroup buttonGroup1; - private javax.swing.ButtonGroup buttonGroup3; private javax.swing.JCheckBox dataSourcesHideKnownCB; private javax.swing.JCheckBox dataSourcesHideSlackCB; + private javax.swing.JRadioButton defaultLogoRB; + private javax.swing.ButtonGroup displayTimesButtonGroup; + private javax.swing.ButtonGroup fileSelectionButtonGroup; private javax.swing.JLabel invalidReasonLabel; private javax.swing.JLabel jLabelHideKnownFiles; private javax.swing.JLabel jLabelHideSlackFiles; @@ -803,12 +871,14 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { private javax.swing.JScrollPane jScrollPane1; private javax.swing.JRadioButton keepCurrentViewerRB; private javax.swing.JPanel logoPanel; + private javax.swing.ButtonGroup logoSourceButtonGroup; private javax.swing.JLabel maxMemoryLabel; private javax.swing.JLabel maxMemoryUnitsLabel; private javax.swing.JLabel maxMemoryUnitsLabel1; private javax.swing.JTextField memField; private javax.swing.JLabel restartNecessaryWarning; private javax.swing.JPanel runtimePanel; + private javax.swing.JRadioButton specifyLogoRB; private javax.swing.JLabel systemMemoryTotal; private javax.swing.JLabel totalMemoryLabel; private javax.swing.JRadioButton useBestViewerRB; diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index 26a2cc03e0..78a3853231 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -192,7 +192,6 @@ AutopsyOptionsPanel.jLabelHideSlackFiles.text=Hide slack files in the: AutopsyOptionsPanel.dataSourcesHideSlackCB.text=Data Sources area (the directory hierarchy) AutopsyOptionsPanel.viewsHideSlackCB.text=Views area AutopsyOptionsPanel.agencyLogoImageLabel.toolTipText= -AutopsyOptionsPanel.agencyLogoImageLabel.text=Image to use as the agency logo for HTML reports: AutopsyOptionsPanel.browseLogosButton.text=Browse AutopsyOptionsPanel.agencyLogoPathField.text= SortChooserDialog.label=remove @@ -201,3 +200,5 @@ DataResultViewerThumbnail.sortButton.text=Sort CriterionChooser.ascendingRadio.text=\u25b2 Ascending\n CriterionChooser.removeButton.text=Remove CriterionChooser.descendingRadio.text=\u25bc Descending +AutopsyOptionsPanel.defaultLogoRB.text=Use default +AutopsyOptionsPanel.specifyLogoRB.text=Specify a logo From 35d4689593769e3236ed286b1e9ebff4ebf6a9b0 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Fri, 8 Dec 2017 16:22:09 -0500 Subject: [PATCH 2/4] Minor revision. --- .../autopsy/corecomponents/AutopsyOptionsPanel.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java index bd88015ce8..55b1d1cd8c 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java @@ -291,12 +291,12 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { useLocalTimeRB.setSelected(useLocalTime); useGMTTimeRB.setSelected(!useLocalTime); String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP); + boolean useDefault = (path == null || path.isEmpty()); + defaultLogoRB.setSelected(useDefault); + specifyLogoRB.setSelected(!useDefault); + agencyLogoPathField.setEnabled(!useDefault); + browseLogosButton.setEnabled(!useDefault); try { - boolean useDefault = (path == null || path.isEmpty()); - defaultLogoRB.setSelected(useDefault); - specifyLogoRB.setSelected(!useDefault); - agencyLogoPathField.setEnabled(!useDefault); - browseLogosButton.setEnabled(!useDefault); updateAgencyLogo(path); } catch (IOException ex) { LOGGER.log(Level.WARNING, "Error loading image from previously saved agency logo path", ex); From 8a83de675852a35a0b162f3b17ee726c4dfb6743 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Mon, 11 Dec 2017 00:34:58 -0500 Subject: [PATCH 3/4] Fixed text input bug and improved validation. --- .../corecomponents/AutopsyOptionsPanel.form | 40 +++- .../corecomponents/AutopsyOptionsPanel.java | 225 ++++++++++++------ .../autopsy/corecomponents/Bundle.properties | 4 +- 3 files changed, 182 insertions(+), 87 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form index 789438198a..7f127ddcfe 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form @@ -91,13 +91,18 @@ - - + + - - - + + + + + + + + @@ -108,14 +113,16 @@ - + + + + - @@ -127,9 +134,6 @@ - - - @@ -193,6 +197,16 @@ + + + + + + + + + + @@ -441,7 +455,7 @@ - + @@ -456,7 +470,7 @@ - + @@ -517,7 +531,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java index 55b1d1cd8c..305d4b6cbe 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java @@ -34,6 +34,8 @@ import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JOptionPane; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.coreutils.Logger; @@ -58,19 +60,26 @@ import org.sleuthkit.autopsy.report.ReportBranding; "AutopsyOptionsPanel.maxMemoryLabel.text=Maximum JVM Memory:", "AutopsyOptionsPanel.maxMemoryUnitsLabel.text=GB", "AutopsyOptionsPanel.runtimePanel.border.title=Runtime", - "AutopsyOptionsPanel.invalidReasonLabel.not64BitInstall.text=JVM memory settings only enabled for 64 bit version", - "AutopsyOptionsPanel.invalidReasonLabel.noValueEntered.text=No value entered", - "AutopsyOptionsPanel.invalidReasonLabel.invalidCharacters.text=Invalid characters, value must be a positive integer", + "AutopsyOptionsPanel.memFieldValidationLabel.not64BitInstall.text=JVM memory settings only enabled for 64 bit version", + "AutopsyOptionsPanel.memFieldValidationLabel.noValueEntered.text=No value entered", + "AutopsyOptionsPanel.memFieldValidationLabel.invalidCharacters.text=Invalid characters, value must be a positive integer", "# {0} - minimumMemory", - "AutopsyOptionsPanel.invalidReasonLabel.underMinMemory.text=Value must be at least {0}GB", + "AutopsyOptionsPanel.memFieldValidationLabel.underMinMemory.text=Value must be at least {0}GB", "# {0} - systemMemory", - "AutopsyOptionsPanel.invalidReasonLabel.overMaxMemory.text=Value must be less than the total system memory of {0}GB", - "AutopsyOptionsPanel.invalidReasonLabel.developerMode.text=Memory settings are not available while running in developer mode"}) + "AutopsyOptionsPanel.memFieldValidationLabel.overMaxMemory.text=Value must be less than the total system memory of {0}GB", + "AutopsyOptionsPanel.memFieldValidationLabel.developerMode.text=Memory settings are not available while running in developer mode", + "AutopsyOptionsPanel.defaultLogoRB.text=Use default", + "AutopsyOptionsPanel.specifyLogoRB.text=Specify a logo", + "AutopsyOptionsPanel.browseLogosButton.text=Browse", + "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.invalidPath.text=Path is not valid.", + "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.pathNotSet.text=Agency logo path must be set." +}) final class AutopsyOptionsPanel extends javax.swing.JPanel { private static final long serialVersionUID = 1L; - private final JFileChooser fc; + private final JFileChooser fileChooser; + private final TextFieldListener textFieldListener; private static final String ETC_FOLDER_NAME = "etc"; private static final String CONFIG_FILE_EXTENSION = ".conf"; private static final long ONE_BILLION = 1000000000L; //used to roughly convert system memory from bytes to gigabytes @@ -84,11 +93,11 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { */ AutopsyOptionsPanel() { initComponents(); - fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.FILES_ONLY); - fc.setMultiSelectionEnabled(false); - fc.setAcceptAllFileFilterUsed(false); - fc.setFileFilter(new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR)); + fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + fileChooser.setMultiSelectionEnabled(false); + fileChooser.setAcceptAllFileFilterUsed(false); + fileChooser.setFileFilter(new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR)); if (!PlatformUtil.is64BitJVM() || Version.getBuildType() == Version.Type.DEVELOPMENT) { //32 bit JVM has a max heap size of 1.4 gb to 4 gb depending on OS //So disabling the setting of heap size when the JVM is not 64 bit @@ -97,6 +106,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { memField.setEnabled(false); } systemMemoryTotal.setText(Long.toString(getSystemMemoryInGB())); + + textFieldListener = new TextFieldListener(); + agencyLogoPathField.getDocument().addDocumentListener(textFieldListener); } /** @@ -310,14 +322,15 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { } memField.setText(initialMemValue); } - isMemFieldValid(); //ensure the error message is up to date + + valid(); //ensure the error messages are up to date } /** * Update the agency logo with the image specified by the path. - * + * * @param path The path to the image. - * + * * @throws IOException Thrown when there is a problem reading the file. */ private void updateAgencyLogo(String path) throws IOException { @@ -367,12 +380,111 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { } /** - * Checks to see if the memory field value is valid. - * + * Checks to see if the memory and agency logo field inputs are valid. + * * @return True if valid; false otherwise. */ boolean valid() { - return isMemFieldValid(); + boolean valid = true; + + if (!isAgencyLogoPathValid()) { + valid = false; + } + if (!isMemFieldValid()) { + valid = false; + } + + return valid; + } + + /** + * Validates the agency logo path to ensure it is valid. + * + * @return True if the default logo is being used or if the path is valid; + * otherwise false. + */ + boolean isAgencyLogoPathValid() { + boolean valid = true; + + if (defaultLogoRB.isSelected()) { + jLabelInvalidAgencyLogoPath.setText(""); + } else { + String agencyLogoPath = agencyLogoPathField.getText(); + if (agencyLogoPath.isEmpty()) { + jLabelInvalidAgencyLogoPath.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_pathNotSet_text()); + valid = false; + } else { + File file = new File(agencyLogoPathField.getText()); + if (file.exists() && file.isFile()) { + jLabelInvalidAgencyLogoPath.setText(""); + } else { + jLabelInvalidAgencyLogoPath.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_invalidPath_text()); + valid = false; + } + } + } + + return valid; + } + + /** + * Checks that if the mem field is enabled it has a valid value. + * + * @return true if the memfield is valid false if it is not + */ + private boolean isMemFieldValid() { + String memText = memField.getText(); + memFieldValidationLabel.setText(""); + if (!PlatformUtil.is64BitJVM()) { + memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_not64BitInstall_text()); + //the panel should be valid when it is a 32 bit jvm because the memfield will be disabled. + return true; + } + if (Version.getBuildType() == Version.Type.DEVELOPMENT) { + memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_developerMode_text()); + //the panel should be valid when you are running in developer mode because the memfield will be disabled + return true; + } + if (memText.length() == 0) { + memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_noValueEntered_text()); + return false; + } + if (memText.replaceAll("[^\\d]", "").length() != memText.length()) { + memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_invalidCharacters_text()); + return false; + } + int parsedInt = Integer.parseInt(memText); + if (parsedInt < MIN_MEMORY_IN_GB) { + memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_underMinMemory_text(MIN_MEMORY_IN_GB)); + return false; + } + if (parsedInt >= getSystemMemoryInGB()) { + memFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_memFieldValidationLabel_overMaxMemory_text(getSystemMemoryInGB())); + return false; + } + return true; + } + + /** + * Listens for registered text fields that have changed and fires a + * PropertyChangeEvent accordingly. + */ + private class TextFieldListener implements DocumentListener { + + @Override + public void insertUpdate(DocumentEvent e) { + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + } + + @Override + public void removeUpdate(DocumentEvent e) { + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + } + + @Override + public void changedUpdate(DocumentEvent e) { + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + } } /** @@ -394,6 +506,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { agencyLogoPreview = new javax.swing.JLabel(); defaultLogoRB = new javax.swing.JRadioButton(); specifyLogoRB = new javax.swing.JRadioButton(); + jLabelInvalidAgencyLogoPath = new javax.swing.JLabel(); viewPanel = new javax.swing.JPanel(); jLabelSelectFile = new javax.swing.JLabel(); useBestViewerRB = new javax.swing.JRadioButton(); @@ -414,14 +527,13 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { systemMemoryTotal = new javax.swing.JLabel(); restartNecessaryWarning = new javax.swing.JLabel(); memField = new javax.swing.JTextField(); - invalidReasonLabel = new javax.swing.JLabel(); + memFieldValidationLabel = new javax.swing.JLabel(); maxMemoryUnitsLabel1 = new javax.swing.JLabel(); jScrollPane1.setBorder(null); logoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.logoPanel.border.title"))); // NOI18N - agencyLogoPathField.setBackground(new java.awt.Color(255, 255, 255)); agencyLogoPathField.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPathField.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(browseLogosButton, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.browseLogosButton.text")); // NOI18N @@ -454,6 +566,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { } }); + jLabelInvalidAgencyLogoPath.setForeground(new java.awt.Color(255, 0, 0)); + org.openide.awt.Mnemonics.setLocalizedText(jLabelInvalidAgencyLogoPath, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelInvalidAgencyLogoPath.text")); // NOI18N + javax.swing.GroupLayout logoPanelLayout = new javax.swing.GroupLayout(logoPanel); logoPanel.setLayout(logoPanelLayout); logoPanelLayout.setHorizontalGroup( @@ -461,12 +576,15 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(specifyLogoRB) - .addComponent(defaultLogoRB)) + .addComponent(specifyLogoRB, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(defaultLogoRB, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(browseLogosButton) + .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(logoPanelLayout.createSequentialGroup() + .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(browseLogosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabelInvalidAgencyLogoPath)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) @@ -475,13 +593,14 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(logoPanelLayout.createSequentialGroup() .addGap(6, 6, 6) - .addComponent(defaultLogoRB) + .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(defaultLogoRB) + .addComponent(jLabelInvalidAgencyLogoPath)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(specifyLogoRB) .addComponent(agencyLogoPathField) - .addComponent(browseLogosButton)) - .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(browseLogosButton))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, logoPanelLayout.createSequentialGroup() .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) @@ -640,7 +759,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { } }); - invalidReasonLabel.setForeground(new java.awt.Color(255, 0, 0)); + memFieldValidationLabel.setForeground(new java.awt.Color(255, 0, 0)); org.openide.awt.Mnemonics.setLocalizedText(maxMemoryUnitsLabel1, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.maxMemoryUnitsLabel.text")); // NOI18N @@ -664,7 +783,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addGap(18, 18, 18) .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(restartNecessaryWarning, javax.swing.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE) - .addComponent(invalidReasonLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); runtimePanelLayout.setVerticalGroup( @@ -675,7 +794,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(maxMemoryUnitsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(memField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(invalidReasonLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(memFieldValidationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(maxMemoryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(runtimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) @@ -758,9 +877,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { private void browseLogosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLogosButtonActionPerformed String oldLogoPath = agencyLogoPathField.getText(); - int returnState = fc.showOpenDialog(this); + int returnState = fileChooser.showOpenDialog(this); if (returnState == JFileChooser.APPROVE_OPTION) { - String path = fc.getSelectedFile().getPath(); + String path = fileChooser.getSelectedFile().getPath(); try { updateAgencyLogo(path); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); @@ -816,43 +935,6 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_specifyLogoRBActionPerformed - /** - * Checks that if the mem field is enabled it has a valid value. - * - * @return true if the memfield is valid false if it is not - */ - private boolean isMemFieldValid() { - String memText = memField.getText(); - invalidReasonLabel.setText(""); - if (!PlatformUtil.is64BitJVM()) { - invalidReasonLabel.setText(Bundle.AutopsyOptionsPanel_invalidReasonLabel_not64BitInstall_text()); - //the panel should be valid when it is a 32 bit jvm because the memfield will be disabled. - return true; - } - if (Version.getBuildType() == Version.Type.DEVELOPMENT) { - invalidReasonLabel.setText(Bundle.AutopsyOptionsPanel_invalidReasonLabel_developerMode_text()); - //the panel should be valid when you are running in developer mode because the memfield will be disabled - return true; - } - if (memText.length() == 0) { - invalidReasonLabel.setText(Bundle.AutopsyOptionsPanel_invalidReasonLabel_noValueEntered_text()); - return false; - } - if (memText.replaceAll("[^\\d]", "").length() != memText.length()) { - invalidReasonLabel.setText(Bundle.AutopsyOptionsPanel_invalidReasonLabel_invalidCharacters_text()); - return false; - } - int parsedInt = Integer.parseInt(memText); - if (parsedInt < MIN_MEMORY_IN_GB) { - invalidReasonLabel.setText(Bundle.AutopsyOptionsPanel_invalidReasonLabel_underMinMemory_text(MIN_MEMORY_IN_GB)); - return false; - } - if (parsedInt >= getSystemMemoryInGB()) { - invalidReasonLabel.setText(Bundle.AutopsyOptionsPanel_invalidReasonLabel_overMaxMemory_text(getSystemMemoryInGB())); - return false; - } - return true; - } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField agencyLogoPathField; private javax.swing.JLabel agencyLogoPreview; @@ -862,9 +944,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { private javax.swing.JRadioButton defaultLogoRB; private javax.swing.ButtonGroup displayTimesButtonGroup; private javax.swing.ButtonGroup fileSelectionButtonGroup; - private javax.swing.JLabel invalidReasonLabel; private javax.swing.JLabel jLabelHideKnownFiles; private javax.swing.JLabel jLabelHideSlackFiles; + private javax.swing.JLabel jLabelInvalidAgencyLogoPath; private javax.swing.JLabel jLabelSelectFile; private javax.swing.JLabel jLabelTimeDisplay; private javax.swing.JPanel jPanel1; @@ -876,6 +958,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { private javax.swing.JLabel maxMemoryUnitsLabel; private javax.swing.JLabel maxMemoryUnitsLabel1; private javax.swing.JTextField memField; + private javax.swing.JLabel memFieldValidationLabel; private javax.swing.JLabel restartNecessaryWarning; private javax.swing.JPanel runtimePanel; private javax.swing.JRadioButton specifyLogoRB; diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index 78a3853231..1b4074340f 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -192,7 +192,6 @@ AutopsyOptionsPanel.jLabelHideSlackFiles.text=Hide slack files in the: AutopsyOptionsPanel.dataSourcesHideSlackCB.text=Data Sources area (the directory hierarchy) AutopsyOptionsPanel.viewsHideSlackCB.text=Views area AutopsyOptionsPanel.agencyLogoImageLabel.toolTipText= -AutopsyOptionsPanel.browseLogosButton.text=Browse AutopsyOptionsPanel.agencyLogoPathField.text= SortChooserDialog.label=remove SortChooser.addCriteriaButton.text=Add Sort Criteria @@ -200,5 +199,4 @@ DataResultViewerThumbnail.sortButton.text=Sort CriterionChooser.ascendingRadio.text=\u25b2 Ascending\n CriterionChooser.removeButton.text=Remove CriterionChooser.descendingRadio.text=\u25bc Descending -AutopsyOptionsPanel.defaultLogoRB.text=Use default -AutopsyOptionsPanel.specifyLogoRB.text=Specify a logo +AutopsyOptionsPanel.jLabelInvalidAgencyLogoPath.text= From 0e6bbaa60a133aa7d18c58706b1f3775163849aa Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Mon, 11 Dec 2017 00:43:21 -0500 Subject: [PATCH 4/4] Variable renamed for consistency. --- .../corecomponents/AutopsyOptionsPanel.form | 8 ++++---- .../corecomponents/AutopsyOptionsPanel.java | 20 +++++++++---------- .../autopsy/corecomponents/Bundle.properties | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form index 7f127ddcfe..c1fc384c5e 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.form @@ -101,7 +101,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -197,13 +197,13 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java index 305d4b6cbe..a9640f005e 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java @@ -407,18 +407,18 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { boolean valid = true; if (defaultLogoRB.isSelected()) { - jLabelInvalidAgencyLogoPath.setText(""); + agencyLogoPathFieldValidationLabel.setText(""); } else { String agencyLogoPath = agencyLogoPathField.getText(); if (agencyLogoPath.isEmpty()) { - jLabelInvalidAgencyLogoPath.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_pathNotSet_text()); + agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_pathNotSet_text()); valid = false; } else { File file = new File(agencyLogoPathField.getText()); if (file.exists() && file.isFile()) { - jLabelInvalidAgencyLogoPath.setText(""); + agencyLogoPathFieldValidationLabel.setText(""); } else { - jLabelInvalidAgencyLogoPath.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_invalidPath_text()); + agencyLogoPathFieldValidationLabel.setText(Bundle.AutopsyOptionsPanel_agencyLogoPathFieldValidationLabel_invalidPath_text()); valid = false; } } @@ -506,7 +506,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { agencyLogoPreview = new javax.swing.JLabel(); defaultLogoRB = new javax.swing.JRadioButton(); specifyLogoRB = new javax.swing.JRadioButton(); - jLabelInvalidAgencyLogoPath = new javax.swing.JLabel(); + agencyLogoPathFieldValidationLabel = new javax.swing.JLabel(); viewPanel = new javax.swing.JPanel(); jLabelSelectFile = new javax.swing.JLabel(); useBestViewerRB = new javax.swing.JRadioButton(); @@ -566,8 +566,8 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { } }); - jLabelInvalidAgencyLogoPath.setForeground(new java.awt.Color(255, 0, 0)); - org.openide.awt.Mnemonics.setLocalizedText(jLabelInvalidAgencyLogoPath, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabelInvalidAgencyLogoPath.text")); // NOI18N + agencyLogoPathFieldValidationLabel.setForeground(new java.awt.Color(255, 0, 0)); + org.openide.awt.Mnemonics.setLocalizedText(agencyLogoPathFieldValidationLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.text")); // NOI18N javax.swing.GroupLayout logoPanelLayout = new javax.swing.GroupLayout(logoPanel); logoPanel.setLayout(logoPanelLayout); @@ -584,7 +584,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addComponent(agencyLogoPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(browseLogosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jLabelInvalidAgencyLogoPath)) + .addComponent(agencyLogoPathFieldValidationLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(agencyLogoPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) @@ -595,7 +595,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { .addGap(6, 6, 6) .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(defaultLogoRB) - .addComponent(jLabelInvalidAgencyLogoPath)) + .addComponent(agencyLogoPathFieldValidationLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(logoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(specifyLogoRB) @@ -937,6 +937,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField agencyLogoPathField; + private javax.swing.JLabel agencyLogoPathFieldValidationLabel; private javax.swing.JLabel agencyLogoPreview; private javax.swing.JButton browseLogosButton; private javax.swing.JCheckBox dataSourcesHideKnownCB; @@ -946,7 +947,6 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { private javax.swing.ButtonGroup fileSelectionButtonGroup; private javax.swing.JLabel jLabelHideKnownFiles; private javax.swing.JLabel jLabelHideSlackFiles; - private javax.swing.JLabel jLabelInvalidAgencyLogoPath; private javax.swing.JLabel jLabelSelectFile; private javax.swing.JLabel jLabelTimeDisplay; private javax.swing.JPanel jPanel1; diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index 1b4074340f..6e9b722d71 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -199,4 +199,4 @@ DataResultViewerThumbnail.sortButton.text=Sort CriterionChooser.ascendingRadio.text=\u25b2 Ascending\n CriterionChooser.removeButton.text=Remove CriterionChooser.descendingRadio.text=\u25bc Descending -AutopsyOptionsPanel.jLabelInvalidAgencyLogoPath.text= +AutopsyOptionsPanel.agencyLogoPathFieldValidationLabel.text=