Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.platform.contentview.jsf
Class ContentViewImpl

java.lang.Object
  extended by org.nuxeo.ecm.platform.contentview.jsf.ContentViewImpl
All Implemented Interfaces:
Serializable, ContentView

public class ContentViewImpl
extends Object
implements ContentView

Default implementation for the content view object.

Provides simple getters for attributes defined in the XMap descriptor, except cache key which is computed from currrent FacesContext instance if cache key is an EL expression.

The page provider is initialized calling ContentViewService.getPageProvider(java.lang.String, java.util.List, java.lang.Long, java.lang.Long, java.lang.Object...).

Since:
5.4
Author:
Anahide Tchertchian
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.platform.contentview.jsf.ContentView
SEARCH_DOCUMENT_EL_VARIABLE
 
Constructor Summary
ContentViewImpl(String name, String title, boolean translateTitle, String iconPath, String selectionList, String pagination, List<String> actionCategories, ContentViewLayout searchLayout, List<ContentViewLayout> resultLayouts, List<String> flags, String cacheKey, Integer cacheSize, List<String> refreshEventNames, List<String> resetEventNames, boolean useGlobalPageSize, String[] queryParameters, String searchDocumentModelBinding, String searchDocumentModelType, String resultColumnsBinding, String sortInfosBinding, String pageSizeBinding, boolean showTitle, boolean showPageSizeSelector, boolean showRefreshCommand, boolean showFilterForm, String emptySentence, boolean translateEmptySentence)
           
 
Method Summary
 List<String> getActionsCategories()
          Returns the list of action categories to display buttons available on selection of items.
 String getCacheKey()
          Returns the cache key for this content view provider, resolving from the current FacesContext instance if it's an EL expression.
 Integer getCacheSize()
          Returns the cache size for this content view.
 PageProvider<?> getCurrentPageProvider()
          Returns the current page provider, or null if methods ContentView.getPageProvider(), ContentView.getPageProvider(DocumentModel, List, Long, Long, Object...) or ContentView.getPageProviderWithParams(Object...) were never called before.
 Long getCurrentPageSize()
          Returns the current page size, as set using ContentView.setCurrentPageSize(Long), or the page size set on current page provider if not null.
 ContentViewLayout getCurrentResultLayout()
          Returns the current result layout, as set using ContentView.setCurrentResultLayout(ContentViewLayout), or the first of defined result layouts when not set.
 List<String> getCurrentResultLayoutColumns()
          Returns the list of selected result layout columns, resolving the bound EL expression set in the content view definition if columns where not explicitely set with ContentView.setCurrentResultLayoutColumns(List).
 String getEmptySentence()
          Returns a sentence to display when this content view is empty
 List<String> getFlags()
          Returns the list of flags set on this content view, useful to group them, see ContentViewService.getContentViewNames(String)
 String getIconPath()
          Returns the icon relative path for this content view.
 String getName()
          Returns the name of this content view
 PageProvider<?> getPageProvider()
          Gets page provider according to given parameters
 PageProvider<?> getPageProvider(DocumentModel searchDocument, List<SortInfo> sortInfos, Long pageSize, Long currentPage, Object... params)
          Returns cached page provider if it exists or build a new one if parameters have changed.
 PageProvider<?> getPageProviderWithParams(Object... params)
          Gets page provider according to given parameters
 String getPagination()
          Returns the pagination type to be used in pagination rendering
 Object[] getQueryParameters()
          Returns the query parameters for this content view provider provider, resolving from the current FacesContext instance if they are EL expressions.
 List<String> getRefreshEventNames()
          Returns the list of event names that should trigger a refresh of this content view page provider.
 List<String> getResetEventNames()
          Returns the list of event names that should trigger a reset of this content view page provider.
 List<String> getResultLayoutColumns()
           
 List<ContentViewLayout> getResultLayouts()
          Returns the result layouts, used to display results.
 DocumentModel getSearchDocumentModel()
          Returns the search document model as set on the content view.
 String getSearchDocumentModelType()
          Returns the search document model type as defined in the XML configuration.
 ContentViewLayout getSearchLayout()
          Returns the search layout, used to filter results.
 String getSelectionListName()
          Returns the selection list name
 boolean getShowFilterForm()
          Returns true is the filter form should be displayed.
 boolean getShowPageSizeSelector()
          Returns true is the page size selector should be displayed.
 boolean getShowRefreshCommand()
          Returns true is the refresh command should be displayed.
 boolean getShowTitle()
          Returns true is the title should be displayed before the result layout selector.
 String getTitle()
          Returns a title for this content view
 boolean getTranslateEmptySentence()
          Returns a boolean stating if sentence to display is empty has to be translated
 boolean getTranslateTitle()
          Returns a boolean stating if title has to be translated
 boolean getUseGlobalPageSize()
          Returns true is this content view can use the global page size set on the application.
 void refreshAndRewindPageProvider()
          Refreshes the current page provider if not null, see PageProvider.refresh(), and resets the current page to the first one.
 void refreshPageProvider()
          Refreshes the current page provider if not null, see PageProvider.refresh().
 void resetPageProvider()
          Resets the page provider.
 void resetSearchDocumentModel()
          Resets the search document model, setting it to null so that it's recomputed when calling ContentView.getSearchDocumentModel()
 void setCurrentPageSize(Long pageSize)
          Sets the current page size.
 void setCurrentResultLayout(ContentViewLayout layout)
          Sets the current result layout.
 void setCurrentResultLayoutColumns(List<String> resultColumns)
          Sets the list of result layout columns.
 void setSearchDocumentModel(DocumentModel searchDocumentModel)
          Sets the search document model to be passed on the page provider, and set it also on the current page provider if not null.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentViewImpl

