Package adams.terminal.core
Class LogTextBox
- java.lang.Object
-
- com.googlecode.lanterna.gui2.AbstractComponent<T>
-
- com.googlecode.lanterna.gui2.AbstractInteractableComponent<com.googlecode.lanterna.gui2.TextBox>
-
- com.googlecode.lanterna.gui2.TextBox
-
- adams.terminal.core.LogTextBox
-
- All Implemented Interfaces:
com.googlecode.lanterna.gui2.Component,com.googlecode.lanterna.gui2.Interactable,com.googlecode.lanterna.gui2.TextGUIElement
public class LogTextBox extends com.googlecode.lanterna.gui2.TextBoxSimple log text box.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description LogTextBox()Default constructor, this creates a single-lineLogTextBoxof size 10 which is initially emptyLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize)Creates a new emptyLogTextBoxwith a specific sizeLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, com.googlecode.lanterna.gui2.TextBox.Style style)Creates a new emptyLogTextBoxwith a specific size and styleLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent)Creates a new emptyLogTextBoxwith a specific size and initial contentLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent, com.googlecode.lanterna.gui2.TextBox.Style style)Main constructor of theLogTextBoxwhich decides size, initial content and styleLogTextBox(String initialContent)Constructor that creates aLogTextBoxwith an initial content and attempting to be big enough to display the whole text at once without scrollbarsLogTextBox(String initialContent, com.googlecode.lanterna.gui2.TextBox.Style style)Creates aLogTextBoxthat has an initial content and attempting to be big enough to display the whole text at once without scrollbars.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.googlecode.lanterna.gui2.TextBoxaddLine(String line)Adds a single line to theTextBoxat the end, this only works when in multi-line modevoidappend(adams.core.logging.LoggingLevel level, String msg)Appends the given string.voidclear()Clears the log.-
Methods inherited from class com.googlecode.lanterna.gui2.TextBox
createDefaultRenderer, getCaretPosition, getLine, getLineCount, getMask, getRenderer, getText, getTextOrDefault, handleKeyStroke, isCaretWarp, isHorizontalFocusSwitching, isReadOnly, isVerticalFocusSwitching, setCaretPosition, setCaretPosition, setCaretWarp, setHorizontalFocusSwitching, setMask, setReadOnly, setText, setValidationPattern, setVerticalFocusSwitching
-
Methods inherited from class com.googlecode.lanterna.gui2.AbstractInteractableComponent
afterEnterFocus, afterLeaveFocus, getCursorLocation, getInputFilter, handleInput, isEnabled, isFocusable, isFocused, onEnterFocus, onLeaveFocus, setEnabled, setInputFilter, takeFocus
-
Methods inherited from class com.googlecode.lanterna.gui2.AbstractComponent
addTo, calculatePreferredSize, draw, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, invalidate, isInside, isInvalid, onAdded, onAfterDrawing, onBeforeDrawing, onRemoved, runOnGUIThreadIfExistsOtherwiseRunDirect, self, setLayoutData, setPosition, setPreferredSize, setRenderer, setSize, setTheme, toBasePane, toGlobal, withBorder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.googlecode.lanterna.gui2.Component
addTo, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, invalidate, isInside, onAdded, onRemoved, setLayoutData, setPosition, setPreferredSize, setSize, setTheme, toBasePane, toGlobal, withBorder
-
-
-
-
Constructor Detail
-
LogTextBox
public LogTextBox()
Default constructor, this creates a single-lineLogTextBoxof size 10 which is initially empty
-
LogTextBox
public LogTextBox(String initialContent)
Constructor that creates aLogTextBoxwith an initial content and attempting to be big enough to display the whole text at once without scrollbars- Parameters:
initialContent- Initial content of theLogTextBox
-
LogTextBox
public LogTextBox(String initialContent, com.googlecode.lanterna.gui2.TextBox.Style style)
Creates aLogTextBoxthat has an initial content and attempting to be big enough to display the whole text at once without scrollbars.- Parameters:
initialContent- Initial content of theLogTextBoxstyle- Forced style instead of auto-detecting
-
LogTextBox
public LogTextBox(com.googlecode.lanterna.TerminalSize preferredSize)
Creates a new emptyLogTextBoxwith a specific size- Parameters:
preferredSize- Size of theLogTextBox
-
LogTextBox
public LogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, com.googlecode.lanterna.gui2.TextBox.Style style)Creates a new emptyLogTextBoxwith a specific size and style- Parameters:
preferredSize- Size of theLogTextBoxstyle- Style to use
-
LogTextBox
public LogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent)Creates a new emptyLogTextBoxwith a specific size and initial content- Parameters:
preferredSize- Size of theLogTextBoxinitialContent- Initial content of theLogTextBox
-
LogTextBox
public LogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent, com.googlecode.lanterna.gui2.TextBox.Style style)Main constructor of theLogTextBoxwhich decides size, initial content and style- Parameters:
preferredSize- Size of theLogTextBoxinitialContent- Initial content of theLogTextBoxstyle- Style to use for thisLogTextBox, instead of auto-detecting
-
-
Method Detail
-
append
public void append(adams.core.logging.LoggingLevel level, String msg)Appends the given string.- Parameters:
level- the logging levelmsg- the message to append
-
addLine
public com.googlecode.lanterna.gui2.TextBox addLine(String line)
Adds a single line to theTextBoxat the end, this only works when in multi-line mode- Overrides:
addLinein classcom.googlecode.lanterna.gui2.TextBox- Parameters:
line- Line to add at the end of the content in thisTextBox- Returns:
- Itself
-
clear
public void clear()
Clears the log.
-
-