Class TargetingPhaseDisplay

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener, BoardViewListener, KeyBindReceiver, GameListener, IPreferenceChangeListener, Distractable

public class TargetingPhaseDisplay extends AttackPhaseDisplay implements ListSelectionListener
Targeting Phase Display. Breaks naming convention because TargetingDisplay is too easy to confuse with something else
See Also:
  • Field Details

  • Constructor Details

    • TargetingPhaseDisplay

      public TargetingPhaseDisplay(ClientGUI clientgui, boolean offboard)
      Creates and lays out a new targeting phase display for the specified clientGUI.getClient().
  • Method Details

    • getDoneButtonLabel

      protected String getDoneButtonLabel()
      Description copied from class: AttackPhaseDisplay
      called by updateDonePanel to populate the label text of the Done button. Usually wraps a call to Messages.getString(...Fire) but can be extended to add more details.
      Specified by:
      getDoneButtonLabel in class AttackPhaseDisplay
      Returns:
      text for label
    • getSkipTurnButtonLabel

      protected String getSkipTurnButtonLabel()
      Description copied from class: AttackPhaseDisplay
      called by updateDonePanel to populate the label text of the NoAction button. Usually wraps a call to Messages.getString(...Skip) but can be extended to add more details.
      Specified by:
      getSkipTurnButtonLabel in class AttackPhaseDisplay
      Returns:
      text for label
    • setButtons

      protected void setButtons()
      Description copied from class: StatusBarPhaseDisplay
      set button that should be displayed.
      Specified by:
      setButtons in class StatusBarPhaseDisplay
    • setButtonsTooltips

      protected void setButtonsTooltips()
      Description copied from class: StatusBarPhaseDisplay
      set button tool tips that should be displayed.
      Specified by:
      setButtonsTooltips in class StatusBarPhaseDisplay
    • twistLeft

      protected void twistLeft()
    • twistRight

      protected void twistRight()
    • shouldPerformClearKeyCommand

      protected boolean shouldPerformClearKeyCommand()
    • registerKeyCommands

      protected void registerKeyCommands()
      Register all of the CommandActions for this panel display.
    • initializeListeners

      public void initializeListeners()
      Have the panel register itself as a listener wherever it's needed.

      According to IBM it is a major bad no-no to perform these registrations before the constructor finishes, so this function has to be called after the panel is created. Please note, this restriction only applies to listeners for objects that aren't on the panel itself.

    • getButtonList

      protected ArrayList<MegaMekButton> getButtonList()
      Description copied from class: StatusBarPhaseDisplay
      Returns the list of buttons that should be displayed.
      Specified by:
      getButtonList in class StatusBarPhaseDisplay
    • ready

      public void ready()
      Description copied from class: AbstractPhaseDisplay
      Tells the display to finish the current player turn and send all planned actions to the server. Planned actions are e.g. movement, attacks or deployment. Usually, the planned actions are all actions that, together, make up a single unit's turn, e.g. all weapon attacks of one unit.
      Specified by:
      ready in class AbstractPhaseDisplay
    • updateDisplayForPendingAttack

      public void updateDisplayForPendingAttack(Mounted<?> mounted, WeaponAttackAction waa)
      Worker function that handles setting associated ammo and other bookkeeping/UI updates for a pending weapon attack action.
    • clearAttacks

      protected void clearAttacks()
      Removes all current fire
      Overrides:
      clearAttacks in class AttackPhaseDisplay
    • target

      public void target(Targetable t)
      Targets something
    • updateTarget

      public void updateTarget()
      Targets something
    • hexMoused

      public void hexMoused(BoardViewEvent b)
      Description copied from interface: BoardViewListener
      Sent when user clicks, double clicks or drags hex.
      Specified by:
      hexMoused in interface BoardViewListener
      Overrides:
      hexMoused in class AbstractPhaseDisplay
      Parameters:
      b - an event
    • hexSelected

      public void hexSelected(BoardViewEvent b)
      Description copied from interface: BoardViewListener
      Sent when Hex is selected through a call to the select method (this is not a mouse click event, although many mouse clicks lead to the hex being selected).
      Specified by:
      hexSelected in interface BoardViewListener
      Overrides:
      hexSelected in class AbstractPhaseDisplay
      Parameters:
      b - The select event
      See Also:
    • gameTurnChange

      public void gameTurnChange(GameTurnChangeEvent e)
      Specified by:
      gameTurnChange in interface GameListener
      Overrides:
      gameTurnChange in class AbstractPhaseDisplay
    • gamePhaseChange

      public void gamePhaseChange(GamePhaseChangeEvent e)
      Specified by:
      gamePhaseChange in interface GameListener
      Overrides:
      gamePhaseChange in class AbstractPhaseDisplay
    • actionPerformed

      public void actionPerformed(ActionEvent ev)
      Specified by:
      actionPerformed in interface ActionListener
    • doClearWeaponJam

      protected void doClearWeaponJam()
      clear weapon jam
    • setTwistEnabled

      protected void setTwistEnabled(boolean enabled)
    • setFlipMountEnabled

      protected void setFlipMountEnabled(boolean enabled)
      Description copied from class: AttackPhaseDisplay
      Enables or disables the Flip Mount button. The default is a no-op; displays that provide the button override this to toggle their own button and menu item.
      Overrides:
      setFlipMountEnabled in class AttackPhaseDisplay
      Parameters:
      enabled - whether the Flip Mount button should be enabled
    • setRotateTurretEnabled

      protected void setRotateTurretEnabled(boolean enabled)
      Description copied from class: AttackPhaseDisplay
      Enables or disables the Rotate Turret button. The default is a no-op; displays that provide the button override this to toggle their own button and menu item.
      Overrides:
      setRotateTurretEnabled in class AttackPhaseDisplay
      Parameters:
      enabled - whether the Rotate Turret button should be enabled
    • setRotateRearTurretEnabled

      protected void setRotateRearTurretEnabled(boolean enabled)
      Description copied from class: AttackPhaseDisplay
      Enables or disables the second Rotate Turret button (the rear turret of a dual-turret vehicle). The default is a no-op; displays that provide the button override this to toggle their own button and menu item.
      Overrides:
      setRotateRearTurretEnabled in class AttackPhaseDisplay
      Parameters:
      enabled - whether the rear-turret rotate button should be enabled
    • setRotateTurretLabel

      protected void setRotateTurretLabel(boolean dualTurretTank)
      Description copied from class: AttackPhaseDisplay
      Relabels the Rotate Turret button for the selected unit: on a dual-turret vehicle it reads "Rotate Fr. Turret" (the second button covers the rear turret); on every other unit it reads the plain "Rotate Turret". The default is a no-op; displays that provide the button override this.
      Overrides:
      setRotateTurretLabel in class AttackPhaseDisplay
      Parameters:
      dualTurretTank - true when the selected unit is a dual-turret vehicle
    • refreshTargetAfterMountChange

      protected void refreshTargetAfterMountChange()
      Refreshes the targeting-phase target panel after a Directional Torso Mount arc change. See AttackPhaseDisplay.flipDirectionalMount(), which drives the shared flip logic.
      Overrides:
      refreshTargetAfterMountChange in class AttackPhaseDisplay
    • declareSecondaryFacing

      protected void declareSecondaryFacing(int facing)
      Declares a torso/turret twist to the given facing through the targeting-phase twist path, used by the Rotate Turret dialog for vehicle main turrets. See AttackPhaseDisplay.rotateSelectedMount().
      Overrides:
      declareSecondaryFacing in class AttackPhaseDisplay
      Parameters:
      facing - the absolute facing (0-5) to twist to
    • clear

      public void clear()
      Description copied from class: StatusBarPhaseDisplay
      Clears the actions of this phase. Called usually when the ESC key is pressed.
      Specified by:
      clear in class StatusBarPhaseDisplay
    • finishedMovingUnits

      public void finishedMovingUnits(BoardViewEvent b)
      Description copied from interface: BoardViewListener
      Sent when moving units is finished.
      Specified by:
      finishedMovingUnits in interface BoardViewListener
      Overrides:
      finishedMovingUnits in class AbstractPhaseDisplay
      Parameters:
      b - an event
    • unitSelected

      public void unitSelected(BoardViewEvent b)
      Description copied from interface: BoardViewListener
      Sent when Unit is selected.
      Specified by:
      unitSelected in interface BoardViewListener
      Overrides:
      unitSelected in class AbstractPhaseDisplay
      Parameters:
      b - an event
    • removeAllListeners

      public void removeAllListeners()
      Description copied from interface: Distractable
      Stop just ignoring events and actually stop listening to them.
      Specified by:
      removeAllListeners in interface Distractable
      Overrides:
      removeAllListeners in class ActionPhaseDisplay
    • valueChanged

      public void valueChanged(ListSelectionEvent event)
      Specified by:
      valueChanged in interface ListSelectionListener