19 package org.sleuthkit.autopsy.casemodule;
21 import java.beans.PropertyChangeListener;
22 import java.util.ArrayList;
23 import java.util.List;
24 import javax.swing.BoxLayout;
25 import javax.swing.JComboBox;
26 import javax.swing.JPanel;
27 import org.openide.util.NbBundle;
28 import org.openide.util.NbBundle.Messages;
35 "LogicalFilesDspPanel.subTypeComboBox.localFilesOption.text=Local files and folders",
36 "LogicalFilesDspPanel.subTypeComboBox.l01FileOption.text=Logical evidence file (L01)"
38 @SuppressWarnings(
"PMD.SingularField")
39 final class LogicalFilesDspPanel extends JPanel {
41 private static final long serialVersionUID = 1L;
43 private final LocalFilesPanel localFilesPanel =
new LocalFilesPanel();
44 private final LogicalEvidenceFilePanel l01panel = LogicalEvidenceFilePanel.createInstance();
45 private static LogicalFilesDspPanel instance;
50 private LogicalFilesDspPanel() {
52 dspSubtypePanel.setLayout(
new BoxLayout(dspSubtypePanel, BoxLayout.Y_AXIS));
53 dspSubtypePanel.add(l01panel);
54 dspSubtypePanel.add(localFilesPanel);
55 l01panel.setVisible(
false);
59 public void addPropertyChangeListener(
final PropertyChangeListener listener) {
60 super.addPropertyChangeListener(listener);
61 localFilesPanel.addPropertyChangeListener(listener);
62 l01panel.addPropertyChangeListener(listener);
66 public void removePropertyChangeListener(
final PropertyChangeListener listener) {
67 super.removePropertyChangeListener(listener);
68 localFilesPanel.removePropertyChangeListener(listener);
69 l01panel.removePropertyChangeListener(listener);
72 static LogicalFilesDspPanel getDefault() {
73 synchronized (LogicalFilesDspPanel.class) {
74 if (instance == null) {
75 instance =
new LogicalFilesDspPanel();
81 String getContentType() {
82 return NbBundle.getMessage(this.getClass(),
"LocalFilesPanel.contentType.text");
86 dspSubtypeComboBox.setSelectedIndex(0);
87 localFilesPanel.setVisible(
true);
88 l01panel.setVisible(
false);
89 localFilesPanel.reset();
91 dspSubtypePanel.repaint();
95 public String toString() {
96 return NbBundle.getMessage(this.getClass(),
"LocalFilesDSProcessor.toString.text");
104 @SuppressWarnings(
"unchecked")
106 private
void initComponents() {
108 dspSubtypePanel =
new javax.swing.JPanel();
109 dspSubtypeComboBox =
new javax.swing.JComboBox<>();
111 dspSubtypePanel.setPreferredSize(
new java.awt.Dimension(467, 160));
113 javax.swing.GroupLayout dspSubtypePanelLayout =
new javax.swing.GroupLayout(dspSubtypePanel);
114 dspSubtypePanel.setLayout(dspSubtypePanelLayout);
115 dspSubtypePanelLayout.setHorizontalGroup(
116 dspSubtypePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
117 .addGap(0, 524, Short.MAX_VALUE)
119 dspSubtypePanelLayout.setVerticalGroup(
120 dspSubtypePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
121 .addGap(0, 334, Short.MAX_VALUE)
124 dspSubtypeComboBox.setModel(
new javax.swing.DefaultComboBoxModel<>(
new String[] {Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text(), Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text()}));
125 dspSubtypeComboBox.setMinimumSize(
new java.awt.Dimension(379, 20));
126 dspSubtypeComboBox.setPreferredSize(
new java.awt.Dimension(379, 20));
127 dspSubtypeComboBox.addActionListener(
new java.awt.event.ActionListener() {
128 public void actionPerformed(java.awt.event.ActionEvent evt) {
129 dspSubtypeComboBoxActionPerformed(evt);
133 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
134 this.setLayout(layout);
135 layout.setHorizontalGroup(
136 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
137 .addGroup(layout.createSequentialGroup()
139 .addComponent(dspSubtypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
140 .addComponent(dspSubtypePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 524, javax.swing.GroupLayout.PREFERRED_SIZE)
142 layout.setVerticalGroup(
143 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
144 .addGroup(layout.createSequentialGroup()
145 .addComponent(dspSubtypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
146 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
147 .addComponent(dspSubtypePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
148 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
152 private void dspSubtypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
153 if (evt.getSource() instanceof JComboBox<?>) {
154 final String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
155 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
156 localFilesPanel.setVisible(
true);
157 l01panel.setVisible(
false);
158 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
159 localFilesPanel.setVisible(
false);
160 l01panel.setVisible(
true);
162 firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(),
false,
true);
171 boolean validatePanel() {
174 final String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
175 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
176 return localFilesPanel.validatePanel();
177 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
178 return l01panel.validatePanel();
184 private javax.swing.JComboBox<String> dspSubtypeComboBox;
185 private javax.swing.JPanel dspSubtypePanel;
193 boolean subTypeIsLogicalEvidencePanel() {
194 final String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
195 return selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text());
204 List<String> getContentPaths() {
205 String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
206 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
207 return localFilesPanel.getContentPaths();
208 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
209 return l01panel.getContentPaths();
211 return new ArrayList<>();
221 String getFileSetName() {
222 String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
223 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
224 return localFilesPanel.getFileSetName();
225 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
226 return l01panel.getFileSetName();
237 Boolean getCreateTimestamp() {
238 return localFilesPanel.getCreateTimestamps();
246 Boolean getModifiedTimestamp() {
247 return localFilesPanel.getModifiedTimestamps();
255 Boolean getAccessTimestamp() {
256 return localFilesPanel.getAccessTimestamps();