Autopsy  4.19.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ExcelExportDialog.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2021 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.datasourcesummary.ui;
20 
21 import java.awt.Cursor;
22 import java.awt.Desktop;
23 import java.awt.event.MouseAdapter;
24 import java.awt.event.MouseEvent;
25 import java.io.File;
26 import java.io.IOException;
27 import java.util.logging.Level;
28 import javax.swing.SwingUtilities;
29 import org.openide.util.NbBundle.Messages;
31 
35 @Messages({
36  "ExcelExportDialog_title=Data Source Summary Exported"
37 })
38 public class ExcelExportDialog extends javax.swing.JDialog {
39 
40  private static final Logger logger = Logger.getLogger(ExcelExportDialog.class.getName());
41 
45  public ExcelExportDialog(java.awt.Frame parent, File filePath) {
46  super(parent, true);
47 
48  initComponents();
49  setTitle(Bundle.ExcelExportDialog_title());
50 
51  this.linkText.setText(filePath.getAbsolutePath());
52  this.linkText.addMouseListener(new MouseAdapter() {
53  @Override
54  public void mouseClicked(MouseEvent e) {
55  SwingUtilities.invokeLater(() -> {
56  try {
57  Desktop.getDesktop().open(filePath);
58  } catch (IOException ex) {
59  logger.log(Level.WARNING, "Unable to open: " + filePath.getAbsolutePath(), ex);
60  }
61  });
62  }
63 
64  });
65  this.linkText.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
66  }
67 
73  @SuppressWarnings("unchecked")
74  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
75  private void initComponents() {
76 
77  javax.swing.JLabel titleLabel = new javax.swing.JLabel();
78  javax.swing.JButton okButton = new javax.swing.JButton();
79  javax.swing.JScrollPane linkTextScrollPane = new javax.swing.JScrollPane();
80  linkText = new javax.swing.JTextArea();
81 
82  setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
83 
84  org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(ExcelExportDialog.class, "ExcelExportDialog.titleLabel.text")); // NOI18N
85 
86  org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(ExcelExportDialog.class, "ExcelExportDialog.okButton.text")); // NOI18N
87  okButton.addActionListener(new java.awt.event.ActionListener() {
88  public void actionPerformed(java.awt.event.ActionEvent evt) {
89  okButtonActionPerformed(evt);
90  }
91  });
92 
93  linkText.setEditable(false);
94  linkText.setBackground(null);
95  linkText.setColumns(20);
96  linkText.setForeground(java.awt.Color.BLUE);
97  linkText.setLineWrap(true);
98  linkText.setRows(1);
99  linkText.setWrapStyleWord(true);
100  linkText.setBorder(null);
101  linkText.setOpaque(false);
102  linkTextScrollPane.setViewportView(linkText);
103 
104  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
105  getContentPane().setLayout(layout);
106  layout.setHorizontalGroup(
107  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
108  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
109  .addContainerGap()
110  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
111  .addComponent(linkTextScrollPane)
112  .addGroup(layout.createSequentialGroup()
113  .addGap(0, 0, Short.MAX_VALUE)
114  .addComponent(okButton))
115  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
116  .addComponent(titleLabel)
117  .addGap(0, 116, Short.MAX_VALUE)))
118  .addContainerGap())
119  );
120  layout.setVerticalGroup(
121  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122  .addGroup(layout.createSequentialGroup()
123  .addContainerGap()
124  .addComponent(titleLabel)
125  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
126  .addComponent(linkTextScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
127  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
128  .addComponent(okButton)
129  .addContainerGap())
130  );
131 
132  pack();
133  }// </editor-fold>//GEN-END:initComponents
134 
135  private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
136  dispose();
137  }//GEN-LAST:event_okButtonActionPerformed
138 
139 
140  // Variables declaration - do not modify//GEN-BEGIN:variables
141  private javax.swing.JTextArea linkText;
142  // End of variables declaration//GEN-END:variables
143 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2021 Basis Technology. Generated on: Fri Aug 6 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.