Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.terminal
Interface TerminalWindow

All Known Implementing Classes:
  TerminalWin

public interface TerminalWindow

Core interface for a terminal window. This is implemented by the actual implementation of the terminal window.

Method Summary
`void` | `addAsEntropyGenerator(RandomSeed seed)` Casuses this terminal window to send events to the specified random seed in order to extract entropy from them
`void` | `addInputListener(TerminalInputListener listener)` Add a input listener which listens to data from the user.
`void` | `addOutputListener(TerminalOutputListener listener)` Add a output listener which listens to data from the server.
`void` | `attachPrinter(TerminalPrinter printer)` Attach a printer to this terminal.
`void` | `clearLine()` This shortcut method clears the current line.
`void` | `clearScreen()` This shortcut method clears the screen.
`int` | `cols()` Get the number of columns shown.
`void` | `detachPrinter()` Detach the previously attached printer.
`TerminalOption[]` | `getOptions()` Get the terminal options.
`java.util.Properties` | `getProperties()` Get the current terminal properties
`java.lang.String` | `getProperty(java.lang.String key)` Get the value of a single property.
`boolean` | `getPropsChanged()` Check if any properties have changed.
`java.lang.String` | `getTitle()` Get the title
`int` | `hpixels()` Get the number of horizontal pixels used to represent the terminal.
`void` | `printScreen()` Dump the current screen to the attached printer.
`void` | `removeInputListener(TerminalInputListener listener)` Removes a previously added input listener
`void` | `removeOutputListener(TerminalOutputListener listener)` Removes a previously added output listener
`void` | `reset()` Reset the terminal emulator to the default state.
`void` | `resetToDefaults()` Reset all properties to their default values.
`void` | `ringBell()` This shortcut method rings the terminal bell.
`int` | `rows()` Get the number of rows shown.
`SearchContext` | `search(SearchContext lastContext, java.lang.String key, boolean reverse, boolean caseSens)` Search for a string in the terminal window
`void` | `sendBreak()` Send a break singal to the server.
`void` | `sendBytes(byte[] b)` May be called when the user pastes data.
`void` | `setAttributeBold(boolean set)` This shortcut menthod is used to enable/disable bold characters.
`void` | `setCursorPos(int row, int col)` This shortcut method moves the cursor to the given position.
`void` | `setProperties(java.util.Properties newProps, boolean merge)` Set a bunch of terminal properties
`void` | `setProperty(java.lang.String key, java.lang.String value)` Set a single terminal property.
`void` | `setPropsChanged(boolean value)` Change the properties changed flag.
`void` | `setTitle(java.lang.String title)` Set title of terminal window.
`void` | `startPrinter()` Start dumping a log of everything which is printed on the terminal to the attached printer.
`void` | `stopPrinter()` Stop printing.
`java.lang.String` | `terminalType()` Get the terminal type which the window currently emulates.
`void` | `typedChar(char c)` Called whn the user tpyes a character
`int` | `vpixels()` Get the number of vertical pixels used to represent the terminal.
`void` | `write(byte b)` Write a byte to the terminal.
`void` | `write(byte[] c, int off, int len)` Write a bunch of bytes to the terminal.
`void` | `write(char c)` Write a character to the terminal.
`void` | `write(char[] c, int off, int len)` Write a bunch of characters to the terminal.
`void` | `write(java.lang.String str)` Write a string to the terminal.

Method Detail

### setTitle

    public void setTitle(java.lang.String title)

  Set title of terminal window.

  Parameters:
    `title` - the title

### getTitle

    public java.lang.String getTitle()

  Get the title

  Returns:
    the title of the terminal window

### rows

    public int rows()

  Get the number of rows shown.

  Returns:
    the number of rows

### cols

    public int cols()

  Get the number of columns shown.

  Returns:
    the number of columns

### vpixels

    public int vpixels()

  Get the number of vertical pixels used to represent the terminal.

  Returns:
    the number of vertical pixels

### hpixels

    public int hpixels()

  Get the number of horizontal pixels used to represent the terminal.

  Returns:
    the number of horizontal pixels

### write

    public void write(byte b)

  Write a byte to the terminal. The byte will be assumed to be in the current remote encoding.

  Parameters:
    `b` - byte to write

### write

    public void write(char c)

  Write a character to the terminal.

  The character is assumed to be in the java internal encoding.

  Parameters:
    `c` - character to write

### write

    public void write(char[] c,
                      int off,
                      int len)

  Write a bunch of characters to the terminal.

  The characters are assumed to be in the java internal encoding.

  Parameters:
    `c` - array containg the characters to write
    `off` - index in array of first character to write
    `len` - number of characters to write

### write

    public void write(byte[] c,
                      int off,
                      int len)

  Write a bunch of bytes to the terminal. The bytes will be assumed to be in the current remote encoding.

  Parameters:
    `c` - array containg the characters to write
    `off` - index in array of first character to write
    `len` - number of characters to write

