Class RenderStateManager

java.lang.Object
com.realtime.crossfire.jxclient.gui.log.RenderStateManager

public class RenderStateManager extends Object
Encapsulates the state for rendering a Buffer instance.
  • 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 changes
      buffer - 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