Class Marker

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public final class Marker extends Chit
Class Marker implements the GUI for a legion marker. TODO this really represents a whole legion (since it shows the height), so it probably should store a Legion object instead of the marker ID TODO after carve out of GUI stuff Marker should probably not be accessed by client at all - need cleanup with Legion ?
Author:
David Ripton
See Also:
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • legion

      private final Legion legion
    • showHeight

      private final boolean showHeight
    • font

      private Font font
    • fontHeight

      private int fontHeight
    • fontWidth

      private int fontWidth
    • hexLabel

      String hexLabel
    • highlight

      private boolean highlight
  • Constructor Details

    • Marker

      Marker(Legion legion, int scale, String id)
      Construct a marker without a client. Use this constructor as a bit of documentation when explicitly not wanting a height drawn on the Marker. Use case: The dialogs where legion height is not so important or legion does not even exist (PickMarker, SplitLegion, in RevealEvent for the destroyed legion)
    • Marker

      Marker(Legion legion, int scale, String id, boolean inverted, Client client)
      Construct a marker with a client (to be able to ask for doNotInvertOption) but showHeight set to false and specified inverted display (for defender) Use case: Marker on the battle map
      Parameters:
      client - A client, only used to ask for options
    • Marker

      Marker(Legion legion, int scale, String id, Client client, boolean showHeight)
      Construct a marker where height is shown - will be asked from legion. Sometimes (on the master board, for example) heights should be shown, and sometimes (in some dialogs, especially when there is no real legion behind it (e.g. pickMarker, splitLegion)) they should be omitted (or cannot even be asked). Use case: Mostly MasterBoard and some dialogs where height is interesting: Concede/Flee, Negotiate and replyToProposal
      Parameters:
      client - A client, only used to ask for options
    • Marker

      private Marker(Legion legion, int scale, String id, Client client, boolean inverted, boolean showHeight)
      Construct a marker
      Parameters:
      id - the marker label (like Bk05 or Bk05-Green)
      inverted - set to true (defender legion) will normally invert the marker but NOT if doNotInvertDefender option is true
      showHeight - set true will add the height of the stack
  • Method Details

    • setLocation

      void setLocation(Point point, String hexLabel)
      this is only used by Battle markers marking entrances.
    • highlightMarker

      void highlightMarker()
    • resetMarkerHighlight

      void resetMarkerHighlight()
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class Chit