com.monica.javacom.interfaces
Interface MJCVirtualDisplay

All Superinterfaces:
MJCConfigureable
All Known Implementing Classes:
MJCAWTDisplay

public interface MJCVirtualDisplay
extends MJCConfigureable

Top level sublayer responsible for the visualization of the connection. This layer implements a basic character device with the followin features:


Method Summary
 void addC(char c)
          Adds a character to the current cursor position.
 void addCA(char[] ca)
          Adds a char array to the current cursor position.
 void addS(java.lang.String s)
          Adds a String to the current cursor position.
 void clear()
          Clears the contents of the screen.
 void deleteChar()
          Deletes a character at the cursor position.
 void deleteChar(int charNum)
          Deletes charNum characters at the cursor position.
 void deleteLine(int lineNum)
          Deletes lineNum rows at the current cursor position.
 void eraseEOL()
          Erases the contents of the current row from the horizontal cursor position (inclusive) to the last column (inclusive).
 int getCPosX()
          Returns the current column of the cursor.
 int getCPosY()
          Returns the current row of the cursor.
 int getCSizeX()
          Returns the screen width in characters.
 int getCSizeY()
          Returns the screen height in characters.
 java.lang.String getVirtualDisplayName()
          Returns the MJC name of the MJCVirtualDisplay.
 java.lang.String getVirtualDisplayVersion()
          Returns the MJC version of the MJCVirtualDisplay.
 boolean goDown()
          Cursor goes one row down (if possible).
 int goDown(int num)
          Cursor goes num times down.
 boolean goLeft()
          Cursor goes one column to the left.
 int goLeft(int num)
          Cursor goes <>num times to the left.
 boolean goRight()
          Cursor goes one column to the right.
 int goRight(int num)
          Cursor goes num times to the right.
 boolean goUp()
          Cursor goes one row up (if possible).
 int goUp(int num)
          Cursor goes num times up.
 void insertChar()
          Inserts an empty character at the cursor position.
 void insertChar(int charNum)
          Inserts charNum empty characters at the cursor position.
 void insertLine(int lineNum)
          Inserts lineNum rows at the current cursor position.
 void moveCursor(boolean status)
          Should addC/addCA/addS advance the cursor while adding characters.
 void newLine()
          Cursors goes one row down.
 void refresh()
          Refreshes the screen contents for the user.
 void scrollDown()
          Moves all rows int the scrolling region one row up.
 void scrollUp()
          Moves all rows in the scolling region one row down.
 void setCPos(int x, int y)
          Sets the position of the cursor.
 void setCPosX(int x)
          Sets the column of the cursor.
 void setCPosY(int y)
          Sets the row of the cursors.
 void setCSize(int sizeX, int sizeY)
          Sets the screen size in characters.
 void setCSizeX(int sizeX)
          Sets the screen width in characters.
 void setCSizeY(int sizeY)
          Sets the screen height in characters.
 void setInvert(boolean status)
          Sets the inverting status.
 void setScrollingRegion(int firstLine, int lastLine)
          Sets the scrolling region for the screen.
 
Methods inherited from interface com.monica.javacom.interfaces.MJCConfigureable
getConfiguration, setConfiguration
 

Method Detail

getVirtualDisplayName

public java.lang.String getVirtualDisplayName()
Returns the MJC name of the MJCVirtualDisplay.
Returns:
String: the MJC name of the MJCVirtualDisplay

getVirtualDisplayVersion

public java.lang.String getVirtualDisplayVersion()
Returns the MJC version of the MJCVirtualDisplay.
Returns:
String: the MJC name of the MJCVirtualDisplay

setCSize

public void setCSize(int sizeX,
                     int sizeY)
Sets the screen size in characters. After resize the screen will be cleared.
Parameters:
int - sizeX: the width
int - sizeY: the height

setCSizeX

public void setCSizeX(int sizeX)
Sets the screen width in characters. After resize the screen will be cleared.
Parameters:
int - sizeX: the width

setCSizeY

public void setCSizeY(int sizeY)
Sets the screen height in characters. After resize the screen will be cleared.
Parameters:
int - sizeY: the height

getCSizeX

public int getCSizeX()
Returns the screen width in characters.
Returns:
int: the width

getCSizeY

public int getCSizeY()
Returns the screen height in characters.
Returns:
int: the height

clear

public void clear()
Clears the contents of the screen. The position of the cursor will not be changed.

setCPos

public void setCPos(int x,
                    int y)
Sets the position of the cursor. Indexing begins with 0.
Parameters:
int - x: the column
int - y: the row

setCPosX

public void setCPosX(int x)
Sets the column of the cursor. Indexing begins with 0.
Parameters:
int - x: the column

setCPosY

public void setCPosY(int y)
Sets the row of the cursors. Indexing begins with 0.
Parameters:
int - y: the row

getCPosX

public int getCPosX()
Returns the current column of the cursor. Indexing begins with 0.
Returns:
int: the current column

getCPosY

public int getCPosY()
Returns the current row of the cursor. Indexing begins with 0.
Returns:
int: the current row

addC

