com.mindbright.terminal
Class Screen

java.lang.Object
  extended by com.mindbright.terminal.Screen

public class Screen
extends java.lang.Object


Field Summary
protected  int[][] attributes
           
protected  boolean autoLF
           
protected  boolean autoReverseWrap
           
protected  boolean autoWrap
           
protected  boolean[] autowraps
           
protected  int cols
           
protected  boolean complexScroll
           
protected  int curAttr
           
protected  int curAttrSave
           
protected  int curCol
           
protected  int curColSave
           
protected  int curRow
           
protected  int curRowSave
           
protected static boolean DEBUG
           
protected  int defaultAttrib
           
protected  int[] defaultAttribs
           
protected  char defaultChar
           
protected  char[] defaultChars
           
protected  DisplayView display
           
static int GRAVITY_NORTHWEST
           
static int GRAVITY_SOUTHWEST
           
protected  boolean hasSelection
           
protected  boolean insertMode
           
protected  int lastCursorCol
           
protected  int lastCursorRow
           
static int MAX_COLS
           
static int MAX_ROWS
           
static int MAX_SAVED_LINES
           
static int MIN_COLS
           
static int MIN_ROWS
           
protected  int rows
           
protected  int[][] save_attributes
           
protected  boolean[] save_autowraps
           
protected  int save_cols
           
protected  int save_rows
           
protected  char[][] save_screen
           
protected  int saveLines
           
protected  char[][] screen
           
protected  int selectBottomCol
           
protected  int selectBottomRow
           
protected  int selectClickRow
           
protected  boolean selectClickState
           
protected  int selectTopCol
           
protected  int selectTopRow
           
protected static char[] spacerow
           
protected  boolean[] tabStops
           
protected  boolean[] termOptions
           
protected  int visTop
           
protected  int windowBottom
           
protected  int windowLeft
           
protected  int windowRight
           
protected  int windowTop
           
protected static int[] zerorow
           
 
Constructor Summary
Screen(int rows, int cols)
           
Screen(int rows, int cols, char defultChar, int defaultAttrib)
           
 
Method Summary
protected  java.lang.String addSpaces(int start, int end)
           
protected  void checkWrap()
           
 void clearAbove()
           
 void clearAllAttributes()
           
 void clearAllTabs()
           
 void clearBelow()
           
 void clearLeft()
           
 void clearLine()
           
 void clearRight()
           
 void clearSaveLines()
           
 void clearScreen()
           
 void clearTab(int col)
           
 void cursorBackward(int n)
           
 void cursorDown(int n)
           
 void cursorForward(int n)
           
 void cursorIndex(int n)
           
 void cursorIndexRev(int n)
           
 void cursorRestore()
           
 void cursorSave()
           
 void cursorSetPos(int v, int h, boolean relative)
           
 void cursorUp(int n)
           
 void deleteChars(int n)
           
 void deleteLines(int n)
           
 void doBackTabs(int n)
           
 void doBS()
           
 void doClickSelect(int row, int col, java.lang.String selectDelims)
           
 void doCR()
           
 void doLF()
           
protected  boolean doMatch(java.lang.String findStr, char firstChar, char[] chars, int idx, boolean caseSens, int len)
           
 void doTab()
           
 void doTabs(int n)
           
 void eraseChars(int n)
           
 void fillScreen(char c)
           
 int[] getAttribsAt(int row)
           
 int[] getAttribsAt(int row, boolean screenRelative)
           
 boolean getAttribute(int attr)
           
 char[] getCharsAt(int row)
           
 char[] getCharsAt(int row, boolean screenRelative)
           
 int getCols()
           
protected  java.lang.String getContents(int startRow, int startCol, int endRow, int endCol, java.lang.String eol)
           
 int getCurCol()
           
 int getCurRow()
           
 int getCursorCol()
           
 int getCursorH()
           
 int getCursorRow()
           
 int getCursorV()
           
 int getRows()
           
 int getSaveLines()
           
 int getScreenTop()
           
 int getSelectBottomCol()
           
 int getSelectBottomRow()
           
 java.lang.String getSelection(java.lang.String eol)
           
 int getSelectTopCol()
           
 int getSelectTopRow()
           
 int getTotalLines()
           
 int getVisTop()
           
 int getWindowBottom()
           
 int getWindowLeft()
           
 int getWindowRight()
           
 int getWindowTop()
           
 void insertChars(int n)
           
 void insertLines(int n)
           
protected  boolean isIntersectingSelect(int topRow, int topCol, int bottomRow, int bottomCol)
           
protected  int[] makeAttribLine()
           
protected  char[] makeCharLine()
           
protected  int nextPrintedChar(int row, int col)
           
