Class UiLoader

java.lang.Object
megameklab.ui.dialog.UiLoader

public class UiLoader extends Object
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 Details

    • loadUi

      public static void loadUi(megamek.common.units.Entity newUnit, String fileName)
    • 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

      public static void initializeFromBlankUI(Consumer<MegaMekLabTabbedUI> initializer)
    • getUI

      public static MegaMekLabMainUI getUI(long type, boolean primitive, boolean industrial)
      Returns:
      The correct MainUI for an Entity of the given type (ETYPE_xxx), primitive and industrial flag.
    • getUI

      public static MegaMekLabMainUI getUI(megamek.common.units.Entity entity, String filename)
      Returns:
      The correct MainUI for an Entity. When a base unit that has a linked Battlefield Support Asset (a co-located .bfs sidecar or a cache-linked asset) is opened, the returned editor has the asset injected; when a .bfs that 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