Package com.day.cq.wcm.foundation
Class List
java.lang.Object
com.day.cq.wcm.foundation.List
Creates a list from a resource for use in the list component.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassList.PageComparator<P extends Page>Compares pages with each other by property. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Loggerstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringUsed to create a list from child pages.static final StringUsed to create a list from descendant pages.static final Stringstatic final StringUsed to create a list from a querybuilder search result.static final StringUsed to create a list from a search result.static final StringUsed to create a list from a fixed selection of pages.static final StringUsed to create a list from list of tags.static final Stringstatic final Stringstatic final Stringstatic final StringUsed for default rendering of the list items.static final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionList(SlingHttpServletRequest request) Creates aListinstance based on the specified request.List(SlingHttpServletRequest request, PageFilter pageFilter) Creates aListinstance based on the specified request. -
Method Summary
Modifier and TypeMethodDescriptionReturns the link to the page with the next set of list items.getNodes()Returns the list as nodes.intReturns the maximum of list items to return per page.getPages()Returns the list items as pages, respecting both starting index and maximum number of list items if specified.intReturns the starting index for list items on this page.Returns the link to the page with the previous set of list items.Deprecated.getType()Returns the type of the list.booleanisEmpty()States whether the list is empty.booleanStates whether the list is ordered.booleanStates whether the list is paginating, i.e.voidsetLimit(int l) Sets the limit for list items.voidsetOrderBy(String ob) Sets the property to order the list by.voidsetOrderComparator(Comparator<Page> obc) Sets the comparator used to order the list with.voidsetOrdered(boolean o) Sets the list style (numbered or not).voidsetPageIterator(Iterator<Page> iter) Sets the page iterator to generate the list from.voidsetPageMaximum(int pm) Sets the maximum list items to return.voidsetPageStart(int psi) Sets the starting index to be respected when returning list items.voidSets the query for the fulltext search.voidSets the query for the search with the specified type (xpath, sql).voidSets the source for the list.voidsetStartIn(String start) Sets the the of the page to start searching on.voidSets the type of the list.intsize()Returns the number of list items.
-
Field Details
-
log
-
DEFAULT_QUERY
- See Also:
-
URL_EXTENSION
- See Also:
-
TYPE_PROPERTY_NAME
- See Also:
-
SOURCE_PROPERTY_NAME
- See Also:
-
SOURCE_CHILDREN
Used to create a list from child pages.- See Also:
-
SOURCE_DESCENDANTS
Used to create a list from descendant pages.- See Also:
-
SOURCE_STATIC
Used to create a list from a fixed selection of pages.- See Also:
-
SOURCE_SEARCH
Used to create a list from a search result.- See Also:
-
SOURCE_QUERYBUILDER
Used to create a list from a querybuilder search result. Allows rendering of any node, not just pages.- See Also:
-
SOURCE_TAGS
Used to create a list from list of tags.- See Also:
-
TYPE_DEFAULT
Used for default rendering of the list items.- See Also:
-
PARENT_PAGE_PROPERTY_NAME
- See Also:
-
ANCESTOR_PAGE_PROPERTY_NAME
- See Also:
-
TAGS_SEARCH_ROOT_PROPERTY_NAME
- See Also:
-
TAGS_PROPERTY_NAME
- See Also:
-
TAGS_MATCH_PROPERTY_NAME
- See Also:
-
PAGES_PROPERTY_NAME
- See Also:
-
QUERY_PROPERTY_NAME
- See Also:
-
SEARCH_IN_PROPERTY_NAME
- See Also:
-
SEARCH_PROPERTY
- See Also:
-
LIMIT_PROPERTY_NAME
- See Also:
-
PAGE_MAX_PROPERTY_NAME
- See Also:
-
ORDER_BY_PROPERTY_NAME
- See Also:
-
ORDERED_PROPERTY_NAME
- See Also:
-
SAVEDQUERY_PROPERTY_NAME
- See Also:
-
PAGE_START_PARAM_NAME
- See Also:
-
PAGE_MAX_PARAM_NAME
- See Also:
-
ALLOW_DUPLICATES_PROPERTY_NAME
- See Also:
-
-
Constructor Details
-
List
Creates aListinstance based on the specified request.- Parameters:
request- The request
-
List
Creates aListinstance based on the specified request.- Parameters:
request- The requestpageFilter- Page filter
-
-
Method Details
-
getResources
Deprecated.usegetPages()insteadReturns the list items as resources.- Returns:
- The resources
-
getPages
Returns the list items as pages, respecting both starting index and maximum number of list items if specified.- Returns:
- The pages
-
getNodes
Returns the list as nodes. This is only the case when an advanced search is run, ie. thesourceisSOURCE_QUERYBUILDER. Otherwisenullwill be returned.- Returns:
- the nodes of a querybuilder search result or
null - Since:
- 5.3
-
isOrdered
public boolean isOrdered()States whether the list is ordered.- Returns:
trueif list is ordered,falseotherwise
-
isEmpty
public boolean isEmpty()States whether the list is empty.- Returns:
trueif list is empty,falseotherwise
-
size
public int size()Returns the number of list items.- Returns:
- The size of the list
-
isPaginating
public boolean isPaginating()States whether the list is paginating, i.e. has a starting index and/or a maximum numbe rof list items per page defined.- Returns:
trueif list is paginating,falseotherwise
-
getPageStart
public int getPageStart()Returns the starting index for list items on this page. Used for pagination.- Returns:
- The start index of
-
getPageMaximum
public int getPageMaximum()Returns the maximum of list items to return per page. Used for pagination.- Returns:
- The maximum per page
-
getNextPageLink
Returns the link to the page with the next set of list items. Used for pagination.- Returns:
- The link to the next page
-
getPreviousPageLink
Returns the link to the page with the previous set of list items. Used for pagination.- Returns:
- The link to the previous page
-
setSource
Sets the source for the list. The value can be one of: This is an optional setter, the default value will be taken from the property defined bySOURCE_PROPERTY_NAME.- Parameters:
src- The list source
-
setQuery
Sets the query for the fulltext search.- Parameters:
q- The query
-
setQuery
Sets the query for the search with the specified type (xpath, sql).- Parameters:
q- The querytype- The query type (optional)
-
setStartIn
Sets the the of the page to start searching on.- Parameters:
start- The start page path
-
getType
Returns the type of the list. This can be used to select the script that renders the list items.- Returns:
- The list type
-
setType
Sets the type of the list. This is an optional setter, the default value will be taken from the property defined byTYPE_PROPERTY_NAME.- Parameters:
t- The list type
-
setOrderComparator
Sets the comparator used to order the list with. This is an optional setter and overrides #setOrderBy(String).- Parameters:
obc- The comparator to order the list with
-
setOrderBy
Sets the property to order the list by. This is an optional setter, the default value will be taken from the property defined byORDER_BY_PROPERTY_NAME.- Parameters:
ob- The property to order the list by
-
setOrdered
public void setOrdered(boolean o) Sets the list style (numbered or not). This is an optional setter, the default value will befalse- Parameters:
o-trueif list should be rendered with numbered items,falseotherwise
-
setLimit
public void setLimit(int l) Sets the limit for list items. This is an optional setter, the default value will be taken from the property defined byLIMIT_PROPERTY_NAME.- Parameters:
l- The limit
-
setPageMaximum
public void setPageMaximum(int pm) Sets the maximum list items to return. Enables pagination. This is an optional setter, the default value will be taken from the property defined byPAGE_MAX_PROPERTY_NAME.- Parameters:
pm- The maximum number of pages per page
-
setPageStart
public void setPageStart(int psi) Sets the starting index to be respected when returning list items. Used when paginating.- Parameters:
psi- The starting index (defaults to 0).
-
setPageIterator
Sets the page iterator to generate the list from.- Parameters:
iter- The iterator
-
getPages()instead