Class RenderStateManager
java.lang.Object
com.realtime.crossfire.jxclient.gui.log.RenderStateManager
Encapsulates the state for rendering a
Buffer instance.-
Constructor Summary
ConstructorsConstructorDescriptionRenderStateManager(@NotNull RenderStateListener renderStateListener, @NotNull Buffer buffer) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether scrolling down is possible.booleanReturns whether scrolling up is possible.voiddispose()Destroys this instance.intReturns the height of the viewable area.intReturns the location of the view area in pixels.intReturns the first line to render.intReturns the number of pixels to shift the first displayed line.voidResets the scrolling range to default values.voidscrollDown(int dy) Scrolls down by pixels.voidscrollTo(int y) Scrolls to a location.voidscrollUp(int dy) Scrolls up by pixels.voidsetHeight(int height) Sets the viewable height in pixel.voidupdate(int oldBufferHeight) Updates the internal state after the buffer has changed.
-
Constructor Details
-
RenderStateManager
public RenderStateManager(@NotNull @NotNull RenderStateListener renderStateListener, @NotNull @NotNull Buffer buffer) Creates a new instance.- Parameters:
renderStateListener- the listener to notify about state changesbuffer- the rendered buffer
-
-
Method Details
-
setHeight
public void setHeight(int height) Sets the viewable height in pixel.- Parameters:
height- the viewable height
-
update
public void update(int oldBufferHeight) Updates the internal state after the buffer has changed.- Parameters:
oldBufferHeight- the buffer height before the change
-
dispose
public void dispose()Destroys this instance. Must be called when the instance is not needed anymore. -
getHeight
public int getHeight()Returns the height of the viewable area.- Returns:
- the height
-
getTopIndex
public int getTopIndex()Returns the first line to render.- Returns:
- the line index
-
getTopOffset
public int getTopOffset()Returns the number of pixels to shift the first displayed line.- Returns:
- the pixel offset
-
getScrollPos
public int getScrollPos()Returns the location of the view area in pixels.- Returns:
- the location
-
resetScroll
public void resetScroll()Resets the scrolling range to default values. -
scrollUp
public void scrollUp(int dy) Scrolls up by pixels.- Parameters:
dy- the number of pixels to scroll
-
scrollDown
public void scrollDown(int dy) Scrolls down by pixels.- Parameters:
dy- the number of pixels to scroll
-
scrollTo
public void scrollTo(int y) Scrolls to a location.- Parameters:
y- the location
-
canScrollUp
public boolean canScrollUp()Returns whether scrolling up is possible.- Returns:
- whether scrolling up is possible
-
canScrollDown
public boolean canScrollDown()Returns whether scrolling down is possible.- Returns:
- whether scrolling down is possible
-