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 String
ASCENDING_DIRECTION
static String
DATA_RESPONSE_FIELD
static String
DESCENDING_DIRECTION
static String
DRAW_PARAMETER
static String
DRAW_RESPONSE_FIELD
static String
LENGTH_PARAMETER
static String
ORDER_0_COLUMN_PARAMETER
static String
ORDER_0_DIRECTION_PARAMETER
static String
RECORDS_FILTERED_RESPONSE_FIELD
static String
RECORDS_TOTAL_RESPONSE_FIELD
static String
SEARCH_REGEX_PARAMETER
static String
SEARCH_VALUE_PARAMETER
static String
START_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 String
generateResponse(PageParameters parameters)
Generates the JSON response for infinite scrolling/paging.protected abstract IDataProvider<T>
getDataProvider(PageParameters parameters)
protected int
getDefaultLength()
Sometimes DataTables confuses itself and send NaN as a value for the length parameter.protected int
getDefaultStart()
IResource
getResource()
protected void
populateDataJson(com.github.openjson.JSONObject response, IDataProvider<T> dataProvider)
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-
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:
getResource
in 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
-
-