Merge pull request #993 from karlmortensen/IngestProgressSnapshotMods

Ingest progress snapshot mods
This commit is contained in:
Richard Cordovano 2014-12-12 16:59:27 -05:00
commit b3d69f2475
4 changed files with 40 additions and 5 deletions

View File

@ -46,7 +46,6 @@ public final class ShowIngestProgressSnapshotAction extends SystemAction impleme
@Override
public void actionPerformed(ActionEvent e) {
IngestProgressSnapshotDialog dialog = new IngestProgressSnapshotDialog();
dialog.setVisible(true);
}
@Override

View File

@ -29,6 +29,7 @@ import javax.swing.JFrame;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
import org.openide.windows.WindowManager;
/**
* The default implementation of the Autopsy startup window
@ -41,7 +42,7 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa
private static Dimension DIMENSIONS = new Dimension(750, 400);
public StartupWindow() {
super(new JFrame(TITLE), TITLE, true);
super(WindowManager.getDefault().getMainWindow(), TITLE, true);
init();
}

View File

@ -19,10 +19,14 @@
package org.sleuthkit.autopsy.ingest;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;
@ -33,12 +37,40 @@ public final class IngestProgressSnapshotDialog extends JDialog {
private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestProgressSnapshotDialog.title.text");
private static final Dimension DIMENSIONS = new Dimension(500, 300);
private JDialog pseudoOwner = null;
/**
* Constructs a non-modal instance of the dialog with its own frame.
*/
public IngestProgressSnapshotDialog() {
super((JFrame) WindowManager.getDefault().getMainWindow(), TITLE, false);
this((Window) WindowManager.getDefault().getMainWindow(), false);
}
/**
* Constructs an instance of the dialog with its own frame. Could be modal.
*
* @param owner - the owner of this dialog. If this dialog should be modal, the owner gets set to non modal.
* @param shouldBeModal - true if this should be modal, false otherwise.
*/
public IngestProgressSnapshotDialog(Container owner, Boolean shouldBeModal) {
super((Window) owner, TITLE, ModalityType.MODELESS);
if (shouldBeModal) { // if called from a modal dialog, manipulate the parent be just under this in z order, and not modal.
pseudoOwner = (JDialog) owner;
addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) { // Put it back to how it was before we manipulated it.
pseudoOwner.setVisible(false);
pseudoOwner.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
pseudoOwner.toFront();
pseudoOwner.setVisible(true);
}
});
pseudoOwner.setVisible(false);
pseudoOwner.setModalityType(Dialog.ModalityType.MODELESS);
pseudoOwner.toFront();
pseudoOwner.repaint();
pseudoOwner.setVisible(true);
}
setResizable(true);
setLayout(new BorderLayout());
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
@ -49,6 +81,9 @@ public final class IngestProgressSnapshotDialog extends JDialog {
add(new IngestProgressSnapshotPanel(this));
pack();
setResizable(false);
if (shouldBeModal) { // if called from a modal dialog, become modal, otherwise don't.
setModal(true);
}
setVisible(true);
}
}

View File

@ -429,7 +429,7 @@ public class IngestProgressSnapshotPanel extends javax.swing.JPanel {
}// </editor-fold>//GEN-END:initComponents
private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
parent.setVisible(false);
parent.dispose();
}//GEN-LAST:event_closeButtonActionPerformed
private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed