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;
26 import org.openide.util.NbBundle.Messages;
27 import org.openide.windows.WindowManager;
32 @SuppressWarnings(
"PMD.SingularField")
33 class CaseInformationPanel extends javax.swing.JPanel {
35 private static final long serialVersionUID = 1L;
36 private CaseDetailsPanel caseDetailsPanel;
42 CaseInformationPanel() {
44 customizeComponents();
48 "CaseInformationPanel.caseDetails.header=Details",
49 "CaseInformationPanel.editDetailsButton.text=Edit Details",
50 "CaseInformationPanel.editDetailsDialog.title=Edit Case Details"
52 private void customizeComponents() {
54 caseDetailsPanel =
new CaseDetailsPanel(Case.getCurrentCaseThrows());
55 }
catch (NoCurrentCaseException ex) {
56 Logger.getLogger(CaseInformationPanel.class.getName()).log(Level.INFO,
"Exception while getting open case.", ex);
58 caseDetailsPanel.setSize(caseDetailsPanel.getPreferredSize());
59 this.detailsPanel.add(caseDetailsPanel);
60 this.detailsPanel.setPreferredSize(caseDetailsPanel.getPreferredSize());
68 void addCloseButtonAction(ActionListener action) {
69 this.closeButton.addActionListener(action);
77 @SuppressWarnings(
"unchecked")
79 private
void initComponents() {
81 outerDetailsPanel =
new javax.swing.JPanel();
82 closeButton =
new javax.swing.JButton();
83 editDetailsButton =
new javax.swing.JButton();
84 detailsPanel =
new javax.swing.JPanel();
86 org.openide.awt.Mnemonics.setLocalizedText(closeButton,
org.openide.util.NbBundle.getMessage(CaseInformationPanel.class,
"CaseInformationPanel.closeButton.text"));
88 org.openide.awt.Mnemonics.setLocalizedText(editDetailsButton,
org.openide.util.NbBundle.getMessage(CaseInformationPanel.class,
"CaseInformationPanel.editDetailsButton.text"));
89 editDetailsButton.addActionListener(
new java.awt.event.ActionListener() {
90 public void actionPerformed(java.awt.event.ActionEvent evt) {
91 editDetailsButtonActionPerformed(evt);
95 javax.swing.GroupLayout detailsPanelLayout =
new javax.swing.GroupLayout(detailsPanel);
96 detailsPanel.setLayout(detailsPanelLayout);
97 detailsPanelLayout.setHorizontalGroup(
98 detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
99 .addGap(0, 709, Short.MAX_VALUE)
101 detailsPanelLayout.setVerticalGroup(
102 detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
103 .addGap(0, 219, Short.MAX_VALUE)
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 .addGroup(outerDetailsPanelLayout.createSequentialGroup()
112 .addComponent(editDetailsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
113 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 502, Short.MAX_VALUE)
114 .addComponent(closeButton)
116 .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
117 .addComponent(detailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
119 outerDetailsPanelLayout.setVerticalGroup(
120 outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
121 .addGroup(outerDetailsPanelLayout.createSequentialGroup()
122 .addContainerGap(228, Short.MAX_VALUE)
123 .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
124 .addComponent(closeButton)
125 .addComponent(editDetailsButton))
127 .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
128 .addGroup(outerDetailsPanelLayout.createSequentialGroup()
129 .addComponent(detailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
130 .addGap(0, 43, Short.MAX_VALUE)))
133 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
134 this.setLayout(layout);
135 layout.setHorizontalGroup(
136 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
137 .addGroup(layout.createSequentialGroup()
139 .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
142 layout.setVerticalGroup(
143 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
144 .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
148 private void editDetailsButtonActionPerformed(java.awt.event.ActionEvent evt) {
149 JDialog editCasePropertiesDialog =
new JDialog(WindowManager.getDefault().getMainWindow(), Bundle.CaseInformationPanel_editDetailsDialog_title(),
true);
150 EditOptionalCasePropertiesPanel editCasePropertiesPanel =
new EditOptionalCasePropertiesPanel();
151 editCasePropertiesPanel.addCancelButtonAction((ActionEvent e) -> {
152 editCasePropertiesDialog.setVisible(
false);
154 editCasePropertiesPanel.addSaveButtonAction((ActionEvent e) -> {
155 editCasePropertiesDialog.setVisible(
false);
156 editCasePropertiesPanel.saveProperties();
157 caseDetailsPanel.updateCaseInfo();
161 editCasePropertiesDialog.add(editCasePropertiesPanel);
162 editCasePropertiesDialog.setResizable(
true);
163 editCasePropertiesDialog.pack();
164 editCasePropertiesDialog.setLocationRelativeTo(
this);
166 editCasePropertiesDialog.setAlwaysOnTop(
true);
167 editCasePropertiesDialog.setVisible(
true);
168 editCasePropertiesDialog.toFront();
169 caseDetailsPanel.updateCaseInfo();
173 private javax.swing.JButton closeButton;
174 private javax.swing.JPanel detailsPanel;
175 private javax.swing.JButton editDetailsButton;
176 private javax.swing.JPanel outerDetailsPanel;