|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.crsh.text.VirtualScreen
public class VirtualScreen
A virtual screen that can be scrolled. This class is thread safe, as it can be used concurrently by two threads, for example one thread can provide new elements while another thread is repainting the buffer to the screen, both threads can either modify the underlying data structure. Paint could also be called concurrently by two threads, one that just provided a new element and wants to repaint the structure and another that changes the current cursor and asks for a repaint too.
Nested Class Summary | |
---|---|
private static class |
VirtualScreen.Foo |
Field Summary | |
---|---|
private ArrayList<VirtualScreen.Foo> |
buffer . |
private int |
cursorIndex The cursor index in the chunk at the current cursorOffset . |
private int |
cursorOffset The cursor offset in the buffer . |
private Style |
cursorStyle . |
private int |
cursorX The cursor coordinate. |
private int |
cursorY The cursor coordinate. |
private int |
height The cached width and height for the current refresh. |
private int |
index The absolute offset, index and row. |
private int |
offset The absolute offset, index and row. |
private ScreenContext |
out . |
private static int |
PAINTED |
private static int |
PAINTING |
private static int |
REFRESH |
private int |
row The absolute offset, index and row. |
private int |
status Do we need to clear screen. |
private Style |
style The current style for last chunk in the buffer. |
private int |
width The cached width and height for the current refresh. |
Constructor Summary | |
---|---|
VirtualScreen(ScreenContext out) |
Method Summary | |
---|---|
Screenable |
append(char c) |
Screenable |
append(CharSequence s) |
Screenable |
append(CharSequence csq, int start, int end) |
Screenable |
append(Style style) |
Screenable |
cls() |
void |
flush() Flush the stream. |
int |
getHeight() Returns the screen height in chars. |
int |
getWidth() Returns the screen width in chars. |
boolean |
isPainted() |
boolean |
isPainting() |
boolean |
isRefresh() |
int |
nextPage() |
boolean |
nextRow() |
private Pair<Integer,Integer> |
nextRow(int offset, int index, int width) |
VirtualScreen |
paint() Pain the underlying screen context. |
boolean |
previousRow() |
private int |
scroll(int amount) |
boolean |
update() |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int width
private int height
private final ArrayList<VirtualScreen.Foo> buffer
private Style style
private int offset
private int index
private int row
private int cursorX
private int cursorY
private int cursorOffset
buffer
.
private int cursorIndex
cursorOffset
.
private Style cursorStyle
private final ScreenContext out
private int status
private static final int REFRESH
private static final int PAINTING
private static final int PAINTED
Constructor Detail |
---|
public VirtualScreen(ScreenContext out)
Method Detail |
---|
public int getWidth()
ScreenContext
getWidth
in interface ScreenContext
public int getHeight()
ScreenContext
getHeight
in interface ScreenContext
public Screenable append(CharSequence s) throws IOException
append
in interface Appendable
IOException
public Screenable append(char c) throws IOException
append
in interface Appendable
IOException
public Screenable append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
IOException
public Screenable append(Style style) throws IOException
append
in interface Screenable
IOException
public Screenable cls() throws IOException
cls
in interface Screenable
IOException
public VirtualScreen paint() throws IOException
IOException
- any io exceptionpublic boolean previousRow() throws IOException
IOException
public boolean isPainted()
public boolean isRefresh()
public boolean isPainting()
public boolean nextRow() throws IOException
IOException
public int nextPage() throws IOException
IOException
private int scroll(int amount) throws IOException
IOException
private Pair<Integer,Integer> nextRow(int offset, int index, int width)
public boolean update() throws IOException
IOException
public void flush() throws IOException
ScreenContext
flush
in interface ScreenContext
IOException
- any io exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |