19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.event.ActionListener;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import javax.swing.JOptionPane;
26 import javax.swing.event.ChangeEvent;
27 import org.openide.util.NbBundle.Messages;
33 class CaseInformationPanel
extends javax.swing.JPanel {
35 private static final Logger logger = Logger.getLogger(CaseInformationPanel.class.getName());
40 CaseInformationPanel() {
42 customizeComponents();
45 @Messages({
"CaseInformationPanel.caseDetails.header=Case Details",
46 "CaseInformationPanel.ingestJobInfo.header=Ingest History",
47 "CaseInformationPanel.loadMetadataFail.message=Failed to load case metadata.",
48 "CaseInformationPanel.loadMetadataFail.title=Metadata load failure",})
49 private void customizeComponents() {
51 Case currentCase = Case.getCurrentCase();
52 String crDate = currentCase.getCreatedDate();
53 String caseDir = currentCase.getCaseDirectory();
56 Map<Long, String> imgPaths = Case.getImagePaths(currentCase.getSleuthkitCase());
57 CasePropertiesForm cpf =
new CasePropertiesForm(currentCase, crDate, caseDir, imgPaths);
58 cpf.setSize(cpf.getPreferredSize());
59 this.tabbedPane.addTab(Bundle.CaseInformationPanel_caseDetails_header(), cpf);
60 this.tabbedPane.addTab(Bundle.CaseInformationPanel_ingestJobInfo_header(),
new IngestJobInfoPanel());
61 this.tabbedPane.addChangeListener((ChangeEvent e) -> {
62 tabbedPane.getSelectedComponent().setSize(tabbedPane.getSelectedComponent().getPreferredSize());
64 }
catch (CaseMetadata.CaseMetadataException ex) {
65 logger.log(Level.SEVERE,
"Failed to load case metadata.", ex);
66 JOptionPane.showMessageDialog(null, Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE);
70 void addCloseButtonAction(ActionListener action) {
71 this.closeButton.addActionListener(action);
78 @SuppressWarnings(
"unchecked")
80 private
void initComponents() {
82 jPanel1 =
new javax.swing.JPanel();
83 tabbedPane =
new javax.swing.JTabbedPane();
84 closeButton =
new javax.swing.JButton();
86 tabbedPane.setPreferredSize(
new java.awt.Dimension(420, 200));
88 org.openide.awt.Mnemonics.setLocalizedText(closeButton,
org.openide.util.NbBundle.getMessage(CaseInformationPanel.class,
"CaseInformationPanel.closeButton.text"));
89 closeButton.addActionListener(
new java.awt.event.ActionListener() {
90 public void actionPerformed(java.awt.event.ActionEvent evt) {
91 closeButtonActionPerformed(evt);
95 javax.swing.GroupLayout jPanel1Layout =
new javax.swing.GroupLayout(jPanel1);
96 jPanel1.setLayout(jPanel1Layout);
97 jPanel1Layout.setHorizontalGroup(
98 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
99 .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 709, Short.MAX_VALUE)
100 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
101 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
102 .addComponent(closeButton)
105 jPanel1Layout.setVerticalGroup(
106 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
107 .addGroup(jPanel1Layout.createSequentialGroup()
108 .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
109 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
110 .addComponent(closeButton)
114 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
115 this.setLayout(layout);
116 layout.setHorizontalGroup(
117 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
118 .addGroup(layout.createSequentialGroup()
120 .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
123 layout.setVerticalGroup(
124 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
125 .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
129 private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {
135 private javax.swing.JButton closeButton;
136 private javax.swing.JPanel jPanel1;
137 private javax.swing.JTabbedPane tabbedPane;