Package VASSAL.build.module
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBasicLogger.LogCommandclassBasicLogger.StepActionclassBasicLogger.UndoAction -
Field Summary
Fields Modifier and Type Field Description static StringBEGINprotected CommandbeginningStatestatic StringENDprotected ActionendLogActionstatic StringLOGprotected List<Command>logInputprotected List<Command>logOutputprotected SaveMetaDatametadataprotected ActionnewLogActionprotected intnextInputprotected intnextUndoprotected FileoutputFilestatic StringPROMPT_LOG_COMMENTstatic StringPROMPT_NEW_LOGstatic StringPROMPT_NEW_LOG_ENDstatic StringPROMPT_NEW_LOG_STARTprotected static StringSTEP_ICONprotected ActionstepActionprotected static StringUNDO_ICONprotected ActionundoAction -
Constructor Summary
Constructors Constructor Description BasicLogger() -
Method Summary
Modifier and Type Method Description voidadd(Buildable b)Adds a child component.voidaddTo(Buildable b)Expects to be added to aGameModule.protected voidbeginOutput()voidbuild(Element e)Build the objectCommanddecode(String command)Translate a String into aCommandvoidenableDrawing(boolean show)Stringencode(Command c)Recognizes a logging command.ElementgetBuildElement(Document doc)CommandgetRestoreCommand()When saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullbooleanhasMoreCommands()Are there Input Steps yet to be replayed?booleanisLogging()booleanisReplaying()voidlog(Command c)voidqueryNewLogFile(boolean atStart)voidremove(Buildable b)voidsetup(boolean show)Notify the GameComponent that a game has started/endedprotected voidstep()protected voidundo()voidwrite()Write the logfile to a file.
-
Field Details
-
BEGIN
- See Also:
- Constant Field Values
-
END
- See Also:
- Constant Field Values
-
LOG
- See Also:
- Constant Field Values
-
PROMPT_NEW_LOG
- See Also:
- Constant Field Values
-
PROMPT_NEW_LOG_START
- See Also:
- Constant Field Values
-
PROMPT_NEW_LOG_END
- See Also:
- Constant Field Values
-
PROMPT_LOG_COMMENT
- See Also:
- Constant Field Values
-
STEP_ICON
- See Also:
- Constant Field Values
-
UNDO_ICON
- See Also:
- Constant Field Values
-
logInput
-
logOutput
-
nextInput
protected int nextInput -
nextUndo
protected int nextUndo -
beginningState
-
outputFile
-
stepAction
-
metadata
-
undoAction
-
endLogAction
-
newLogAction
-
-
Constructor Details
-
BasicLogger
public BasicLogger()
-
-
Method Details
-
build
Description copied from interface:BuildableBuild the object -
addTo
Expects to be added to aGameModule. AddsUndo,Step, andEnd Logbuttons to the the control window toolbar. RegistersKeyStrokeListeners for hotkey equivalents of each button. -
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Returns:
- an XML element from which this component can be built
-
add
Description copied from interface:BuildableAdds a child component. Both this method andBuildable.addTo(VASSAL.build.Buildable)are invoked when adding a child to a parent -
remove
-
setup
public void setup(boolean show)Description copied from interface:GameComponentNotify the GameComponent that a game has started/ended- Specified by:
setupin interfaceGameComponent- 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
Description copied from interface:GameComponentWhen saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommandin interfaceGameComponent
-
enableDrawing
public void enableDrawing(boolean show) -
step
protected void step() -
queryNewLogFile
public void queryNewLogFile(boolean atStart) -
write
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
-
hasMoreCommands
public boolean hasMoreCommands()Are there Input Steps yet to be replayed? -
encode
Recognizes a logging command. The logging command is a wrapper around an ordinaryCommandindicating that the wrapped command should be stored and executed in sequence (when theStepbutton is pressed)- Specified by:
encodein interfaceCommandEncoder
-
decode
Description copied from interface:CommandEncoderTranslate a String into aCommand- Specified by:
decodein interfaceCommandEncoder
-