Autopsy  4.11.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.addActionListener(new java.awt.event.ActionListener() {
123  public void actionPerformed(java.awt.event.ActionEvent evt) {
124  compressCheckboxActionPerformed(evt);
125  }
126  });
127 
128  errorLabel.setForeground(new java.awt.Color(255, 0, 0));
129  org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(ReportWizardPortableCaseOptionsVisualPanel.class, "ReportWizardPortableCaseOptionsVisualPanel.errorLabel.text")); // NOI18N
130 
131  javax.swing.GroupLayout listPanelLayout = new javax.swing.GroupLayout(listPanel);
132  listPanel.setLayout(listPanelLayout);
133  listPanelLayout.setHorizontalGroup(
134  listPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
135  .addGap(0, 0, Short.MAX_VALUE)
136  );
137  listPanelLayout.setVerticalGroup(
138  listPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
139  .addGap(0, 217, Short.MAX_VALUE)
140  );
141 
142  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
143  jPanel1.setLayout(jPanel1Layout);
144  jPanel1Layout.setHorizontalGroup(
145  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
146  .addGroup(jPanel1Layout.createSequentialGroup()
147  .addContainerGap()
148  .addComponent(compressCheckbox)
149  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
150  .addComponent(chunkSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
151  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
152  .addComponent(errorLabel)
153  .addContainerGap(97, Short.MAX_VALUE))
154  .addComponent(listPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
155  );
156  jPanel1Layout.setVerticalGroup(
157  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
158  .addGroup(jPanel1Layout.createSequentialGroup()
159  .addComponent(listPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
160  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
161  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
162  .addComponent(compressCheckbox)
163  .addComponent(chunkSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
164  .addComponent(errorLabel))
165  .addContainerGap())
166  );
167 
168  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
169  this.setLayout(layout);
170  layout.setHorizontalGroup(
171  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
172  .addGap(0, 463, Short.MAX_VALUE)
173  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
174  .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
175  );
176  layout.setVerticalGroup(
177  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
178  .addGap(0, 259, Short.MAX_VALUE)
179  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
180  .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
181  );
182  }// </editor-fold>//GEN-END:initComponents
183 
184  private void chunkSizeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chunkSizeComboBoxActionPerformed
185  updateCompression();
186  }//GEN-LAST:event_chunkSizeComboBoxActionPerformed
187 
188  private void compressCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_compressCheckboxActionPerformed
189  chunkSizeComboBox.setEnabled(compressCheckbox.isSelected());
190  updateCompression();
191  }//GEN-LAST:event_compressCheckboxActionPerformed
192 
193 
194  // Variables declaration - do not modify//GEN-BEGIN:variables
195  private javax.swing.JComboBox<ChunkSize> chunkSizeComboBox;
196  private javax.swing.JCheckBox compressCheckbox;
197  private javax.swing.JLabel errorLabel;
198  private javax.swing.JPanel jPanel1;
199  private javax.swing.JPanel listPanel;
200  // End of variables declaration//GEN-END:variables
201 }

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