public abstract class AbstractConsoleEditor extends Object implements ConsoleEditor, CommandFactory
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_ESCAPE_TIMEOUT |
static String |
DIRTY_SIGN |
static String |
EDITOR_NAME |
static int |
ESCAPE |
static int |
READ_EXPIRED |
CARRIEGE_RETURN, NEW_LINE| Constructor and Description |
|---|
AbstractConsoleEditor(jline.Terminal term) |
| Modifier and Type | Method and Description |
|---|---|
String |
backspace()
Deletes the previous character if exists.
|
protected void |
clearLine()
Clears the current line.
|
void |
close() |
String |
delete()
Deletes the current character, shifting remaining characters one position left.
|
protected void |
displayText(String text)
Displays Text highlighting the text that was marked as highlighted.
|
void |
end()
Moves cursor to the end of the current line.
|
void |
findNext(String str)
Finds the next appearance of the String.
|
void |
findPrevious(String str)
Finds the next appearance of the String.
|
void |
flush() |
int |
getColumn()
Returns the current column.
|
String |
getContent()
Returns the content of the file.
|
String |
getContent(int line)
Returns the content of the file.
|
Editor<String> |
getDelegate() |
String |
getDisplayAs() |
File |
getFile()
Returns the
File being edited. |
int |
getFooterSize()
Returns the size in lines of the footer.
|
int |
getHeaderSize()
Returns the size in lines of the header.
|
jline.console.KeyMap |
getKeys() |
int |
getLine()
Returns the number of the current line.
|
jline.Terminal |
getTerminal()
Returns the
Terminal used by the ConsoleEditor. |
Theme |
getTheme()
Returns the
Theme. |
String |
getTitle()
Returns the
ConsoleEditor title. |
UndoContext |
getUndoContext() |
void |
hide()
Hides the editor screen and restore the
Terminal. |
protected void |
highLight(String text) |
void |
home()
Moves cursor to the end of the current line.
|
void |
init() |
Boolean |
isDirty()
Returns if editor contains 'dirty' data.
|
boolean |
isOpenEnabled()
Checks if the
ConsoleEditor can open new file. |
boolean |
isReadOnly()
Checks if the
ConsoleEditor is set to be read only. |
int |
lines()
Returns the number of lines.
|
void |
mergeLine()
Removes the new line character at the end of the line.
|
void |
move(int line,
int column)
Moves the cursor to the specified line and column.
|
void |
moveDown(int offset)
Moves cursor down.
|
void |
moveLeft(int offset)
Moves cursor left.
|
void |
moveRight(int offset)
Moves cursor left.
|
void |
moveUp(int offset)
Moves cursors up.
|
void |
newLine()
Adds a new line to the current position.
|
void |
onCommand(Command command) |
void |
open(File source)
Opens a file for editing.
|
void |
open(File source,
String displayAs)
Opens a file for editing.
|
void |
put(String str)
Puts the
link to the current position. |
int |
read()
Reads a character from the user input.
|
boolean |
readBoolean()
Reads a boolean from the user input.
|
boolean |
readBoolean(String message,
Boolean defaultValue)
Displays a message and reads a boolean from the user input.
|
String |
readLine()
Reads a line from the user input.
|
String |
readLine(String message)
Displays a message and prompts the user for input.
|
void |
redrawText()
Redraws the text that fits inside the current frame.
|
void |
restoreCursorPosition()
Moves the cursor to the last saved position.
|
void |
save(File target)
Saves the file.
|
void |
saveCursorPosition()
Saves the cursor position.
|
protected void |
scrollDown(int rows) |
protected void |
scrollUp(int rows) |
void |
setDirty(Boolean dirty)
Marks that the editor has unsaved changes.
|
void |
setDisplayAs(String displayAs) |
void |
setFooterSize(int footerSize) |
void |
setHeaderSize(int headerSize) |
void |
setKeys(jline.console.KeyMap keys) |
void |
setOpenEnabled(boolean openEnabled)
Allows/disallows the
ConsoleEditor to open files. |
void |
setReadOnly(boolean readOnly)
Sets/Unsets the
ConsoleEditor to read only mode. |
void |
setTheme(Theme theme)
Sets the
Theme of the editor. |
void |
setTitle(String title)
Sets the
ConsoleEditor title. |
void |
show()
Shows the editor screen.
|
void |
start()
Starts the editor.
|
void |
stop()
Stops the editor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitredrawCoords, redrawFooter, redrawHeadercreatepublic static final String EDITOR_NAME
public static final String DIRTY_SIGN
public static final int ESCAPE
public static final int DEFAULT_ESCAPE_TIMEOUT
public static final int READ_EXPIRED
public void start()
Reader.public void stop()
Reader.public void show()
show in interface ConsoleEditorpublic void hide()
Terminal.hide in interface ConsoleEditorpublic int read()
throws IOException
read in interface InputReaderIOExceptionpublic boolean readBoolean()
throws IOException
readBoolean in interface InputReaderIOExceptionpublic boolean readBoolean(String message, Boolean defaultValue) throws IOException
readBoolean in interface InputReadermessage - defaultValue - IOExceptionpublic String readLine() throws IOException
readLine in interface InputReaderIOExceptionpublic String readLine(String message) throws IOException
InputReaderreadLine in interface InputReaderIOExceptionpublic void onCommand(Command command)
public void redrawText()
ConsoleEditorredrawText in interface ConsoleEditorpublic int getLine()
Editorpublic int getColumn()
Editorpublic void move(int line,
int column)
Editorpublic void moveUp(int offset)
ConsoleEditormoveUp in interface ConsoleEditoroffset - The number of lines to move upwards.public void moveDown(int offset)
ConsoleEditormoveDown in interface ConsoleEditoroffset - The number of lines to move downwards.public void moveLeft(int offset)
ConsoleEditormoveLeft in interface ConsoleEditoroffset - The number of lines to move.public void moveRight(int offset)
ConsoleEditormoveRight in interface ConsoleEditoroffset - The number of lines to move.public void end()
public void home()
public void put(String str)
Editorlink to the current position.public String delete()
Editorpublic String backspace()
Editorpublic void newLine()
Editorpublic void mergeLine()
Editorpublic void findNext(String str)
public void findPrevious(String str)
findPrevious in interface Editor<String>str - protected void scrollUp(int rows)
protected void scrollDown(int rows)
protected void displayText(String text)
text - protected void clearLine()
public void saveCursorPosition()
ConsoleEditorsaveCursorPosition in interface ConsoleEditorpublic void restoreCursorPosition()
ConsoleEditorrestoreCursorPosition in interface ConsoleEditorpublic void flush()
protected void highLight(String text)
public void open(File source, String displayAs) throws IOException
ConsoleEditoropen in interface ConsoleEditordisplayAs - The display String (if flavor supports it).IOExceptionpublic void open(File source) throws IOException
Editoropen in interface Editor<String>IOExceptionpublic void save(File target) throws IOException
Editorsave in interface Editor<String>IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic int lines()
public String getContent()
EditorgetContent in interface Editor<String>public String getContent(int line)
EditorgetContent in interface Editor<String>public File getFile()
EditorFile being edited.public jline.Terminal getTerminal()
ConsoleEditorTerminal used by the ConsoleEditor.getTerminal in interface ConsoleEditorpublic Boolean isDirty()
Editorpublic void setDirty(Boolean dirty)
Editorpublic int getHeaderSize()
ConsoleEditorgetHeaderSize in interface ConsoleEditorpublic void setHeaderSize(int headerSize)
public int getFooterSize()
ConsoleEditorgetFooterSize in interface ConsoleEditorpublic void setFooterSize(int footerSize)
public jline.console.KeyMap getKeys()
public void setKeys(jline.console.KeyMap keys)
public Theme getTheme()
ConsoleEditorTheme.getTheme in interface ConsoleEditorpublic void setTheme(Theme theme)
ConsoleEditorTheme of the editor.setTheme in interface ConsoleEditorpublic UndoContext getUndoContext()
public String getTitle()
ConsoleEditorConsoleEditor title.getTitle in interface ConsoleEditorpublic void setTitle(String title)
ConsoleEditorConsoleEditor title.setTitle in interface ConsoleEditorpublic boolean isReadOnly()
ConsoleEditorConsoleEditor is set to be read only.isReadOnly in interface ConsoleEditorpublic void setReadOnly(boolean readOnly)
ConsoleEditorConsoleEditor to read only mode.setReadOnly in interface ConsoleEditorpublic boolean isOpenEnabled()
ConsoleEditorConsoleEditor can open new file.isOpenEnabled in interface ConsoleEditorpublic void setOpenEnabled(boolean openEnabled)
ConsoleEditorConsoleEditor to open files.setOpenEnabled in interface ConsoleEditorpublic String getDisplayAs()
public void setDisplayAs(String displayAs)
Copyright © 2013. All Rights Reserved.