public ContentViewImpl(String name,
                       String title,
                       boolean translateTitle,
                       String iconPath,
                       String selectionList,
                       String pagination,
                       List<String> actionCategories,
                       ContentViewLayout searchLayout,
                       List<ContentViewLayout> resultLayouts,
                       List<String> flags,
                       String cacheKey,
                       Integer cacheSize,
                       List<String> refreshEventNames,
                       List<String> resetEventNames,
                       boolean useGlobalPageSize,
                       String[] queryParameters,
                       String searchDocumentModelBinding,
                       String searchDocumentModelType,
                       String resultColumnsBinding,
                       String sortInfosBinding,
                       String pageSizeBinding,
                       boolean showTitle,
                       boolean showPageSizeSelector,
                       boolean showRefreshCommand,
                       boolean showFilterForm,
                       String emptySentence,
                       boolean translateEmptySentence)
Method Detail

getName

public String getName()
Description copied from interface: ContentView
Returns the name of this content view

Specified by:
getName in interface ContentView

getTitle

public String getTitle()
Description copied from interface: ContentView
Returns a title for this content view

Specified by:
getTitle in interface ContentView

getTranslateTitle

public boolean getTranslateTitle()
Description copied from interface: ContentView
Returns a boolean stating if title has to be translated

Specified by:
getTranslateTitle in interface ContentView
See Also:
ContentView.getTitle()

getIconPath

public String getIconPath()
Description copied from interface: ContentView
Returns the icon relative path for this content view.

Specified by:
getIconPath in interface ContentView

getSelectionListName

public String getSelectionListName()
Description copied from interface: ContentView
Returns the selection list name

Specified by:
getSelectionListName in interface ContentView

getPagination

public String getPagination()
Description copied from interface: ContentView
Returns the pagination type to be used in pagination rendering

Specified by:
getPagination in interface ContentView

getActionsCategories

public List<String> getActionsCategories()
Description copied from interface: ContentView
Returns the list of action categories to display buttons available on selection of items.

Specified by:
getActionsCategories in interface ContentView

getSearchLayout

public ContentViewLayout getSearchLayout()
Description copied from interface: ContentView
Returns the search layout, used to filter results.

Specified by:
getSearchLayout in interface ContentView

getResultLayouts

public List<ContentViewLayout> getResultLayouts()
Description copied from interface: ContentView
Returns the result layouts, used to display results.

Specified by:
getResultLayouts in interface ContentView

getCurrentResultLayout

public ContentViewLayout getCurrentResultLayout()
Description copied from interface: ContentView
Returns the current result layout, as set using ContentView.setCurrentResultLayout(ContentViewLayout), or the first of defined result layouts when not set.

Specified by:
getCurrentResultLayout in interface ContentView