### write

    public void write(java.lang.String str)

  Write a string to the terminal. The string is assumed to be in the java internal encoding.

  Parameters:
    `str` - string to write

### addInputListener

    public void addInputListener(TerminalInputListener listener)

  Add a input listener which listens to data from the user.

  Parameters:
    `listener` - input listener to add

### removeInputListener

    public void removeInputListener(TerminalInputListener listener)

  Removes a previously added input listener

  Parameters:
    `listener` - input listener to remove

### addOutputListener

    public void addOutputListener(TerminalOutputListener listener)

  Add a output listener which listens to data from the server.

  Parameters:
    `listener` - output listener to add

### removeOutputListener

    public void removeOutputListener(TerminalOutputListener listener)

  Removes a previously added output listener

  Parameters:
    `listener` - output listener to remove

### attachPrinter

    public void attachPrinter(TerminalPrinter printer)

  Attach a printer to this terminal.

  Parameters:
    `printer` - printer to attach

### detachPrinter

    public void detachPrinter()

  Detach the previously attached printer.

### typedChar

    public void typedChar(char c)

  Called whn the user tpyes a character

  Parameters:
    `c` - typed character

### sendBytes

    public void sendBytes(byte[] b)

  May be called when the user pastes data. It may also be called by some external entity whishing to simulate multiple key presses.

  Parameters:
    `b` - array of bytes representing characters to input

### sendBreak

    public void sendBreak()

  Send a break singal to the server.

### reset

    public void reset()

  Reset the terminal emulator to the default state.

### printScreen

    public void printScreen()

  Dump the current screen to the attached printer.

### startPrinter

    public void startPrinter()

  Start dumping a log of everything which is printed on the terminal to the attached printer.

### stopPrinter

    public void stopPrinter()

  Stop printing.

### terminalType

    public java.lang.String terminalType()

  Get the terminal type which the window currently emulates.

  Returns:
    the name of the emulated terminal

### setProperties

    public void setProperties(java.util.Properties newProps,
                              boolean merge)
                       throws java.lang.IllegalArgumentException,
                              java.util.NoSuchElementException

  Set a bunch of terminal properties

  Parameters:
    `newProps` - new properties
    `merge` - if true the new properties are merged with any previous properties. If false all old properties are deleted.
  Throws:
    `java.lang.IllegalArgumentException`
    `java.util.NoSuchElementException`

### setProperty

    public void setProperty(java.lang.String key,
                            java.lang.String value)
                     throws java.lang.IllegalArgumentException,
                            java.util.NoSuchElementException

  Set a single terminal property.

  Parameters:
    `key` - property to set
    `value` - value to set it to
  Throws:
    `java.lang.IllegalArgumentException`
    `java.util.NoSuchElementException`

### getProperties

    public java.util.Properties getProperties()

  Get the current terminal properties

  Returns:
    the current properties

### getProperty

    public java.lang.String getProperty(java.lang.String key)

  Get the value of a single property.

  Parameters:
    `key` - name of perty to get value of
  Returns:
    the value of the property. Null if the peroperty is not defined and there is no default value.

### resetToDefaults

    public void resetToDefaults()

  Reset all properties to their default values.

### getPropsChanged

    public boolean getPropsChanged()

  Check if any properties have changed.

  Returns:
    true if any properties has changed

### setPropsChanged

    public void setPropsChanged(boolean value)

  Change the properties changed flag.

  Parameters:
    `value` - new value.

### getOptions

    public TerminalOption[] getOptions()

  Get the terminal options.

### search

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

  Search for a string in the terminal window

  Parameters:
    `lastContext` - used as a starying point, if not null, so tha the search may continue from the last position
    `key` - string to search for
    `reverse` - if true the search is performed backwards
    `caseSens` - if true the key is case sensitive
  Returns:
    a search context which describes where the key was found or `null` if the key was not found.

### addAsEntropyGenerator

    public void addAsEntropyGenerator(RandomSeed seed)

  Casuses this terminal window to send events to the specified random seed in order to extract entropy from them

  Parameters:
    `seed` - the random seed to send entropy to

### setAttributeBold

    public void setAttributeBold(boolean set)

  This shortcut menthod is used to enable/disable bold characters.

  The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

  Parameters:
    `set` - if true turn on bold for subsequent characters.

### clearScreen

    public void clearScreen()

  This shortcut method clears the screen.

  The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

### ringBell

    public void ringBell()

  This shortcut method rings the terminal bell.

  The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

### setCursorPos

    public void setCursorPos(int row,
                             int col)

  This shortcut method moves the cursor to the given position.

  The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

  Parameters:
    `row` - row to place cursor on
    `col` - column to place cursor on

### clearLine

    public void clearLine()

  This shortcut method clears the current line.

  The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD