Class ViewContext<T>
java.lang.Object
org.deltava.commands.ViewContext<T>
- Type Parameters:
T- the result object type
A bean to store scrollable view page parameters.
- Since:
- 1.0
- Version:
- 10.0
- Author:
- Luke
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRequest parameter to store view window size.static final StringRequest parameter to store sort type.static final StringRequest parameter to store start position.static final StringRequest attribute to store view data for presentation-layer JSPs. -
Constructor Summary
ConstructorsConstructorDescriptionViewContext(jakarta.servlet.http.HttpServletRequest req, int size) Initializes the view context from the HTTP request. -
Method Summary
Modifier and TypeMethodDescriptionintgetCount()Returns the number of entries in the view to display.intgetEnd()Returns the position of the end of this view slice.Returns all the request parameters for this view slice, minus any reserved parametersintGets 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.intgetStart()Returns the start of this slice of the view.booleanReturns if we are at the end of the view.voidsetResults(Collection<T> results) Updates the result data for this view slice.voidsetSortType(String sortType) Sets the default sort parameter for this view slice.
-
Field Details
-
VIEW_CONTEXT
Request attribute to store view data for presentation-layer JSPs.- See Also:
-
START
-
COUNT
-
SORTBY
-
-
Constructor Details
-
ViewContext
public ViewContext(jakarta.servlet.http.HttpServletRequest req, int size) Initializes the view context from the HTTP request.- Parameters:
req- the HTTP requestsize- 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
-
getResults
Returns the result data to display.- Returns:
- a Collection of beans
- See Also:
-
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
Updates the result data for this view slice.- Parameters:
results- a List of beans- See Also:
-
setSortType
Sets the default sort parameter for this view slice.- Parameters:
sortType- the sort parameter- See Also:
-