jcurzez
Class Screen

java.lang.Object
  |
  +--jcurzez.AbstractWindow
        |
        +--jcurzez.Screen

public class Screen
extends AbstractWindow

This class inherits features from AbstractWindow, and internally uses a peer component so that it is a concrete class.
The peer component is chosen using system properties, a explained here.

Note: To decide if the screen should have linewrapping and autoscrolling features, one may use jcurzez.term.linewrap and jcurzez.term.scroll system properties, which both default to true when not set.

Version:
0.0.4
Author:
Thomas Girard

Nested Class Summary
private static class Screen.CursesHook
           
 
Field Summary
private static boolean endCalled
          Indicates whether end() was already called.
private static ScreenPeer peer
          The peer implementation.
private static java.lang.Object peerLock
          The lock on the peer.
static java.io.PrintStream previousErr
          Previous object for stderr.
static java.io.PrintStream previousOut
          Previous object for stdout.
private static Screen SCREEN
          The one and only screen.
private static boolean screenLinewrap
          true if the screen has the linewrap feature.
private static boolean screenScroll
          true if the screen has the scroll feature.
 
Fields inherited from class jcurzez.AbstractWindow
buffer, cat, cursor, id, linewrap, parent, scroll
 
Constructor Summary
private Screen()
          Constructs a new Screen.
 
Method Summary
 void beep()
          Delegates call to peer.
static void end()
          This method is invoked by shutdown hook, or explicitly to stop using Jcurzez.
private static java.lang.String getPeerPackageName()
          To achieve screen creation, the Screen static initializer uses the jcurzez.term.type property.
static Screen getScreen()
          Retrieves the one and only screen.
protected  void gotoXY(int x, int y)
          Delegates call to peer.
protected  void printCell(int x, int y, Cell cell)
          Delegates call to peer.
(package private)  void setCursorVisibility(int visibility)
          Delegates call to peer.
protected  void update()
          Delegates call to peer.
 
Methods inherited from class jcurzez.AbstractWindow
clear, clearToBottom, clearToEndOfLine, copyCellsAt, deleteChar, deleteLine, equals, getCellsAt, getCursor, getId, getParent, getRectangle, getTabulationSize, hashCode, hasLinesWrapped, insertChar, insertLine, insertString, printChar, printString, refresh, removeExtraChars, toString, touch, wouldScroll
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

peer

private static volatile ScreenPeer peer
The peer implementation.


endCalled

private static volatile boolean endCalled
Indicates whether end() was already called.


screenLinewrap

private static final boolean screenLinewrap
true if the screen has the linewrap feature. It is determined using the jcurzez.term.linewrap system propety, and defaults to true if this property is not set.


screenScroll

private static final boolean screenScroll
true if the screen has the scroll feature. It is determined using the jcurzez.term.scroll system propety, and defaults to true if this property is not set.


previousOut

public static final java.io.PrintStream previousOut
Previous object for stdout.


previousErr

public static final java.io.PrintStream previousErr
Previous object for stderr.


SCREEN

private static Screen SCREEN
The one and only screen.


peerLock

private static final java.lang.Object peerLock
The lock on the peer.

Constructor Detail

Screen

private Screen()
Constructs a new Screen. Hook are set so that all calls to System.out and System.err are routed to this.

Method Detail

getPeerPackageName

private static final java.lang.String getPeerPackageName()
To achieve screen creation, the Screen static initializer uses the jcurzez.term.type property.
If this property is not set, then we try to guess which implementation we should use with the os.name property, with the following rules:

Returns:
the peer package name.

getScreen

public static Screen getScreen()
Retrieves the one and only screen.

Returns:
the screen.

beep

public void beep()
Delegates call to peer.

Specified by:
beep in class AbstractWindow
Following copied from class: jcurzez.AbstractWindow
See Also:
ScreenPeer.beep()

gotoXY

protected void gotoXY(int x,
                      int y)
Delegates call to peer.

Specified by:
gotoXY in class AbstractWindow
Following copied from class: jcurzez.AbstractWindow
Parameters:
x - the x coordinate where to move the cursor.
y - the y coordinate where to move the cursor.
See Also:
ScreenPeer.gotoXY(int, int)

setCursorVisibility

void setCursorVisibility(int visibility)
Delegates call to peer.


printCell

protected void printCell(int x,
                         int y,
                         Cell cell)
Delegates call to peer.

Specified by:
printCell in class AbstractWindow
Following copied from class: jcurzez.AbstractWindow
Parameters:
x - the x coordinate where to print the cell.
y - the y coordinate where to print the cell.
cell - the cell to print.
See Also:
ScreenPeer.printCell(int, int, jcurzez.Cell)

update

protected void update()
Delegates call to peer.

Specified by:
update in class AbstractWindow
Following copied from class: jcurzez.AbstractWindow
See Also:
ScreenPeer.update()

end

public static void end()
This method is invoked by shutdown hook, or explicitly to stop using Jcurzez.
The screen is cleared, jcurzez.peer is invoked, the peer is changed to a NullScreenPeer. Eventually System.out is restored.
This method can be invoked only once.



Send me an email