|
|||||||||||
| 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.columnsjcurzez.term.linesjcurzez.term.xjcurzez.term.ytput(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)
ScreenPeerx and
y should be consistent.
This method is used by refresh
to move the cursor where it is supposed to be.
gotoXY in interface ScreenPeerjcurzez.peer.ScreenPeerx - 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)
ScreenPeercell on the physical screen at
specified position.
printCell in interface ScreenPeerjcurzez.peer.ScreenPeerx - 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.Cellpublic int getColumns()
jcurzez.term.columns property,
or defaults to 80 if this property is not set.
getColumns in interface ScreenPeerjcurzez.peer.ScreenPeerpublic int getLines()
ScreenPeer25, but it may be different if you use a xterm,
a different screen mode, or frame buffering.
getLines in interface ScreenPeerjcurzez.peer.ScreenPeerpublic int getFirstX()
ScreenPeer
getFirstX in interface ScreenPeerjcurzez.peer.ScreenPeerpublic int getFirstY()
ScreenPeer
getFirstY in interface ScreenPeerjcurzez.peer.ScreenPeerpublic void update()
ScreenPeerScreenPeer.gotoXY(int, int) - to where it should be.
update in interface ScreenPeerjcurzez.peer.ScreenPeerAbstractWindow.refresh()public void setCursorVisibility(int v)
setCursorVisibility in interface ScreenPeerjcurzez.peer.ScreenPeerv - visibility of the cursor. One of
NORMAL,
INVISIBLE,
VERY_VISIBLE.Cursorpublic void beep()
ScreenPeer
beep in interface ScreenPeerpublic void end()
end in interface ScreenPeer
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||