setCurrentResultLayout

public void setCurrentResultLayout(ContentViewLayout layout)
Description copied from interface: ContentView
Sets the current result layout.

Specified by:
setCurrentResultLayout in interface ContentView

getPageProvider

public PageProvider<?> getPageProvider(DocumentModel searchDocument,
                                       List<SortInfo> sortInfos,
                                       Long pageSize,
                                       Long currentPage,
                                       Object... params)
                                throws ClientException
Returns cached page provider if it exists or build a new one if parameters have changed.

The search document, current page and page size are set on the page provider anyway. Sort infos are not set again if page provider was not built again (e.g if parameters did not change) to avoid erasing sort infos already held by it.

Specified by:
getPageProvider in interface ContentView
Parameters:
searchDocument - document that will be set on the page provider. If this document is null, we try to retrieve the content view document model calling ContentView.getSearchDocumentModel(). If it is not null, it is set on the page provider.
sortInfos - if not null, will override default sort info put in the page provider XML description
pageSize - if not null, will override default page size put in the page provider XML description
currentPage - if not null, will set the current page to given one
params - if not null, will set the parameters on provider. If null, will take parameters as resolved on the content view from the XML configuration, see ContentView.getQueryParameters()
Throws:
ClientException

getPageProviderWithParams

public PageProvider<?> getPageProviderWithParams(Object... params)
                                          throws ClientException
Description copied from interface: ContentView
Gets page provider according to given parameters

Specified by:
getPageProviderWithParams in interface ContentView
Throws:
ClientException
See Also:
using null as every argument except params

getPageProvider

public PageProvider<?> getPageProvider()
                                throws ClientException
Description copied from interface: ContentView
Gets page provider according to given parameters

Specified by:
getPageProvider in interface ContentView
Throws:
ClientException
See Also:
#getPageProvider(DocumentModel, List, Long, Long, Object...), using null as every argument

getCurrentPageProvider

public PageProvider<?> getCurrentPageProvider()
Description copied from interface: ContentView
Returns the current page provider, or null if methods ContentView.getPageProvider(), ContentView.getPageProvider(DocumentModel, List, Long, Long, Object...) or ContentView.getPageProviderWithParams(Object...) were never called before.

Specified by:
getCurrentPageProvider in interface ContentView

resetPageProvider

public void resetPageProvider()
Description copied from interface: ContentView
Resets the page provider.

A new page provider will be computed next time ContentView.getPageProviderWithParams(Object...) is called. Sort information and query parameters will have to be re-generated.

Specified by:
resetPageProvider in interface ContentView

refreshPageProvider

public void refreshPageProvider()
Description copied from interface: ContentView
Refreshes the current page provider if not null, see PageProvider.refresh().

Sort information and query parameters and current page are kept.

Specified by:
refreshPageProvider in interface ContentView

refreshAndRewindPageProvider

public void refreshAndRewindPageProvider()
Description copied from interface: ContentView
Refreshes the current page provider if not null, see PageProvider.refresh(), and resets the current page to the first one.

Sort information and query parameters are kept.

Specified by:
refreshAndRewindPageProvider in interface ContentView

getCacheKey

public String getCacheKey()
Description copied from interface: ContentView
Returns the cache key for this content view provider, resolving from the current FacesContext instance if it's an EL expression.

Specified by:
getCacheKey in interface ContentView

getCacheSize

public Integer getCacheSize()
Description copied from interface: ContentView
Returns the cache size for this content view.

Specified by:
getCacheSize in interface ContentView

getQueryParameters

public Object[] getQueryParameters()
Description copied from interface: ContentView
Returns the query parameters for this content view provider provider, resolving from the current FacesContext instance if they are EL expressions.

Specified by:
getQueryParameters in interface ContentView

getRefreshEventNames

public List<String> getRefreshEventNames()
Description copied from interface: ContentView
Returns the list of event names that should trigger a refresh of this content view page provider.

Specified by:
getRefreshEventNames in interface ContentView

getResetEventNames

public List<String> getResetEventNames()
Description copied from interface: ContentView
Returns the list of event names that should trigger a reset of this content view page provider.

Specified by:
getResetEventNames in interface ContentView

getUseGlobalPageSize

