Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
CaseInformationPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2016 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.casemodule;
20 
21 import java.awt.event.ActionListener;
22 import java.util.Map;
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;
28 
33 class CaseInformationPanel extends javax.swing.JPanel {
34 
35  private static final Logger logger = Logger.getLogger(CaseInformationPanel.class.getName());
36 
40  CaseInformationPanel() {
41  initComponents();
42  customizeComponents();
43  }
44 
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() {
50  try {
51  Case currentCase = Case.getCurrentCase();
52  String crDate = currentCase.getCreatedDate();
53  String caseDir = currentCase.getCaseDirectory();
54 
55  // put the image paths information into hashmap
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());
63  });
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);
67  }
68  }
69 
70  void addCloseButtonAction(ActionListener action) {
71  this.closeButton.addActionListener(action);
72  }
78  @SuppressWarnings("unchecked")
79  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
80  private void initComponents() {
81 
82  jPanel1 = new javax.swing.JPanel();
83  tabbedPane = new javax.swing.JTabbedPane();
84  closeButton = new javax.swing.JButton();
85 
86  tabbedPane.setPreferredSize(new java.awt.Dimension(420, 200));
87 
88  org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(CaseInformationPanel.class, "CaseInformationPanel.closeButton.text")); // NOI18N
89  closeButton.addActionListener(new java.awt.event.ActionListener() {
90  public void actionPerformed(java.awt.event.ActionEvent evt) {
91  closeButtonActionPerformed(evt);
92  }
93  });
94 
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)
103  .addGap(5, 5, 5))
104  );
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)
111  .addGap(5, 5, 5))
112  );
113 
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()
119  .addGap(0, 0, 0)
120  .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
121  .addGap(0, 0, 0))
122  );
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)
126  );
127  }// </editor-fold>//GEN-END:initComponents
128 
129  private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
130  // TODO add your handling code here:
131  }//GEN-LAST:event_closeButtonActionPerformed
132 
133 
134  // Variables declaration - do not modify//GEN-BEGIN:variables
135  private javax.swing.JButton closeButton;
136  private javax.swing.JPanel jPanel1;
137  private javax.swing.JTabbedPane tabbedPane;
138  // End of variables declaration//GEN-END:variables
139 }

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