19 package org.sleuthkit.autopsy.report;
21 import org.openide.util.NbBundle;
23 import java.awt.event.MouseEvent;
24 import java.awt.event.MouseListener;
25 import java.beans.PropertyChangeListener;
26 import java.beans.PropertyChangeSupport;
28 import java.io.IOException;
29 import java.util.logging.Level;
39 private static final Color
GREEN =
new Color(50, 205, 50);
40 private static final Color
RED =
new Color(178, 34, 34);
41 private final PropertyChangeSupport
pcs =
new PropertyChangeSupport(
this);
68 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.progress.queuing"));
70 if (null != reportPath) {
73 String linkPath = reportPath;
74 pathLabel.addMouseListener(
new MouseListener() {
77 public void mouseClicked(MouseEvent mouseEvent) {
81 public void mousePressed(MouseEvent mouseEvent) {
85 public void mouseReleased(MouseEvent mouseEvent) {
86 File file =
new File(linkPath);
88 Desktop.getDesktop().open(file);
89 }
catch (IOException ioex) {
90 logger.log(Level.SEVERE,
"Error opening report file", ioex);
91 }
catch (IllegalArgumentException iaEx) {
92 logger.log(Level.SEVERE,
"Error opening report file", iaEx);
94 Desktop.getDesktop().open(file.getParentFile());
95 }
catch (IOException ioEx2) {
96 logger.log(Level.SEVERE,
"Error opening report file parent", ioEx2);
102 public void mouseEntered(MouseEvent e3) {
103 pathLabel.setForeground(Color.DARK_GRAY);
104 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
108 public void mouseExited(MouseEvent e4) {
110 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
114 pathLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.initPathLabel.noFile"));
125 this.pcs.addPropertyChangeListener(listener);
135 this.pcs.removePropertyChangeListener(listener);
151 EventQueue.invokeLater(() -> {
152 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.start.progress.text"));
163 EventQueue.invokeLater(() -> {
165 reportProgressBar.setMaximum(max);
175 EventQueue.invokeLater(() -> {
177 reportProgressBar.setValue(reportProgressBar.getValue() + 1);
188 EventQueue.invokeLater(() -> {
190 reportProgressBar.setValue(value);
203 EventQueue.invokeLater(() -> {
205 reportProgressBar.setIndeterminate(indeterminate);
218 EventQueue.invokeLater(() -> {
220 statusMessageLabel.setText(statusMessage);
232 EventQueue.invokeLater(() -> {
235 switch (reportStatus) {
240 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.complete.processLbl.text"));
252 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.complete.processLb2.text"));
290 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.cancel.procLbl.text"));
303 if (path.length() > 100) {
304 return path.substring(0, 10 + path.substring(10).indexOf(File.separator) + 1) +
"..."
305 + path.substring((path.length() - 70) + path.substring(path.length() - 70).indexOf(File.separator));
316 @SuppressWarnings(
"unchecked")
326 setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11));
327 setMinimumSize(
new java.awt.Dimension(486, 68));
336 pathLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
343 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
344 this.setLayout(layout);
345 layout.setHorizontalGroup(
346 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
347 .addGroup(layout.createSequentialGroup()
349 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
350 .addComponent(
statusMessageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
351 .addComponent(
reportProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
352 .addGroup(layout.createSequentialGroup()
354 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
356 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
357 .addComponent(
pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 548, Short.MAX_VALUE)))
360 layout.setVerticalGroup(
361 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
362 .addGroup(layout.createSequentialGroup()
364 .addComponent(
reportProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
365 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
366 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
368 .addComponent(
pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
370 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
ReportProgressPanel(String reportName, String reportPath)
static final Logger logger
void complete(ReportStatus reportStatus)
javax.swing.JLabel reportLabel
javax.swing.JLabel separationLabel
void setIndeterminate(boolean indeterminate)
void removePropertyChangeListener(PropertyChangeListener listener)
static final long serialVersionUID
void addPropertyChangeListener(PropertyChangeListener listener)
javax.swing.JLabel pathLabel
void setMaximumProgress(int max)
synchronized static Logger getLogger(String name)
void updateStatusLabel(String statusMessage)
String shortenPath(String path)
final PropertyChangeSupport pcs
javax.swing.JProgressBar reportProgressBar
void setProgress(int value)
javax.swing.JLabel statusMessageLabel