Package megameklab.ui.dialog
Class UiLoader
java.lang.Object
megameklab.ui.dialog.UiLoader
This class prepares a new editing UI for either a given Entity or an Entity type (new unit). While preparation runs,
a splash screen is shown.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MegaMekLabMainUIgetUI(long type, boolean primitive, boolean industrial) static MegaMekLabMainUIstatic MegaMekLabMainUIgetUIWithoutLinkedAsset(megamek.common.units.Entity entity, String filename) Builds the editor for an already-loaded unit without auto-loading a linked Battlefield Support Asset from disk.static voidinitializeFromBlankUI(Consumer<MegaMekLabTabbedUI> initializer) static voidloadUi(long type, boolean primitive, boolean industrial) static voidstatic voidvoidshow()Shows the splash image, hides the calling frame and starts loading the new unit's UI.
-
Method Details
-
loadUi
-
loadUi
public static void loadUi(long type, boolean primitive, boolean industrial) -
restoreTabbedUi
public static void restoreTabbedUi() -
show
public void show()Shows the splash image, hides the calling frame and starts loading the new unit's UI. -
initializeFromBlankUI
-
getUI
- Returns:
- The correct MainUI for an Entity of the given type (ETYPE_xxx), primitive and industrial flag.
-
getUI
- Returns:
- The correct MainUI for an Entity. When a base unit that has a linked Battlefield Support Asset (a
co-located
.bfssidecar or a cache-linked asset) is opened, the returned editor has the asset injected; when a.bfsthat links to a base unit is opened, the base unit's editor is returned with the asset injected. A standalone asset opens the asset editor.
-
getUIWithoutLinkedAsset
public static MegaMekLabMainUI getUIWithoutLinkedAsset(megamek.common.units.Entity entity, String filename) Builds the editor for an already-loaded unit without auto-loading a linked Battlefield Support Asset from disk. Used by tab-state (session) restore, which authoritatively supplies the asset (including its enabled/disabled state and any unsaved edits) itself, so re-deriving it from disk would be wrong.- Parameters:
entity- the base unit (or a standalone asset)filename- the unit's file name- Returns:
- the editor, with no linked asset injected
-