Class AbstractVirtualScrollResourceReference<T>
- java.lang.Object
-
- org.apache.wicket.request.resource.ResourceReference
-
- org.wicketstuff.datatables.virtualscroll.AbstractVirtualScrollResourceReference<T>
-
- All Implemented Interfaces:
Serializable,IClusterable
public abstract class AbstractVirtualScrollResourceReference<T> extends ResourceReference
An abstract resource reference that could be used as a base for custom implementations- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.ResourceReference
ResourceReference.Key, ResourceReference.LambdaResourceReference, ResourceReference.UrlAttributes
-
-
Field Summary
Fields Modifier and Type Field Description static StringASCENDING_DIRECTIONstatic StringDATA_RESPONSE_FIELDstatic StringDESCENDING_DIRECTIONstatic StringDRAW_PARAMETERstatic StringDRAW_RESPONSE_FIELDstatic StringLENGTH_PARAMETERstatic StringORDER_0_COLUMN_PARAMETERstatic StringORDER_0_DIRECTION_PARAMETERstatic StringRECORDS_FILTERED_RESPONSE_FIELDstatic StringRECORDS_TOTAL_RESPONSE_FIELDstatic StringSEARCH_REGEX_PARAMETERstatic StringSEARCH_VALUE_PARAMETERstatic StringSTART_PARAMETER
-
Constructor Summary
Constructors Constructor Description AbstractVirtualScrollResourceReference(Class<?> scope, String name)AbstractVirtualScrollResourceReference(Class<?> scope, String name, Locale locale, String style, String variation)AbstractVirtualScrollResourceReference(String name)AbstractVirtualScrollResourceReference(ResourceReference.Key key)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringgenerateResponse(PageParameters parameters)Generates the JSON response for infinite scrolling/paging.protected abstract IDataProvider<T>getDataProvider(PageParameters parameters)protected intgetDefaultLength()Sometimes DataTables confuses itself and send NaN as a value for the length parameter.protected intgetDefaultStart()IResourcegetResource()protected voidpopulateDataJson(com.github.openjson.JSONObject response, IDataProvider<T> dataProvider)protected abstract voidpopulateEntryJson(com.github.openjson.JSONObject entryJson, T dataEntry)A callback method that should populate the JSON object for a single entry in the response-
Methods inherited from class org.apache.wicket.request.resource.ResourceReference
canBeRegistered, equals, getDependencies, getExtension, getKey, getLocale, getName, getScope, getStyle, getUrlAttributes, getVariation, hashCode, of, of, toString
-
-
-
-
Field Detail
-
LENGTH_PARAMETER
public static final String LENGTH_PARAMETER
- See Also:
- Constant Field Values
-
START_PARAMETER
public static final String START_PARAMETER
- See Also:
- Constant Field Values
-
DRAW_PARAMETER
public static final String DRAW_PARAMETER
- See Also:
- Constant Field Values
-
ORDER_0_COLUMN_PARAMETER
public static final String ORDER_0_COLUMN_PARAMETER
- See Also:
- Constant Field Values
-
ORDER_0_DIRECTION_PARAMETER
public static final String ORDER_0_DIRECTION_PARAMETER
- See Also:
- Constant Field Values
-
ASCENDING_DIRECTION
public static final String ASCENDING_DIRECTION
- See Also:
- Constant Field Values
-
DESCENDING_DIRECTION
public static final String DESCENDING_DIRECTION
- See Also:
- Constant Field Values
-
SEARCH_VALUE_PARAMETER
public static final String SEARCH_VALUE_PARAMETER
- See Also:
- Constant Field Values
-
SEARCH_REGEX_PARAMETER
public static final String SEARCH_REGEX_PARAMETER
- See Also:
- Constant Field Values
-
RECORDS_TOTAL_RESPONSE_FIELD
public static final String RECORDS_TOTAL_RESPONSE_FIELD
- See Also:
- Constant Field Values
-
RECORDS_FILTERED_RESPONSE_FIELD
public static final String RECORDS_FILTERED_RESPONSE_FIELD
- See Also:
- Constant Field Values
-
DRAW_RESPONSE_FIELD
public static final String DRAW_RESPONSE_FIELD
- See Also:
- Constant Field Values
-
DATA_RESPONSE_FIELD
public static final String DATA_RESPONSE_FIELD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractVirtualScrollResourceReference
public AbstractVirtualScrollResourceReference(ResourceReference.Key key)
-
AbstractVirtualScrollResourceReference
public AbstractVirtualScrollResourceReference(Class<?> scope, String name, Locale locale, String style, String variation)
-
AbstractVirtualScrollResourceReference
public AbstractVirtualScrollResourceReference(Class<?> scope, String name)
-
AbstractVirtualScrollResourceReference
public AbstractVirtualScrollResourceReference(String name)
-
-
Method Detail
-
getResource
public IResource getResource()
- Specified by:
getResourcein classResourceReference
-
generateResponse
protected String generateResponse(PageParameters parameters)
Generates the JSON response for infinite scrolling/paging. See DataTables server side docs.- Parameters:
parameters- The request parameters- Returns:
-
populateDataJson
protected void populateDataJson(com.github.openjson.JSONObject response, IDataProvider<T> dataProvider)
-
populateEntryJson
protected abstract void populateEntryJson(com.github.openjson.JSONObject entryJson, T dataEntry)A callback method that should populate the JSON object for a single entry in the response- Parameters:
entryJson- The JSON object to populatedataEntry- The data entry returned by thedata provider
-
getDataProvider
protected abstract IDataProvider<T> getDataProvider(PageParameters parameters)
- Returns:
- The provider of the data for the table
-
getDefaultStart
protected int getDefaultStart()
- Returns:
- A default value for the start request parameter for the cases when DataTables sends non-numeric value, like Nan
-
getDefaultLength
protected int getDefaultLength()
Sometimes DataTables confuses itself and send NaN as a value for the length parameter.- Returns:
- The default value of length when DataTables cannot calculate a good value for some reason
-
-