Class EngagementResults

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

final class EngagementResults extends KDialog
Post-engagement status dialog. It collects the results of all battles that are send by 'addData()`.
Author:
Towi, David Ripton
  • Field Details

    • oracle

      private IOracle oracle
    • options

      private IOptions options
    • current

      private int current
    • lastSeen

      private int lastSeen
    • engagementLog

      private final List<EngagementResults.Engagement> engagementLog
    • saveWindow

      private final SaveWindow saveWindow
    • firstButton

      private JButton firstButton
    • prevButton

      private JButton prevButton
    • nextButton

      private JButton nextButton
    • lastButton

      private JButton lastButton
    • summaryLabel

      private JLabel summaryLabel
    • resultLabel

      private JLabel resultLabel
    • attackerIdLabel

      private JLabel attackerIdLabel
    • defenderIdLabel

      private JLabel defenderIdLabel
    • panelCenter

      private JPanel panelCenter
    • moveNext

      private boolean moveNext
    • advanceToLast

      private boolean advanceToLast
  • Constructor Details

    • EngagementResults

      EngagementResults(JFrame frame, IOracle oracle, IOptions options)
      Inits the dialog, not opens it.
      Parameters:
      frame - is the parent window
      oracle - gives us information
  • Method Details

    • addData

      void addData(Legion winner, String method, int points, int turns, List<String> attackerStartingContents, List<String> defenderStartingContents, List<Boolean> attackerStartingCertainities, List<Boolean> defenderStartingCertainities, boolean attackersTurn)
      Adds a log record to the list of logged engagements. Now the dialog moves to the new engagement if either - the engagement happens in the attacker's turn - it is the first one after the attacker's turn The idea behind this design is that the dialog content moves along with the player when the player is in charge of the game tempo, but if the player is only passive the engagements stop moving until the player takes control by either continuing to play or by clicking the next button. TODO: see if xxxStartingCertainities can somehow get values of better quality.
      Parameters:
      attackerStartingContents - - imagew names, result from oracle.getLegionImageNames
      defenderStartingContents - - imagew names, result from oracle.getLegionImageNames
      attackerStartingCertainities - - list of Booleans, for overlay ?-marks
      defenderStartingCertainities - - list of Booleans, for overlay ?-marks
      attackersTurn - should be set to true if the engagement happened in the attackers master board turn. The engagement dialog will be moved to this engagement, the same will happen with the next
    • setupGUI

      private void setupGUI()
      like toString into a swing component. the current rough layout is:
        ### Content:BorderLayout ########################
        # +--North:GridLayout(n,1)--------------------+ #
        # | Label_1                                   | #
        # | Label_2                                   | #
        # | ...                                       | #
        # | Label_n                                   | #
        # +-------------------------------------------+ #
        #===============================================#
        # +West:Grid(4,1)-+  %  +-Center:Grid(4,1)----+ #
        # | Label_bef_att |  %  | ImageList_bef_att   | #
        # | Label_bef_def |  %  | ImageList_bef_def   | #
        # | Label_aft_att |  %  | ImageList_aft_att   | #
        # | Label_aft_def |  %  | ImageList_aft_def   | #
        # +---------------+  %  +---------------------+ #
        #===============================================#
        # +-South:FlowLayout(left)--------------------+ #
        # |  -buttons-                                | #
        # +-------------------------------------------+ #
        #################################################
       
    • createLegionComponent

      private Component createLegionComponent(Legion legion, List<String> imageNames, List<Boolean> certainList, boolean isDefender)
    • showCurrent

      private void showCurrent()
    • maybeShow

      void maybeShow()
    • dispose

      public void dispose()
      Overrides:
      dispose in class KDialog
    • setVisible

      public void setVisible(boolean visible)
      Overrides:
      setVisible in class KDialog