com.jscape.inet.terminal

## Class Screen

- java.lang.Object
- - com.jscape.inet.terminal.Screen

-     public class Screen
      extends java.lang.Object

  Represents terminal screen as array of rows. By default it has 24 x 80 cells and 500 rows history. Lines and columns are numbered consecutively, with the origin being line 1, column 1.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Screen.Cursor` Represents cursor position in screen.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_HISTORY_SIZE`
    `static int` | `DEFAULT_MAX_COL`
    `static int` | `DEFAULT_MAX_ROW`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Screen()` Creates `Screen` object with default dimensions and history size.
    `Screen(int bufferSize)` Creates `Screen` object givng its history size.
    `Screen(int rowNum, int colNum)` Creates `Screen` object givng its dimensions.
    `Screen(int rowNum, int colNum, int historySize)` Creates `Screen` object givng its dimensions and history size.
    `Screen(Screen screen)` Copy constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearTabs()` Clears all tabstops in screen.
    `void` | `erase()` Clears entire screen.
    `void` | `erase(int row, int col)` Clears screen area starting from provided row and column arguments to current cursor position.
    `void` | `eraseLine(int start, int end)` Erases current cursor line giving start and end columns by resetting it's content.
    `int` | `getBottomMargin()` Returns bottom margin value.
    `Cell` | `getCell(int row, int column)` Gives access to screen cell.
    `Screen.Cursor` | `getCursor()` Returns current `Cursor` in screen.
    `Cell[][]` | `getHistory()` Represents history buffer as two dimensional array of `Cell` objects.
    `int` | `getMaxCol()` Returns quantity of columns in current screen.
    `int` | `getMaxRow()` Returns quantity of rows in current screen.
    `int` | `getUpperMargin()` Returns upper margin value.
    `boolean` | `isOriginMode()` Checks if screen is in Origin mode.
    `void` | `setMargins(int upperMargin, int bottomMargin)` Sets screen margins for scrolling region.
    `void` | `setOriginMode(boolean originMode)` Sets screen Origin mode.
    `Cell[][]` | `toCellArray()` Represents screen as two dimensional array of `Cell` objects.
    `java.lang.String` | `toString()` Gets String representation of this `Screen` with each `Row` in `Screen` terminated by a \r\n.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_HISTORY_SIZE

          public static final int DEFAULT_HISTORY_SIZE

      See Also:
        Constant Field Values

    - #### DEFAULT_MAX_ROW

          public static final int DEFAULT_MAX_ROW

      See Also:
        Constant Field Values

    - #### DEFAULT_MAX_COL

          public static final int DEFAULT_MAX_COL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Screen

          public Screen(int rowNum,
                        int colNum,
                        int historySize)

      Creates `Screen` object givng its dimensions and history size.
      Parameters:
        `rowNum` - quantity of rows in screen.
        `colNum` - quantity of columns in screen.
        `historySize` - size of history (in rows).

    - #### Screen

          public Screen(int bufferSize)

      Creates `Screen` object givng its history size.
      Parameters:
        `bufferSize` - size of history (in rows).

    - #### Screen

          public Screen(int rowNum,
                        int colNum)

      Creates `Screen` object givng its dimensions.
      Parameters:
        `rowNum` - quantity of rows in screen.
        `colNum` - quantity of columns in screen.

    - #### Screen

          public Screen()

      Creates `Screen` object with default dimensions and history size.

    - #### Screen

          public Screen(Screen screen)

      Copy constructor.
      Parameters:
        `screen` - screen to by copied.

  - ### Method Detail

    - #### getMaxRow

          public int getMaxRow()

      Returns quantity of rows in current screen.
      Returns:
        int quantity of rows in current screen.

    - #### getMaxCol

          public int getMaxCol()

      Returns quantity of columns in current screen.
      Returns:
        int quantity of columns in current screen.

    - #### getCursor

          public Screen.Cursor getCursor()

      Returns current `Cursor` in screen.
      Returns:
        the current `Cursor` for this `Screen`

    - #### getCell

          public Cell getCell(int row,
                              int column)

      Gives access to screen cell.
      Parameters:
        `row` - cell row number.
        `column` - cell column number.
      Returns:
        `Cell` object at specified position.

    - #### getUpperMargin

          public int getUpperMargin()

      Returns upper margin value.
      Returns:
        upper margin value.

    - #### getBottomMargin

          public int getBottomMargin()

      Returns bottom margin value.
      Returns:
        bottom margin value.

    - #### setMargins

          public void setMargins(int upperMargin,
                                 int bottomMargin)

      Sets screen margins for scrolling region. The minimum size of the scrolling region allowed is two lines.
      Parameters:
        `upperMargin` - upper margin
        `bottomMargin` - bottom margin

    - #### isOriginMode

          public boolean isOriginMode()

      Checks if screen is in Origin mode.
      Returns:
        true if screen is in Origin mode.

    - #### setOriginMode

          public void setOriginMode(boolean originMode)

      Sets screen Origin mode.
      Parameters:
        `originMode` - true if screen must be in Origin mode.

    - #### toCellArray

          public Cell[][] toCellArray()

      Represents screen as two dimensional array of `Cell` objects.
      Returns:
        two dimensional array of `Cell` objects.

    - #### getHistory

          public Cell[][] getHistory()

      Represents history buffer as two dimensional array of `Cell` objects.
      Returns:
        two dimensional array of `Cell` objects.

    - #### toString

          public java.lang.String toString()

      Gets String representation of this `Screen` with each `Row` in `Screen` terminated by a \r\n.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        screen contents

    - #### eraseLine

          public void eraseLine(int start,
                                int end)

      Erases current cursor line giving start and end columns by resetting it's content.
      Parameters:
        `start` - 'from' column.
        `end` - 'to' column.

    - #### erase

          public void erase(int row,
                            int col)

      Clears screen area starting from provided row and column arguments to current cursor position.
      Parameters:
        `row` - starting row number.
        `col` - starting column number.

    - #### erase

          public void erase()

      Clears entire screen.

    - #### clearTabs

          public void clearTabs()

      Clears all tabstops in screen.

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved