mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-16 17:57:43 +00:00
677 lines
30 KiB
Java
Executable File
677 lines
30 KiB
Java
Executable File
/*
|
|
* Autopsy Forensic Browser
|
|
*
|
|
* Copyright 2011-2017 Basis Technology Corp.
|
|
* Contact: carrier <at> sleuthkit <dot> org
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package org.sleuthkit.autopsy.experimental.autoingest;
|
|
|
|
import java.awt.Cursor;
|
|
import java.awt.Desktop;
|
|
import java.awt.EventQueue;
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.WindowAdapter;
|
|
import java.awt.event.WindowEvent;
|
|
import java.io.IOException;
|
|
import java.nio.file.Path;
|
|
import java.nio.file.Paths;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.logging.Level;
|
|
import javax.swing.JDialog;
|
|
import javax.swing.JOptionPane;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.SwingWorker;
|
|
import javax.swing.event.ListSelectionEvent;
|
|
import javax.swing.table.DefaultTableModel;
|
|
import javax.swing.table.TableColumn;
|
|
import org.openide.util.NbBundle;
|
|
import org.openide.util.lookup.ServiceProvider;
|
|
import org.openide.windows.WindowManager;
|
|
import org.sleuthkit.autopsy.casemodule.CaseActionCancelledException;
|
|
import org.sleuthkit.autopsy.casemodule.CaseMetadata;
|
|
import org.sleuthkit.autopsy.casemodule.StartupWindowProvider;
|
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
|
import org.sleuthkit.autopsy.casemodule.AutoIngestCasePanelInterface;
|
|
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
|
|
import org.sleuthkit.autopsy.experimental.configuration.StartupWindow;
|
|
|
|
/**
|
|
* A panel that allows a user to open cases created by auto ingest.
|
|
*/
|
|
@ServiceProvider(service = AutoIngestCasePanelInterface.class)
|
|
public final class AutoIngestCasePanel extends JPanel implements AutoIngestCasePanelInterface {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
private static final Logger logger = Logger.getLogger(AutoIngestCasePanel.class.getName());
|
|
private static final AutoIngestCase.LastAccessedDateDescendingComparator reverseDateModifiedComparator = new AutoIngestCase.LastAccessedDateDescendingComparator();
|
|
private static final int CASE_COL_MIN_WIDTH = 30;
|
|
private static final int CASE_COL_MAX_WIDTH = 2000;
|
|
private static final int CASE_COL_PREFERRED_WIDTH = 300;
|
|
private static final int TIME_COL_MIN_WIDTH = 40;
|
|
private static final int TIME_COL_MAX_WIDTH = 250;
|
|
private static final int TIME_COL_PREFERRED_WIDTH = 160;
|
|
private static final int STATUS_COL_MIN_WIDTH = 55;
|
|
private static final int STATUS_COL_MAX_WIDTH = 250;
|
|
private static final int STATUS_COL_PREFERRED_WIDTH = 60;
|
|
private static final int MILLIS_TO_WAIT_BEFORE_STARTING = 500;
|
|
private static final int MILLIS_TO_WAIT_BETWEEN_UPDATES = 300000;
|
|
private ScheduledThreadPoolExecutor casesTableRefreshExecutor;
|
|
|
|
/*
|
|
* The JTable table model for the cases table presented by this view is
|
|
* defined by the following string, enum, and array.
|
|
*
|
|
* TODO (RC): Consider unifying this stuff in an enum as in
|
|
* AutoIngestDashboard to make it less error prone.
|
|
*/
|
|
private static final String CASE_HEADER = org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "ReviewModeCasePanel.CaseHeaderText");
|
|
private static final String CREATEDTIME_HEADER = org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "ReviewModeCasePanel.CreatedTimeHeaderText");
|
|
private static final String COMPLETEDTIME_HEADER = org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "ReviewModeCasePanel.LastAccessedTimeHeaderText");
|
|
private static final String STATUS_ICON_HEADER = org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "ReviewModeCasePanel.StatusIconHeaderText");
|
|
private static final String OUTPUT_FOLDER_HEADER = org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "ReviewModeCasePanel.OutputFolderHeaderText");
|
|
|
|
enum COLUMN_HEADERS {
|
|
|
|
CASE,
|
|
CREATEDTIME,
|
|
COMPLETEDTIME,
|
|
STATUS_ICON,
|
|
OUTPUTFOLDER
|
|
}
|
|
private final String[] columnNames = {CASE_HEADER, CREATEDTIME_HEADER, COMPLETEDTIME_HEADER, STATUS_ICON_HEADER, OUTPUT_FOLDER_HEADER};
|
|
private DefaultTableModel caseTableModel;
|
|
private Path currentlySelectedCase = null;
|
|
|
|
public AutoIngestCasePanel() {
|
|
init(null);
|
|
}
|
|
|
|
@Override
|
|
public void addWindowStateListener(JDialog parent) {
|
|
/*
|
|
* Add a window state listener that starts and stops refreshing of the
|
|
* cases table.
|
|
*/
|
|
parent.addWindowListener(new WindowAdapter() {
|
|
@Override
|
|
public void windowClosing(WindowEvent e) {
|
|
stopCasesTableRefreshes();
|
|
}
|
|
|
|
@Override
|
|
public void windowActivated(WindowEvent e) {
|
|
startCasesTableRefreshes();
|
|
}
|
|
|
|
@Override
|
|
public void windowClosed(WindowEvent e) {
|
|
stopCasesTableRefreshes();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Constructs a panel that allows a user to open cases created by automated
|
|
* ingest.
|
|
*
|
|
* @param parent The parent dialog for this panel.
|
|
*/
|
|
public AutoIngestCasePanel(JDialog parent) {
|
|
init(parent);
|
|
}
|
|
|
|
public void init(JDialog parent) {
|
|
caseTableModel = new DefaultTableModel(columnNames, 0) {
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Override
|
|
public boolean isCellEditable(int row, int column) {
|
|
return false;
|
|
}
|
|
@Override
|
|
public Class<?> getColumnClass(int col) {
|
|
if (this.getColumnName(col).equals(CREATEDTIME_HEADER) || this.getColumnName(col).equals(COMPLETEDTIME_HEADER)) {
|
|
return Date.class;
|
|
} else {
|
|
return super.getColumnClass(col);
|
|
}
|
|
}
|
|
};
|
|
|
|
initComponents();
|
|
|
|
/*
|
|
* Configure the columns of the cases table.
|
|
*/
|
|
TableColumn theColumn;
|
|
theColumn = casesTable.getColumn(CASE_HEADER);
|
|
theColumn.setCellRenderer(new GrayableCellRenderer());
|
|
theColumn.setMinWidth(CASE_COL_MIN_WIDTH);
|
|
theColumn.setMaxWidth(CASE_COL_MAX_WIDTH);
|
|
theColumn.setPreferredWidth(CASE_COL_PREFERRED_WIDTH);
|
|
theColumn.setWidth(CASE_COL_PREFERRED_WIDTH);
|
|
|
|
theColumn = casesTable.getColumn(CREATEDTIME_HEADER);
|
|
theColumn.setCellRenderer(new LongDateCellRenderer());
|
|
theColumn.setMinWidth(TIME_COL_MIN_WIDTH);
|
|
theColumn.setMaxWidth(TIME_COL_MAX_WIDTH);
|
|
theColumn.setPreferredWidth(TIME_COL_PREFERRED_WIDTH);
|
|
theColumn.setWidth(TIME_COL_PREFERRED_WIDTH);
|
|
|
|
theColumn = casesTable.getColumn(COMPLETEDTIME_HEADER);
|
|
theColumn.setCellRenderer(new LongDateCellRenderer());
|
|
theColumn.setMinWidth(TIME_COL_MIN_WIDTH);
|
|
theColumn.setMaxWidth(TIME_COL_MAX_WIDTH);
|
|
theColumn.setPreferredWidth(TIME_COL_PREFERRED_WIDTH);
|
|
theColumn.setWidth(TIME_COL_PREFERRED_WIDTH);
|
|
|
|
theColumn = casesTable.getColumn(STATUS_ICON_HEADER);
|
|
theColumn.setCellRenderer(new CaseStatusIconCellRenderer());
|
|
theColumn.setMinWidth(STATUS_COL_MIN_WIDTH);
|
|
theColumn.setMaxWidth(STATUS_COL_MAX_WIDTH);
|
|
theColumn.setPreferredWidth(STATUS_COL_PREFERRED_WIDTH);
|
|
theColumn.setWidth(STATUS_COL_PREFERRED_WIDTH);
|
|
|
|
casesTable.removeColumn(casesTable.getColumn(OUTPUT_FOLDER_HEADER));
|
|
|
|
/*
|
|
* Listen for row selection changes and set button state for the current
|
|
* selection.
|
|
*/
|
|
casesTable.getSelectionModel().addListSelectionListener((ListSelectionEvent e) -> {
|
|
//Ignore extra messages.
|
|
if (e.getValueIsAdjusting()) {
|
|
return;
|
|
}
|
|
setButtons();
|
|
});
|
|
|
|
/*
|
|
* Add a window state listener that starts and stops refreshing of the
|
|
* cases table.
|
|
*/
|
|
if (parent != null) {
|
|
parent.addWindowListener(new WindowAdapter() {
|
|
@Override
|
|
public void windowClosing(WindowEvent e) {
|
|
stopCasesTableRefreshes();
|
|
}
|
|
|
|
@Override
|
|
public void windowActivated(WindowEvent e) {
|
|
startCasesTableRefreshes();
|
|
}
|
|
|
|
@Override
|
|
public void windowClosed(WindowEvent e) {
|
|
stopCasesTableRefreshes();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Start doing periodic refreshes of the cases table.
|
|
*/
|
|
private void startCasesTableRefreshes() {
|
|
if (null == casesTableRefreshExecutor) {
|
|
casesTableRefreshExecutor = new ScheduledThreadPoolExecutor(1);
|
|
this.casesTableRefreshExecutor.scheduleAtFixedRate(() -> {
|
|
refreshCasesTable();
|
|
}, MILLIS_TO_WAIT_BEFORE_STARTING, MILLIS_TO_WAIT_BETWEEN_UPDATES, TimeUnit.MILLISECONDS);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Stop doing periodic refreshes of the cases table.
|
|
*/
|
|
private void stopCasesTableRefreshes() {
|
|
if (null != casesTableRefreshExecutor) {
|
|
casesTableRefreshExecutor.shutdown();
|
|
}
|
|
this.casesTableRefreshExecutor = null;
|
|
}
|
|
|
|
/*
|
|
* Updates the view presented by the panel.
|
|
*/
|
|
public void updateView() {
|
|
Thread thread = new Thread(() -> {
|
|
refreshCasesTable();
|
|
});
|
|
thread.start();
|
|
}
|
|
|
|
/**
|
|
* Gets the list of cases known to the review mode cases manager and
|
|
* refreshes the cases table.
|
|
*/
|
|
private void refreshCasesTable() {
|
|
try {
|
|
currentlySelectedCase = getSelectedCase();
|
|
List<AutoIngestCase> theModel = AutoIngestCaseManager.getInstance().getCases();
|
|
EventQueue.invokeLater(new CaseTableRefreshTask(theModel));
|
|
} catch (Exception ex) {
|
|
logger.log(Level.SEVERE, "Unexpected exception in refreshCasesTable", ex); //NON-NLS
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the current selection in the cases table.
|
|
*
|
|
* @return A path representing the current selected case, null if there is
|
|
* no selection.
|
|
*/
|
|
private Path getSelectedCase() {
|
|
try {
|
|
int selectedRow = casesTable.getSelectedRow();
|
|
if (selectedRow >= 0 && selectedRow < casesTable.getRowCount()) {
|
|
return Paths.get(caseTableModel.getValueAt(casesTable.convertRowIndexToModel(selectedRow), COLUMN_HEADERS.CASE.ordinal()).toString());
|
|
}
|
|
} catch (Exception ignored) {
|
|
return null;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Sets the current selection in the cases table.
|
|
*
|
|
* @param path The case folder path of the case to select.
|
|
*/
|
|
private void setSelectedCase(Path path) {
|
|
if (path != null) {
|
|
try {
|
|
for (int row = 0; row < casesTable.getRowCount(); ++row) {
|
|
Path temp = Paths.get(caseTableModel.getValueAt(casesTable.convertRowIndexToModel(row), COLUMN_HEADERS.CASE.ordinal()).toString());
|
|
if (temp.compareTo(path) == 0) { // found it
|
|
casesTable.setRowSelectionInterval(row, row);
|
|
return;
|
|
}
|
|
}
|
|
} catch (Exception ignored) {
|
|
casesTable.clearSelection();
|
|
}
|
|
}
|
|
casesTable.clearSelection();
|
|
}
|
|
|
|
/**
|
|
* Enables/disables the Open and Show Log buttons based on the case selected
|
|
* in the cases table.
|
|
*/
|
|
private void setButtons() {
|
|
boolean enabled = casesTable.getSelectedRow() >= 0 && casesTable.getSelectedRow() < casesTable.getRowCount();
|
|
bnOpen.setEnabled(enabled);
|
|
bnShowLog.setEnabled(enabled);
|
|
}
|
|
|
|
/**
|
|
* Opens a case.
|
|
*
|
|
* @param caseMetadataFilePath The path to the case metadata file.
|
|
*/
|
|
private void openCase(Path caseMetadataFilePath) {
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
new SwingWorker<Void, Void>() {
|
|
|
|
@Override
|
|
protected Void doInBackground() throws Exception {
|
|
AutoIngestCaseManager.getInstance().openCase(caseMetadataFilePath);
|
|
stopCasesTableRefreshes();
|
|
StartupWindowProvider.getInstance().close();
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
protected void done() {
|
|
try {
|
|
get();
|
|
} catch (InterruptedException | ExecutionException ex) {
|
|
if (null != ex.getCause() && !(ex.getCause() instanceof CaseActionCancelledException)) {
|
|
logger.log(Level.SEVERE, String.format("Error opening case with metadata file path %s", caseMetadataFilePath), ex); //NON-NLS
|
|
MessageNotifyUtil.Message.error(ex.getCause().getLocalizedMessage());
|
|
}
|
|
StartupWindowProvider.getInstance().open();
|
|
} finally {
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
|
}
|
|
}
|
|
}.execute();
|
|
}
|
|
|
|
/**
|
|
* A task that refreshes the cases table using a list of auto ingest cases.
|
|
*/
|
|
private class CaseTableRefreshTask implements Runnable {
|
|
|
|
private final List<AutoIngestCase> cases;
|
|
|
|
CaseTableRefreshTask(List<AutoIngestCase> cases) {
|
|
setButtons();
|
|
this.cases = cases;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
@Override
|
|
public void run() {
|
|
cases.sort(reverseDateModifiedComparator);
|
|
caseTableModel.setRowCount(0);
|
|
long now = new Date().getTime();
|
|
for (AutoIngestCase autoIngestCase : cases) {
|
|
if (passesTimeFilter(now, autoIngestCase.getLastAccessedDate().getTime())) {
|
|
caseTableModel.addRow(new Object[]{
|
|
autoIngestCase.getCaseName(),
|
|
autoIngestCase.getCreationDate(),
|
|
autoIngestCase.getLastAccessedDate(),
|
|
(AutoIngestCase.CaseStatus.OK != autoIngestCase.getStatus()),
|
|
autoIngestCase.getCaseDirectoryPath().toString()});
|
|
}
|
|
}
|
|
setSelectedCase(currentlySelectedCase);
|
|
}
|
|
|
|
/**
|
|
* Indicates whether or not a time satisfies a time filter defined by
|
|
* this panel's time filter radio buttons.
|
|
*
|
|
* @param currentTime The current date and time in milliseconds from the
|
|
* Unix epoch.
|
|
* @param inputTime The date and time to be tested as milliseconds
|
|
* from the Unix epoch.
|
|
*/
|
|
private boolean passesTimeFilter(long currentTime, long inputTime) {
|
|
long numberOfUnits = 10;
|
|
long multiplier = 1;
|
|
if (rbAllCases.isSelected()) {
|
|
return true;
|
|
} else if (rbMonths.isSelected()) {
|
|
multiplier = 31;
|
|
} else if (rbWeeks.isSelected()) {
|
|
multiplier = 7;
|
|
} else if (rbDays.isSelected()) {
|
|
multiplier = 1;
|
|
}
|
|
return ((currentTime - inputTime) / (1000 * 60 * 60 * 24)) < (numberOfUnits * multiplier);
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* This method is called from within the constructor to initialize the form.
|
|
* WARNING: Do NOT modify this code. The content of this method is always
|
|
* regenerated by the Form Editor.
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents() {
|
|
|
|
rbGroupHistoryLength = new javax.swing.ButtonGroup();
|
|
bnOpen = new javax.swing.JButton();
|
|
scrollPaneTable = new javax.swing.JScrollPane();
|
|
casesTable = new javax.swing.JTable();
|
|
bnRefresh = new javax.swing.JButton();
|
|
panelFilter = new javax.swing.JPanel();
|
|
rbAllCases = new javax.swing.JRadioButton();
|
|
bnShowLog = new javax.swing.JButton();
|
|
rbDays = new javax.swing.JRadioButton();
|
|
rbWeeks = new javax.swing.JRadioButton();
|
|
rbMonths = new javax.swing.JRadioButton();
|
|
rbGroupLabel = new javax.swing.JLabel();
|
|
|
|
setName("Completed Cases"); // NOI18N
|
|
|
|
org.openide.awt.Mnemonics.setLocalizedText(bnOpen, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.bnOpen.text")); // NOI18N
|
|
bnOpen.setEnabled(false);
|
|
bnOpen.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
bnOpenActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
casesTable.setAutoCreateRowSorter(true);
|
|
casesTable.setModel(caseTableModel);
|
|
casesTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
|
|
casesTable.setRowHeight(20);
|
|
casesTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
|
casesTable.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
|
casesTableMouseClicked(evt);
|
|
}
|
|
});
|
|
scrollPaneTable.setViewportView(casesTable);
|
|
|
|
org.openide.awt.Mnemonics.setLocalizedText(bnRefresh, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.bnRefresh.text")); // NOI18N
|
|
bnRefresh.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
bnRefreshActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
rbGroupHistoryLength.add(rbAllCases);
|
|
rbAllCases.setSelected(true);
|
|
org.openide.awt.Mnemonics.setLocalizedText(rbAllCases, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.rbAllCases.text")); // NOI18N
|
|
rbAllCases.addItemListener(new java.awt.event.ItemListener() {
|
|
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
|
rbAllCasesItemStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
javax.swing.GroupLayout panelFilterLayout = new javax.swing.GroupLayout(panelFilter);
|
|
panelFilter.setLayout(panelFilterLayout);
|
|
panelFilterLayout.setHorizontalGroup(
|
|
panelFilterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelFilterLayout.createSequentialGroup()
|
|
.addComponent(rbAllCases)
|
|
.addGap(0, 0, Short.MAX_VALUE))
|
|
);
|
|
panelFilterLayout.setVerticalGroup(
|
|
panelFilterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelFilterLayout.createSequentialGroup()
|
|
.addGap(0, 0, 0)
|
|
.addComponent(rbAllCases))
|
|
);
|
|
|
|
org.openide.awt.Mnemonics.setLocalizedText(bnShowLog, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.bnShowLog.text")); // NOI18N
|
|
bnShowLog.setToolTipText(org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.bnShowLog.toolTipText")); // NOI18N
|
|
bnShowLog.setEnabled(false);
|
|
bnShowLog.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
bnShowLogActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
rbGroupHistoryLength.add(rbDays);
|
|
org.openide.awt.Mnemonics.setLocalizedText(rbDays, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.rbDays.text")); // NOI18N
|
|
rbDays.setName(""); // NOI18N
|
|
rbDays.addItemListener(new java.awt.event.ItemListener() {
|
|
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
|
rbDaysItemStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
rbGroupHistoryLength.add(rbWeeks);
|
|
org.openide.awt.Mnemonics.setLocalizedText(rbWeeks, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.rbWeeks.text")); // NOI18N
|
|
rbWeeks.addItemListener(new java.awt.event.ItemListener() {
|
|
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
|
rbWeeksItemStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
rbGroupHistoryLength.add(rbMonths);
|
|
org.openide.awt.Mnemonics.setLocalizedText(rbMonths, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.rbMonths.text")); // NOI18N
|
|
rbMonths.addItemListener(new java.awt.event.ItemListener() {
|
|
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
|
rbMonthsItemStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
rbGroupLabel.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
|
|
org.openide.awt.Mnemonics.setLocalizedText(rbGroupLabel, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "AutoIngestCasePanel.rbGroupLabel.text")); // NOI18N
|
|
|
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
this.setLayout(layout);
|
|
layout.setHorizontalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(4, 4, 4)
|
|
.addComponent(bnOpen, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(bnShowLog)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(rbGroupLabel)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(rbDays)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(rbWeeks)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(rbMonths)
|
|
.addGap(0, 0, 0)
|
|
.addComponent(panelFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
.addComponent(bnRefresh)
|
|
.addGap(4, 4, 4))
|
|
.addComponent(scrollPaneTable, javax.swing.GroupLayout.DEFAULT_SIZE, 1007, Short.MAX_VALUE))
|
|
.addContainerGap())
|
|
);
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(6, 6, 6)
|
|
.addComponent(scrollPaneTable, javax.swing.GroupLayout.PREFERRED_SIZE, 450, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(bnOpen)
|
|
.addComponent(bnShowLog))
|
|
.addComponent(bnRefresh)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(rbDays)
|
|
.addComponent(rbWeeks)
|
|
.addComponent(rbMonths)
|
|
.addComponent(rbGroupLabel))
|
|
.addComponent(panelFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
.addGap(0, 0, 0))
|
|
);
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
/**
|
|
* Open button action
|
|
*
|
|
* @param evt -- The event that caused this to be called
|
|
*/
|
|
private void bnOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnOpenActionPerformed
|
|
int modelRow = casesTable.convertRowIndexToModel(casesTable.getSelectedRow());
|
|
Path caseMetadataFilePath = Paths.get((String) caseTableModel.getValueAt(modelRow,
|
|
COLUMN_HEADERS.OUTPUTFOLDER.ordinal()),
|
|
caseTableModel.getValueAt(modelRow, COLUMN_HEADERS.CASE.ordinal()) + CaseMetadata.getFileExtension());
|
|
openCase(caseMetadataFilePath);
|
|
}//GEN-LAST:event_bnOpenActionPerformed
|
|
|
|
/**
|
|
* Refresh button action
|
|
*
|
|
* @param evt -- The event that caused this to be called
|
|
*/
|
|
private void bnRefreshActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_bnRefreshActionPerformed
|
|
{//GEN-HEADEREND:event_bnRefreshActionPerformed
|
|
updateView();
|
|
}//GEN-LAST:event_bnRefreshActionPerformed
|
|
|
|
private void rbDaysItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_rbDaysItemStateChanged
|
|
if (rbDays.isSelected()) {
|
|
updateView();
|
|
}
|
|
}//GEN-LAST:event_rbDaysItemStateChanged
|
|
|
|
private void rbAllCasesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_rbAllCasesItemStateChanged
|
|
if (rbAllCases.isSelected()) {
|
|
updateView();
|
|
}
|
|
}//GEN-LAST:event_rbAllCasesItemStateChanged
|
|
|
|
private void rbMonthsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_rbMonthsItemStateChanged
|
|
if (rbMonths.isSelected()) {
|
|
updateView();
|
|
}
|
|
}//GEN-LAST:event_rbMonthsItemStateChanged
|
|
|
|
private void rbWeeksItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_rbWeeksItemStateChanged
|
|
if (rbWeeks.isSelected()) {
|
|
updateView();
|
|
}
|
|
}//GEN-LAST:event_rbWeeksItemStateChanged
|
|
|
|
private void bnShowLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnShowLogActionPerformed
|
|
int selectedRow = casesTable.convertRowIndexToModel(casesTable.getSelectedRow());
|
|
int rowCount = casesTable.getRowCount();
|
|
if (selectedRow >= 0 && selectedRow < rowCount) {
|
|
String thePath = (String) caseTableModel.getValueAt(selectedRow, COLUMN_HEADERS.OUTPUTFOLDER.ordinal());
|
|
Path pathToLog = AutoIngestJobLogger.getLogPath(Paths.get(thePath));
|
|
try {
|
|
if (pathToLog.toFile().exists()) {
|
|
Desktop.getDesktop().edit(pathToLog.toFile());
|
|
} else {
|
|
JOptionPane.showMessageDialog(this, org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "DisplayLogDialog.cannotFindLog"),
|
|
org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "DisplayLogDialog.unableToShowLogFile"), JOptionPane.ERROR_MESSAGE);
|
|
}
|
|
} catch (IOException ex) {
|
|
logger.log(Level.SEVERE, String.format("Error attempting to open case auto ingest log file %s", pathToLog), ex);
|
|
JOptionPane.showMessageDialog(this,
|
|
org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "DisplayLogDialog.cannotOpenLog"),
|
|
org.openide.util.NbBundle.getMessage(AutoIngestCasePanel.class, "DisplayLogDialog.unableToShowLogFile"),
|
|
JOptionPane.PLAIN_MESSAGE);
|
|
}
|
|
}
|
|
}//GEN-LAST:event_bnShowLogActionPerformed
|
|
|
|
private void casesTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_casesTableMouseClicked
|
|
if (evt.getClickCount() == 2) {
|
|
int modelRow = casesTable.convertRowIndexToModel(casesTable.getSelectedRow());
|
|
Path caseMetadataFilePath = Paths.get((String) caseTableModel.getValueAt(modelRow,
|
|
COLUMN_HEADERS.OUTPUTFOLDER.ordinal()),
|
|
caseTableModel.getValueAt(modelRow, COLUMN_HEADERS.CASE.ordinal()) + CaseMetadata.getFileExtension());
|
|
openCase(caseMetadataFilePath);
|
|
}
|
|
}//GEN-LAST:event_casesTableMouseClicked
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JButton bnOpen;
|
|
private javax.swing.JButton bnRefresh;
|
|
private javax.swing.JButton bnShowLog;
|
|
private javax.swing.JTable casesTable;
|
|
private javax.swing.JPanel panelFilter;
|
|
private javax.swing.JRadioButton rbAllCases;
|
|
private javax.swing.JRadioButton rbDays;
|
|
private javax.swing.ButtonGroup rbGroupHistoryLength;
|
|
private javax.swing.JLabel rbGroupLabel;
|
|
private javax.swing.JRadioButton rbMonths;
|
|
private javax.swing.JRadioButton rbWeeks;
|
|
private javax.swing.JScrollPane scrollPaneTable;
|
|
// End of variables declaration//GEN-END:variables
|
|
|
|
}
|