public class ContentViewImpl extends Object implements ContentView, PageProviderChangedListener
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<org.nuxeo.ecm.core.api.SortInfo>, java.lang.Long, java.lang.Long, org.nuxeo.ecm.core.api.DocumentModel, java.lang.Object...).
CONTENT_VIEW_PAGE_CHANGED_EVENT, CONTENT_VIEW_PAGE_SIZE_CHANGED_EVENT, CONTENT_VIEW_REFRESH_EVENT, SEARCH_DOCUMENT_EL_VARIABLE| Constructor and Description |
|---|
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 resultLayoutBinding,
String sortInfosBinding,
String pageSizeBinding,
boolean showTitle,
boolean showPageSizeSelector,
boolean showRefreshCommand,
boolean showFilterForm,
String emptySentence,
boolean translateEmptySentence) |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
addSearchDocumentToELContext(javax.faces.context.FacesContext facesContext) |
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<QuickFilter> |
getQuickFilters() |
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.
|
String |
getWaitForExecutionSentence()
Returns the sentence to display when content view is waiting for a first execution.
|
boolean |
hasResultLayoutBinding() |
boolean |
hasResultLayoutColumnsBinding() |
boolean |
isExecuted()
Returns true if content view has been executed.
|
boolean |
isWaitForExecution()
Returns true if content view will not display results until an explicit search is executed.
|
void |
pageChanged(PageProvider<?> pageProvider)
Called when the current page of the
pageProvider has changed. |
protected void |
raiseEvent(String eventName) |
protected void |
raiseEvent(String eventName,
Object... params) |
void |
refreshAndRewindPageProvider()
Refreshes the current page provider if not null, see
PageProvider.refresh(), and resets the current page
to the first one. |
void |
refreshed(PageProvider<?> pageProvider)
Called when the
pageProvider has refreshed. |
void |
refreshPageProvider()
Refreshes the current page provider if not null, see
PageProvider.refresh(). |
protected void |
removeSearchDocumentFromELContext(javax.faces.context.FacesContext facesContext,
Object previousValue) |
void |
resetPageProvider()
Resets the page provider.
|
void |
resetPageProviderAggregates()
Reset the page provider aggregates.
|
void |
resetSearchDocumentModel()
Resets the search document model, setting it to null so that it's recomputed when calling
ContentView.getSearchDocumentModel() |
protected Long |
resolvePageSize() |
protected List<SortInfo> |
resolveSortInfos() |
protected Object |
resolveWithSearchDocument(com.google.common.base.Function<javax.faces.context.FacesContext,Object> func) |
void |
setCurrentPageSize(Long pageSize)
Sets the current page size.
|
void |
setCurrentResultLayout(ContentViewLayout layout)
Sets the current result layout.
|
void |
setCurrentResultLayout(ContentViewLayout layout,
boolean resetLayoutColumn) |
void |
setCurrentResultLayout(String resultLayoutName)
Sets the current result layout given its name.
|
void |
setCurrentResultLayoutColumns(List<String> resultColumns)
Sets the list of result layout columns.
|
void |
setExecuted(boolean executed)
Sets the content view execution status.
|
void |
setQuickFilters(List<QuickFilter> quickFilters) |
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.
|
void |
setWaitForExecution(boolean waitForExecution) |
void |
setWaitForExecutionSentence(String waitForExecutionSentence) |
String |
toString() |
protected PageProvider<?> pageProvider
protected boolean translateTitle
protected String emptySentence
protected boolean translateEmptySentence
protected boolean showTitle
protected String selectionList
protected String pagination
protected List<String> actionCategories
protected ContentViewLayout searchLayout
protected List<ContentViewLayout> resultLayouts
protected boolean currentResultLayoutSet
protected ContentViewLayout currentResultLayout
protected List<String> currentResultLayoutColumns
protected List<String> refreshEventNames
protected List<String> resetEventNames
protected boolean useGlobalPageSize
protected boolean showPageSizeSelector
protected boolean showRefreshCommand
protected boolean showFilterForm
protected Long currentPageSize
protected String[] queryParameters
protected DocumentModel searchDocumentModel
protected String searchDocumentModelBinding
protected String searchDocumentModelType
protected String resultColumnsBinding
protected String resultLayoutBinding
protected String pageSizeBinding
protected String sortInfosBinding
protected boolean waitForExecution
protected String waitForExecutionSentence
protected boolean executed
protected List<QuickFilter> quickFilters
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 resultLayoutBinding, String sortInfosBinding, String pageSizeBinding, boolean showTitle, boolean showPageSizeSelector, boolean showRefreshCommand, boolean showFilterForm, String emptySentence, boolean translateEmptySentence)
public String getName()
ContentViewgetName in interface ContentViewpublic String getTitle()
ContentViewgetTitle in interface ContentViewpublic boolean getTranslateTitle()
ContentViewgetTranslateTitle in interface ContentViewContentView.getTitle()public String getIconPath()
ContentViewgetIconPath in interface ContentViewpublic String getSelectionListName()
ContentViewgetSelectionListName in interface ContentViewpublic String getPagination()
ContentViewgetPagination in interface ContentViewpublic List<String> getActionsCategories()
ContentViewgetActionsCategories in interface ContentViewpublic ContentViewLayout getSearchLayout()
ContentViewgetSearchLayout in interface ContentViewpublic List<ContentViewLayout> getResultLayouts()
ContentViewgetResultLayouts in interface ContentViewpublic ContentViewLayout getCurrentResultLayout()
ContentViewContentView.setCurrentResultLayout(ContentViewLayout), or the first
of defined result layouts when not set.getCurrentResultLayout in interface ContentViewpublic void setCurrentResultLayout(ContentViewLayout layout)
ContentViewsetCurrentResultLayout in interface ContentViewpublic void setCurrentResultLayout(ContentViewLayout layout, boolean resetLayoutColumn)
protected Object resolveWithSearchDocument(com.google.common.base.Function<javax.faces.context.FacesContext,Object> func)
public void setCurrentResultLayout(String resultLayoutName)
ContentViewsetCurrentResultLayout in interface ContentViewpublic boolean hasResultLayoutBinding()
hasResultLayoutBinding in interface ContentViewpublic PageProvider<?> getPageProvider(DocumentModel searchDocument, List<SortInfo> sortInfos, Long pageSize, Long currentPage, Object... params)
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.
getPageProvider in interface ContentViewsearchDocument - 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 descriptionpageSize - if not null, will override default page size put in the page provider XML descriptioncurrentPage - if not null, will set the current page to given oneparams - 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()public PageProvider<?> getPageProviderWithParams(Object... params)
ContentViewgetPageProviderWithParams in interface ContentViewusing null as every argument except paramspublic PageProvider<?> getPageProvider()
ContentViewgetPageProvider in interface ContentView, using null as every argumentpublic PageProvider<?> getCurrentPageProvider()
ContentViewContentView.getPageProvider(),
ContentView.getPageProvider(DocumentModel, List, Long, Long, Object...) or
ContentView.getPageProviderWithParams(Object...) were never called before.getCurrentPageProvider in interface ContentViewpublic void resetPageProvider()
ContentView
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.
resetPageProvider in interface ContentViewpublic void refreshPageProvider()
ContentViewPageProvider.refresh().
Sort information and query parameters and current page are kept.
refreshPageProvider in interface ContentViewpublic void refreshAndRewindPageProvider()
ContentViewPageProvider.refresh(), and resets the current page
to the first one.
Sort information and query parameters are kept.
refreshAndRewindPageProvider in interface ContentViewpublic String getCacheKey()
ContentViewFacesContext instance if
it's an EL expression.getCacheKey in interface ContentViewpublic Integer getCacheSize()
ContentViewgetCacheSize in interface ContentViewpublic Object[] getQueryParameters()
ContentViewFacesContext instance if they are EL expressions.getQueryParameters in interface ContentViewpublic List<String> getRefreshEventNames()
ContentViewgetRefreshEventNames in interface ContentViewpublic List<String> getResetEventNames()
ContentViewgetResetEventNames in interface ContentViewpublic boolean getUseGlobalPageSize()
ContentViewgetUseGlobalPageSize in interface ContentViewpublic Long getCurrentPageSize()
ContentViewContentView.setCurrentPageSize(Long), or the page size set on current
page provider if not null.getCurrentPageSize in interface ContentViewpublic void setCurrentPageSize(Long pageSize)
ContentViewsetCurrentPageSize in interface ContentViewpublic DocumentModel getSearchDocumentModel()
ContentViewIf 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.
getSearchDocumentModel in interface ContentViewpublic void setSearchDocumentModel(DocumentModel searchDocumentModel)
ContentViewsetSearchDocumentModel in interface ContentViewpublic void resetSearchDocumentModel()
ContentViewContentView.getSearchDocumentModel()resetSearchDocumentModel in interface ContentViewpublic String getSearchDocumentModelType()
ContentViewgetSearchDocumentModelType in interface ContentViewpublic List<String> getFlags()
ContentViewContentViewService.getContentViewNames(String)getFlags in interface ContentViewpublic List<String> getResultLayoutColumns()
getResultLayoutColumns in interface ContentViewpublic List<String> getCurrentResultLayoutColumns()
ContentViewContentView.setCurrentResultLayoutColumns(List).getCurrentResultLayoutColumns in interface ContentViewpublic void setCurrentResultLayoutColumns(List<String> resultColumns)
ContentViewsetCurrentResultLayoutColumns in interface ContentViewpublic boolean hasResultLayoutColumnsBinding()
hasResultLayoutColumnsBinding in interface ContentViewprotected List<SortInfo> resolveSortInfos()
protected Long resolvePageSize()
protected Object addSearchDocumentToELContext(javax.faces.context.FacesContext facesContext)
protected void removeSearchDocumentFromELContext(javax.faces.context.FacesContext facesContext, Object previousValue)
public boolean getShowPageSizeSelector()
ContentViewgetShowPageSizeSelector in interface ContentViewpublic boolean getShowRefreshCommand()
ContentViewgetShowRefreshCommand in interface ContentViewpublic boolean getShowFilterForm()
ContentViewFilter 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.
getShowFilterForm in interface ContentViewpublic boolean getShowTitle()
ContentViewgetShowTitle in interface ContentViewpublic String getEmptySentence()
ContentViewgetEmptySentence in interface ContentViewpublic boolean getTranslateEmptySentence()
ContentViewgetTranslateEmptySentence in interface ContentViewContentView.getEmptySentence()protected void raiseEvent(String eventName, Object... params)
protected void raiseEvent(String eventName)
public void pageChanged(PageProvider<?> pageProvider)
PageProviderChangedListenerpageProvider has changed.pageChanged in interface PageProviderChangedListenerpublic void refreshed(PageProvider<?> pageProvider)
PageProviderChangedListenerpageProvider has refreshed.refreshed in interface PageProviderChangedListenerpublic void resetPageProviderAggregates()
ContentViewresetPageProviderAggregates in interface ContentViewpublic String getWaitForExecutionSentence()
ContentViewgetWaitForExecutionSentence in interface ContentViewpublic void setWaitForExecutionSentence(String waitForExecutionSentence)
public boolean isWaitForExecution()
ContentViewisWaitForExecution in interface ContentViewContentView.isExecuted()public void setWaitForExecution(boolean waitForExecution)
public boolean isExecuted()
ContentView
Execution is detected when either ContentView.refreshPageProvider() or ContentView.refreshAndRewindPageProvider()
methods are called, or when ContentView.setExecuted(boolean) is called explicitely.
isExecuted in interface ContentViewpublic void setExecuted(boolean executed)
ContentViewsetExecuted in interface ContentViewpublic void setQuickFilters(List<QuickFilter> quickFilters)
setQuickFilters in interface ContentViewpublic List<QuickFilter> getQuickFilters()
getQuickFilters in interface ContentViewCopyright © 2016 Nuxeo SA. All rights reserved.