com.sshtools.terminal
Class VDUBuffer

java.lang.Object
  extended by com.sshtools.terminal.VDUBuffer
Direct Known Subclasses:
TerminalEmulation

public abstract class VDUBuffer
extends java.lang.Object

The VDUBuffer provides a rectangular buffer that represents a terminal screen and provides methods for manipulating this buffer. Both character data and character attributes are stored together the cursor position.

The buffer may be physically larger than the actual display, in which case the buffer will also manage the visible viewport and any scrolling that may be required

Implementation of any emulation protocol should be carried about by a sub class, such as TerminalEmulation.


Nested Class Summary
 class VDUBuffer.BufferLock
           
static interface VDUBuffer.ResizeListener
           
 
Field Summary
static int BOLD
           
protected  VDUBuffer.BufferLock bufferLock
           
 int bufSize
           
 char[][] charArray
           
 int[][] charAttributes
           
static int COLOR
           
static int COLOR_BG
           
static int COLOR_FG
           
protected  int cursorX
           
protected  int cursorY
           
protected  VDUDisplay display
           
 int fill
           
 int height
           
static int INVERT
           
 boolean[] lineMarker
           
protected  java.util.Vector listenerList
           
static int LOW
           
 int maxBufSize
           
static int NORMAL
           
 int screenBase
           
static boolean SCROLL_DOWN
           
static boolean SCROLL_UP
           
 int scrollMarker
           
protected  boolean showcursor
           
static int UNDERLINE
           
 boolean[] update
           
 int width
           
 int windowBase
           
 
Constructor Summary
VDUBuffer()
           
VDUBuffer(int width, int height)
           
 
Method Summary
 void addResizeListener(VDUBuffer.ResizeListener l)
           
 void deleteArea(int c, int l, int w, int h)
           
 void deleteArea(int c, int l, int w, int h, int curAttr)
           
 void deleteChar(int c, int l)
          Delete a character at a given
 void deleteLine(int l)
           
 void fireResize(int w, int h, boolean remote)
           
 int getAttributes(int c, int l)
          Get the attributes mask at the specified line and column.
 int getBottomMargin()
          Get the bottom margin.
 VDUBuffer.BufferLock getBufferLock()
          Get the buffer lock
 int getBufferSize()
          Get the buffer size in lines
 char getChar(int c, int l)
          Get the character at the given column and line on the display.
 int getColumns()
          Return the display width of this buffer
 int getCursorX()
          Get the X co-ordinate of the cursor
 int getCursorY()
          Get the Y co-ordinate of the cursor
 java.lang.String getLine(int l)
          Get the text of a complete row at the specified line on the display as a string.
 int getMaxBufferSize()
          Get the maximum buffer size in lines.
 int getRows()
          Return the display height of this buffer
 int getTopMargin()
          Get the top margin.
 int getWindowBase()
          Get the window base.
 int insertChar(int c, int l, char ch, int attributes)
          Insert a character and its attributes at a given column and line.
 void insertLine(int l)
           
 void insertLine(int l, boolean scrollDown)
           
 void insertLine(int l, int n)
           
 void insertLine(int l, int n, boolean scrollDown)
           
abstract  boolean isShowCursor()
           
 void markLine(int l, int n)
          Mark a range of lines for update.
 void putChar(int c, int l, char ch)
           
 int putChar(int c, int l, char ch, int attributes)
           
 void putString(int c, int l, java.lang.String s)
           
 void putString(int c, int l, java.lang.String s, int attributes)
           
protected  void redraw()
           
 void removeResizeListener(VDUBuffer.ResizeListener l)
           
 void setBottomMargin(int l)
          Set the bottom margin.
 void setBufferSize(int amount)
          Set the buffer size in lines.
 void setCursorPosition(int c, int l)
           
 void setDisplay(VDUDisplay display)
           
 void setScreenSize(int w, int h, boolean remote)
           
 void setTopMargin(int l)
          Set the top margin.
 void setWindowBase(int line)
          Set the window base and redraw the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCROLL_UP

public static final boolean SCROLL_UP
See Also:
Constant Field Values

SCROLL_DOWN

public static final boolean SCROLL_DOWN
See Also:
Constant Field Values

NORMAL

public static final int NORMAL
See Also:
Constant Field Values

BOLD

public static final int BOLD
See Also:
Constant Field Values

UNDERLINE

public static final int UNDERLINE
See Also:
Constant Field Values

INVERT

public static final int INVERT
See Also:
Constant Field Values

LOW

public static final int LOW
See Also:
Constant Field Values

COLOR

public static final int COLOR
See Also:
Constant Field Values

COLOR_FG

public static final int COLOR_FG
See Also:
Constant Field Values

COLOR_BG

public static final int COLOR_BG
See Also:
Constant Field Values

height

public int height

width

public int width

update

public boolean[] update

charArray

public char[][] charArray

charAttributes

public int[][] charAttributes

lineMarker

public boolean[] lineMarker

bufSize

public int bufSize

maxBufSize

public int maxBufSize

fill

public int fill

screenBase

