Autopsy  4.9.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-2018 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.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.util.logging.Level;
24 import javax.swing.JDialog;
25 import javax.swing.event.ChangeEvent;
26 import javax.swing.event.ChangeListener;
28 import org.openide.util.NbBundle.Messages;
29 import org.openide.windows.WindowManager;
30 
35 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
36 class CaseInformationPanel extends javax.swing.JPanel {
37 
38  private static final long serialVersionUID = 1L;
39  CasePropertiesPanel propertiesPanel;
40 
45  CaseInformationPanel() {
46  initComponents();
47  customizeComponents();
48  }
49 
50  @Messages({
51  "CaseInformationPanel.caseDetails.header=Details",
52  "CaseInformationPanel.ingestJobInfo.header=Ingest History",
53  "CaseInformationPanel.editDetailsButton.text=Edit Details",
54  "CaseInformationPanel.editDetailsDialog.title=Edit Case Details"
55  })
56  private void customizeComponents() {
57  try {
58  propertiesPanel = new CasePropertiesPanel(Case.getCurrentCaseThrows());
59  } catch (NoCurrentCaseException ex) {
60  Logger.getLogger(CaseInformationPanel.class.getName()).log(Level.INFO, "Exception while getting open case.", ex);
61  }
62  propertiesPanel.setSize(propertiesPanel.getPreferredSize());
63  this.tabbedPane.addTab(Bundle.CaseInformationPanel_caseDetails_header(), propertiesPanel);
64  this.tabbedPane.addTab(Bundle.CaseInformationPanel_ingestJobInfo_header(), new IngestJobInfoPanel());
65  this.tabbedPane.addChangeListener(new ChangeListener() {
66  @Override
67  public void stateChanged(ChangeEvent e) {
68  tabbedPane.getSelectedComponent().setSize(tabbedPane.getSelectedComponent().getPreferredSize());
69  }
70  });
71  }
72 
78  void addCloseButtonAction(ActionListener action) {
79  this.closeButton.addActionListener(action);
80  }
81 
87  @SuppressWarnings("unchecked")
88  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
89  private void initComponents() {
90 
91  outerDetailsPanel = new javax.swing.JPanel();
92  tabbedPane = new javax.swing.JTabbedPane();
93  closeButton = new javax.swing.JButton();
94  editDetailsButton = new javax.swing.JButton();
95 
96  tabbedPane.setPreferredSize(new java.awt.Dimension(420, 200));
97 
98  org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(CaseInformationPanel.class, "CaseInformationPanel.closeButton.text")); // NOI18N
99 
100  org.openide.awt.Mnemonics.setLocalizedText(editDetailsButton, org.openide.util.NbBundle.getMessage(CaseInformationPanel.class, "CaseInformationPanel.editDetailsButton.text")); // NOI18N
101  editDetailsButton.addActionListener(new java.awt.event.ActionListener() {
102  public void actionPerformed(java.awt.event.ActionEvent evt) {
103  editDetailsButtonActionPerformed(evt);
104  }
105  });
106 
107  javax.swing.GroupLayout outerDetailsPanelLayout = new javax.swing.GroupLayout(outerDetailsPanel);
108  outerDetailsPanel.setLayout(outerDetailsPanelLayout);
109  outerDetailsPanelLayout.setHorizontalGroup(
110  outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
111  .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 709, Short.MAX_VALUE)
112  .addGroup(outerDetailsPanelLayout.createSequentialGroup()
113  .addContainerGap()
114  .addComponent(editDetailsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
115  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
116  .addComponent(closeButton)
117  .addContainerGap())
118  );
119  outerDetailsPanelLayout.setVerticalGroup(
120  outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
121  .addGroup(outerDetailsPanelLayout.createSequentialGroup()
122  .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
123  .addGap(0, 0, 0)
124  .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
125  .addComponent(closeButton)
126  .addComponent(editDetailsButton))
127  .addContainerGap())
128  );
129 
130  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
131  this.setLayout(layout);
132  layout.setHorizontalGroup(
133  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
134  .addGroup(layout.createSequentialGroup()
135  .addGap(0, 0, 0)
136  .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
137  .addGap(0, 0, 0))
138  );
139  layout.setVerticalGroup(
140  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
141  .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
142  );
143  }// </editor-fold>//GEN-END:initComponents
144 
145  private void editDetailsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editDetailsButtonActionPerformed
146  JDialog editCasePropertiesDialog = new JDialog(WindowManager.getDefault().getMainWindow(), Bundle.CaseInformationPanel_editDetailsDialog_title(), true);
147  EditOptionalCasePropertiesPanel editCasePropertiesPanel = new EditOptionalCasePropertiesPanel();
148  editCasePropertiesPanel.addCancelButtonAction((ActionEvent e) -> {
149  editCasePropertiesDialog.setVisible(false);
150  });
151  editCasePropertiesPanel.addSaveButtonAction((ActionEvent e) -> {
152  editCasePropertiesDialog.setVisible(false);
153  editCasePropertiesPanel.saveProperties();
154  propertiesPanel.updateCaseInfo();
155 
156  });
157 
158  editCasePropertiesDialog.add(editCasePropertiesPanel);
159  editCasePropertiesDialog.setResizable(true);
160  editCasePropertiesDialog.pack();
161  editCasePropertiesDialog.setLocationRelativeTo(this);
162  editCasePropertiesDialog.setVisible(true);
163  editCasePropertiesDialog.toFront();
164  propertiesPanel.updateCaseInfo();
165  }//GEN-LAST:event_editDetailsButtonActionPerformed
166 
167  // Variables declaration - do not modify//GEN-BEGIN:variables
168  private javax.swing.JButton closeButton;
169  private javax.swing.JButton editDetailsButton;
170  private javax.swing.JPanel outerDetailsPanel;
171  private javax.swing.JTabbedPane tabbedPane;
172  // End of variables declaration//GEN-END:variables
173 }

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