Class RenderStateManager


  • public class RenderStateManager
    extends java.lang.Object
    Encapsulates the state for rendering a Buffer instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canScrollDown()
      Returns whether scrolling down is possible.
      boolean canScrollUp()
      Returns whether scrolling up is possible.
      void dispose()
      Destroys this instance.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • setHeight

        public void setHeight​(int height)
        Sets the viewable height in pixel.
        Parameters:
        height - the viewable height
      • dispose

        public void dispose()
        Destroys this instance. Must be called when the instance is not needed anymore.
      • 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