mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Auto refresh fixed for multi-user cases panel.
This commit is contained in:
parent
2082928e51
commit
ad0fe641a7
@ -56,25 +56,6 @@ public final class CaseOpenMultiUserAction extends CallableSystemAction implemen
|
|||||||
|
|
||||||
public CaseOpenMultiUserAction() {}
|
public CaseOpenMultiUserAction() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs the Multi-User Cases window used by the Open Multi-User Case
|
|
||||||
* menu item.
|
|
||||||
*/
|
|
||||||
private void initMultiUserCasesWindow() {
|
|
||||||
multiUserCaseWindow = new JDialog(
|
|
||||||
WindowManager.getDefault().getMainWindow(),
|
|
||||||
REVIEW_MODE_TITLE,
|
|
||||||
Dialog.ModalityType.APPLICATION_MODAL);
|
|
||||||
multiUserCaseWindow.getRootPane().registerKeyboardAction(
|
|
||||||
e -> {
|
|
||||||
multiUserCaseWindow.setVisible(false);
|
|
||||||
},
|
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
||||||
multiUserCaseWindow.add(MultiUserCasesPanel.getInstance());
|
|
||||||
multiUserCaseWindow.pack();
|
|
||||||
multiUserCaseWindow.setResizable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void closeMultiUserCasesWindow() {
|
public static void closeMultiUserCasesWindow() {
|
||||||
if (null != multiUserCaseWindow) {
|
if (null != multiUserCaseWindow) {
|
||||||
multiUserCaseWindow.setVisible(false);
|
multiUserCaseWindow.setVisible(false);
|
||||||
@ -95,7 +76,7 @@ public final class CaseOpenMultiUserAction extends CallableSystemAction implemen
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
if(multiUserCaseWindow == null) {
|
if(multiUserCaseWindow == null) {
|
||||||
initMultiUserCasesWindow();
|
multiUserCaseWindow = MultiUserCasesDialog.getInstance();
|
||||||
}
|
}
|
||||||
multiUserCaseWindow.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
|
multiUserCaseWindow.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
|
||||||
multiUserCaseWindow.setVisible(true);
|
multiUserCaseWindow.setVisible(true);
|
||||||
|
@ -114,21 +114,6 @@ public class CueBannerPanel extends javax.swing.JPanel {
|
|||||||
recentCasesWindow.setResizable(false);
|
recentCasesWindow.setResizable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMultiUserCasesWindow() {
|
|
||||||
multiUserCaseWindow = new JDialog(
|
|
||||||
WindowManager.getDefault().getMainWindow(),
|
|
||||||
REVIEW_MODE_TITLE,
|
|
||||||
Dialog.ModalityType.APPLICATION_MODAL);
|
|
||||||
multiUserCaseWindow.getRootPane().registerKeyboardAction(
|
|
||||||
e -> {
|
|
||||||
multiUserCaseWindow.setVisible(false);
|
|
||||||
},
|
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
||||||
multiUserCaseWindow.add(MultiUserCasesPanel.getInstance());
|
|
||||||
multiUserCaseWindow.pack();
|
|
||||||
multiUserCaseWindow.setResizable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableComponents() {
|
private void enableComponents() {
|
||||||
boolean enableOpenRecentCaseButton = (RecentCases.getInstance().getTotalRecentCases() > 0);
|
boolean enableOpenRecentCaseButton = (RecentCases.getInstance().getTotalRecentCases() > 0);
|
||||||
openRecentCaseButton.setEnabled(enableOpenRecentCaseButton);
|
openRecentCaseButton.setEnabled(enableOpenRecentCaseButton);
|
||||||
@ -304,7 +289,7 @@ public class CueBannerPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private void openMultiUserCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMultiUserCaseButtonActionPerformed
|
private void openMultiUserCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMultiUserCaseButtonActionPerformed
|
||||||
if(multiUserCaseWindow == null) {
|
if(multiUserCaseWindow == null) {
|
||||||
initMultiUserCasesWindow();
|
multiUserCaseWindow = MultiUserCasesDialog.getInstance();
|
||||||
}
|
}
|
||||||
multiUserCaseWindow.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
|
multiUserCaseWindow.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
|
||||||
multiUserCaseWindow.setVisible(true);
|
multiUserCaseWindow.setVisible(true);
|
||||||
|
81
Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesDialog.java
Executable file
81
Core/src/org/sleuthkit/autopsy/casemodule/MultiUserCasesDialog.java
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* 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.casemodule;
|
||||||
|
|
||||||
|
import java.awt.Dialog;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
import javax.swing.KeyStroke;
|
||||||
|
import org.openide.windows.WindowManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class extends a JDialog and maintains the MultiUserCasesPanel.
|
||||||
|
*/
|
||||||
|
public class MultiUserCasesDialog extends JDialog {
|
||||||
|
private static final String REVIEW_MODE_TITLE = "Open Multi-User Case";
|
||||||
|
private final MultiUserCasesPanel multiUserCasesPanel;
|
||||||
|
private static MultiUserCasesDialog instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the instance of the MultiuserCasesDialog.
|
||||||
|
*
|
||||||
|
* @return The instance.
|
||||||
|
*/
|
||||||
|
static public MultiUserCasesDialog getInstance() {
|
||||||
|
if(instance == null) {
|
||||||
|
instance = new MultiUserCasesDialog();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a MultiUserCasesDialog object.
|
||||||
|
*/
|
||||||
|
MultiUserCasesDialog() {
|
||||||
|
super(WindowManager.getDefault().getMainWindow(),
|
||||||
|
REVIEW_MODE_TITLE,
|
||||||
|
Dialog.ModalityType.APPLICATION_MODAL);
|
||||||
|
|
||||||
|
getRootPane().registerKeyboardAction(
|
||||||
|
e -> {
|
||||||
|
setVisible(false);
|
||||||
|
},
|
||||||
|
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||||
|
|
||||||
|
multiUserCasesPanel = new MultiUserCasesPanel();
|
||||||
|
add(multiUserCasesPanel);
|
||||||
|
pack();
|
||||||
|
setResizable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the dialog visibility. When setting it to visible, the contents will
|
||||||
|
* refresh.
|
||||||
|
*
|
||||||
|
* @param value True or false.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setVisible(boolean value) {
|
||||||
|
if(value) {
|
||||||
|
multiUserCasesPanel.refreshCasesTable();
|
||||||
|
}
|
||||||
|
super.setVisible(value);
|
||||||
|
}
|
||||||
|
}
|
@ -20,13 +20,16 @@ package org.sleuthkit.autopsy.casemodule;
|
|||||||
|
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
|
import java.awt.EventQueue;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
@ -79,26 +82,12 @@ public class MultiUserCasesPanel extends javax.swing.JPanel {
|
|||||||
private final String[] columnNames = {CASE_HEADER, CREATEDTIME_HEADER, COMPLETEDTIME_HEADER, STATUS_ICON_HEADER, OUTPUT_FOLDER_HEADER};
|
private final String[] columnNames = {CASE_HEADER, CREATEDTIME_HEADER, COMPLETEDTIME_HEADER, STATUS_ICON_HEADER, OUTPUT_FOLDER_HEADER};
|
||||||
private DefaultTableModel caseTableModel;
|
private DefaultTableModel caseTableModel;
|
||||||
private Path currentlySelectedCase = null;
|
private Path currentlySelectedCase = null;
|
||||||
private static MultiUserCasesPanel instance;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Gets the singleton instance of the panel.
|
|
||||||
*/
|
|
||||||
static MultiUserCasesPanel getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new MultiUserCasesPanel();
|
|
||||||
}
|
|
||||||
instance.refreshCasesTable();
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a panel that allows a user to open cases created by automated
|
* Constructs a panel that allows a user to open cases created by automated
|
||||||
* ingest.
|
* ingest.
|
||||||
*
|
|
||||||
* @param parent The parent dialog for this panel.
|
|
||||||
*/
|
*/
|
||||||
private MultiUserCasesPanel() {
|
MultiUserCasesPanel() {
|
||||||
caseTableModel = new DefaultTableModel(columnNames, 0) {
|
caseTableModel = new DefaultTableModel(columnNames, 0) {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -164,14 +153,21 @@ public class MultiUserCasesPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
setButtons();
|
setButtons();
|
||||||
});
|
});
|
||||||
refreshCasesTable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of cases known to the review mode cases manager and
|
* Gets the list of cases known to the review mode cases manager and
|
||||||
* refreshes the cases table.
|
* refreshes the cases table.
|
||||||
*/
|
*/
|
||||||
private void refreshCasesTable() {
|
void refreshCasesTable() {
|
||||||
|
EventQueue.invokeLater(() -> {
|
||||||
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
});
|
||||||
|
|
||||||
|
new SwingWorker<Void, Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground() throws Exception {
|
||||||
try {
|
try {
|
||||||
currentlySelectedCase = getSelectedCase();
|
currentlySelectedCase = getSelectedCase();
|
||||||
MultiUserCaseManager manager = MultiUserCaseManager.getInstance();
|
MultiUserCaseManager manager = MultiUserCaseManager.getInstance();
|
||||||
@ -192,8 +188,22 @@ public class MultiUserCasesPanel extends javax.swing.JPanel {
|
|||||||
setSelectedCase(currentlySelectedCase);
|
setSelectedCase(currentlySelectedCase);
|
||||||
setButtons();
|
setButtons();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOGGER.log(Level.SEVERE, "Unexpected exception in refreshCasesTable", ex); //NON-NLS
|
LOGGER.log(Level.SEVERE, "Unexpected exception while refreshing the table.", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
super.done();
|
||||||
|
setCursor(null);
|
||||||
|
try {
|
||||||
|
get();
|
||||||
|
} catch (InterruptedException | ExecutionException ex) {
|
||||||
|
LOGGER.log(Level.SEVERE, "Unexpected exception while refreshing the table.", ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,6 @@ import org.openide.windows.WindowManager;
|
|||||||
import org.sleuthkit.autopsy.casemodule.StartupWindowProvider;
|
import org.sleuthkit.autopsy.casemodule.StartupWindowProvider;
|
||||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||||
import static org.sleuthkit.autopsy.core.UserPreferences.SETTINGS_PROPERTIES;
|
import static org.sleuthkit.autopsy.core.UserPreferences.SETTINGS_PROPERTIES;
|
||||||
import static org.sleuthkit.autopsy.core.UserPreferences.setMode;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
||||||
|
|
||||||
@ -74,13 +73,18 @@ public class Installer extends ModuleInstall {
|
|||||||
super.uninstalled();
|
super.uninstalled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the mode in the configuration file is 'REVIEW' (2, now invalid), this
|
||||||
|
* method will set it to 'STANDALONE' (0) and disable auto ingest.
|
||||||
|
*/
|
||||||
private void updateConfig() {
|
private void updateConfig() {
|
||||||
// If mode is 'REVIEW' (2, now invalid), set it to 'STANDALONE' (0).
|
String mode = ModuleSettings.getConfigSetting(SETTINGS_PROPERTIES, "AutopsyMode");
|
||||||
int ordinal = Integer.parseInt(ModuleSettings.getConfigSetting(SETTINGS_PROPERTIES, "AutopsyMode"));
|
if(mode != null) {
|
||||||
|
int ordinal = Integer.parseInt(mode);
|
||||||
if(ordinal > 1) {
|
if(ordinal > 1) {
|
||||||
setMode(UserPreferences.SelectedMode.STANDALONE);
|
UserPreferences.setMode(UserPreferences.SelectedMode.STANDALONE);
|
||||||
ModuleSettings.setConfigSetting(UserPreferences.SETTINGS_PROPERTIES, "JoinAutoModeCluster", Boolean.toString(false));
|
ModuleSettings.setConfigSetting(UserPreferences.SETTINGS_PROPERTIES, "JoinAutoModeCluster", Boolean.toString(false));
|
||||||
ordinal = 0;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user