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 @SuppressWarnings(
"PMD.SingularField")
36 class CaseInformationPanel extends javax.swing.JPanel {
38 private static final long serialVersionUID = 1L;
39 CasePropertiesPanel propertiesPanel;
45 CaseInformationPanel() {
47 customizeComponents();
51 "CaseInformationPanel.caseDetails.header=Details",
52 "CaseInformationPanel.ingestJobInfo.header=Ingest History",
53 "CaseInformationPanel.editDetailsButton.text=Edit Details",
54 "CaseInformationPanel.editDetailsDialog.title=Edit Case Details"
56 private void customizeComponents() {
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);
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() {
67 public void stateChanged(ChangeEvent e) {
68 tabbedPane.getSelectedComponent().setSize(tabbedPane.getSelectedComponent().getPreferredSize());
78 void addCloseButtonAction(ActionListener action) {
79 this.closeButton.addActionListener(action);
87 @SuppressWarnings(
"unchecked")
89 private
void initComponents() {
91 outerDetailsPanel =
new javax.swing.JPanel();
92 tabbedPane =
new javax.swing.JTabbedPane();
93 closeButton =
new javax.swing.JButton();
94 editDetailsButton =
new javax.swing.JButton();
96 tabbedPane.setPreferredSize(
new java.awt.Dimension(420, 200));
98 org.openide.awt.Mnemonics.setLocalizedText(closeButton,
org.openide.util.NbBundle.getMessage(CaseInformationPanel.class,
"CaseInformationPanel.closeButton.text"));
100 org.openide.awt.Mnemonics.setLocalizedText(editDetailsButton,
org.openide.util.NbBundle.getMessage(CaseInformationPanel.class,
"CaseInformationPanel.editDetailsButton.text"));
101 editDetailsButton.addActionListener(
new java.awt.event.ActionListener() {
102 public void actionPerformed(java.awt.event.ActionEvent evt) {
103 editDetailsButtonActionPerformed(evt);
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()
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)
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)
124 .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
125 .addComponent(closeButton)
126 .addComponent(editDetailsButton))
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()
136 .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
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)
145 private void editDetailsButtonActionPerformed(java.awt.event.ActionEvent evt) {
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);
151 editCasePropertiesPanel.addSaveButtonAction((ActionEvent e) -> {
152 editCasePropertiesDialog.setVisible(
false);
153 editCasePropertiesPanel.saveProperties();
154 propertiesPanel.updateCaseInfo();
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();
168 private javax.swing.JButton closeButton;
169 private javax.swing.JButton editDetailsButton;
170 private javax.swing.JPanel outerDetailsPanel;
171 private javax.swing.JTabbedPane tabbedPane;