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.TextBox
Simple 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-lineLogTextBox
of size 10 which is initially emptyLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize)
Creates a new emptyLogTextBox
with a specific sizeLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, com.googlecode.lanterna.gui2.TextBox.Style style)
Creates a new emptyLogTextBox
with a specific size and styleLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent)
Creates a new emptyLogTextBox
with a specific size and initial contentLogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent, com.googlecode.lanterna.gui2.TextBox.Style style)
Main constructor of theLogTextBox
which decides size, initial content and styleLogTextBox(String initialContent)
Constructor that creates aLogTextBox
with 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 aLogTextBox
that 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.TextBox
addLine(String line)
Adds a single line to theTextBox
at the end, this only works when in multi-line modevoid
append(adams.core.logging.LoggingLevel level, String msg)
Appends the given string.void
clear()
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-lineLogTextBox
of size 10 which is initially empty
-
LogTextBox
public LogTextBox(String initialContent)
Constructor that creates aLogTextBox
with 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 aLogTextBox
that has an initial content and attempting to be big enough to display the whole text at once without scrollbars.- Parameters:
initialContent
- Initial content of theLogTextBox
style
- Forced style instead of auto-detecting
-
LogTextBox
public LogTextBox(com.googlecode.lanterna.TerminalSize preferredSize)
Creates a new emptyLogTextBox
with 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 emptyLogTextBox
with a specific size and style- Parameters:
preferredSize
- Size of theLogTextBox
style
- Style to use
-
LogTextBox
public LogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent)
Creates a new emptyLogTextBox
with a specific size and initial content- Parameters:
preferredSize
- Size of theLogTextBox
initialContent
- Initial content of theLogTextBox
-
LogTextBox
public LogTextBox(com.googlecode.lanterna.TerminalSize preferredSize, String initialContent, com.googlecode.lanterna.gui2.TextBox.Style style)
Main constructor of theLogTextBox
which decides size, initial content and style- Parameters:
preferredSize
- Size of theLogTextBox
initialContent
- Initial content of theLogTextBox
style
- 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 theTextBox
at the end, this only works when in multi-line mode- Overrides:
addLine
in 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.
-
-