Autopsy  4.11.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ConfigureLogicalImager.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2019 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.logicalimager.configuration;
20 
21 import java.awt.Component;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
24 import java.text.MessageFormat;
25 import java.util.ArrayList;
26 import java.util.List;
27 import javax.swing.JComponent;
28 import org.openide.DialogDisplayer;
29 import org.openide.WizardDescriptor;
30 import org.openide.awt.ActionID;
31 import org.openide.awt.ActionReference;
32 import org.openide.awt.ActionRegistration;
33 import org.openide.util.NbBundle;
34 import org.openide.util.NbBundle.Messages;
35 
40 @ActionID(
41  category = "Tools",
42  id = "org.sleuthkit.autopsy.configurelogicalimager.ConfigureLogicalImager"
43 )
44 @ActionRegistration(
45  displayName = "#CTL_ConfigureLogicalImager"
46 )
47 @ActionReference(path = "Menu/Tools", position = 2000, separatorBefore = 1999)
48 @Messages("CTL_ConfigureLogicalImager=Configure Logical Imager")
49 public final class ConfigureLogicalImager implements ActionListener {
50 
51  @NbBundle.Messages({
52  "ConfigureLogicalImager.title=Configure Logical Imager"
53  })
54  @Override
55  public void actionPerformed(ActionEvent e) {
56  List<WizardDescriptor.Panel<WizardDescriptor>> panels = new ArrayList<>();
57  panels.add(new ConfigWizardPanel1());
58  panels.add(new ConfigWizardPanel2());
59  String[] steps = new String[panels.size()];
60  for (int i = 0; i < panels.size(); i++) {
61  Component c = panels.get(i).getComponent();
62  // Default step name to component name of panel.
63  steps[i] = c.getName();
64  if (c instanceof JComponent) { // assume Swing components
65  JComponent jc = (JComponent) c;
66  jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
67  jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
68  jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
69  jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
70  jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
71  }
72  }
73  WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator<>(panels));
74  // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
75  wiz.setTitleFormat(new MessageFormat("{0}")); // NON-NLS
76  wiz.setTitle(Bundle.ConfigureLogicalImager_title());
77  if ((DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) &&
78  (panels.get(1) instanceof ConfigWizardPanel2)) {
79  ConfigWizardPanel2 panel = (ConfigWizardPanel2) panels.get(1);
80  panel.saveConfigFile();
81  }
82  }
83 }

Copyright © 2012-2018 Basis Technology. Generated on: Fri Jun 21 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.