Class ScrollEndEvent


public class ScrollEndEvent extends ScrollbarEvent
Represents a scroll end event that occurs when scrolling reaches the end boundary of a scrollable element.

This event is fired when the user scrolls to the bottom or right edge of a scrollable container. It extends ScrollbarEvent to inherit comprehensive scroll position tracking capabilities, including vertical and horizontal scroll positions, and is dispatched to registered ScrollListener instances for processing.

Features:

  • Detects when scrolling reaches the end boundary
  • Inherits scroll position tracking (top, bottom, left, right, height, width)
  • Supports both vertical and horizontal scrolling
  • Integrates with the scroll event listener pattern

Usage:


 // Create a scroll end event with position information
 ScrollEndEvent event = new ScrollEndEvent(
     500f,  // scrollTop
     500f,  // scrollBottom
     1000f, // scrollHeight
     0f,    // scrollLeft
     400f,  // scrollRight
     400f   // scrollWidth
 );

 // Access inherited position getters
 int top = event.getScrollTop();       // Returns 500
 int height = event.getScrollHeight(); // Returns 1000

 // Dispatch to a listener for infinite scroll, lazy loading, etc.
 event.dispatchTo(myScrollListener);
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • ScrollEndEvent

      public ScrollEndEvent(Float scrollTop, Float scrollBottom, Float scrollHeight, Float scrollLeft, Float scrollRight, Float scrollWidth)
      Constructs a new ScrollEndEvent with the specified scroll position information.
      Parameters:
      scrollTop - the distance from the top of the element to its topmost visible content
      scrollBottom - the distance from the top of the element to its bottommost visible content
      scrollHeight - the total height of the element's content, including content not visible due to scrolling
      scrollLeft - the distance from the left of the element to its leftmost visible content
      scrollRight - the distance from the left of the element to its rightmost visible content
      scrollWidth - the total width of the element's content, including content not visible due to scrolling
  • Method Details

    • dispatchTo

      public void dispatchTo(ScrollListener listener)
      Dispatches this event to the specified listener for processing.

      This method invokes the listener's onEvent method with this event instance, allowing the listener to handle the scroll end event, such as implementing infinite scrolling or lazy loading of content.

      Specified by:
      dispatchTo in class Event<ScrollListener>
      Parameters:
      listener - the listener to which this event should be dispatched