20 package org.sleuthkit.autopsy.casemodule;
22 import java.awt.Dimension;
23 import java.awt.Toolkit;
24 import java.awt.event.ActionEvent;
25 import java.awt.event.ActionListener;
27 import java.util.logging.Level;
28 import javax.swing.Action;
29 import javax.swing.JDialog;
30 import javax.swing.JFrame;
31 import org.openide.util.HelpCtx;
32 import org.openide.util.NbBundle;
33 import org.openide.util.actions.CallableSystemAction;
43 final class CasePropertiesAction
extends CallableSystemAction {
45 private static JDialog popUpWindow;
50 CasePropertiesAction() {
51 putValue(Action.NAME, NbBundle.getMessage(CasePropertiesAction.class,
"CTL_CasePropertiesAction"));
52 this.setEnabled(
false);
60 public void performAction() {
63 String title = NbBundle.getMessage(this.getClass(),
"CasePropertiesAction.window.title");
64 final JFrame frame =
new JFrame(title);
65 popUpWindow =
new JDialog(frame, title,
true);
69 Case currentCase = Case.getCurrentCase();
70 String crDate = currentCase.getCreatedDate();
71 String caseDir = currentCase.getCaseDirectory();
74 Map<Long, String> imgPaths = Case.getImagePaths(currentCase.getSleuthkitCase());
77 CasePropertiesForm cpf =
new CasePropertiesForm(currentCase, crDate, caseDir, imgPaths);
80 cpf.setOKButtonActionListener(
new ActionListener() {
83 public void actionPerformed(ActionEvent e) {
84 popUpWindow.dispose();
91 popUpWindow.setResizable(
false);
94 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
95 double w = popUpWindow.getSize().getWidth();
96 double h = popUpWindow.getSize().getHeight();
97 popUpWindow.setLocation((
int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2));
99 popUpWindow.setVisible(
true);
100 }
catch (Exception ex) {
101 Logger.getLogger(CasePropertiesAction.class.getName()).log(Level.WARNING,
"Error displaying Case Properties window.", ex);
110 public String getName() {
111 return NbBundle.getMessage(CasePropertiesAction.class,
"CTL_CasePropertiesAction");
119 public HelpCtx getHelpCtx() {
120 return HelpCtx.DEFAULT_HELP;
123 static void closeCasePropertiesWindow() {
124 popUpWindow.dispose();