|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jcurzez.peer.ansi.PeerScreen
This is the ansi implementation of jcurzez. There are no native calls, thus this implementation should work on any platform that supports Java and ansi.
For retrieving size of the screen, we use four system properties:
jcurzez.term.columns
jcurzez.term.lines
jcurzez.term.x
jcurzez.term.y
tput(1)
,
or environment variables COLUMNS
and LINES
. If they are not set, they default to
80
, 24
(or 25 for Windows) and 0
,
0
.
Field Summary | |
private int |
columns
Number of columns the screen has. |
private int |
lines
Number of lines the screen has. |
private Cell |
previousCell
To optimize, we keep the last cell. |
private int |
previousX
To optimize cursor motion, we store previous cursor position. |
private int |
previousY
To optimize cursor motion, we store previous cursor position. |
private java.lang.StringBuffer |
text
Current representation of the content of the screen. |
Constructor Summary | |
PeerScreen()
Constructs a new ANSI PeerScreen. |
Method Summary | |
private void |
attributeToEscapeSequence(Attribute a)
Computes the representation of the attribute a ,
and appends this representation to text . |
void |
beep()
Emits an audio beep. |
void |
end()
Does nothing. |
int |
getColumns()
Relies on the jcurzez.term.columns property,
or defaults to 80 if this property is not set. |
int |
getFirstX()
Retrieves the x coordinate by the time the screen object is created. |
int |
getFirstY()
Retrieves the y coordinate by the time the screen object is created. |
int |
getLines()
Retrieves the number of lines the screen has. |
void |
gotoXY(int x,
int y)
Moves the cursor on the physical screen at specified position. |
void |
printCell(int x,
int y,
Cell cell)
Prints the cell cell on the physical screen at
specified position. |
void |
setCursorVisibility(int v)
Does nothing for the ansi implementation. |
void |
update()
Updates the physical screen. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int columns
private int lines
private int previousX
private int previousY
private java.lang.StringBuffer text
private Cell previousCell
Constructor Detail |
public PeerScreen()
Color.setRealColor(java.lang.Object)
)
which, for the ansi implementation, are escape sequences.
Method Detail |
public void gotoXY(int x, int y)
ScreenPeer
x
and
y
should be consistent.
This method is used by refresh
to move the cursor where it is supposed to be.
gotoXY
in interface ScreenPeer
jcurzez.peer.ScreenPeer
x
- x coordinate where to send the cursor. This is an absolute
coordinate.y
- y coordinate where to send the cursor. This is an absolute
coordinate.AbstractWindow.refresh()
private void attributeToEscapeSequence(Attribute a)
a
,
and appends this representation to text
.
a
- the attribute we want to use.public void printCell(int x, int y, Cell cell)
ScreenPeer
cell
on the physical screen at
specified position.
printCell
in interface ScreenPeer
jcurzez.peer.ScreenPeer
x
- x coordinate where to send the cursor. This is an absolute
coordinate.y
- y coordinate where to send the cursor. This is an absolute
coordinate.cell
- the cell to print at this position.Cell
public int getColumns()
jcurzez.term.columns
property,
or defaults to 80
if this property is not set.
getColumns
in interface ScreenPeer
jcurzez.peer.ScreenPeer
public int getLines()
ScreenPeer
25
, but it may be different if you use a xterm
,
a different screen mode, or frame buffering.
getLines
in interface ScreenPeer
jcurzez.peer.ScreenPeer
public int getFirstX()
ScreenPeer
getFirstX
in interface ScreenPeer
jcurzez.peer.ScreenPeer
public int getFirstY()
ScreenPeer
getFirstY
in interface ScreenPeer
jcurzez.peer.ScreenPeer
public void update()
ScreenPeer
ScreenPeer.gotoXY(int, int)
- to where it should be.
update
in interface ScreenPeer
jcurzez.peer.ScreenPeer
AbstractWindow.refresh()
public void setCursorVisibility(int v)
setCursorVisibility
in interface ScreenPeer
jcurzez.peer.ScreenPeer
v
- visibility of the cursor. One of
NORMAL
,
INVISIBLE
,
VERY_VISIBLE
.Cursor
public void beep()
ScreenPeer
beep
in interface ScreenPeer
public void end()
end
in interface ScreenPeer
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |