-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5709 from IllianiCBT/gui_dialogUpdate
Added `MHQDialogImmersive` for Immersive Dialog Functionality that Immersively Improves Immersion
- Loading branch information
Showing
16 changed files
with
549 additions
and
174 deletions.
There are no files selected for viewing
142 changes: 71 additions & 71 deletions
142
...gui/baseComponents/AbstractMHQDialog.java → ...aseComponents/AbstractMHQDialogBasic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,71 @@ | ||
/* | ||
* Copyright (c) 2021 - The MegaMek Team. All Rights Reserved. | ||
* | ||
* This file is part of MekHQ. | ||
* | ||
* MekHQ is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MekHQ is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with MekHQ. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package mekhq.gui.baseComponents; | ||
|
||
import megamek.client.ui.baseComponents.AbstractDialog; | ||
import mekhq.MekHQ; | ||
|
||
import javax.swing.*; | ||
import java.util.ResourceBundle; | ||
|
||
/** | ||
* This is the base class for dialogs in MegaMek. This class handles setting the UI, managing the X | ||
* button, managing the escape key, and saving the dialog preferences. | ||
* | ||
* Inheriting classes must call initialize() in their constructors and override createCenterPane() | ||
*/ | ||
public abstract class AbstractMHQDialog extends AbstractDialog { | ||
//region Constructors | ||
/** | ||
* This creates a non-modal AbstractMHQDialog using the default MHQ resource bundle. This is | ||
* the normal constructor to use for an AbstractMHQDialog. | ||
*/ | ||
protected AbstractMHQDialog(final JFrame frame, final String name, final String title) { | ||
this(frame, false, name, title); | ||
} | ||
|
||
/** | ||
* This creates an AbstractMHQDialog using the default MHQ resource bundle. It allows one | ||
* to create modal dialogs. | ||
*/ | ||
protected AbstractMHQDialog(final JFrame frame, final boolean modal, final String name, final String title) { | ||
this(frame, modal, ResourceBundle.getBundle("mekhq.resources.GUI", | ||
MekHQ.getMHQOptions().getLocale()), name, title); | ||
} | ||
|
||
/** | ||
* This creates an AbstractMHQDialog using the specified resource bundle. This is not recommended | ||
* by default. | ||
*/ | ||
protected AbstractMHQDialog(final JFrame frame, final boolean modal, final ResourceBundle resources, | ||
final String name, final String title) { | ||
super(frame, modal, resources, name, title); | ||
} | ||
//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 <strong>not</strong> had its name value set. | ||
*/ | ||
@Override | ||
protected void setPreferences() throws Exception { | ||
setPreferences(MekHQ.getMHQPreferences().forClass(getClass())); | ||
} | ||
} | ||
/* | ||
* Copyright (c) 2021-2025 - The MegaMek Team. All Rights Reserved. | ||
* | ||
* This file is part of MekHQ. | ||
* | ||
* MekHQ is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MekHQ is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with MekHQ. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package mekhq.gui.baseComponents; | ||
|
||
import megamek.client.ui.baseComponents.AbstractDialog; | ||
import mekhq.MekHQ; | ||
|
||
import javax.swing.*; | ||
import java.util.ResourceBundle; | ||
|
||
/** | ||
* This is the base class for dialogs in MegaMek. This class handles setting the UI, managing the X | ||
* button, managing the escape key, and saving the dialog preferences. | ||
* <p> | ||
* Inheriting classes must call initialize() in their constructors and override createCenterPane() | ||
*/ | ||
public abstract class AbstractMHQDialogBasic extends AbstractDialog { | ||
//region Constructors | ||
/** | ||
* This creates a non-modal AbstractMHQDialog using the default MHQ resource bundle. This is | ||
* the normal constructor to use for an AbstractMHQDialog. | ||
*/ | ||
protected AbstractMHQDialogBasic(final JFrame frame, final String name, final String title) { | ||
this(frame, false, name, title); | ||
} | ||
|
||
/** | ||
* This creates an AbstractMHQDialog using the default MHQ resource bundle. It allows one | ||
* to create modal dialogs. | ||
*/ | ||
protected AbstractMHQDialogBasic(final JFrame frame, final boolean modal, final String name, final String title) { | ||
this(frame, modal, ResourceBundle.getBundle("mekhq.resources.GUI", | ||
MekHQ.getMHQOptions().getLocale()), name, title); | ||
} | ||
|
||
/** | ||
* This creates an AbstractMHQDialog using the specified resource bundle. This is not recommended | ||
* by default. | ||
*/ | ||
protected AbstractMHQDialogBasic(final JFrame frame, final boolean modal, final ResourceBundle resources, | ||
final String name, final String title) { | ||
super(frame, modal, resources, name, title); | ||
} | ||
//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 <strong>not</strong> had its name value set. | ||
*/ | ||
@Override | ||
protected void setPreferences() throws Exception { | ||
setPreferences(MekHQ.getMHQPreferences().forClass(getClass())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.