com.grahamedgecombe.jterminal
Interface TerminalModel

All Known Implementing Classes:
AbstractTerminalModel, Vt100TerminalModel

public interface TerminalModel

Model for terminals - defines methods for getting/setting cells, printing text to a terminal and getting the size of the terminal and buffer.


Method Summary
 void clear()
          Clears the terminal.
 BellStrategy getBellStrategy()
          Gets the bell strategy.
 int getBufferSize()
          Gets the buffer size.
 TerminalCell getCell(int column, int row)
          Gets a cell.
 int getColumns()
          Gets the number of columns.
 int getCursorColumn()
          Gets the cursor column.
 int getCursorRow()
          Gets the cursor row.
 java.awt.Color getDefaultBackgroundColor()
          Gets the default background color.
 java.awt.Color getDefaultForegroundColor()
          Gets the default foreground color.
 int getRows()
          Gets the number of rows.
 void moveCursorBack(int n)
          Moves the cursor back n characters.
 void moveCursorDown(int n)
          Moves the cursor down n characters.
 void moveCursorForward(int n)
          Moves the cursor forward n characters.
 void moveCursorUp(int n)
          Moves the cursor up n characters.
 void print(java.lang.String str)
          Prints the specified string to the terminal at the cursor position, interpreting any escape sequences/special ASCII codes the model may support.
 void setBellStrategy(BellStrategy strategy)
          Sets the bell strategy.
 void setCell(int column, int row, TerminalCell cell)
          Sets a cell.
 void setCursorColumn(int column)
          Sets the cursor column.
 void setCursorRow(int row)
          Sets the cursor row.
 

Method Detail

getBellStrategy

BellStrategy getBellStrategy()
Gets the bell strategy.

Returns:
The bell strategy.

setBellStrategy

void setBellStrategy(BellStrategy strategy)
Sets the bell strategy.

Parameters:
strategy - The bell strategy.
Throws:
java.lang.NullPointerException - if the strategy is null.

clear

void clear()
Clears the terminal.


moveCursorBack

void moveCursorBack(int n)
Moves the cursor back n characters.

Parameters:
n - The number of characters.
Throws:
java.lang.IllegalArgumentException - if n is not positive.

moveCursorForward

void moveCursorForward(int n)
Moves the cursor forward n characters.

Parameters:
n - The number of characters.
Throws:
java.lang.IllegalArgumentException - if n is not positive.

moveCursorDown

void moveCursorDown(int n)
Moves the cursor down n characters.

Parameters:
n - The number of characters.
Throws:
java.lang.IllegalArgumentException - if n is not positive.

moveCursorUp

void moveCursorUp(int n)
Moves the cursor up n characters.

Parameters:
n - The number of characters.
Throws:
java.lang.IllegalArgumentException - if n is not positive.

setCell

void setCell(int column,
             int row,
             TerminalCell cell)
Sets a cell.

Parameters:
column - The column.
row - The row.
cell - The cell.
Throws:
java.lang.IndexOutOfBoundsException - if the column and/or row number(s) are out of bounds.

getCell

TerminalCell getCell(int column,
                     int row)
Gets a cell.

Parameters:
column - The column.
row - The row.
Returns:
The cell.
Throws:
java.lang.IndexOutOfBoundsException - if the column and/or row number(s) are out of bounds.

print

void print(java.lang.String str)
Prints the specified string to the terminal at the cursor position, interpreting any escape sequences/special ASCII codes the model may support. Lines will be wrapped if necessary.

Parameters:
str - The string to print.
Throws:
java.lang.NullPointerException - if the string is null.

getColumns

int getColumns()
Gets the number of columns.

Returns:
The number of columns.

getRows

int getRows()
Gets the number of rows.

Returns:
The number of rows.

getBufferSize

int getBufferSize()
Gets the buffer size.

Returns:
The buffer size.

getCursorRow

int getCursorRow()
Gets the cursor row.

Returns:
The cursor row.

setCursorRow

void setCursorRow(int row)
Sets the cursor row.

Parameters:
row - The cursor row.
Throws:
java.lang.IllegalArgumentException - if the row is out of the valid range.

getCursorColumn

int getCursorColumn()
Gets the cursor column.

Returns:
The cursor column.

setCursorColumn

void setCursorColumn(int column)
Sets the cursor column.

Parameters:
column - The cursor column.
Throws:
java.lang.IllegalArgumentException - if the column is out of the valid range.

getDefaultBackgroundColor

java.awt.Color getDefaultBackgroundColor()
Gets the default background color.

Returns:
The default background color.

getDefaultForegroundColor

java.awt.Color getDefaultForegroundColor()
Gets the default foreground color.

Returns:
The default foreground color.


Copyright © 2009-2012. All Rights Reserved.