Package jexer.backend

Class ECMA48Backend

  • All Implemented Interfaces:
    Backend

    public class ECMA48Backend
    extends GenericBackend
    This class uses an xterm/ANSI X3.64/ECMA-48 type terminal to provide a screen, keyboard, and mouse to TApplication.
    • Constructor Summary

      Constructors 
      Constructor Description
      ECMA48Backend()
      Public constructor will use System.in and System.out and UTF-8 encoding.
      ECMA48Backend​(java.lang.Object listener, java.io.InputStream input, java.io.OutputStream output)
      Public constructor.
      ECMA48Backend​(java.lang.Object listener, java.io.InputStream input, java.io.OutputStream output, boolean readOnly)
      Public constructor.
      ECMA48Backend​(java.lang.Object listener, java.io.InputStream input, java.io.OutputStream output, int windowWidth, int windowHeight, int fontSize)
      Public constructor.
      ECMA48Backend​(java.lang.Object listener, java.io.InputStream input, java.io.Reader reader, java.io.PrintWriter writer)
      Public constructor.
      ECMA48Backend​(java.lang.Object listener, java.io.InputStream input, java.io.Reader reader, java.io.PrintWriter writer, boolean setRawMode)
      Public constructor.
    • Constructor Detail

      • ECMA48Backend

        public ECMA48Backend()
                      throws java.io.UnsupportedEncodingException
        Public constructor will use System.in and System.out and UTF-8 encoding. On non-Windows systems System.in will be put in raw mode; shutdown() will (blindly!) put System.in in cooked mode.
        Throws:
        java.io.UnsupportedEncodingException - if an exception is thrown when creating the InputStreamReader
      • ECMA48Backend

        public ECMA48Backend​(java.lang.Object listener,
                             java.io.InputStream input,
                             java.io.OutputStream output,
                             int windowWidth,
                             int windowHeight,
                             int fontSize)
                      throws java.io.UnsupportedEncodingException
        Public constructor.
        Parameters:
        listener - the object this backend needs to wake up when new input comes in
        input - an InputStream connected to the remote user, or null for System.in. If System.in is used, then on non-Windows systems it will be put in raw mode; shutdown() will (blindly!) put System.in in cooked mode. input is always converted to a Reader with UTF-8 encoding.
        output - an OutputStream connected to the remote user, or null for System.out. output is always converted to a Writer with UTF-8 encoding.
        windowWidth - the number of text columns to start with
        windowHeight - the number of text rows to start with
        fontSize - the size in points. ECMA48 cannot set it, but it is here to match the Swing API.
        Throws:
        java.io.UnsupportedEncodingException - if an exception is thrown when creating the InputStreamReader
      • ECMA48Backend

        public ECMA48Backend​(java.lang.Object listener,
                             java.io.InputStream input,
                             java.io.OutputStream output)
                      throws java.io.UnsupportedEncodingException
        Public constructor.
        Parameters:
        listener - the object this backend needs to wake up when new input comes in
        input - an InputStream connected to the remote user, or null for System.in. If System.in is used, then on non-Windows systems it will be put in raw mode; shutdown() will (blindly!) put System.in in cooked mode. input is always converted to a Reader with UTF-8 encoding.
        output - an OutputStream connected to the remote user, or null for System.out. output is always converted to a Writer with UTF-8 encoding.
        Throws:
        java.io.UnsupportedEncodingException - if an exception is thrown when creating the InputStreamReader
      • ECMA48Backend

        public ECMA48Backend​(java.lang.Object listener,
                             java.io.InputStream input,
                             java.io.OutputStream output,
                             boolean readOnly)
                      throws java.io.UnsupportedEncodingException
        Public constructor.
        Parameters:
        listener - the object this backend needs to wake up when new input comes in
        input - an InputStream connected to the remote user, or null for System.in. If System.in is used, then on non-Windows systems it will be put in raw mode; shutdown() will (blindly!) put System.in in cooked mode. input is always converted to a Reader with UTF-8 encoding.
        output - an OutputStream connected to the remote user, or null for System.out. output is always converted to a Writer with UTF-8 encoding.
        readOnly - if true, start this backend as read-only
        Throws:
        java.io.UnsupportedEncodingException - if an exception is thrown when creating the InputStreamReader
      • ECMA48Backend

        public ECMA48Backend​(java.lang.Object listener,
                             java.io.InputStream input,
                             java.io.Reader reader,
                             java.io.PrintWriter writer,
                             boolean setRawMode)
        Public constructor.
        Parameters:
        listener - the object this backend needs to wake up when new input comes in
        input - the InputStream underlying 'reader'. Its available() method is used to determine if reader.read() will block or not.
        reader - a Reader connected to the remote user.
        writer - a PrintWriter connected to the remote user.
        setRawMode - if true, set System.in into raw mode with stty. This should in general not be used. It is here solely for Demo3, which uses System.in.
        Throws:
        java.lang.IllegalArgumentException - if input, reader, or writer are null.
      • ECMA48Backend

        public ECMA48Backend​(java.lang.Object listener,
                             java.io.InputStream input,
                             java.io.Reader reader,
                             java.io.PrintWriter writer)
        Public constructor.
        Parameters:
        listener - the object this backend needs to wake up when new input comes in
        input - the InputStream underlying 'reader'. Its available() method is used to determine if reader.read() will block or not.
        reader - a Reader connected to the remote user.
        writer - a PrintWriter connected to the remote user.
        Throws:
        java.lang.IllegalArgumentException - if input, reader, or writer are null.
    • Method Detail

      • isImagesOverText

        public boolean isImagesOverText()
        Check if backend will support incomplete image fragments over text display.
        Specified by:
        isImagesOverText in interface Backend
        Overrides:
        isImagesOverText in class GenericBackend
        Returns:
        true if images can partially obscure text
      • isPixelMouse

        public boolean isPixelMouse()
        Check if backend is reporting pixel-based mouse position.
        Specified by:
        isPixelMouse in interface Backend
        Overrides:
        isPixelMouse in class GenericBackend
        Returns:
        true if single-pixel mouse movements are reported
      • setPixelMouse

        public void setPixelMouse​(boolean pixelMouse)
        Set request for backend to report pixel-based mouse position.
        Specified by:
        setPixelMouse in interface Backend
        Overrides:
        setPixelMouse in class GenericBackend
        Parameters:
        pixelMouse - if true, single-pixel mouse movements will be reported, if the backend supports it
      • setMouseStyle

        public void setMouseStyle​(java.lang.String mouseStyle)
        Set the mouse pointer (cursor) style.
        Specified by:
        setMouseStyle in interface Backend
        Overrides:
        setMouseStyle in class GenericBackend
        Parameters:
        mouseStyle - the pointer style string, one of: "default", "none", "hand", "text", "move", or "crosshair"