Class PreserveStateAddon
java.lang.Object
com.flowingcode.vaadin.addons.xterm.PreserveStateAddon
- All Implemented Interfaces:
ITerminal,ITerminalOptions,Serializable
Add-on which preserves the client-side state when the component is removed
from the UI then reattached later on. The problem here is that when the
XTerm server-side component is detached from the UI, the xterm.js client-side
component is destroyed along with its state. When the XTerm component
is later re-attached to the UI, a new unconfigured xterm.js is created on the
client-side.
To use this addon, simply create the addon then make sure to call all ITerminal
and ITerminalOptions methods via this addon:
final XTerm xterm = new XTerm();
final PreserveStateAddon addon = new PreserveStateAddon(xterm);
addon.writeln("Hello!");
addon.setPrompt("$ ");
addon.writePrompt();
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.flowingcode.vaadin.addons.xterm.ITerminalOptions
ITerminalOptions.BellStyle, ITerminalOptions.CursorStyle, ITerminalOptions.FastScrollModifier, ITerminalOptions.RendererType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidblur()Unfocus the terminal.voidclear()Clear the entire buffer, making the prompt line the new first line.voidClears the current terminal selection.voidfocus()Focus the terminal.Gets the terminal's current selection, this is useful for implementing copy behavior outside of xterm.js.getXTerm()Gets whether the terminal has an active selection.voidWrites text to the terminal, performing the necessary transformations for pasted text.voidrefresh(int start, int end) Tells the renderer to refresh terminal content between two rows (inclusive) at the next opportunity.voidreset()Perform a full reset (RIS, aka '\x1bc').voidresize(int columns, int rows) Resizes the terminal.voidscrollLines(int amount) Scroll the display of the terminalvoidscrollPages(int pageCount) Scroll the display of the terminal by a number of pages.voidScrolls the display of the terminal to the bottom.voidscrollToLine(int line) Scrolls to a line within the buffer.voidScrolls the display of the terminal to the top.voidselect(int column, int row, int length) Selects text within the terminal.voidSelects all text within the terminal.voidselectLines(int start, int end) Selects text in the buffer between 2 lines.voidvoidWrite data to the terminal.voidWrites data to the terminal, followed by a break line character (\n).voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.flowingcode.vaadin.addons.xterm.ITerminalOptions
setBellSound, setBellStyle, setCursorBlink, setCursorStyle, setCursorWidth, setDrawBoldTextInBrightColors, setFastScrollModifier, setFastScrollSensitivity, setFontFamily, setFontSize, setFontWeight, setFontWeightBold, setLetterSpacing, setLineHeight, setMacOptionClickForcesSelection, setMacOptionIsMeta, setMinimumContrastRatio, setRendererType, setRightClickSelectsWord, setScreenReaderMode, setScrollback, setScrollSensitivity, setTabStopWidth, setTheme, setWordSeparator
-
Constructor Details
-
PreserveStateAddon
-
-
Method Details
-
blur
public void blur()Description copied from interface:ITerminalUnfocus the terminal. -
focus
public void focus()Description copied from interface:ITerminalFocus the terminal. -
hasSelection
Description copied from interface:ITerminalGets whether the terminal has an active selection.- Specified by:
hasSelectionin interfaceITerminal
-
getSelection
Description copied from interface:ITerminalGets the terminal's current selection, this is useful for implementing copy behavior outside of xterm.js.- Specified by:
getSelectionin interfaceITerminal
-
clearSelection
public void clearSelection()Description copied from interface:ITerminalClears the current terminal selection.- Specified by:
clearSelectionin interfaceITerminal
-
select
public void select(int column, int row, int length) Description copied from interface:ITerminalSelects text within the terminal. -
selectAll
public void selectAll()Description copied from interface:ITerminalSelects all text within the terminal. -
selectLines
public void selectLines(int start, int end) Description copied from interface:ITerminalSelects text in the buffer between 2 lines.- Specified by:
selectLinesin interfaceITerminal- Parameters:
start- The 0-based line index to select from (inclusive).end- The 0-based line index to select to (inclusive).
-
scrollLines
public void scrollLines(int amount) Description copied from interface:ITerminalScroll the display of the terminal- Specified by:
scrollLinesin interfaceITerminal- Parameters:
amount- The number of lines to scroll down (negative scroll up).
-
scrollPages
public void scrollPages(int pageCount) Description copied from interface:ITerminalScroll the display of the terminal by a number of pages.- Specified by:
scrollPagesin interfaceITerminal- Parameters:
pageCount- The number of pages to scroll (negative scrolls up).
-
scrollToTop
public void scrollToTop()Description copied from interface:ITerminalScrolls the display of the terminal to the top.- Specified by:
scrollToTopin interfaceITerminal
-
scrollToBottom
public void scrollToBottom()Description copied from interface:ITerminalScrolls the display of the terminal to the bottom.- Specified by:
scrollToBottomin interfaceITerminal
-
scrollToLine
public void scrollToLine(int line) Description copied from interface:ITerminalScrolls to a line within the buffer.- Specified by:
scrollToLinein interfaceITerminal- Parameters:
line- The 0-based line index to scroll to.
-
clear
public void clear()Description copied from interface:ITerminalClear the entire buffer, making the prompt line the new first line. -
write
Description copied from interface:ITerminalWrite data to the terminal. -
writeln
Description copied from interface:ITerminalWrites data to the terminal, followed by a break line character (\n). -
paste
Description copied from interface:ITerminalWrites text to the terminal, performing the necessary transformations for pasted text. -
refresh
public void refresh(int start, int end) Description copied from interface:ITerminalTells the renderer to refresh terminal content between two rows (inclusive) at the next opportunity. -
reset
public void reset()Description copied from interface:ITerminalPerform a full reset (RIS, aka '\x1bc'). -
resize
public void resize(int columns, int rows) Description copied from interface:ITerminalResizes the terminal. Set the number of columns and rows in the terminal. -
setPrompt
-
getPrompt
-
writePrompt
public void writePrompt() -
getScrollbackBuffer
-
getXTerm
-