Autopsy  4.5.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-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.Dimension;
22 import java.awt.Toolkit;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import javax.swing.JDialog;
26 import javax.swing.event.ChangeEvent;
27 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  propertiesPanel = new CasePropertiesPanel(Case.getCurrentCase());
57  propertiesPanel.setSize(propertiesPanel.getPreferredSize());
58  this.tabbedPane.addTab(Bundle.CaseInformationPanel_caseDetails_header(), propertiesPanel);
59  this.tabbedPane.addTab(Bundle.CaseInformationPanel_ingestJobInfo_header(), new IngestJobInfoPanel());
60  this.tabbedPane.addChangeListener(new ChangeListener() {
61  @Override
62  public void stateChanged(ChangeEvent e) {
63  tabbedPane.getSelectedComponent().setSize(tabbedPane.getSelectedComponent().getPreferredSize());
64  if (tabbedPane.getSelectedComponent() instanceof CasePropertiesPanel) {
65  editDetailsButton.setVisible(true);
66  } else {
67  editDetailsButton.setVisible(false);
68  }
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, 88, 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 
120  outerDetailsPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {closeButton, editDetailsButton});
121 
122  outerDetailsPanelLayout.setVerticalGroup(
123  outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
124  .addGroup(outerDetailsPanelLayout.createSequentialGroup()
125  .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
126  .addGap(0, 0, 0)
127  .addGroup(outerDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
128  .addComponent(closeButton)
129  .addComponent(editDetailsButton))
130  .addContainerGap())
131  );
132 
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()
138  .addGap(0, 0, 0)
139  .addComponent(outerDetailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
140  .addGap(0, 0, 0))
141  );
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)
145  );
146  }// </editor-fold>//GEN-END:initComponents
147 
148  private void editDetailsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editDetailsButtonActionPerformed
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);
153  });
154  editCasePropertiesPanel.addSaveButtonAction((ActionEvent e) -> {
155  editCasePropertiesDialog.setVisible(false);
156  editCasePropertiesPanel.saveProperties();
157  propertiesPanel.updateCaseInfo();
158 
159  });
160 
161  editCasePropertiesDialog.add(editCasePropertiesPanel);
162  editCasePropertiesDialog.setResizable(true);
163  editCasePropertiesDialog.pack();
164 
165  Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
166  double w = editCasePropertiesDialog.getSize().getWidth();
167  double h = editCasePropertiesDialog.getSize().getHeight();
168  editCasePropertiesDialog.setLocation((int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2));
169  editCasePropertiesDialog.setVisible(true);
170  editCasePropertiesDialog.toFront();
171  propertiesPanel.updateCaseInfo();
172  }//GEN-LAST:event_editDetailsButtonActionPerformed
173 
174  // Variables declaration - do not modify//GEN-BEGIN:variables
175  private javax.swing.JButton closeButton;
176  private javax.swing.JButton editDetailsButton;
177  private javax.swing.JPanel outerDetailsPanel;
178  private javax.swing.JTabbedPane tabbedPane;
179  // End of variables declaration//GEN-END:variables
180 }

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