com.day.cq.wcm.foundation
Class List

java.lang.Object
  extended by com.day.cq.wcm.foundation.List

public class List
extends Object

Creates a list from a resource for use in the list component.


Nested Class Summary
 class List.PageComparator<P extends Page>
          Compares pages with eachother by property.
 
Field Summary
static String DEFAULT_QUERY
           
static String LIMIT_PROPERTY_NAME
           
static org.slf4j.Logger log
           
static String ORDER_BY_PROPERTY_NAME
           
static String ORDERED_PROPERTY_NAME
           
static String PAGES_PROPERTY_NAME
           
static String PARENT_PAGE_PROPERTY_NAME
           
static String QUERY_PROPERTY_NAME
           
static String SEARCH_IN_PROPERTY_NAME
           
static String SOURCE_CHILDREN
          Used to create a list from child pages.
static String SOURCE_PROPERTY_NAME
           
static String SOURCE_SEARCH
          Used to create a list from a search result.
static String SOURCE_STATIC
          Used to create a list from a fixed selection of pages.
static String TYPE_DEFAULT
          Used for default rendering of the list items.
static String TYPE_PROPERTY_NAME
           
static String URL_EXTENSION
           
 
Constructor Summary
List(org.apache.sling.api.SlingHttpServletRequest request)
          Creates a List instance based on the specified request.
 
Method Summary
 Iterator<Page> getPages()
          Returns the list items as pages.
 Iterator<org.apache.sling.api.resource.Resource> getResources()
          Returns the list items as resources.
 String getType()
          Returns the type of the list.
 boolean isEmpty()
          States whether the list is empty.
 boolean isOrdered()
          States whether the list is ordered.
 void setLimit(int l)
          Sets the limit for list items.
 void setOrderBy(String ob)
          Sets the property to order the list by.
 void setOrdered(boolean o)
          Sets the list style (numbered or not).
 void setPageIterator(Iterator<Page> iter)
          Sets the page iterator to generate the list from.
 void setQuery(String q)
          Sets the query for the search.
 void setSource(String src)
          Sets the source for the list.
 void setStartIn(String start)
          Sets the the of the page to start searching on.
 void setType(String t)
          Sets the type of the list.
 int size()
          Returns the number of list items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.slf4j.Logger log

DEFAULT_QUERY

public static final String DEFAULT_QUERY
See Also:
Constant Field Values

URL_EXTENSION

public static final String URL_EXTENSION
See Also:
Constant Field Values

TYPE_PROPERTY_NAME

public static final String TYPE_PROPERTY_NAME
See Also:
Constant Field Values

SOURCE_PROPERTY_NAME

public static final String SOURCE_PROPERTY_NAME
See Also:
Constant Field Values

SOURCE_CHILDREN

public static final String SOURCE_CHILDREN
Used to create a list from child pages.

See Also:
Constant Field Values

SOURCE_STATIC

public static final String SOURCE_STATIC
Used to create a list from a fixed selection of pages.

See Also:
Constant Field Values

SOURCE_SEARCH

public static final String SOURCE_SEARCH
Used to create a list from a search result.

See Also:
Constant Field Values

TYPE_DEFAULT

public static final String TYPE_DEFAULT
Used for default rendering of the list items.

See Also:
Constant Field Values

PARENT_PAGE_PROPERTY_NAME

public static final String PARENT_PAGE_PROPERTY_NAME
See Also:
Constant Field Values

PAGES_PROPERTY_NAME

public static final String PAGES_PROPERTY_NAME
See Also:
Constant Field Values

QUERY_PROPERTY_NAME

public static final String QUERY_PROPERTY_NAME
See Also:
Constant Field Values

SEARCH_IN_PROPERTY_NAME

public static final String SEARCH_IN_PROPERTY_NAME
See Also:
Constant Field Values

LIMIT_PROPERTY_NAME

public static final String LIMIT_PROPERTY_NAME
See Also:
Constant Field Values

ORDER_BY_PROPERTY_NAME

public static final String ORDER_BY_PROPERTY_NAME
See Also:
Constant Field Values

ORDERED_PROPERTY_NAME

public static final String ORDERED_PROPERTY_NAME
See Also:
Constant Field Values
Constructor Detail

List

public List(org.apache.sling.api.SlingHttpServletRequest request)
Creates a List instance based on the specified request.

Parameters:
request - The request
Method Detail

getResources

public Iterator<org.apache.sling.api.resource.Resource> getResources()
Returns the list items as resources.

Returns:
The resources

getPages

public Iterator<Page> getPages()
Returns the list items as pages.

Returns:
The pages

isOrdered

public boolean isOrdered()
States whether the list is ordered.

Returns:
true if list is ordered, false otherwise

isEmpty

public boolean isEmpty()
States whether the list is empty.

Returns:
true if list is empty, false otherwise

size

public int size()
Returns the number of list items.

Returns:
The size of the list

setSource

public void setSource(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 by SOURCE_PROPERTY_NAME.

Parameters:
src - The list source

setQuery

public void setQuery(String q)
Sets the query for the search.

Parameters:
q - The query

setStartIn

public void setStartIn(String start)
Sets the the of the page to start searching on.

Parameters:
start - The start page path

getType

public 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(String t)
Sets the type of the list. This is an optional setter, the default value will be taken from the property defined by TYPE_PROPERTY_NAME.

Parameters:
t - The list type

setOrderBy

public void setOrderBy(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 by ORDER_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 be false

Parameters:
o - true if list should be rendered with numbered items, false otherwise

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 by LIMIT_PROPERTY_NAME.

Parameters:
l - The limit

setPageIterator

public void setPageIterator(Iterator<Page> iter)
Sets the page iterator to generate the list from.

Parameters:
iter - The iterator


Copyright © 2009 Day Management AG. All Rights Reserved.