Autopsy  4.12.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ReportWizardPortableCaseOptionsVisualPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.report;
20 
21 import java.awt.GridLayout;
22 import org.openide.util.NbBundle;
26 
30 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
31 class ReportWizardPortableCaseOptionsVisualPanel extends javax.swing.JPanel {
32 
33  private final ReportWizardPortableCaseOptionsPanel wizPanel;
34  private final PortableCaseOptions options = new PortableCaseOptions();
35 
39  ReportWizardPortableCaseOptionsVisualPanel(ReportWizardPortableCaseOptionsPanel wizPanel) {
40  this.wizPanel = wizPanel;
41  initComponents();
42  customizeComponents();
43  }
44 
45  private void customizeComponents() {
46 
47  if ( ! PlatformUtil.isWindowsOS()) {
48  errorLabel.setVisible(true);
49  compressCheckbox.setEnabled(false);
50  } else {
51  errorLabel.setVisible(false);
52  }
53 
54  for (ChunkSize chunkSize:ChunkSize.values()) {
55  chunkSizeComboBox.addItem(chunkSize);
56  }
57  chunkSizeComboBox.setSelectedItem(ChunkSize.NONE);
58  chunkSizeComboBox.setEnabled(false);
59  options.updateCompression(false, ChunkSize.NONE);
60 
61  listPanel.setLayout(new GridLayout(1,2));
62  listPanel.add(new PortableCaseTagsListPanel(wizPanel, options));
63  listPanel.add(new PortableCaseInterestingItemsListPanel(wizPanel, options));
64  }
65 
66  @NbBundle.Messages({
67  "ReportWizardPortableCaseOptionsVisualPanel.getName.title=Choose Portable Case settings",
68  })
69  @Override
70  public String getName() {
71  return Bundle.ReportWizardPortableCaseOptionsVisualPanel_getName_title();
72  }
73 
79  private ChunkSize getChunkSize() {
80  return (ChunkSize) chunkSizeComboBox.getSelectedItem();
81  }
82 
86  private void updateCompression() {
87  options.updateCompression(compressCheckbox.isSelected(), getChunkSize());
88  wizPanel.setFinish(options.isValid());
89  }
90 
96  PortableCaseOptions getPortableCaseReportOptions() {
97  return options;
98  }
99 
105  @SuppressWarnings("unchecked")
106  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
107  private void initComponents() {
108 
109  jPanel1 = new javax.swing.JPanel();
110  chunkSizeComboBox = new javax.swing.JComboBox<>();
111  compressCheckbox = new javax.swing.JCheckBox();
112  errorLabel = new javax.swing.JLabel();
113  listPanel = new javax.swing.JPanel();
114 
115  chunkSizeComboBox.addActionListener(new java.awt.event.ActionListener() {
116  public void actionPerformed(java.awt.event.ActionEvent evt) {
117  chunkSizeComboBoxActionPerformed(evt);
118  }
119  });
120 
121  org.openide.awt.Mnemonics.setLocalizedText(compressCheckbox, org.openide.util.NbBundle.getMessage(ReportWizardPortableCaseOptionsVisualPanel.class, "ReportWizardPortableCaseOptionsVisualPanel.compressCheckbox.text")); // NOI18N
122  compressCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(ReportWizardPortableCaseOptionsVisualPanel.class, "ReportWizardPortableCaseOptionsVisualPanel.compressCheckbox.toolTipText")); // NOI18N
123  compressCheckbox.addActionListener(new java.awt.event.ActionListener() {
124  public void actionPerformed(java.awt.event.ActionEvent evt) {
125  compressCheckboxActionPerformed(evt);
126  }
127  });
128 
129  errorLabel.setForeground(new java.awt.Color(255, 0, 0));
130  org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(ReportWizardPortableCaseOptionsVisualPanel.class, "ReportWizardPortableCaseOptionsVisualPanel.errorLabel.text")); // NOI18N
131 
132  javax.swing.GroupLayout listPanelLayout = new javax.swing.GroupLayout(listPanel);
133  listPanel.setLayout(listPanelLayout);
134  listPanelLayout.setHorizontalGroup(
135  listPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
136  .addGap(0, 0, Short.MAX_VALUE)
137  );
138  listPanelLayout.setVerticalGroup(
139  listPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
140  .addGap(0, 217, Short.MAX_VALUE)
141  );
142 
143  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
144  jPanel1.setLayout(jPanel1Layout);
145  jPanel1Layout.setHorizontalGroup(
146  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
147  .addGroup(jPanel1Layout.createSequentialGroup()
148  .addContainerGap()
149  .addComponent(compressCheckbox)
150  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
151  .addComponent(chunkSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)
152  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
153  .addComponent(errorLabel)
154  .addContainerGap(41, Short.MAX_VALUE))
155  .addComponent(listPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
156  );
157  jPanel1Layout.setVerticalGroup(
158  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
159  .addGroup(jPanel1Layout.createSequentialGroup()
160  .addComponent(listPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
161  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
162  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
163  .addComponent(compressCheckbox)
164  .addComponent(chunkSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
165  .addComponent(errorLabel))
166  .addContainerGap())
167  );
168 
169  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
170  this.setLayout(layout);
171  layout.setHorizontalGroup(
172  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
173  .addGap(0, 463, Short.MAX_VALUE)
174  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
175  .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
176  );
177  layout.setVerticalGroup(
178  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
179  .addGap(0, 259, Short.MAX_VALUE)
180  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
181  .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
182  );
183  }// </editor-fold>//GEN-END:initComponents
184 
185  private void chunkSizeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chunkSizeComboBoxActionPerformed
186  updateCompression();
187  }//GEN-LAST:event_chunkSizeComboBoxActionPerformed
188 
189  private void compressCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_compressCheckboxActionPerformed
190  chunkSizeComboBox.setEnabled(compressCheckbox.isSelected());
191  updateCompression();
192  }//GEN-LAST:event_compressCheckboxActionPerformed
193 
194 
195  // Variables declaration - do not modify//GEN-BEGIN:variables
196  private javax.swing.JComboBox<ChunkSize> chunkSizeComboBox;
197  private javax.swing.JCheckBox compressCheckbox;
198  private javax.swing.JLabel errorLabel;
199  private javax.swing.JPanel jPanel1;
200  private javax.swing.JPanel listPanel;
201  // End of variables declaration//GEN-END:variables
202 }

Copyright © 2012-2018 Basis Technology. Generated on: Wed Sep 18 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.