19 package org.sleuthkit.autopsy.report;
21 import org.openide.util.NbBundle;
23 import java.awt.event.MouseEvent;
24 import java.awt.event.MouseListener;
26 import java.io.IOException;
27 import java.util.logging.Level;
37 private static final Color
GREEN =
new Color(50, 205, 50);
38 private static final Color
RED =
new Color(178, 34, 34);
65 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.progress.queuing"));
67 if (null != reportPath) {
70 String linkPath = reportPath;
71 pathLabel.addMouseListener(
new MouseListener() {
74 public void mouseClicked(MouseEvent mouseEvent) {
78 public void mousePressed(MouseEvent mouseEvent) {
82 public void mouseReleased(MouseEvent mouseEvent) {
83 File file =
new File(linkPath);
85 Desktop.getDesktop().open(file);
86 }
catch (IOException ioex) {
87 logger.log(Level.SEVERE,
"Error opening report file", ioex);
88 }
catch (IllegalArgumentException iaEx) {
89 logger.log(Level.SEVERE,
"Error opening report file", iaEx);
91 Desktop.getDesktop().open(file.getParentFile());
92 }
catch (IOException ioEx2) {
93 logger.log(Level.SEVERE,
"Error opening report file parent", ioEx2);
99 public void mouseEntered(MouseEvent e3) {
100 pathLabel.setForeground(Color.DARK_GRAY);
101 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
105 public void mouseExited(MouseEvent e4) {
107 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
111 pathLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.initPathLabel.noFile"));
128 EventQueue.invokeLater(() -> {
129 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.start.progress.text"));
140 EventQueue.invokeLater(() -> {
142 reportProgressBar.setMaximum(max);
152 EventQueue.invokeLater(() -> {
154 reportProgressBar.setValue(reportProgressBar.getValue() + 1);
165 EventQueue.invokeLater(() -> {
167 reportProgressBar.setValue(value);
180 EventQueue.invokeLater(() -> {
182 reportProgressBar.setIndeterminate(indeterminate);
195 EventQueue.invokeLater(() -> {
197 statusMessageLabel.setText(statusMessage);
209 EventQueue.invokeLater(() -> {
212 switch (reportStatus) {
217 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.complete.processLbl.text"));
229 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.complete.processLb2.text"));
267 statusMessageLabel.setText(NbBundle.getMessage(
this.getClass(),
"ReportProgressPanel.cancel.procLbl.text"));
280 if (path.length() > 100) {
281 return path.substring(0, 10 + path.substring(10).indexOf(File.separator) + 1) +
"..."
282 + path.substring((path.length() - 70) + path.substring(path.length() - 70).indexOf(File.separator));
293 @SuppressWarnings(
"unchecked")
303 setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11));
304 setMinimumSize(
new java.awt.Dimension(486, 68));
313 pathLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
320 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
321 this.setLayout(layout);
322 layout.setHorizontalGroup(
323 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
324 .addGroup(layout.createSequentialGroup()
326 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
327 .addComponent(
statusMessageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
328 .addComponent(
reportProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
329 .addGroup(layout.createSequentialGroup()
331 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
333 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
334 .addComponent(
pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 548, Short.MAX_VALUE)))
337 layout.setVerticalGroup(
338 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
339 .addGroup(layout.createSequentialGroup()
341 .addComponent(
reportProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
342 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
343 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
345 .addComponent(
pathLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
347 .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)
static final long serialVersionUID
javax.swing.JLabel pathLabel
void setMaximumProgress(int max)
volatile ReportStatus status
synchronized static Logger getLogger(String name)
void updateStatusLabel(String statusMessage)
String shortenPath(String path)
javax.swing.JProgressBar reportProgressBar
void setProgress(int value)
javax.swing.JLabel statusMessageLabel