Class BasicLogger

java.lang.Object
VASSAL.build.module.BasicLogger
All Implemented Interfaces:
Buildable, GameComponent, CommandEncoder, Logger

public class BasicLogger
extends Object
implements Logger, Buildable, GameComponent, CommandEncoder
  • Field Details

  • Constructor Details

    • BasicLogger

      public BasicLogger()
  • Method Details

    • build

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

      public void addTo​(Buildable b)
      Expects to be added to a GameModule. Adds Undo, Step, and End Log buttons to the the control window toolbar. Registers KeyStrokeListeners for hotkey equivalents of each button.
      Specified by:
      addTo in interface Buildable
    • getBuildElement

      public Element getBuildElement​(Document doc)
      Specified by:
      getBuildElement in interface Buildable
      Returns:
      an XML element from which this component can be built
    • 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
    • remove

      public void remove​(Buildable b)
    • setup

      public void setup​(boolean show)
      Description copied from interface: GameComponent
      Notify the GameComponent that a game has started/ended
      Specified by:
      setup in interface GameComponent
      Parameters:
      show - if true, a game is starting. If false, then a game is ending
    • isLogging

      public boolean isLogging()
    • isReplaying

      public boolean isReplaying()
      Returns:
      true if we're currently replaying a VLOG file, that has unexecuted "step forwards" remaining
    • getRestoreCommand

      public Command getRestoreCommand()
      Description copied from interface: GameComponent
      When saving a game, each GameComponent should return a Command that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null
      Specified by:
      getRestoreCommand in interface GameComponent
    • enableDrawing

      public void enableDrawing​(boolean show)
    • step

      protected void step()
    • queryNewLogFile

      public void queryNewLogFile​(boolean atStart)
    • write

      public void write() throws IOException
      Write the logfile to a file. The file will have been selected when the logfile was begun.
      Throws:
      IOException
    • beginOutput

      protected void beginOutput()
    • undo

      protected void undo()
    • log

      public void log​(Command c)
      Specified by:
      log in interface Logger
    • hasMoreCommands

      public boolean hasMoreCommands()
      Are there Input Steps yet to be replayed?
    • encode

      public String encode​(Command c)
      Recognizes a logging command. The logging command is a wrapper around an ordinary Command indicating that the wrapped command should be stored and executed in sequence (when the Step button is pressed)
      Specified by:
      encode in interface CommandEncoder
    • decode

      public Command decode​(String command)
      Description copied from interface: CommandEncoder
      Translate a String into a Command
      Specified by:
      decode in interface CommandEncoder