19 package org.sleuthkit.autopsy.casemodule;
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;
35 class CaseInformationPanel
extends javax.swing.JPanel {
37 private static final long serialVersionUID = 1L;
38 CasePropertiesPanel propertiesPanel;
44 CaseInformationPanel() {
46 customizeComponents();
50 "CaseInformationPanel.caseDetails.header=Details",
51 "CaseInformationPanel.ingestJobInfo.header=Ingest History",
52 "CaseInformationPanel.editDetailsButton.text=Edit Details",
53 "CaseInformationPanel.editDetailsDialog.title=Edit Case Details"
55 private void customizeComponents() {
57 propertiesPanel =
new CasePropertiesPanel(Case.getOpenCase());
58 }
catch (NoCurrentCaseException ex) {
59 Logger.getLogger(CaseInformationPanel.class.getName()).log(Level.INFO,
"Exception while getting open case.", ex);
61 propertiesPanel.setSize(propertiesPanel.getPreferredSize());
62 this.tabbedPane.addTab(Bundle.CaseInformationPanel_caseDetails_header(), propertiesPanel);
63 this.tabbedPane.addTab(Bundle.CaseInformationPanel_ingestJobInfo_header(),
new IngestJobInfoPanel());
64 this.tabbedPane.addChangeListener(
new ChangeListener() {
66 public void stateChanged(ChangeEvent e) {
67 tabbedPane.getSelectedComponent().setSize(tabbedPane.getSelectedComponent().getPreferredSize());
77 void addCloseButtonAction(ActionListener action) {
78 this.closeButton.addActionListener(action);
86 @SuppressWarnings(
"unchecked")
88 private
void initComponents() {
90 outerDetailsPanel =
new javax.swing.JPanel();
91 tabbedPane =
new javax.swing.JTabbedPane();
92 closeButton =
new javax.swing.JButton();
93 editDetailsButton =
new javax.swing.JButton();
95 tabbedPane.setPreferredSize(
new java.awt.Dimension(420, 200));
97 org.openide.awt.Mnemonics.setLocalizedText(closeButton,
org.openide.util.NbBundle.getMessage(CaseInformationPanel.class,
"CaseInformationPanel.closeButton.text"));
99 org.openide.awt.Mnemonics.setLocalizedText(editDetailsButton,
org.openide.util.NbBundle.getMessage(CaseInformationPanel.class,
"CaseInformationPanel.editDetailsButton.text"));
100 editDetailsButton.addActionListener(
new java.awt.event.ActionListener() {
101 public void actionPerformed(java.awt.event.ActionEvent evt) {
102 editDetailsButtonActionPerformed(evt);
106 javax.swing.GroupLayout outerDetailsPanelLayout =
new javax.swing.GroupLayout(outerDetailsPanel);
107 outerDetailsPanel.setLayout(outerDetailsPanelLayout);
108 outerDetailsPanelLayout.setHorizontalGroup(
109 outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
110 .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 709, Short.MAX_VALUE)
111 .addGroup(outerDetailsPanelLayout.createSequentialGroup()
113 .addComponent(editDetailsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
114 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
115 .addComponent(closeButton)
118 outerDetailsPanelLayout.setVerticalGroup(
119 outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
120 .addGroup(outerDetailsPanelLayout.createSequentialGroup()
121 .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
123 .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
124 .addComponent(closeButton)
125 .addComponent(editDetailsButton))
129 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
130 this.setLayout(layout);
131 layout.setHorizontalGroup(
132 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
133 .addGroup(layout.createSequentialGroup()
135 .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
138 layout.setVerticalGroup(
139 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
140 .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
144 private void editDetailsButtonActionPerformed(java.awt.event.ActionEvent evt) {
145 JDialog editCasePropertiesDialog =
new JDialog(WindowManager.getDefault().getMainWindow(), Bundle.CaseInformationPanel_editDetailsDialog_title(),
true);
146 EditOptionalCasePropertiesPanel editCasePropertiesPanel =
new EditOptionalCasePropertiesPanel();
147 editCasePropertiesPanel.addCancelButtonAction((ActionEvent e) -> {
148 editCasePropertiesDialog.setVisible(
false);
150 editCasePropertiesPanel.addSaveButtonAction((ActionEvent e) -> {
151 editCasePropertiesDialog.setVisible(
false);
152 editCasePropertiesPanel.saveProperties();
153 propertiesPanel.updateCaseInfo();
157 editCasePropertiesDialog.add(editCasePropertiesPanel);
158 editCasePropertiesDialog.setResizable(
true);
159 editCasePropertiesDialog.pack();
160 editCasePropertiesDialog.setLocationRelativeTo(
this);
161 editCasePropertiesDialog.setVisible(
true);
162 editCasePropertiesDialog.toFront();
163 propertiesPanel.updateCaseInfo();
167 private javax.swing.JButton closeButton;
168 private javax.swing.JButton editDetailsButton;
169 private javax.swing.JPanel outerDetailsPanel;
170 private javax.swing.JTabbedPane tabbedPane;