From 0174a2fa6aab4456b93f03e6ff5f79cfede4761f Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 3 Apr 2017 16:23:03 -0400 Subject: [PATCH] 2512 resizable scrollable profile creation panel --- .../autopsy/ingest/ProfilePanel.form | 183 ++++++++++-------- .../autopsy/ingest/ProfilePanel.java | 72 ++++--- .../autopsy/ingest/ProfileSettingsPanel.java | 21 +- 3 files changed, 166 insertions(+), 110 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form index 59aa34e062..18d2c49f40 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.form @@ -1,11 +1,6 @@
- - - - - @@ -21,92 +16,122 @@ - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java index 2ec0756aad..68781faf0d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfilePanel.java @@ -96,14 +96,18 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel { // //GEN-BEGIN:initComponents private void initComponents() { + jScrollPane1 = new javax.swing.JScrollPane(); + jPanel2 = new javax.swing.JPanel(); + profileNameField = new javax.swing.JTextField(); + profileDescLabel = new javax.swing.JLabel(); profileDescPane = new javax.swing.JScrollPane(); profileDescArea = new javax.swing.JTextArea(); profileNameLabel = new javax.swing.JLabel(); - profileDescLabel = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); - profileNameField = new javax.swing.JTextField(); - setMaximumSize(new java.awt.Dimension(625, 450)); + jScrollPane1.setPreferredSize(new java.awt.Dimension(650, 323)); + + org.openide.awt.Mnemonics.setLocalizedText(profileDescLabel, org.openide.util.NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.profileDescLabel.text")); // NOI18N profileDescArea.setColumns(20); profileDescArea.setLineWrap(true); @@ -111,48 +115,58 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel { profileDescArea.setWrapStyleWord(true); profileDescArea.setMinimumSize(new java.awt.Dimension(104, 22)); profileDescArea.setName(""); // NOI18N - profileDescPane.setViewportView(profileDescArea); + profileDescArea.setPreferredSize(new java.awt.Dimension(164, 30)); org.openide.awt.Mnemonics.setLocalizedText(profileNameLabel, org.openide.util.NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.profileNameLabel.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(profileDescLabel, org.openide.util.NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.profileDescLabel.text")); // NOI18N - jPanel1.setMinimumSize(new java.awt.Dimension(625, 450)); jPanel1.setPreferredSize(new java.awt.Dimension(625, 450)); jPanel1.setLayout(new java.awt.BorderLayout()); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() .addGap(6, 6, 6) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(profileDescLabel) - .addComponent(profileNameLabel)) - .addContainerGap(480, Short.MAX_VALUE)) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(profileDescPane, javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(profileNameField)) - .addGap(6, 6, 6)) + .addComponent(profileNameLabel))) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 637, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(6, 6, 6) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(profileNameField) + .addComponent(profileDescPane)) + .addGap(5, 5, 5)) ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(1, 1, 1) + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(0, 0, 0) .addComponent(profileNameLabel) .addGap(0, 0, 0) .addComponent(profileNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(4, 4, 4) .addComponent(profileDescLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) - .addComponent(profileDescPane, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE) + .addComponent(profileDescPane, javax.swing.GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE) .addGap(0, 0, 0) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(1, 1, 1)) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE) + .addGap(0, 0, 0)) + ); + + jScrollPane1.setViewportView(jPanel2); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 639, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 591, Short.MAX_VALUE) ); }// //GEN-END:initComponents @Override @@ -166,6 +180,8 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel { } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea profileDescArea; private javax.swing.JLabel profileDescLabel; private javax.swing.JScrollPane profileDescPane; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index d3e4cadb84..adb6c06987 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -19,14 +19,19 @@ package org.sleuthkit.autopsy.ingest; import java.awt.Cursor; +import java.awt.event.ActionEvent; +import java.util.ArrayList; import java.util.Map; import java.util.TreeMap; +import java.util.logging.Level; +import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultListModel; import javax.swing.JOptionPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.ingest.IngestProfiles.IngestProfile; @@ -54,7 +59,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op private Map profiles; private ProfilePanel panel; private boolean canBeEnabled; //if something can be enabled ingest is not running - + private int option = JOptionPane.CANCEL_OPTION; /** * Creates new form ProfileOptionsPanel */ @@ -368,6 +373,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op */ private void doProfileDialog(IngestProfile selectedProfile) { // Create a files set defintion panel. + final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); //start wait cursor for ingest job settings construction if (selectedProfile != null) { @@ -377,12 +383,21 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op // Creating a new set definition. panel = new ProfilePanel(); } + dialog.addApplyButtonListener( + (ActionEvent e) -> { + panel.store(); + option = JOptionPane.OK_OPTION; + dialog.close(); + } + ); + + //end wait Cursor for ingest job settings construction setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); // Do a dialog box with the profilePanel till the user enters a name or chooses cancel - int option = JOptionPane.OK_OPTION; do { - option = JOptionPane.showConfirmDialog(null, panel, Bundle.ProfileSettingsPanel_title(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); + option = JOptionPane.CANCEL_OPTION; + dialog.display(panel); } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition()); if (option == JOptionPane.OK_OPTION) {