Class KeyNamer

java.lang.Object
VASSAL.build.module.KeyNamer
All Implemented Interfaces:
Buildable

public class KeyNamer extends Object implements Buildable
Translates key codes into human-readable strings (e.g. "Backspace"). Exists as a buildable (buildFile element) so that it can be overridden by custom classes
  • Constructor Details

    • KeyNamer

      public KeyNamer()
  • Method Details

    • build

      public void build(Element e)
      Description copied from interface: Buildable
      Build the object from the XML representation of the Buildable
      Specified by:
      build in interface Buildable
      Parameters:
      e - the XML element containing the object data
    • getBuildElement

      public Element getBuildElement(Document doc)
      Specified by:
      getBuildElement in interface Buildable
      Parameters:
      doc - XML file
      Returns:
      an XML element from which this component can be built
    • addTo

      public void addTo(Buildable b)
      Description copied from interface: Buildable
      Adds this component to its parent. In order to make Buildable objects extensible, the child is responsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class.
      Specified by:
      addTo in interface Buildable
      Parameters:
      b - parent Buildable to add this component to as a subcomponent.
    • add

      public void add(Buildable b)
      Description copied from interface: Buildable
      Adds a child component. Both this method and Buildable.addTo(VASSAL.build.Buildable) are invoked when adding a child to a parent
      Specified by:
      add in interface Buildable
      Parameters:
      b - Child to attach to this buildable as a subcomponent
    • getKeyString

      public static String getKeyString(KeyStroke k)
      Implements VASSAL's plain text representation of a KeyStroke.
      Parameters:
      k - - a keystroke (e.g. VK_BACKSPACE) to be rendered as a string
      Returns:
      - a human-readable name for the keystroke (e.g. "Backspace")
    • isMandatory

      public boolean isMandatory()
      Description copied from interface: Buildable
      Is this component a reqired component within its parent?
      Specified by:
      isMandatory in interface Buildable
      Returns:
      true if component is mandatory
    • isUnique

      public boolean isUnique()
      Description copied from interface: Buildable
      Does this component need to be unique within it's parent?
      Specified by:
      isUnique in interface Buildable
      Returns: