fr.gedeon.telnetservice
Interface ConsoleDelegate


public interface ConsoleDelegate

Represents the user console in the context of an active connection. It is a collection of getter methods that inform the caller of the state of the console, such as getEOLN() or getRightMargin(); as well as methods that will affect the state of the console: write*.

Author:
wgedeon@gmail.com

Field Summary
static int OFFSET_UPDATE_LOCK_ALL
          Use to prevent user from editing all text entered so far.
static int OFFSET_UPDATE_LOCK_PREVIOUS
          Use to allow the user to only edit newly entered text (on the same line)
static int OFFSET_UPDATE_NO_LOCK
          Use to allow the user to edit both previously entered text (on the same line) and newly written text
 
Method Summary
 void backspaceActiveText(int count)
          Remove the last count characters from the active text
 OutputStream getConsoleOutputStream()
          Convenience getter for situations where integrating application already takes a writer for output of processing results.
 Writer getConsoleWriter()
          Convenience getter for situations where integrating application already takes a writer for output of processing results.
 String getEOLN()
          Is called by the Session to know what to print for the end-of-line character sequence
 int getRightMargin()
          Is called by the Session when negociating telnet options window width.
Note that there is no garantie that this right margin be honored by the client.
 void setRightMargin(int rightMargin)
          Is called by the Session when the client requests a specific window width.
 void setSuppressOutput(boolean suppressOutput)
          Use this method to turn character echo to the user on/off.
Note: the password prompt is automatically configured with suppressOutput = true while typing password, and turned back off afterwards.
 void updateActiveText(String txt, boolean append, int offsetUpdateMask)
          Write txt to the telnet console current active text.
 void write(byte[] bbuf, int off, int len)
          Write a subsequence of the given byte buffer to the console, starting at off and of length len.
 void write(char[] cbuf, int off, int len)
          Write a subsequence of the given character buffer to the console, starting at off and of length len.
 void write(String txt)
          Write the given text string to the console.
 void writeln(String txt)
          Write txt to the telnet console.
 void writeNewLine()
          Request a new line on the telnet console as defined by the assigned display handler.
The controller will be asked for the prompt to show once the newline is output.
Note: in the current implementation, this will automatically lock the previous line from user edit.
 void writePrompt()
          Request the display of the prompt after having written to output
 

Field Detail

OFFSET_UPDATE_NO_LOCK

static final int OFFSET_UPDATE_NO_LOCK
Use to allow the user to edit both previously entered text (on the same line) and newly written text

See Also:
Constant Field Values

OFFSET_UPDATE_LOCK_PREVIOUS

static final int OFFSET_UPDATE_LOCK_PREVIOUS
Use to allow the user to only edit newly entered text (on the same line)

See Also:
Constant Field Values

OFFSET_UPDATE_LOCK_ALL

static final int OFFSET_UPDATE_LOCK_ALL
Use to prevent user from editing all text entered so far.

See Also:
Constant Field Values
Method Detail

getEOLN

String getEOLN()
Is called by the Session to know what to print for the end-of-line character sequence

Returns:
the desired end-of-line character sequence, typically "\n\r";

getRightMargin

int getRightMargin()
Is called by the Session when negociating telnet options window width.
Note that there is no garantie that this right margin be honored by the client. Note also that, if the client is resized, then the right margin will be set using setRightMargin(int).

Returns:
the desired width

setRightMargin

void setRightMargin(int rightMargin)
Is called by the Session when the client requests a specific window width.

Parameters:
rightMargin - the requested right margin

setSuppressOutput

void setSuppressOutput(boolean suppressOutput)
Use this method to turn character echo to the user on/off.
Note: the password prompt is automatically configured with suppressOutput = true while typing password, and turned back off afterwards.

Parameters:
suppressOutput - set to true to suppress console echo, and false to turn it back on

updateActiveText

void updateActiveText(String txt,
                      boolean append,
                      int offsetUpdateMask)
Write txt to the telnet console current active text. Use offsetUpdateMask to specify the behaviour with respect to already entered text.

Parameters:
txt - the message to write
append - true if the text is to append to existing active text, false if the text is to be replaced.
offsetUpdateMask - the cursor update instructions, one of OFFSET_UPDATE_* declared in this interface

backspaceActiveText

void backspaceActiveText(int count)
Remove the last count characters from the active text

Parameters:
count -

getConsoleWriter

Writer getConsoleWriter()
Convenience getter for situations where integrating application already takes a writer for output of processing results.


getConsoleOutputStream

OutputStream getConsoleOutputStream()
Convenience getter for situations where integrating application already takes a writer for output of processing results.


write

void write(char[] cbuf,
           int off,
           int len)
Write a subsequence of the given character buffer to the console, starting at off and of length len.


write

void write(byte[] bbuf,
           int off,
           int len)
Write a subsequence of the given byte buffer to the console, starting at off and of length len.


write

void write(String txt)
Write the given text string to the console.


writeln

void writeln(String txt)
Write txt to the telnet console.

Parameters:
txt - the message to write followed by a newline sequence as defined by the assigned display handler.

writeNewLine

void writeNewLine()
Request a new line on the telnet console as defined by the assigned display handler.
The controller will be asked for the prompt to show once the newline is output.
Note: in the current implementation, this will automatically lock the previous line from user edit.


writePrompt

void writePrompt()
Request the display of the prompt after having written to output



Copyright © 2008. All Rights Reserved.