Implementation of a Video Display Unit (VDU) buffer. This class contains
all methods to manipulate the buffer that stores characters and their
attributes as well as the regions displayed.
BOLD
public static final int BOLD
Make character bold.
COLOR
public static final int COLOR
color mask
COLOR_BG
public static final int COLOR_BG
background color mask
COLOR_BG_SHIFT
public static final int COLOR_BG_SHIFT
how much to left shift the background color
COLOR_FG
public static final int COLOR_FG
foreground color mask
COLOR_FG_SHIFT
public static final int COLOR_FG_SHIFT
how much to left shift the foreground color
ID
public static final String ID
The current version id tag
INVERT
public static final int INVERT
Invert character.
INVISIBLE
public static final int INVISIBLE
Invisible character.
LOW
public static final int LOW
Lower intensity character.
NORMAL
public static final int NORMAL
Make character normal.
SCROLL_DOWN
public static final boolean SCROLL_DOWN
Scroll down when inserting a line.
SCROLL_UP
public static final boolean SCROLL_UP
Scroll up when inserting a line.
UNDERLINE
public static final int UNDERLINE
Underline character.
bufSize
public int bufSize
charArray
public char[][] charArray
charAttributes
public int[][] charAttributes
cursorX
protected int cursorX
cursorY
protected int cursorY
debug
public static final int debug
Enable debug messages.
display
protected VDUDisplay display
a generic display that should redraw on demand
maxBufSize
public int maxBufSize
screenBase
public int screenBase
scrollMarker
public int scrollMarker
showcursor
protected boolean showcursor
update
public boolean[] update
windowBase
public int windowBase
deleteArea
public void deleteArea(int c,
int l,
int w,
int h)
Delete a rectangular portion of the screen.
You need to call redraw() to update the screen.
c
- x-coordinate (column)l
- y-coordinate (row)w
- with of the area in charactersh
- height of the area in characters
deleteArea
public void deleteArea(int c,
int l,
int w,
int h,
int curAttr)
Delete a rectangular portion of the screen.
You need to call redraw() to update the screen.
c
- x-coordinate (column)l
- y-coordinate (row)w
- with of the area in charactersh
- height of the area in characterscurAttr
- attribute to fill
deleteChar
public void deleteChar(int c,
int l)
Delete a character at a given position on the screen.
All characters right to the position will be moved one to the left.
You need to call redraw() to update the screen.
c
- x-coordinate (column)l
- y-coordinate (line)
deleteLine
public void deleteLine(int l)
Delete a line at a specific position. Subsequent lines will be scrolled
up to fill the space and a blank line is inserted at the end of the
screen.
l
- the y-coordinate to insert the line
getAttributes
public int getAttributes(int c,
int l)
Get the attributes for the specified position.
c
- x-coordinate (column)l
- y-coordinate (line)
getBottomMargin
public int getBottomMargin()
Get the bottom scroll margin.
getBufferSize
public int getBufferSize()
Retrieve current scrollback buffer size.
getChar
public char getChar(int c,
int l)
Get the character at the specified position.
c
- x-coordinate (column)l
- y-coordinate (line)
getColumns
public int getColumns()
Get amount of columns on the screen.
getCursorColumn
public int getCursorColumn()
Get the current column of the cursor position.
getCursorRow
public int getCursorRow()
Get the current line of the cursor position.
getMaxBufferSize
public int getMaxBufferSize()
Retrieve maximum buffer Size.
getRows
public int getRows()
Get amount of rows on the screen.
getTopMargin
public int getTopMargin()
Get the top scroll margin.
getWindowBase
public int getWindowBase()
Get the current window base.
insertChar
public void insertChar(int c,
int l,
char ch,
int attributes)
Insert a character at a specific position on the screen.
All character right to from this position will be moved one to the right.
You need to call redraw() to update the screen.
c
- x-coordinate (column)l
- y-coordinate (line)ch
- the character to insertattributes
- the character attributes
insertLine
public void insertLine(int l)
Insert a blank line at a specific position.
The current line and all previous lines are scrolled one line up. The
top line is lost. You need to call redraw() to update the screen.
l
- the y-coordinate to insert the line
insertLine
public void insertLine(int l,
boolean scrollDown)
Insert a blank line at a specific position. Scroll text according to
the argument.
You need to call redraw() to update the screen
l
- the y-coordinate to insert the linescrollDown
- scroll down
insertLine
public void insertLine(int l,
int n)
Insert blank lines at a specific position.
You need to call redraw() to update the screen
l
- the y-coordinate to insert the linen
- amount of lines to be inserted
insertLine
public void insertLine(int l,
int n,
boolean scrollDown)
Insert blank lines at a specific position.
The current line and all previous lines are scrolled one line up. The
top line is lost. You need to call redraw() to update the screen.
l
- the y-coordinate to insert the linen
- number of lines to be insertedscrollDown
- scroll down
markLine
public void markLine(int l,
int n)
Mark lines to be updated with redraw().
l
- starting linen
- amount of lines to be updated
putChar
public void putChar(int c,
int l,
char ch)
Put a character on the screen with normal font and outline.
The character previously on that position will be overwritten.
You need to call redraw() to update the screen.
c
- x-coordinate (column)l
- y-coordinate (line)ch
- the character to show on the screen
putChar
public void putChar(int c,
int l,
char ch,
int attributes)
Put a character on the screen with specific font and outline.
The character previously on that position will be overwritten.
You need to call redraw() to update the screen.
c
- x-coordinate (column)l
- y-coordinate (line)ch
- the character to show on the screenattributes
- the character attributes
BOLD
, UNDERLINE
, INVERT
, INVISIBLE
, NORMAL
, LOW
, insertChar(int,int,char,int)
, deleteChar(int,int)
, redraw()
putString
public void putString(int c,
int l,
String s)
Put a String at a specific position. Any characters previously on that
position will be overwritten. You need to call redraw() for screen update.
c
- x-coordinate (column)l
- y-coordinate (line)s
- the string to be shown on the screen
putString
public void putString(int c,
int l,
String s,
int attributes)
Put a String at a specific position giving all characters the same
attributes. Any characters previously on that position will be
overwritten. You need to call redraw() to update the screen.
c
- x-coordinate (column)l
- y-coordinate (line)s
- the string to be shown on the screenattributes
- character attributes
redraw
protected void redraw()
Trigger a redraw on the display.
setBottomMargin
public void setBottomMargin(int l)
Set the bottom scroll margin for the screen. If the current top margin
is bigger it will become the bottom margin and the line will become the
top margin.
l
- line that is the margin
setBufferSize
public void setBufferSize(int amount)
Set scrollback buffer size.
amount
- new size of the buffer
setCursorPosition
public void setCursorPosition(int c,
int l)
Puts the cursor at the specified position.
setDisplay
public void setDisplay(VDUDisplay display)
setScreenSize
public void setScreenSize(int w,
int h,
boolean broadcast)
Change the size of the screen. This will include adjustment of the
scrollback buffer.
w
- of the screenh
- of the screen
setTopMargin
public void setTopMargin(int l)
Set the top scroll margin for the screen. If the current bottom margin
is smaller it will become the top margin and the line will become the
bottom margin.
l
- line that is the margin
setWindowBase
public void setWindowBase(int line)
Set the current window base. This allows to view the scrollback buffer.
line
- the line where the screen window starts
showCursor
public void showCursor(boolean doshow)
Sets whether the cursor is visible or not.