Class ViewContext<T>

java.lang.Object
org.deltava.commands.ViewContext<T>
Type Parameters:
T - the result object type

public class ViewContext<T> extends Object
A bean to store scrollable view page parameters.
Since:
1.0
Version:
10.0
Author:
Luke
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Request parameter to store view window size.
    static final String
    Request parameter to store sort type.
    static final String
    Request parameter to store start position.
    static final String
    Request attribute to store view data for presentation-layer JSPs.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ViewContext(jakarta.servlet.http.HttpServletRequest req, int size)
    Initializes the view context from the HTTP request.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of entries in the view to display.
    int
    Returns the position of the end of this view slice.
    Returns all the request parameters for this view slice, minus any reserved parameters
    int
    Gets the start position of the previous slice of the view (for the Page Up tag)
    Returns the result data to display.
    Gets the sort parameter for this view slice.
    int
    Returns the start of this slice of the view.
    boolean
    Returns if we are at the end of the view.
    void
    Updates the result data for this view slice.
    void
    setSortType(String sortType)
    Sets the default sort parameter for this view slice.

    Methods inherited from class Object

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

  • Constructor Details

    • ViewContext

      public ViewContext(jakarta.servlet.http.HttpServletRequest req, int size)
      Initializes the view context from the HTTP request.
      Parameters:
      req - the HTTP request
      size - the size of the viewport
  • Method Details

    • getStart

      public int getStart()
      Returns the start of this slice of the view.
      Returns:
      the start position
      See Also:
    • getCount

      public int getCount()
      Returns the number of entries in the view to display.
      Returns:
      the number of entries
      See Also:
    • getEnd

      public int getEnd()
      Returns the position of the end of this view slice.
      Returns:
      the end position
    • getParameters

      public Map<String,String> getParameters()
      Returns all the request parameters for this view slice, minus any reserved parameters
      Returns:
      the parameters to the request
    • getResults

      public Collection<T> getResults()
      Returns the result data to display.
      Returns:
      a Collection of beans
      See Also:
    • getSortType

      public String getSortType()
      Gets the sort parameter for this view slice.
      Returns:
      the sort parameter
      See Also:
    • getPreviousStart

      public int getPreviousStart()
      Gets the start position of the previous slice of the view (for the Page Up tag)
      Returns:
      the start position of the previous slice, or zero if negative
      See Also:
    • isEndOfView

      public boolean isEndOfView()
      Returns if we are at the end of the view.
      Returns:
      TRUE if no more data is available, otherwise FALSE
    • setResults

      public void setResults(Collection<T> results)
      Updates the result data for this view slice.
      Parameters:
      results - a List of beans
      See Also:
    • setSortType

      public void setSortType(String sortType)
      Sets the default sort parameter for this view slice.
      Parameters:
      sortType - the sort parameter
      See Also: