Package megameklab.ui

Interface MenuBarOwner

All Superinterfaces:
AppCloser
All Known Implementing Classes:
MegaMekLabTabbedUI, StartupGUI

public interface MenuBarOwner extends AppCloser
This interface must be implemented by classes that display the MenuBar.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    changeTheme(String lookAndFeelInfo)
    Sets the look and feel for the application and let's Swing update the current components.
    default void
    Sets the look and feel for the application and let's Swing update the current components.
    megamek.common.units.Entity
     
     
     
     
    boolean
     
    default void
    This method is called when this menubar owner should refresh all displayed content (all tabs in the unit main UIs).
    void
    Refreshes the menu bar.
    default boolean
    This method is called when an action will cause the currently edited unit to be discarded (exit MML, load a new unit or switch unit type).

    Methods inherited from interface megameklab.ui.util.AppCloser

    exit
  • Method Details

    • getFrame

      JFrame getFrame()
      Returns:
      A frame of this menubar owner to use as a parent for dialogs.
    • getEntity

      @Nullable megamek.common.units.Entity getEntity()
      Returns:
      The entity currently worked on or null.
    • getFileName

      @Nullable String getFileName()
      Returns:
      The file name of the currently worked on unit or an empty String.
    • hasEntityNameChanged

      boolean hasEntityNameChanged()
      Returns:
      True if the entity's name has changed since load.
    • safetyPrompt

      default boolean safetyPrompt()
      This method is called when an action will cause the currently edited unit to be discarded (exit MML, load a new unit or switch unit type).

      It should return true only when MML should continue with the action that called this method. If there is any data to be lost by this menubar owner, then this method should display a safety dialog prompting the user to consider saving the currently entered unit. If the user selects NO or selects YES and actually saves the unit, true should be returned.

      If there is no data to be lost or when the setting "Disable save prompts" is active (see Misc Settings), it may directly return true. See also MiscSettingsPanel.

      By default, this method directly returns true.
      Returns:
      True only when the user agrees to continue or has deactivated these prompts, false otherwise
    • refreshAll

      default void refreshAll()
      This method is called when this menubar owner should refresh all displayed content (all tabs in the unit main UIs). By default, this method does nothing.
    • refreshMenuBar

      void refreshMenuBar()
      Refreshes the menu bar. Updates the recent units in the File menu.
    • changeTheme

      default void changeTheme(UIManager.LookAndFeelInfo lookAndFeelInfo)
      Sets the look and feel for the application and let's Swing update the current components.
      Parameters:
      lookAndFeelInfo - The look and feel to use for the application.
    • changeTheme

      default void changeTheme(String lookAndFeelInfo)
      Sets the look and feel for the application and let's Swing update the current components. *
      Parameters:
      lookAndFeelInfo - The name of the look and feel to use for the application.
    • getMMLMenuBar

      MenuBar getMMLMenuBar()