public class RenderStateManager
extends java.lang.Object
Buffer
instance.Modifier and Type | Field and Description |
---|---|
private Buffer |
buffer
The rendered buffer.
|
private BufferListener |
bufferListener
The listener to re-render the window contents after changes.
|
private boolean |
lastCanScrollDown
The last known result of
RenderState.canScrollDown for renderState . |
private boolean |
lastCanScrollUp
The last known result of
RenderState.canScrollUp for renderState . |
private int |
lastScrollPos
The position in pixels of the viewable window.
|
private int |
lastTopIndex
The first line of
buffer to display. |
private int |
lastTopOffset
The number of pixels to shift the first displayed line.
|
private RenderState |
renderState
The underlying
RenderState instance. |
private RenderStateListener |
renderStateListener
The listener to notify about state changes.
|
Constructor and Description |
---|
RenderStateManager(RenderStateListener renderStateListener,
Buffer buffer)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canScrollDown()
Returns whether scrolling down is possible.
|
boolean |
canScrollUp()
Returns whether scrolling up is possible.
|
void |
dispose()
Destroys this instance.
|
private void |
fireChanges()
Notifies listeners of changes.
|
int |
getScrollPos()
Returns the location of the view area in pixels.
|
int |
getTopIndex()
Returns the first line to render.
|
int |
getTopOffset()
Returns the number of pixels to shift the first displayed line.
|
void |
resetScroll()
Resets the scrolling range to default values.
|
void |
scrollDown(int dy)
Scrolls down by pixels.
|
void |
scrollTo(int y)
Scrolls to a location.
|
void |
scrollUp(int dy)
Scrolls up by pixels.
|
void |
setHeight(int height)
Sets the viewable height in pixel.
|
@NotNull private final Buffer buffer
@NotNull private final BufferListener bufferListener
private boolean lastCanScrollDown
RenderState.canScrollDown
for renderState
. Used to detect changes.private boolean lastCanScrollUp
RenderState.canScrollUp
for renderState
. Used to detect changes.private int lastScrollPos
private int lastTopIndex
buffer
to display.private int lastTopOffset
@NotNull private final RenderState renderState
RenderState
instance.@NotNull private final RenderStateListener renderStateListener
public RenderStateManager(@NotNull RenderStateListener renderStateListener, @NotNull Buffer buffer)
renderStateListener
- the listener to notify about state changesbuffer
- the rendered bufferpublic boolean canScrollDown()
public boolean canScrollUp()
public void dispose()
private void fireChanges()
public int getScrollPos()
public int getTopIndex()
public int getTopOffset()
public void resetScroll()
public void scrollDown(int dy)
dy
- the number of pixels to scrollpublic void scrollTo(int y)
y
- the locationpublic void scrollUp(int dy)
dy
- the number of pixels to scrollpublic void setHeight(int height)
height
- the viewable height