public boolean getUseGlobalPageSize()
Description copied from interface: ContentView
Returns true is this content view can use the global page size set on the application.

Specified by:
getUseGlobalPageSize in interface ContentView

getCurrentPageSize

public Long getCurrentPageSize()
Description copied from interface: ContentView
Returns the current page size, as set using ContentView.setCurrentPageSize(Long), or the page size set on current page provider if not null.

Specified by:
getCurrentPageSize in interface ContentView

setCurrentPageSize

public void setCurrentPageSize(Long pageSize)
Description copied from interface: ContentView
Sets the current page size.

Specified by:
setCurrentPageSize in interface ContentView

getSearchDocumentModel

public DocumentModel getSearchDocumentModel()
Description copied from interface: ContentView
Returns the search document model as set on the content view.

If this document is null and a EL binding has been set on the content view description, the document model will be resolved from this binding, and set as the search document model.

Else, if the content view is using a provider that needs a search document model, a new one is created and attached to it thanks to the document type held in the definition.

Specified by:
getSearchDocumentModel in interface ContentView

setSearchDocumentModel

public void setSearchDocumentModel(DocumentModel searchDocumentModel)
Description copied from interface: ContentView
Sets the search document model to be passed on the page provider, and set it also on the current page provider if not null.

Specified by:
setSearchDocumentModel in interface ContentView

resetSearchDocumentModel

public void resetSearchDocumentModel()
Description copied from interface: ContentView
Resets the search document model, setting it to null so that it's recomputed when calling ContentView.getSearchDocumentModel()

Specified by:
resetSearchDocumentModel in interface ContentView

getSearchDocumentModelType

public String getSearchDocumentModelType()
Description copied from interface: ContentView
Returns the search document model type as defined in the XML configuration.

Specified by:
getSearchDocumentModelType in interface ContentView

getFlags

public List<String> getFlags()
Description copied from interface: ContentView
Returns the list of flags set on this content view, useful to group them, see ContentViewService.getContentViewNames(String)

Specified by:
getFlags in interface ContentView

getResultLayoutColumns

public List<String> getResultLayoutColumns()
Specified by:
getResultLayoutColumns in interface ContentView

getCurrentResultLayoutColumns

public List<String> getCurrentResultLayoutColumns()
Description copied from interface: ContentView
Returns the list of selected result layout columns, resolving the bound EL expression set in the content view definition if columns where not explicitely set with ContentView.setCurrentResultLayoutColumns(List).

Specified by:
getCurrentResultLayoutColumns in interface ContentView

setCurrentResultLayoutColumns

public void setCurrentResultLayoutColumns(List<String> resultColumns)
Description copied from interface: ContentView
Sets the list of result layout columns.

Specified by:
setCurrentResultLayoutColumns in interface ContentView

getShowPageSizeSelector

public boolean getShowPageSizeSelector()
Description copied from interface: ContentView
Returns true is the page size selector should be displayed.

Specified by:
getShowPageSizeSelector in interface ContentView

getShowRefreshCommand

public boolean getShowRefreshCommand()
Description copied from interface: ContentView
Returns true is the refresh command should be displayed.

Specified by:
getShowRefreshCommand in interface ContentView

getShowFilterForm

public boolean getShowFilterForm()
Description copied from interface: ContentView
Returns true is the filter form should be displayed.

Filter form is displayed on top of content view results, using the search document model and search layout if they have been set on the content view.

Specified by:
getShowFilterForm in interface ContentView

getShowTitle

public boolean getShowTitle()
Description copied from interface: ContentView
Returns true is the title should be displayed before the result layout selector.

Specified by:
getShowTitle in interface ContentView

getEmptySentence

public String getEmptySentence()
Description copied from interface: ContentView
Returns a sentence to display when this content view is empty

Specified by:
getEmptySentence in interface ContentView

getTranslateEmptySentence

public boolean getTranslateEmptySentence()
Description copied from interface: ContentView
Returns a boolean stating if sentence to display is empty has to be translated

Specified by:
getTranslateEmptySentence in interface ContentView
See Also:
ContentView.getEmptySentence()

toString

public String toString()
Overrides:
toString in class Object

Nuxeo Enterprise Platform 5.4

Copyright © 2011 Nuxeo SAS. All Rights Reserved.