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;
32 "LogicalFilesDspPanel.subTypeComboBox.localFilesOption.text=Local files and folders",
33 "LogicalFilesDspPanel.subTypeComboBox.l01FileOption.text=Logical evidence file (L01)"
38 final class LogicalFilesDspPanel extends JPanel {
40 private static final long serialVersionUID = 1L;
42 private final LocalFilesPanel localFilesPanel =
new LocalFilesPanel();
43 private final LogicalEvidenceFilePanel l01panel = LogicalEvidenceFilePanel.createInstance();
44 private static LogicalFilesDspPanel instance;
49 private LogicalFilesDspPanel() {
51 dspSubtypePanel.setLayout(
new BoxLayout(dspSubtypePanel, BoxLayout.Y_AXIS));
52 dspSubtypePanel.add(l01panel);
53 dspSubtypePanel.add(localFilesPanel);
54 l01panel.setVisible(
false);
58 public void addPropertyChangeListener(
final PropertyChangeListener listener) {
59 super.addPropertyChangeListener(listener);
60 localFilesPanel.addPropertyChangeListener(listener);
61 l01panel.addPropertyChangeListener(listener);
65 public void removePropertyChangeListener(
final PropertyChangeListener listener) {
66 super.removePropertyChangeListener(listener);
67 localFilesPanel.removePropertyChangeListener(listener);
68 l01panel.removePropertyChangeListener(listener);
71 static LogicalFilesDspPanel getDefault() {
72 synchronized (LogicalFilesDspPanel.class) {
73 if (instance == null) {
74 instance =
new LogicalFilesDspPanel();
80 String getContentType() {
81 return NbBundle.getMessage(this.getClass(),
"LocalFilesPanel.contentType.text");
85 dspSubtypeComboBox.setSelectedIndex(0);
86 localFilesPanel.setVisible(
true);
87 l01panel.setVisible(
false);
88 localFilesPanel.reset();
90 dspSubtypePanel.repaint();
94 public String toString() {
95 return NbBundle.getMessage(this.getClass(),
"LocalFilesDSProcessor.toString.text");
103 @SuppressWarnings(
"unchecked")
105 private
void initComponents() {
107 dspSubtypePanel =
new javax.swing.JPanel();
108 dspSubtypeComboBox =
new javax.swing.JComboBox<>();
110 dspSubtypePanel.setPreferredSize(
new java.awt.Dimension(467, 160));
112 javax.swing.GroupLayout dspSubtypePanelLayout =
new javax.swing.GroupLayout(dspSubtypePanel);
113 dspSubtypePanel.setLayout(dspSubtypePanelLayout);
114 dspSubtypePanelLayout.setHorizontalGroup(
115 dspSubtypePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116 .addGap(0, 466, Short.MAX_VALUE)
118 dspSubtypePanelLayout.setVerticalGroup(
119 dspSubtypePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
120 .addGap(0, 160, Short.MAX_VALUE)
123 dspSubtypeComboBox.setModel(
new javax.swing.DefaultComboBoxModel<>(
new String[] {Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text(), Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text()}));
124 dspSubtypeComboBox.setMinimumSize(
new java.awt.Dimension(379, 20));
125 dspSubtypeComboBox.setPreferredSize(
new java.awt.Dimension(379, 20));
126 dspSubtypeComboBox.addActionListener(
new java.awt.event.ActionListener() {
127 public void actionPerformed(java.awt.event.ActionEvent evt) {
128 dspSubtypeComboBoxActionPerformed(evt);
132 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
133 this.setLayout(layout);
134 layout.setHorizontalGroup(
135 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
136 .addGroup(layout.createSequentialGroup()
137 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
138 .addGroup(layout.createSequentialGroup()
140 .addComponent(dspSubtypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
141 .addComponent(dspSubtypePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 466, javax.swing.GroupLayout.PREFERRED_SIZE))
142 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
144 layout.setVerticalGroup(
145 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
146 .addGroup(layout.createSequentialGroup()
147 .addComponent(dspSubtypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
148 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
149 .addComponent(dspSubtypePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
154 private void dspSubtypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
155 if (evt.getSource() instanceof JComboBox<?>) {
156 final String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
157 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
158 localFilesPanel.setVisible(
true);
159 l01panel.setVisible(
false);
160 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
161 localFilesPanel.setVisible(
false);
162 l01panel.setVisible(
true);
164 firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(),
false,
true);
173 boolean validatePanel() {
176 final String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
177 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
178 return localFilesPanel.validatePanel();
179 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
180 return l01panel.validatePanel();
186 private javax.swing.JComboBox<String> dspSubtypeComboBox;
187 private javax.swing.JPanel dspSubtypePanel;
195 boolean subTypeIsLogicalEvidencePanel() {
196 final String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
197 return selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text());
206 List<String> getContentPaths() {
207 String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
208 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
209 return localFilesPanel.getContentPaths();
210 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
211 return l01panel.getContentPaths();
213 return new ArrayList<>();
223 String getFileSetName() {
224 String selectedSubType = dspSubtypeComboBox.getSelectedItem().toString();
225 if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_localFilesOption_text())) {
226 return localFilesPanel.getFileSetName();
227 }
else if (selectedSubType.equals(Bundle.LogicalFilesDspPanel_subTypeComboBox_l01FileOption_text())) {
228 return l01panel.getFileSetName();