public int screenBase

windowBase

public int windowBase

scrollMarker

public int scrollMarker

showcursor

protected boolean showcursor

cursorX

protected int cursorX

cursorY

protected int cursorY

display

protected VDUDisplay display

listenerList

protected java.util.Vector listenerList

bufferLock

protected VDUBuffer.BufferLock bufferLock
Constructor Detail

VDUBuffer

public VDUBuffer(int width,
                 int height)
Parameters:
width -
height -
terminal -

VDUBuffer

public VDUBuffer()
Parameters:
terminal -
Method Detail

getBufferLock

public VDUBuffer.BufferLock getBufferLock()
Get the buffer lock


getCursorY

public int getCursorY()
Get the Y co-ordinate of the cursor

Returns:
Y co-ordinate of the cursor

getCursorX

public int getCursorX()
Get the X co-ordinate of the cursor

Returns:
X co-ordinate of the cursor

addResizeListener

public void addResizeListener(VDUBuffer.ResizeListener l)
Parameters:
l -

fireResize

public void fireResize(int w,
                       int h,
                       boolean remote)
Parameters:
l -

removeResizeListener

public void removeResizeListener(VDUBuffer.ResizeListener l)
Parameters:
l -

putChar

public void putChar(int c,
                    int l,
                    char ch)
Parameters:
c -
l -
ch -

putChar

public int putChar(int c,
                   int l,
                   char ch,
                   int attributes)
Parameters:
c -
l -
ch -
characters - taken up
attributes -

getChar

public char getChar(int c,
                    int l)
Get the character at the given column and line on the display.

Parameters:
c - column
l - line
Returns:
the character at the position supplied

getLine

public java.lang.String getLine(int l)
Get the text of a complete row at the specified line on the display as a string.

Parameters:
l - line number
Returns:
text at line

getAttributes

public int getAttributes(int c,
                         int l)
Get the attributes mask at the specified line and column.

Parameters:
c - column
l - line
Returns:
attributes

insertChar

public int insertChar(int c,
                      int l,
                      char ch,
                      int attributes)
Insert a character and its attributes at a given column and line.

Parameters:
c - column
l - line
ch - character to insert
attributes - attributes for character
characters - taken up

deleteChar

public void deleteChar(int c,
                       int l)
Delete a character at a given

Parameters:
c -
l -

putString

public void putString(int c,
                      int l,
                      java.lang.String s)
Parameters:
c -
l -
s -

putString

public void putString(int c,
                      int l,
                      java.lang.String s,
                      int attributes)
Parameters:
c -
l -
s -
attributes -

insertLine

public void insertLine(int l)
Parameters:
l -

insertLine

public void insertLine(int l,
                       int n)
Parameters:
l -
n -

insertLine

public void insertLine(int l,
                       boolean scrollDown)
Parameters:
l -
scrollDown -

insertLine

public void insertLine(int l,
                       int n,
                       boolean scrollDown)
Parameters:
l -
n -
scrollDown -

deleteLine

public void deleteLine(int l)
Parameters:
l -

deleteArea

public void deleteArea(int c,
                       int l,
                       int w,
                       int h,
                       int curAttr)
Parameters:
c -
l -
w -
h -
curAttr -

deleteArea

public void deleteArea(int c,
                       int l,
                       int w,
                       int h)
Parameters:
c -
l -
w -
h -

setCursorPosition

public void setCursorPosition(int c,
                              int l)
Parameters:
c -
l -

setWindowBase

public void setWindowBase(int line)
Set the window base and redraw the screen.

Parameters:
line - window base

getWindowBase

public int getWindowBase()
Get the window base.

Returns:
window base

setTopMargin

public void setTopMargin(int l)
Set the top margin.

Parameters:
l - top margin

getTopMargin

public int getTopMargin()
Get the top margin.

Returns:
top margin

setBottomMargin

public void setBottomMargin(int l)
Set the bottom margin.

Parameters:
l - bottom margin

getBottomMargin

public int getBottomMargin()
Get the bottom margin.

Returns:
bottom margin

setBufferSize

public void setBufferSize(int amount)
Set the buffer size in lines.

Parameters:
amount - buffer size in lines.

getBufferSize

public int getBufferSize()
Get the buffer size in lines

Returns:
buffer size in lines

getMaxBufferSize

public int getMaxBufferSize()
Get the maximum buffer size in lines.

Returns:
maximum buffer size in lines

setScreenSize

public void setScreenSize(int w,
                          int h,
                          boolean remote)
Parameters:
w -
h -
remote -

getRows

public int getRows()
Return the display height of this buffer

Returns:
display height

getColumns

public int getColumns()
Return the display width of this buffer

Returns:
display width

markLine

public void markLine(int l,
                     int n)
Mark a range of lines for update.

Parameters:
l - first line to update
n - last line to update

setDisplay

public void setDisplay(VDUDisplay display)
Parameters:
display -

redraw

protected void redraw()

isShowCursor

public abstract boolean isShowCursor()
Returns:


Copyright © 2003-2004 3SP LTD. All Rights Reserved.