Autopsy  4.6.0
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-2017 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 class CaseInformationPanel extends javax.swing.JPanel {
36 
37  private static final long serialVersionUID = 1L;
38  CasePropertiesPanel propertiesPanel;
39 
44  CaseInformationPanel() {
45  initComponents();
46  customizeComponents();
47  }
48 
49  @Messages({
50  "CaseInformationPanel.caseDetails.header=Details",
51  "CaseInformationPanel.ingestJobInfo.header=Ingest History",
52  "CaseInformationPanel.editDetailsButton.text=Edit Details",
53  "CaseInformationPanel.editDetailsDialog.title=Edit Case Details"
54  })
55  private void customizeComponents() {
56  try {
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);
60  }
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() {
65  @Override
66  public void stateChanged(ChangeEvent e) {
67  tabbedPane.getSelectedComponent().setSize(tabbedPane.getSelectedComponent().getPreferredSize());
68  }
69  });
70  }
71 
77  void addCloseButtonAction(ActionListener action) {
78  this.closeButton.addActionListener(action);
79  }
80 
86  @SuppressWarnings("unchecked")
87  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
88  private void initComponents() {
89 
90  outerDetailsPanel = new javax.swing.JPanel();
91  tabbedPane = new javax.swing.JTabbedPane();
92  closeButton = new javax.swing.JButton();
93  editDetailsButton = new javax.swing.JButton();
94 
95  tabbedPane.setPreferredSize(new java.awt.Dimension(420, 200));
96 
97  org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(CaseInformationPanel.class, "CaseInformationPanel.closeButton.text")); // NOI18N
98 
99  org.openide.awt.Mnemonics.setLocalizedText(editDetailsButton, org.openide.util.NbBundle.getMessage(CaseInformationPanel.class, "CaseInformationPanel.editDetailsButton.text")); // NOI18N
100  editDetailsButton.addActionListener(new java.awt.event.ActionListener() {
101  public void actionPerformed(java.awt.event.ActionEvent evt) {
102  editDetailsButtonActionPerformed(evt);
103  }
104  });
105 
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()
112  .addContainerGap()
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)
116  .addContainerGap())
117  );
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)
122  .addGap(0, 0, 0)
123  .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
124  .addComponent(closeButton)
125  .addComponent(editDetailsButton))
126  .addContainerGap())
127  );
128 
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()
134  .addGap(0, 0, 0)
135  .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
136  .addGap(0, 0, 0))
137  );
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)
141  );
142  }// </editor-fold>//GEN-END:initComponents
143 
144  private void editDetailsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editDetailsButtonActionPerformed
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);
149  });
150  editCasePropertiesPanel.addSaveButtonAction((ActionEvent e) -> {
151  editCasePropertiesDialog.setVisible(false);
152  editCasePropertiesPanel.saveProperties();
153  propertiesPanel.updateCaseInfo();
154 
155  });
156 
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();
164  }//GEN-LAST:event_editDetailsButtonActionPerformed
165 
166  // Variables declaration - do not modify//GEN-BEGIN:variables
167  private javax.swing.JButton closeButton;
168  private javax.swing.JButton editDetailsButton;
169  private javax.swing.JPanel outerDetailsPanel;
170  private javax.swing.JTabbedPane tabbedPane;
171  // End of variables declaration//GEN-END:variables
172 }

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.