Class AbstractRandomArmyDialog

java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
megamek.client.ui.dialogs.randomArmy.AbstractRandomArmyDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
MMLForceBuilderRandomArmyDialog, MMMainMenuRandomArmyDialog, RandomArmyDialog

public abstract class AbstractRandomArmyDialog extends JDialog
This class is the framework for the random army dialog that is most prominently used in MM's lobby. Subclasses of it can be used anywhere. It requires the data/names and data/rat folders for full functionality. Subclasses can generate a button panel that allows interaction with the results (see the present subclasses for examples). Subclasses or callers can also supply GameOptions that influence some of the generators.
See Also:
  • Field Details

  • Constructor Details

    • AbstractRandomArmyDialog

      public AbstractRandomArmyDialog(JFrame parent)
  • Method Details

    • setGameOptions

      public void setGameOptions(GameOptions newOptions)
    • createButtonsPanel

      protected abstract JComponent createButtonsPanel()
      Override to add buttons or other components to the bottom of the dialog. The returned component is added when setVisible(true) is called for the first time; it is added as BorderLayout.SOUTH and is therefore stretched to the width of the dialog.
      Returns:
      A button panel for the dialog
    • getGenerationContext

      protected GenerationContext getGenerationContext()
      What the units on the current tab were rolled for. Only three tabs ask the player for a faction, a command and a year; the rest roll off a table that knows none of it, and report the Inner Sphere at large for the game year rather than claiming a choice the player never made.

      The tab that produced the units decides this. Reading it from a fixed panel would attribute one tab's faction to another tab's units.

      Returns:
      the context, never null
    • updateYear

      protected void updateYear()
    • setVisible

      public void setVisible(boolean show)
      Overrides:
      setVisible in class Dialog
    • clearData

      protected void clearData()
      Clears all rolled results from all of the tabs.
    • addToChosenUnits

      protected void addToChosenUnits(MekSummary unit)