Class ClientTextRenderer
java.lang.Object
za.co.wethinkcode.robots.rendering.Renderer
za.co.wethinkcode.robots.rendering.TextRenderer
za.co.wethinkcode.robots.rendering.ClientTextRenderer
This class encapsulates all rendering behavior on the client
Most methods contained in this class are void methods that print statements to render the TUI
All of these are designed to be pure render methods, causing no state mutations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic DebugLevelStandard debug level unless reassignedstatic OutputStreamStandard output unless reassignedstatic StringFields inherited from class za.co.wethinkcode.robots.rendering.Renderer
GUI_WINDOW -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclientCausedError(String message) Rendering designed for notifying the user that they have made an errorstatic StringformatBotSelection(Memory mem) static StringformatLastResponse(RequestResponse reqResp) Format the last response the client received to be pretty printedstatic StringformatLook(com.google.gson.JsonObject lookResult) static voidhelpfulMessage(String message) static StringprettyJsonFormat(String message) Take in a raw unparsed string and prettify itstatic voidpromptInput(String message) Rendering designed for prompting an input from the userstatic voidrenderBotSelection(Memory mem) static voidSimple Styled closingstatic voidserverCausedError(String message) Rendering designed for notifying the user that an error occurred on the serverstatic voidsetDbg(DebugLevel dbg) static StringstyleMemory(Memory memory) Stylistically similar to amemory.toString()static voidstylishInfo(String message) Rendering for info that is otherwise styledstatic voidstylishInfo(String message, String symbol) Overload of styled text with a custom symbolstatic voidstylishInfo(String message, String symbol, Object configurable, Ansi_Styling configurableStyle) The complete implementation that overloads call.static voiduserCausedError(String message) Rendering designed for notifying the user that they have made an errorstatic voidworldPrint(String worldString) Methods inherited from class za.co.wethinkcode.robots.rendering.TextRenderer
customPrintln, customPrintln, logWorldCreation, newRobotConnectionReceivedCopy, renderANetworkMessage, renderAnInternalDebugMessage, renderAnInternalDebugMessage, renderAnInternalErrorMessage, renderAnInternalErrorMessage, renderMessage, renderMessageMethods inherited from class za.co.wethinkcode.robots.rendering.Renderer
updateRenderer
-
Field Details
-
RENDER_OUTPUT
Standard output unless reassigned -
dbg
Standard debug level unless reassigned -
RESET
-
-
Constructor Details
-
ClientTextRenderer
public ClientTextRenderer()
-
-
Method Details
-
prettyJsonFormat
Take in a raw unparsed string and prettify it- Parameters:
message- the raw string being prettified
-
helpfulMessage
-
renderClosing
public static void renderClosing()Simple Styled closing -
promptInput
Rendering designed for prompting an input from the user- Parameters:
message- the input being asked for
-
userCausedError
Rendering designed for notifying the user that they have made an error- Parameters:
message- the error message for them to read
-
clientCausedError
Rendering designed for notifying the user that they have made an error- Parameters:
message- the error message for them to read
-
serverCausedError
Rendering designed for notifying the user that an error occurred on the server- Parameters:
message- the error message for them to read
-
stylishInfo
Rendering for info that is otherwise styled- Parameters:
message- the info being rendered
-
stylishInfo
Overload of styled text with a custom symbol -
stylishInfo
public static void stylishInfo(String message, String symbol, Object configurable, Ansi_Styling configurableStyle) The complete implementation that overloads call. Allows a custom symbol, as well as a configurable ansi style- Parameters:
message- the info being rendered
-
worldPrint
-
styleMemory
Stylistically similar to amemory.toString()- Parameters:
memory- the memory instance being styled- Returns:
- string version of a styled memory
-
formatLastResponse
Format the last response the client received to be pretty printed- Parameters:
reqResp- the last completed request response flow- Returns:
- a formatted and renderable string representation
-
formatLook
-
renderBotSelection
-
formatBotSelection
-
setDbg
-