protected  int prevPrintedChar(int row, int col)
           
 void resetClickSelect()
           
 void resetSelection()
           
 void resetTabs()
           
 void resetWindow()
           
 void resize(int newRows, int newCols)
           
 void resizeBuffers(int rows, int cols)
           
 boolean screenRestore()
           
 boolean screenSave()
           
 void scrollDown(int n)
           
protected  void scrollSelection(int n)
           
 void scrollUp(int n)
           
 SearchContext search(SearchContext lastContext, java.lang.String key, boolean reverse, boolean caseSens)
           
 void selectAll()
           
 void setAttribute(int attr, boolean val)
           
 void setAutoLF(boolean set)
           
 void setAutoReverseWrap(boolean set)
           
 void setAutoWrap(boolean set)
           
 void setBackgroundColor(int c)
           
protected  void setCursorPosition(int row, int col)
           
 void setDisplay(DisplayView display)
           
 void setForegroundColor(int c)
           
 void setInsertMode(boolean set)
           
 boolean setSaveLines(int n)
           
 void setSelection(int anchorRow, int anchorCol, int endRow, int endCol)
           
 void setTab(int col)
           
 void setWindow(int top, int bottom)
           
 void setWindow(int top, int left, int bottom, int right)
           
protected  void updateDirtyArea(int top, int left, int bottom, int right)
           
 void writeChar(char c)
           
 void writeChar(char c, int attr)
           
 void writeChar(char c, int attr, boolean insert)
           
 void writeLineDrawChar(char c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values

GRAVITY_SOUTHWEST

public static final int GRAVITY_SOUTHWEST
See Also:
Constant Field Values

GRAVITY_NORTHWEST

public static final int GRAVITY_NORTHWEST
See Also:
Constant Field Values

MIN_ROWS

public static final int MIN_ROWS
See Also:
Constant Field Values

MIN_COLS

public static final int MIN_COLS
See Also:
Constant Field Values

MAX_COLS

public static final int MAX_COLS
See Also:
Constant Field Values

MAX_ROWS

public static final int MAX_ROWS
See Also:
Constant Field Values

MAX_SAVED_LINES

public static final int MAX_SAVED_LINES
See Also:
Constant Field Values

rows

protected int rows

cols

protected int cols

windowTop

protected int windowTop

windowBottom

protected int windowBottom

windowLeft

protected int windowLeft

windowRight

protected int windowRight

complexScroll

protected boolean complexScroll

curRow

protected int curRow

curCol

protected int curCol

lastCursorRow

protected int lastCursorRow

lastCursorCol

protected int lastCursorCol

selectTopRow

protected int selectTopRow

selectTopCol

protected int selectTopCol

selectBottomRow

protected int selectBottomRow

selectBottomCol

protected int selectBottomCol

hasSelection

protected boolean hasSelection

selectClickRow

protected int selectClickRow

selectClickState

protected boolean selectClickState

curAttr

protected int curAttr

autoLF

protected boolean autoLF

autoWrap

protected boolean autoWrap

autoReverseWrap

protected boolean autoReverseWrap

insertMode

protected boolean insertMode

curRowSave

protected int curRowSave

curColSave

protected int curColSave

curAttrSave

protected int curAttrSave

screen

protected char[][] screen

attributes

protected int[][] attributes

autowraps

protected boolean[] autowraps

defaultChar

protected char defaultChar

defaultChars

protected char[] defaultChars

defaultAttrib

protected int defaultAttrib

defaultAttribs

protected int[] defaultAttribs

saveLines

protected int saveLines

visTop

protected int visTop

spacerow

protected static final char[] spacerow

zerorow

protected static final int[] zerorow

tabStops

protected boolean[] tabStops

termOptions

protected boolean[] termOptions

display

protected DisplayView display

save_screen

protected char[][] save_screen

save_attributes

protected int[][] save_attributes

save_autowraps

protected boolean[] save_autowraps

save_rows

protected int save_rows

save_cols

protected int save_cols
Constructor Detail

Screen

public Screen(int rows,
              int cols)

Screen

public Screen(int rows,
              int cols,
              char defultChar,
              int defaultAttrib)
Method Detail

setDisplay

public void setDisplay(DisplayView display)

updateDirtyArea

protected void updateDirtyArea(int top,
                               int left,
                               int bottom,
                               int right)

setCursorPosition

protected void setCursorPosition(int row,
                                 int col)

getSaveLines

public int getSaveLines()

screenSave

public boolean screenSave()

screenRestore

public boolean screenRestore()

setSaveLines

public boolean setSaveLines(int n)

clearSaveLines

public void clearSaveLines()

makeCharLine

protected char[] makeCharLine()

makeAttribLine

protected int[] makeAttribLine()

resizeBuffers

public void resizeBuffers(int rows,
                          int cols)

writeLineDrawChar

public void writeLineDrawChar(char c)

writeChar

public void writeChar(char c)

writeChar

public void writeChar(char c,
                      int attr)

writeChar

public void writeChar(char c,
                      int attr,
                      boolean insert)

getCursorRow

public int getCursorRow()

getCursorCol

public int getCursorCol()

getScreenTop

public int getScreenTop()

getTotalLines

public int getTotalLines()

getCharsAt

public char[] getCharsAt(int row)

getCharsAt

public char[] getCharsAt(int row,
                         boolean screenRelative)

getAttribsAt

public int[] getAttribsAt(int row)

getAttribsAt

public int[] getAttribsAt(int row,
                          boolean screenRelative)

setAutoLF

public void setAutoLF(boolean set)

setAutoWrap

public void setAutoWrap(boolean set)

setAutoReverseWrap

public void setAutoReverseWrap(boolean set)

setInsertMode

public void setInsertMode(boolean set)

getVisTop

public int getVisTop()

getCurRow

public int getCurRow()

getCurCol

public int getCurCol()

getSelectTopRow

public int getSelectTopRow()

getSelectTopCol

public int getSelectTopCol()

getSelectBottomRow

public int getSelectBottomRow()

getSelectBottomCol

public int getSelectBottomCol()

getRows

public int getRows()

getCols

public int getCols()

checkWrap

protected void checkWrap()

fillScreen

public void fillScreen(char c)

doBS

public void doBS()

doTab

public void doTab()

doTabs

public void doTabs(int n)

doBackTabs

public void doBackTabs(int n)

setTab

public void setTab(int col)

clearTab

public void clearTab(int col)

resetTabs

public void resetTabs()

clearAllTabs

public void clearAllTabs()

doCR

public void doCR()

doLF

public void doLF()

resetWindow

public void resetWindow()

setWindow

public void setWindow(int top,
                      int bottom)

setWindow

public void setWindow(int top,
                      int left,
                      int bottom,
                      int right)

getWindowTop

public int getWindowTop()

getWindowBottom

public int getWindowBottom()

getWindowLeft

public int getWindowLeft()

getWindowRight

public int getWindowRight()

getCursorV

public int getCursorV()

getCursorH

public int getCursorH()

cursorSetPos

public void cursorSetPos(int v,
                         int h,
                         boolean relative)

cursorUp

public void cursorUp(int n)

cursorDown

public void cursorDown(int n)

cursorForward

public void cursorForward(int n)

cursorBackward

public void cursorBackward(int n)

cursorIndex

public void cursorIndex(int n)

cursorIndexRev

public void cursorIndexRev(int n)

cursorSave

public void cursorSave()

cursorRestore

public void cursorRestore()

scrollUp

public void scrollUp(int n)

scrollDown

public void scrollDown(int n)

clearBelow

public void clearBelow()

clearAbove

public void clearAbove()

clearScreen

public void clearScreen()

clearRight

public void clearRight()

clearLeft

public void clearLeft()

clearLine

public void clearLine()

eraseChars

public void eraseChars(int n)

insertChars

public void insertChars(int n)

deleteChars

public void deleteChars(int n)

insertLines

public void insertLines(int n)

deleteLines

public void deleteLines(int n)

setAttribute

public void setAttribute(int attr,
                         boolean val)

getAttribute

public boolean getAttribute(int attr)

setForegroundColor

public void setForegroundColor(int c)

setBackgroundColor

public void setBackgroundColor(int c)

clearAllAttributes

public void clearAllAttributes()

resize

public void resize(int newRows,
                   int newCols)

nextPrintedChar

protected int nextPrintedChar(int row,
                              int col)

prevPrintedChar

protected int prevPrintedChar(int row,
                              int col)

addSpaces

protected java.lang.String addSpaces(int start,
                                     int end)

isIntersectingSelect

protected boolean isIntersectingSelect(int topRow,
                                       int topCol,
                                       int bottomRow,
                                       int bottomCol)

resetSelection

public void resetSelection()

selectAll

public void selectAll()

scrollSelection

protected void scrollSelection(int n)

setSelection

public void setSelection(int anchorRow,
                         int anchorCol,
                         int endRow,
                         int endCol)

getSelection

public java.lang.String getSelection(java.lang.String eol)

getContents

protected java.lang.String getContents(int startRow,
                                       int startCol,
                                       int endRow,
                                       int endCol,
                                       java.lang.String eol)

resetClickSelect

public void resetClickSelect()

doClickSelect

public void doClickSelect(int row,
                          int col,
                          java.lang.String selectDelims)

search

public SearchContext search(SearchContext lastContext,
                            java.lang.String key,
                            boolean reverse,
                            boolean caseSens)

doMatch

protected boolean doMatch(java.lang.String findStr,
                          char firstChar,
                          char[] chars,
                          int idx,
                          boolean caseSens,
                          int len)