19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Dimension;
22 import java.awt.Toolkit;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
26 import java.util.logging.Level;
27 import javax.swing.Action;
28 import javax.swing.JDialog;
29 import javax.swing.JFrame;
30 import org.openide.util.HelpCtx;
31 import org.openide.util.NbBundle;
32 import org.openide.util.actions.CallableSystemAction;
42 final class CasePropertiesAction
extends CallableSystemAction {
44 private static JDialog popUpWindow;
49 CasePropertiesAction() {
50 putValue(Action.NAME, NbBundle.getMessage(CasePropertiesAction.class,
"CTL_CasePropertiesAction"));
51 this.setEnabled(
false);
59 public void performAction() {
62 String title = NbBundle.getMessage(this.getClass(),
"CasePropertiesAction.window.title");
63 final JFrame frame =
new JFrame(title);
64 popUpWindow =
new JDialog(frame, title,
true);
67 Case currentCase = Case.getCurrentCase();
68 String crDate = currentCase.getCreatedDate();
69 String caseDir = currentCase.getCaseDirectory();
72 Map<Long, String> imgPaths = Case.getImagePaths(currentCase.getSleuthkitCase());
75 CasePropertiesForm cpf =
new CasePropertiesForm(currentCase, crDate, caseDir, imgPaths);
78 cpf.setOKButtonActionListener(
new ActionListener() {
81 public void actionPerformed(ActionEvent e) {
82 popUpWindow.dispose();
89 popUpWindow.setResizable(
false);
92 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
93 double w = popUpWindow.getSize().getWidth();
94 double h = popUpWindow.getSize().getHeight();
95 popUpWindow.setLocation((
int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2));
97 popUpWindow.setVisible(
true);
98 }
catch (Exception ex) {
99 Logger.getLogger(CasePropertiesAction.class.getName()).log(Level.WARNING,
"Error displaying Case Properties window.", ex);
109 public String getName() {
110 return NbBundle.getMessage(CasePropertiesAction.class,
"CTL_CasePropertiesAction");
119 public HelpCtx getHelpCtx() {
120 return HelpCtx.DEFAULT_HELP;
123 static void closeCasePropertiesWindow() {
124 popUpWindow.dispose();