Class RenderState

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

public class RenderState extends Object
Encapsulates the state for a scroll bar. The first line shown is the line index topIndex. If topOffset is non-zero, it should be shifted by this number of pixels. The current scrolling position is scrollPos.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether scrolling down is possible.
    boolean
    Returns whether scrolling up is possible.
    int
    Returns the height of the viewable area.
    int
    Returns the location of the view area in pixels.
    int
    Returns the index of the first line to display.
    int
    Returns the number of pixels to shift the first displayed line.
    void
    linesAdded(@NotNull Buffer buffer)
    Some lines have been added to the buffer.
    void
    linesRemoved(@NotNull Buffer buffer, @NotNull Collection<Line> lines)
    Some lines have been removed from the buffer.
    void
    linesReplaced(@NotNull Buffer buffer)
    Some lines have been replaced at the end of the buffer.
    boolean
    Returns whether the view should be repainted even if no other values have changed.
    void
    scrollTo(@NotNull Buffer buffer, int y)
    Scrolls to the given pixel location.
    void
    scrollToBottom(@NotNull Buffer buffer)
    Sets the view area to the bottom-most value.
    void
    setHeight(@NotNull Buffer buffer, int h)
    Sets the viewable height in pixel.
    void
    update(@NotNull Buffer buffer, int oldBufferHeight)
    Updates the internal state after the buffer has changed.

    Methods inherited from class java.lang.Object

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

    • RenderState

      public RenderState()
  • Method Details

    • setHeight

      public void setHeight(@NotNull @NotNull Buffer buffer, int h)
      Sets the viewable height in pixel.
      Parameters:
      buffer - the displayed buffer
      h - the viewable height
    • update

      public void update(@NotNull @NotNull Buffer buffer, int oldBufferHeight)
      Updates the internal state after the buffer has changed.
      Parameters:
      buffer - the buffer
      oldBufferHeight - the buffer height before the change
    • linesAdded

      public void linesAdded(@NotNull @NotNull Buffer buffer)
      Some lines have been added to the buffer.
      Parameters:
      buffer - the displayed buffer
    • linesReplaced

      public void linesReplaced(@NotNull @NotNull Buffer buffer)
      Some lines have been replaced at the end of the buffer.
      Parameters:
      buffer - the displayed buffer
    • linesRemoved

      public void linesRemoved(@NotNull @NotNull Buffer buffer, @NotNull @NotNull Collection<Line> lines)
      Some lines have been removed from the buffer.
      Parameters:
      buffer - the displayed buffer
      lines - the number of lines that have been removed
    • getHeight

      public int getHeight()
      Returns the height of the viewable area.
      Returns:
      the height
    • getTopIndex

      public int getTopIndex()
      Returns the index of the first line to display.
      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
    • 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
    • mustRepaint

      public boolean mustRepaint()
      Returns whether the view should be repainted even if no other values have changed. This function resets the flag; calling the function twice returns false in the second call (if no other changes happen concurrently).
      Returns:
      whether the view should be repainted
    • scrollTo

      public void scrollTo(@NotNull @NotNull Buffer buffer, int y)
      Scrolls to the given pixel location.
      Parameters:
      buffer - the displayed buffer
      y - the new location
    • scrollToBottom

      public void scrollToBottom(@NotNull @NotNull Buffer buffer)
      Sets the view area to the bottom-most value.
      Parameters:
      buffer - the displayed buffer