Class StatusBarPhaseDisplay

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, BoardViewListener, KeyBindReceiver, GameListener, IPreferenceChangeListener, Distractable
Direct Known Subclasses:
ActionPhaseDisplay, DeploymentDisplay, DeployMinefieldDisplay, PrephaseDisplay, ReportDisplay, SBFActionPhaseDisplay, SBFReportDisplay, SelectArtyAutoHitHexDisplay

public abstract class StatusBarPhaseDisplay extends AbstractPhaseDisplay implements ActionListener, IPreferenceChangeListener, KeyBindReceiver
This is a parent class for the button display for each phase. Every phase has a panel of control buttons along with a Done button. Each button corresponds to a command that can be carried out in the current phase. This class formats the button panel, the done button, and a status display area. Control buttons are grouped and the groups can be cycled through.
See Also:
  • Field Details

    • GUIP

      protected static final GUIPreferences GUIP
    • MIN_BUTTON_SIZE

      protected static final Dimension MIN_BUTTON_SIZE
    • clientgui

      protected final IClientGUI clientgui
    • panStatus

      protected JPanel panStatus
    • panButtons

      protected JPanel panButtons
    • currentButtonGroup

      protected int currentButtonGroup
      The button group that is currently displayed
    • numButtonGroups

      protected int numButtonGroups
      The number of button groups there are, needs to be computed in a child class.
    • buttonsPerRow

      protected int buttonsPerRow
    • buttonsPerGroup

      protected int buttonsPerGroup
  • Constructor Details

    • StatusBarPhaseDisplay

      protected StatusBarPhaseDisplay(IClientGUI cg)
  • Method Details

    • getButtonList

      protected abstract List<MegaMekButton> getButtonList()
      Returns the list of buttons that should be displayed.
    • setButtons

      protected abstract void setButtons()
      set button that should be displayed.
    • createButton

      protected MegaMekButton createButton(String cmd, String keyPrefix)
    • setButtonsTooltips

      protected abstract void setButtonsTooltips()
      set button tool tips that should be displayed.
    • createToolTip

      protected String createToolTip(String cmd, String keyPrefix, String hotKeyDesc)
    • setupButtonPanel

      public void setupButtonPanel()
      Adds buttons to the button panel. The buttons to be added are retrieved with the getButtonList() method. The number of buttons to display is defined in buttonsPerGroup and which group of buttons will be displayed is set by currentButtonGroup.
    • setupDonePanel

      protected UIUtil.FixedXPanel setupDonePanel()
    • addToDonePanel

      protected void addToDonePanel(JPanel donePanel, JComponent item)
    • clear

      public abstract void clear()
      Clears the actions of this phase. Called usually when the ESC key is pressed.
    • setupStatusBar

      protected void setupStatusBar(String statusInfo)
      Sets up the status bar. It usually displays info on the current phase and if it's the local player's turn.
    • setStatusBarText

      public void setStatusBarText(String text)
    • preferenceChange

      public void preferenceChange(PreferenceChangeEvent e)
      Specified by:
      preferenceChange in interface IPreferenceChangeListener
    • shouldReceiveKeyCommands

      public boolean shouldReceiveKeyCommands()
      Description copied from interface: KeyBindReceiver
      This method should return true when this KeyBindReceiver is in a state to receive the keybind and may react to it, false otherwise. This should return false when the receiver is hidden, inactive or behind a modal dialog. It should return true when it would be expected to act on a keybind, i.e. when it has the appearance of being in focus. When this method returns false, this receiver will not be counted as having consumed the key press.
      Specified by:
      shouldReceiveKeyCommands in interface KeyBindReceiver
      Returns:
      True when the this receiver is in a state to receive the keybind and may react to it. False otherwise.
    • startTimer

      public void startTimer()
    • stopTimer

      public void stopTimer()
    • extendTimer

      public void extendTimer()
    • isTimerExpired

      public boolean isTimerExpired()
      Returns:
      True when there is a turn timer and it has expired, false when there was no turn timer or it has not yet expired.
    • getRemainingPlayerWithTurns

      public String getRemainingPlayerWithTurns()
    • setStatusBarWithNotDonePlayers

      public void setStatusBarWithNotDonePlayers()
    • playerNameOrUnknown

      protected String playerNameOrUnknown(@Nullable Player player)