Package com.calebleavell.jatui.modules
Class TextModule
java.lang.Object
com.calebleavell.jatui.modules.TUIModule
com.calebleavell.jatui.modules.TextModule
Handles the displaying of text. Usually this means displaying to console (
System.out), but
TUIModule.Builder.printStream(PrintStream) can be used to output to other places as well.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forTextInputModule.static enumDefines the behavior of theTextModule, specifically whether it displays raw text or fetches application state.Nested classes/interfaces inherited from class com.calebleavell.jatui.modules.TUIModule
TUIModule.Property -
Field Summary
Fields inherited from class com.calebleavell.jatui.modules.TUIModule
DEFAULT_SCANNER, logger, restart, UNNAMED_ERROR -
Constructor Summary
ConstructorsConstructorDescriptionTextModule(TextModule.Builder builder) Constructs a newTextModulebased on the configuration of theTextModule.Builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic TextModule.BuilderConstructs a newTextModulebuilder.voidOutputs text via the behavior given byTextModule.OutputType.booleanequals(TextModule other) Checks equality for properties given by the builder.Methods inherited from class com.calebleavell.jatui.modules.TUIModule
getAnsi, getAnsiEnabled, getApplication, getChild, getChild, getChildren, getCurrentRunningBranch, getCurrentRunningChild, getCurrentRunningChild, getName, getPrintStream, getScanner, navigateTo, restart, restartChild, shallowStructuralEquals, start, structuralEquals, terminate, terminateChild, toString, toTreeString, toTreeString
-
Constructor Details
-
TextModule
Constructs a newTextModulebased on the configuration of theTextModule.Builder. Copiestext,printNewLine, andoutputTypefrom the builder.- Parameters:
builder- The builder to construct the new module from.
-
-
Method Details
-
doRunLogic
public void doRunLogic()Outputs text via the behavior given byTextModule.OutputType. Ifapplicationis null andTextModule.OutputTypeisTextModule.OutputType.DISPLAY_APP_STATE, nothing is outputted and a warning is logged.
Also displays the ansi provided byTUIModule.Builder.style(Ansi)unless disabled viaTUIModule.Builder.enableAnsi(boolean). The ansi gets reset at the end of the run.
Prints a new line unless disabled viaTextModule.Builder.printNewLine(boolean).- Specified by:
doRunLogicin classTUIModule
-
equals
Checks equality for properties given by the builder. ForTextModule, this includestext,printNewLine, andoutputType, as well as other requirements provided byTUIModule.structuralEquals(TUIModule). -
builder
Constructs a newTextModulebuilder.- Parameters:
name- The name of the builder.text- The text to either display directly, or the input identifier fetch the input from for theApplicationModuleifTextModule.Builder.outputType(OutputType)is set toTextModule.OutputType.DISPLAY_APP_STATE.- Returns:
- The new builder.
-