Package com.day.cq.wcm.foundation
Class List
- java.lang.Object
 - 
- com.day.cq.wcm.foundation.List
 
 
- 
public class List extends java.lang.ObjectCreates a list from a resource for use in the list component. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description classList.PageComparator<P extends Page>Compares pages with each other by property. 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALLOW_DUPLICATES_PROPERTY_NAMEstatic java.lang.StringANCESTOR_PAGE_PROPERTY_NAMEstatic java.lang.StringDEFAULT_QUERYstatic java.lang.StringLIMIT_PROPERTY_NAMEstatic Loggerlogstatic java.lang.StringORDER_BY_PROPERTY_NAMEstatic java.lang.StringORDERED_PROPERTY_NAMEstatic java.lang.StringPAGE_MAX_PARAM_NAMEstatic java.lang.StringPAGE_MAX_PROPERTY_NAMEstatic java.lang.StringPAGE_START_PARAM_NAMEstatic java.lang.StringPAGES_PROPERTY_NAMEstatic java.lang.StringPARENT_PAGE_PROPERTY_NAMEstatic java.lang.StringQUERY_PROPERTY_NAMEstatic java.lang.StringSAVEDQUERY_PROPERTY_NAMEstatic java.lang.StringSEARCH_IN_PROPERTY_NAMEstatic java.lang.StringSEARCH_PROPERTYstatic java.lang.StringSOURCE_CHILDRENUsed to create a list from child pages.static java.lang.StringSOURCE_DESCENDANTSUsed to create a list from descendant pages.static java.lang.StringSOURCE_PROPERTY_NAMEstatic java.lang.StringSOURCE_QUERYBUILDERUsed to create a list from a querybuilder search result.static java.lang.StringSOURCE_SEARCHUsed to create a list from a search result.static java.lang.StringSOURCE_STATICUsed to create a list from a fixed selection of pages.static java.lang.StringSOURCE_TAGSUsed to create a list from list of tags.static java.lang.StringTAGS_MATCH_PROPERTY_NAMEstatic java.lang.StringTAGS_PROPERTY_NAMEstatic java.lang.StringTAGS_SEARCH_ROOT_PROPERTY_NAMEstatic java.lang.StringTYPE_DEFAULTUsed for default rendering of the list items.static java.lang.StringTYPE_PROPERTY_NAMEstatic java.lang.StringURL_EXTENSION 
- 
Constructor Summary
Constructors Constructor Description List(SlingHttpServletRequest request)Creates aListinstance based on the specified request.List(SlingHttpServletRequest request, PageFilter pageFilter)Creates aListinstance based on the specified request. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetNextPageLink()Returns the link to the page with the next set of list items.java.util.Iterator<javax.jcr.Node>getNodes()Returns the list as nodes.intgetPageMaximum()Returns the maximum of list items to return per page.java.util.Iterator<Page>getPages()Returns the list items as pages, respecting both starting index and maximum number of list items if specified.intgetPageStart()Returns the starting index for list items on this page.java.lang.StringgetPreviousPageLink()Returns the link to the page with the previous set of list items.java.util.Iterator<Resource>getResources()Deprecated.usegetPages()insteadjava.lang.StringgetType()Returns the type of the list.booleanisEmpty()States whether the list is empty.booleanisOrdered()States whether the list is ordered.booleanisPaginating()States whether the list is paginating, i.e.voidsetLimit(int l)Sets the limit for list items.voidsetOrderBy(java.lang.String ob)Sets the property to order the list by.voidsetOrderComparator(java.util.Comparator<Page> obc)Sets the comparator used to order the list with.voidsetOrdered(boolean o)Sets the list style (numbered or not).voidsetPageIterator(java.util.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.voidsetQuery(java.lang.String q)Sets the query for the fulltext search.voidsetQuery(java.lang.String q, java.lang.String type)Sets the query for the search with the specified type (xpath, sql).voidsetSource(java.lang.String src)Sets the source for the list.voidsetStartIn(java.lang.String start)Sets the the of the page to start searching on.voidsetType(java.lang.String t)Sets the type of the list.intsize()Returns the number of list items. 
 - 
 
- 
- 
Field Detail
- 
log
public static final Logger log
 
- 
DEFAULT_QUERY
public static final java.lang.String DEFAULT_QUERY
- See Also:
 - Constant Field Values
 
 
- 
URL_EXTENSION
public static final java.lang.String URL_EXTENSION
- See Also:
 - Constant Field Values
 
 
- 
TYPE_PROPERTY_NAME
public static final java.lang.String TYPE_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
SOURCE_PROPERTY_NAME
public static final java.lang.String SOURCE_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
SOURCE_CHILDREN
public static final java.lang.String SOURCE_CHILDREN
Used to create a list from child pages.- See Also:
 - Constant Field Values
 
 
- 
SOURCE_DESCENDANTS
public static final java.lang.String SOURCE_DESCENDANTS
Used to create a list from descendant pages.- See Also:
 - Constant Field Values
 
 
- 
SOURCE_STATIC
public static final java.lang.String SOURCE_STATIC
Used to create a list from a fixed selection of pages.- See Also:
 - Constant Field Values
 
 
- 
SOURCE_SEARCH
public static final java.lang.String SOURCE_SEARCH
Used to create a list from a search result.- See Also:
 - Constant Field Values
 
 
- 
SOURCE_QUERYBUILDER
public static final java.lang.String SOURCE_QUERYBUILDER
Used to create a list from a querybuilder search result. Allows rendering of any node, not just pages.- See Also:
 - Constant Field Values
 
 
- 
SOURCE_TAGS
public static final java.lang.String SOURCE_TAGS
Used to create a list from list of tags.- See Also:
 - Constant Field Values
 
 
- 
TYPE_DEFAULT
public static final java.lang.String TYPE_DEFAULT
Used for default rendering of the list items.- See Also:
 - Constant Field Values
 
 
- 
PARENT_PAGE_PROPERTY_NAME
public static final java.lang.String PARENT_PAGE_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
ANCESTOR_PAGE_PROPERTY_NAME
public static final java.lang.String ANCESTOR_PAGE_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
TAGS_SEARCH_ROOT_PROPERTY_NAME
public static final java.lang.String TAGS_SEARCH_ROOT_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
TAGS_PROPERTY_NAME
public static final java.lang.String TAGS_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
TAGS_MATCH_PROPERTY_NAME
public static final java.lang.String TAGS_MATCH_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
PAGES_PROPERTY_NAME
public static final java.lang.String PAGES_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
QUERY_PROPERTY_NAME
public static final java.lang.String QUERY_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
SEARCH_IN_PROPERTY_NAME
public static final java.lang.String SEARCH_IN_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
SEARCH_PROPERTY
public static final java.lang.String SEARCH_PROPERTY
- See Also:
 - Constant Field Values
 
 
- 
LIMIT_PROPERTY_NAME
public static final java.lang.String LIMIT_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
PAGE_MAX_PROPERTY_NAME
public static final java.lang.String PAGE_MAX_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
ORDER_BY_PROPERTY_NAME
public static final java.lang.String ORDER_BY_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
ORDERED_PROPERTY_NAME
public static final java.lang.String ORDERED_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
SAVEDQUERY_PROPERTY_NAME
public static final java.lang.String SAVEDQUERY_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
- 
PAGE_START_PARAM_NAME
public static final java.lang.String PAGE_START_PARAM_NAME
- See Also:
 - Constant Field Values
 
 
- 
PAGE_MAX_PARAM_NAME
public static final java.lang.String PAGE_MAX_PARAM_NAME
- See Also:
 - Constant Field Values
 
 
- 
ALLOW_DUPLICATES_PROPERTY_NAME
public static final java.lang.String ALLOW_DUPLICATES_PROPERTY_NAME
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
List
public List(SlingHttpServletRequest request)
Creates aListinstance based on the specified request.- Parameters:
 request- The request
 
- 
List
public List(SlingHttpServletRequest request, PageFilter pageFilter)
Creates aListinstance based on the specified request.- Parameters:
 request- The requestpageFilter- Page filter
 
 - 
 
- 
Method Detail
- 
getResources
public java.util.Iterator<Resource> getResources()
Deprecated.usegetPages()insteadReturns the list items as resources.- Returns:
 - The resources
 
 
- 
getPages
public java.util.Iterator<Page> getPages()
Returns the list items as pages, respecting both starting index and maximum number of list items if specified.- Returns:
 - The pages
 
 
- 
getNodes
public java.util.Iterator<javax.jcr.Node> 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
public java.lang.String 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
public java.lang.String 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
public void setSource(java.lang.String src)
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
public void setQuery(java.lang.String q)
Sets the query for the fulltext search.- Parameters:
 q- The query
 
- 
setQuery
public void setQuery(java.lang.String q, java.lang.String type)Sets the query for the search with the specified type (xpath, sql).- Parameters:
 q- The querytype- The query type (optional)
 
- 
setStartIn
public void setStartIn(java.lang.String start)
Sets the the of the page to start searching on.- Parameters:
 start- The start page path
 
- 
getType
public java.lang.String 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
public void setType(java.lang.String t)
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
public void setOrderComparator(java.util.Comparator<Page> obc)
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
public void setOrderBy(java.lang.String ob)
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
public void setPageIterator(java.util.Iterator<Page> iter)
Sets the page iterator to generate the list from.- Parameters:
 iter- The iterator
 
 - 
 
 -