Class PrivateMap

All Implemented Interfaces:
DropTargetListener, MouseListener, MouseMotionListener, PropertyChangeListener, EventListener, AutoConfigurable, Buildable, Configurable, GameComponent, PlayerRoster.SideChangeListener, MutablePropertiesContainer, PropertyNameSource, PropertySource, ComponentDescription, ValidityChecker, Translatable, Auditable, ImageSearchTarget, SearchTarget, ToolBarComponent, UniqueIdManager.Identifyable
Direct Known Subclasses:
PlayerHand

public class PrivateMap extends Map
A Map that may be configured to be visible only a particular side. If visible to all, the map will respond to key/mouse events only from the player playing the assigned side
  • Field Details

  • Constructor Details

    • PrivateMap

      public PrivateMap()
  • Method Details

    • getAttributeNames

      public String[] getAttributeNames()
      Description copied from class: Map
      Lists all the buildFile (XML) attribute names for this component. If this component is ALSO an AbstractConfigurable, then this list of attributes determines the appropriate attribute order for AbstractConfigurable.getAttributeDescriptions() and AbstractConfigurable.getAttributeTypes().
      Specified by:
      getAttributeNames in interface AutoConfigurable
      Overrides:
      getAttributeNames in class Map
      Returns:
      a list of all buildFile (XML) attribute names for this component
      See Also:
    • getAttributeDescriptions

      public String[] getAttributeDescriptions()
      Description copied from class: AbstractToolbarItem
      This getAttributeDescriptions() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeDescriptions(), key1, ..., keyN), or supply their own order from scratch.
      Specified by:
      getAttributeDescriptions in interface AutoConfigurable
      Overrides:
      getAttributeDescriptions in class Map
      Returns:
      an array of Strings describing the buildFile (XML) attributes of this component. These strings are used as prompts in the Properties window for this object, when the component is configured in the Editor. The order of descriptions should be the same as the order of names in AbstractBuildable.getAttributeNames()
      See Also:
    • getAttributeTypes

      public Class<?>[] getAttributeTypes()
      Description copied from class: AbstractToolbarItem
      This getAttributeTypes() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeTypes(), key1, ..., keyN), or supply their own order from scratch.
      Specified by:
      getAttributeTypes in interface AutoConfigurable
      Overrides:
      getAttributeTypes in class Map
      Returns:
      the Class for the buildFile (XML) attributes of this component. Valid classes include: String, Integer, Double, Boolean, Image, Color, and KeyStroke, along with any class for which a Configurer exists in VASSAL.configure. The class determines, among other things, which type of AutoConfigurer will be used to configure the attribute when the object is configured in the Editor. The order of classes should be the same as the order of names in AbstractBuildable.getAttributeNames()
      See Also:
    • setAttribute

      public void setAttribute(String key, Object value)
      Description copied from class: Map
      Sets a buildFile (XML) attribute value for this component.
      Specified by:
      setAttribute in interface AutoConfigurable
      Specified by:
      setAttribute in interface Translatable
      Overrides:
      setAttribute in class Map
      Parameters:
      key - the name of the attribute. Will be one of those listed in Map.getAttributeNames()
      value - If the value parameter is a String, it will be the value returned by Map.getAttributeValueString(java.lang.String) for the same key. Since Map extends AbstractConfigurable, then value can also be an instance of the corresponding Class listed in Map.getAttributeTypes().
    • getAttributeValueString

      public String getAttributeValueString(String key)
      Description copied from class: AbstractToolbarItem
      Classes extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.
      Specified by:
      getAttributeValueString in interface AutoConfigurable
      Specified by:
      getAttributeValueString in interface Translatable
      Overrides:
      getAttributeValueString in class Map
      Parameters:
      key - the name of the attribute. Will be one of those listed in Map.getAttributeNames()
      Returns:
      a String representation of the XML buildFile attribute with the given name. When initializing a module, this String value will loaded from the XML and passed to Map.setAttribute(java.lang.String, java.lang.Object). It is also frequently used for checking the current value of an attribute.
    • getView

      public JComponent getView()
      Yes this LOOKS exactly the same as the method it overrides, but confusingly Map and PrivateMap each have *different* View classes sharing the same name.
      Overrides:
      getView in class Map
      Returns:
      the Swing component representing the private map
    • createParentFrame

      protected Window createParentFrame()
      Description copied from class: Map
      Creates the top-level window for this map. Could be a JDialog or a JFrame depending on whether we are set to use a single window or have our own window.
      Overrides:
      createParentFrame in class Map
      Returns:
      the top-level window containing this map
    • sideChanged

      public void sideChanged(String oldSide, String newSide)
      Description copied from class: Map
      Takes action when the local player has switched sides. Because Map implements PlayerRoster.SideChangeListener, this method will automatically be called whenever the local player switches sides.
      Specified by:
      sideChanged in interface PlayerRoster.SideChangeListener
      Overrides:
      sideChanged in class Map
      Parameters:
      oldSide - side the local player is switching away from
      newSide - side the local player is switching to
    • shouldDockIntoMainWindow

      public boolean shouldDockIntoMainWindow()
      Description copied from class: Map
      If this map shows with its own special button, it does not dock into the main window. Likewise if we have no combined window setting. Otherwise the *first* non-button-launched map we find will be the one we dock.
      Overrides:
      shouldDockIntoMainWindow in class Map
      Returns:
      whether this map should dock into the main window
    • isAccessibleTo

      public boolean isAccessibleTo(String playerSide)
      Return true if the player playing the given side can access this map
      See Also:
    • isVisibleTo

      public boolean isVisibleTo(String playerSide)
    • setup

      public void setup(boolean show)
      Description copied from class: Map
      When a game is started, create a top-level window, if none exists. When a game is ended, remove all boards from the map.
      Specified by:
      setup in interface GameComponent
      Overrides:
      setup in class Map
      Parameters:
      show - true if a game is starting, false if a game is ending
      See Also:
    • setBoards

      public void setBoards(Collection<Board> c)
      Description copied from class: Map
      Set the boards for this map. Each map may contain more than one Board.
      Overrides:
      setBoards in class Map
      Parameters:
      c - Collection of Boards to be used.
    • getConfigureTypeName

      public static String getConfigureTypeName()
    • getHelpFile

      public HelpFile getHelpFile()
      Specified by:
      getHelpFile in interface Configurable
      Overrides:
      getHelpFile in class Map
      Returns:
      a HelpFile describing how to use and configure this component
    • build

      public void build(Element el)
      Description copied from class: Map
      Builds the map's component hierarchy from a given XML element, or a null one is given initializes a brand new default "new map" hierarchy.
      Specified by:
      build in interface Buildable
      Overrides:
      build in class Map
      Parameters:
      el - XML element to build from, or null to build the default hierarchy for a brand new Map