Autopsy  4.16.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ReportFileTextConfigurationPanel.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.modules.file;
20 
24 class ReportFileTextConfigurationPanel extends javax.swing.JPanel {
25 
26  private static final long serialVersionUID = 1L;
27  private static final String TAB_DELIMITER = "\t"; //NON-NLS
28  private static final String COMMA_DELIMITER = ","; //NON-NLS
29 
33  ReportFileTextConfigurationPanel() {
34  initComponents();
35  }
36 
42  void setConfiguration(FileReportModuleSettings settings) {
43  if (settings.getReportDelimiter() == FileReportModuleSettings.ReportDelimiter.COMA_DELIMITED) {
44  commaDelimitedButton.setSelected(true);
45  } else {
46  // default to tab since it was previously the only option
47  tabDelimitedButton.setSelected(true);
48  }
49  }
50 
56  FileReportModuleSettings getConfiguration() {
57  if (commaDelimitedButton.isSelected()) {
58  return new FileReportModuleSettings(FileReportModuleSettings.ReportDelimiter.COMA_DELIMITED);
59  } else {
60  return new FileReportModuleSettings(FileReportModuleSettings.ReportDelimiter.TAB_DELIMITED);
61  }
62  }
63 
69  String getDelimiter() {
70  if (commaDelimitedButton.isSelected()) {
71  return COMMA_DELIMITER;
72  } else {
73  //if the comma button is not selected default to tab since it was previously the only option
74  return TAB_DELIMITER;
75  }
76  }
77 
83  @SuppressWarnings("unchecked")
84  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
85  private void initComponents() {
86 
87  delimiterGroup = new javax.swing.ButtonGroup();
88  tabDelimitedButton = new javax.swing.JRadioButton();
89  commaDelimitedButton = new javax.swing.JRadioButton();
90 
91  delimiterGroup.add(tabDelimitedButton);
92  tabDelimitedButton.setSelected(true);
93  org.openide.awt.Mnemonics.setLocalizedText(tabDelimitedButton, org.openide.util.NbBundle.getMessage(ReportFileTextConfigurationPanel.class, "ReportFileTextConfigurationPanel.tabDelimitedButton.text")); // NOI18N
94 
95  delimiterGroup.add(commaDelimitedButton);
96  org.openide.awt.Mnemonics.setLocalizedText(commaDelimitedButton, org.openide.util.NbBundle.getMessage(ReportFileTextConfigurationPanel.class, "ReportFileTextConfigurationPanel.commaDelimitedButton.text")); // NOI18N
97 
98  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
99  this.setLayout(layout);
100  layout.setHorizontalGroup(
101  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
102  .addGroup(layout.createSequentialGroup()
103  .addContainerGap()
104  .addComponent(tabDelimitedButton, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
105  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
106  .addComponent(commaDelimitedButton, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
107  .addContainerGap(166, Short.MAX_VALUE))
108  );
109  layout.setVerticalGroup(
110  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
111  .addGroup(layout.createSequentialGroup()
112  .addContainerGap()
113  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
114  .addComponent(tabDelimitedButton)
115  .addComponent(commaDelimitedButton))
116  .addContainerGap(78, Short.MAX_VALUE))
117  );
118  }// </editor-fold>//GEN-END:initComponents
119 
120 
121  // Variables declaration - do not modify//GEN-BEGIN:variables
122  private javax.swing.JRadioButton commaDelimitedButton;
123  private javax.swing.ButtonGroup delimiterGroup;
124  private javax.swing.JRadioButton tabDelimitedButton;
125  // End of variables declaration//GEN-END:variables
126 }

Copyright © 2012-2020 Basis Technology. Generated on: Tue Sep 22 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.