diff --git a/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQButtonDialog.java b/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQButtonDialog.java index 0ebc56082b..e99bb8ad77 100644 --- a/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQButtonDialog.java +++ b/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQButtonDialog.java @@ -28,9 +28,9 @@ * This is the Base Dialog for a dialog with buttons in MegaMek. It extends Base Dialog, and adds a * button panel with base Ok and Cancel buttons. It also includes an enum tracker for the result of * the dialog. - * + *
* Inheriting classes must call initialize() in their constructors and override createCenterPane() - * + *
* The resources associated with this dialog need to contain at least the following keys:
* - "Ok.text" - text for the ok button
* - "Ok.toolTipText" - toolTipText for the ok button
@@ -39,6 +39,7 @@
*/
public abstract class AbstractMHQButtonDialog extends AbstractButtonDialog {
//region Constructors
+
/**
* This creates a modal AbstractMHQButtonDialog using the default MHQ resource bundle. This is
* the normal constructor to use for an AbstractMHQButtonDialog.
@@ -47,6 +48,10 @@ protected AbstractMHQButtonDialog(final JFrame frame, final String name, final S
this(frame, true, name, title);
}
+ protected AbstractMHQButtonDialog(final JDialog dialog, final JFrame frame, final String name, final String title) {
+ this(dialog, frame, true, name, title);
+ }
+
/**
* This creates an AbstractMHQButtonDialog using the default MHQ resource bundle. It allows one
* to create non-modal button dialogs, which is not recommended by default.
@@ -57,6 +62,12 @@ protected AbstractMHQButtonDialog(final JFrame frame, final boolean modal, final
MekHQ.getMHQOptions().getLocale()), name, title);
}
+ protected AbstractMHQButtonDialog(final JDialog dialog, final JFrame frame, final boolean modal, final String name,
+ final String title) {
+ this(dialog, frame, modal, ResourceBundle.getBundle("mekhq.resources.GUI",
+ MekHQ.getMHQOptions().getLocale()), name, title);
+ }
+
/**
* This creates an AbstractMHQButtonDialog using the specified resource bundle. This is not
* recommended by default.
@@ -65,12 +76,19 @@ protected AbstractMHQButtonDialog(final JFrame frame, final boolean modal, final
final String name, final String title) {
super(frame, modal, resources, name, title);
}
+
+ protected AbstractMHQButtonDialog(final JDialog dialog, final JFrame frame, final boolean modal, final ResourceBundle resources,
+ final String name, final String title) {
+ super(dialog, frame, modal, resources, name, title);
+ }
+ //endregion Constructors
//endregion Constructors
/**
* This override forces the preferences for this class to be tracked in MekHQ instead of MegaMek.
+ *
* @throws Exception if there's an issue initializing the preferences. Normally this means
- * a component has not had its name value set.
+ * a component has not had its name value set.
*/
@Override
protected void setPreferences() throws Exception {
diff --git a/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQValidationButtonDialog.java b/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQValidationButtonDialog.java
index ee1ed9c26c..6eb0c8f029 100644
--- a/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQValidationButtonDialog.java
+++ b/MekHQ/src/mekhq/gui/baseComponents/AbstractMHQValidationButtonDialog.java
@@ -72,6 +72,16 @@ protected AbstractMHQValidationButtonDialog(final JFrame frame, final boolean mo
final String title) {
super(frame, modal, resources, name, title);
}
+
+ /**
+ * This creates an AbstractMHQValidationButtonDialog using the specified resource bundle. This
+ * is not recommended by default. Allows a JDialog to be specified as parent.
+ */
+ protected AbstractMHQValidationButtonDialog(final JDialog dialog, final JFrame frame, final boolean modal,
+ final ResourceBundle resources, final String name,
+ final String title) {
+ super(dialog, frame, modal, resources, name, title);
+ }
//endregion Constructors
/**
diff --git a/MekHQ/src/mekhq/gui/dialog/CampaignOptionsDialog.java b/MekHQ/src/mekhq/gui/dialog/CampaignOptionsDialog.java
index 0d6aa4c1a1..445319c73c 100644
--- a/MekHQ/src/mekhq/gui/dialog/CampaignOptionsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CampaignOptionsDialog.java
@@ -53,6 +53,18 @@ public CampaignOptionsDialog(final JFrame frame, final Campaign campaign, final
this.startup = startup;
initialize();
}
+
+ /**
+ * Allows dialog to be constructed with an owner being another dialog
+ */
+ public CampaignOptionsDialog(final JDialog owner, final JFrame frame, final Campaign campaign, final boolean startup) {
+ super(owner, frame, true, ResourceBundle.getBundle("mekhq.resources.CampaignOptionsDialog",
+ MekHQ.getMHQOptions().getLocale()),
+ "CampaignOptionsDialog", "CampaignOptionsDialog.title");
+ this.campaign = campaign;
+ this.startup = startup;
+ initialize();
+ }
//endregion Constructors
//region Getters/Setters
diff --git a/MekHQ/src/mekhq/gui/dialog/CampaignPresetSelectionDialog.java b/MekHQ/src/mekhq/gui/dialog/CampaignPresetSelectionDialog.java
index 714ffef72e..848be08b22 100644
--- a/MekHQ/src/mekhq/gui/dialog/CampaignPresetSelectionDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CampaignPresetSelectionDialog.java
@@ -32,8 +32,16 @@ public class CampaignPresetSelectionDialog extends AbstractMHQButtonDialog {
//endregion Variable Declarations
//region Constructors
- public CampaignPresetSelectionDialog(final JFrame parent) {
- super(parent, "CampaignPresetSelectionDialog", "CampaignPresetSelectionDialog.title");
+ public CampaignPresetSelectionDialog(final JFrame parentFrame) {
+ super(parentFrame, "CampaignPresetSelectionDialog", "CampaignPresetSelectionDialog.title");
+ initialize();
+ }
+
+ /**
+ * Allows dialog to be constructed using a dialog as owner
+ */
+ public CampaignPresetSelectionDialog(final JDialog parentDialog, final JFrame parentFrame) {
+ super(parentDialog, parentFrame, "CampaignPresetSelectionDialog", "CampaignPresetSelectionDialog.title");
initialize();
}
//endregion Constructors
diff --git a/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java b/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java
index 4fae5dd08e..e7b363c6f4 100644
--- a/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java
@@ -71,7 +71,7 @@ public DataLoadingDialog(final JFrame frame, final MekHQ application,
super(frame, "DataLoadingDialog", "DataLoadingDialog.title");
this.application = application;
this.campaignFile = campaignFile;
- this.task = new Task();
+ this.task = new Task(this);
getTask().addPropertyChangeListener(this);
initialize();
getTask().execute();
@@ -191,6 +191,10 @@ public void propertyChange(final PropertyChangeEvent evt) {
* Main task. This is executed in a background thread.
*/
private class Task extends SwingWorker