Package megameklab.ui
Interface MenuBarOwner
- All Superinterfaces:
AppCloser
- All Known Implementing Classes:
MegaMekLabTabbedUI,StartupGUI
This interface must be implemented by classes that display the
MenuBar.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidchangeTheme(String lookAndFeelInfo) Sets the look and feel for the application and let's Swing update the current components.default voidchangeTheme(UIManager.LookAndFeelInfo lookAndFeelInfo) Sets the look and feel for the application and let's Swing update the current components.megamek.common.units.EntitygetFrame()booleandefault voidThis method is called when this menubar owner should refresh all displayed content (all tabs in the unit main UIs).voidRefreshes the menu bar.default booleanThis 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).
-
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
- 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 alsoMiscSettingsPanel.
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
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
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()
-