public void addC(char c)
Adds a character to the current cursor position. The cursor will be adwanced once. The cursor can be positioned one characted right off the screen. If there is an add character at that position, the cursor will go one line down and to the beginning of the line, and the character will be added there. If there are no lines to go down, the screen will be scrolled down. The removed line at the top will be lost. The cursor cannot leave the scrolling region with this method. Characters will be added with the current inverting status.
Parameters:
char - c: the characted to be added

addS

public void addS(java.lang.String s)
Adds a String to the current cursor position. This method should do s.length() times the functionality of addC(s.charAt(i)).
Parameters:
String - s: the String to be added

addCA

public void addCA(char[] ca)
Adds a char array to the current cursor position. This method should do ca.length times the functionality of addC(ca[i]).
Parameters:
char[] - ca: the char array to be added

newLine

public void newLine()
Cursors goes one row down. If the current cursor position is at the bottom of the screen, the screen will be scrolled down. The row scrolled out will be lost. Horizontal position of the cursor will not be altered.

goLeft

public boolean goLeft()
Cursor goes one column to the left. If the current cursor position is the first column then the cursor will go up one row (if possible) and to the last column. There won't be any scrolling. The cursor cannot leave the scrolling region with this method.

goLeft

public int goLeft(int num)
Cursor goes <>num times to the left. This method should do num times the functionality of goLeft().
Parameters:
int - num: the number of times to go left

goRight

public boolean goRight()
Cursor goes one column to the right. If the current cursor position is the last column then the cursor will go down one row (if possible) and to the first column. There won't be any scrolling. The cursor cannot leave the scrolling region wit this method.

goRight

public int goRight(int num)
Cursor goes num times to the right. This method should do num times the functionality of goRight().
Parameters:
int - num: the number of times to go right

goUp

public boolean goUp()
Cursor goes one row up (if possible). There won't be any scrolling. Horizontal position of the cursor will not be altered. Cursor cannot leave the scrolling region with this method.

goUp

public int goUp(int num)
Cursor goes num times up. This method should do num times the functionality of goUp().
Parameters:
int - num: the number of times to go up

goDown

public boolean goDown()
Cursor goes one row down (if possible). There won't be any scrolling. Horizontal position of the cursor will not be altered. Cursor cannot leave the scrolling region with this method.

goDown

public int goDown(int num)
Cursor goes num times down. This method should do num times the functionality of goDown().
Parameters:
int - num: the number of times to go down.

setInvert

public void setInvert(boolean status)
Sets the inverting status. True means inverted, false normal.
Parameters:
boolan - status: the inverting status

refresh

public void refresh()
Refreshes the screen contents for the user.

eraseEOL

public void eraseEOL()
Erases the contents of the current row from the horizontal cursor position (inclusive) to the last column (inclusive).

moveCursor

public void moveCursor(boolean status)
Should addC/addCA/addS advance the cursor while adding characters. True means yes, false no. If the cursor is positioned outside the visible screen area and an addC/addCA/addS method is called, the cursor will in either case go one row down and to the first column (and a scrolling will be performed if required). By default addC/addCA/addS will advance the cursor.
Parameters:
boolean - status: should the addC/addCA/addS methods advance the cursor while adding characters.

setScrollingRegion

public void setScrollingRegion(int firstLine,
                               int lastLine)
Sets the scrolling region for the screen. Scrolling region is given by the first and last line (both includive, indexing begins with 0). If the cursor is inside the scrolling are, it cannot leave it with addC/addCA/addS/goLeft/goRight/goUp/goDown/ newLine/insertLine/insertChar/deleteLine/deleteChar. By default the scrolling region is the whole screen.
Parameters:
int - firstLine: the first line of the scrolling region
int - lastLine: the last line of the scrolling region

scrollUp

public void scrollUp()
Moves all rows in the scolling region one row down. The first row in the scrolling region will get empty. Cursor position will not be altered.

scrollDown

public void scrollDown()
Moves all rows int the scrolling region one row up. The last row in the scrolling region will get empty. Cursor position will not be altered.

insertLine

public void insertLine(int lineNum)
Inserts lineNum rows at the current cursor position. The current row and the rows below the cursor will be moved lineNum rows down. The last row in the scrolling region will get lost during the movement. lineNum empty rows will be created beginning with the current row. Cursor will move to the first column of the current row.
Parameters:
int - lineNum: the number of rows to be inserted

deleteLine

public void deleteLine(int lineNum)
Deletes lineNum rows at the current cursor position. The rows below the deleted rows will be moved upwards. At the bottom of the scrolling region new empty lines will be added. Cursor will move to the first column of the current row.
Parameters:
int - lineNum: the number of rows to be deleted

insertChar

public void insertChar()
Inserts an empty character at the cursor position. Characters after the cursor position in the current row will be moved one position to the right. The last character in the current row will be lost.

insertChar

public void insertChar(int charNum)
Inserts charNum empty characters at the cursor position. This method should do charNum times the functionality of insertChar().
Parameters:
int - charNum: number of characters to be inserted

deleteChar

public void deleteChar()
Deletes a character at the cursor position. Characters after the cursor position in the current row will be moved one position to the left. The last character in the current row will be empty.

deleteChar

public void deleteChar(int charNum)
Deletes charNum characters at the cursor position. This method should do charNum times the functionality of deleteChar().
Parameters:
int - charNum: number of characters to be deleted