Package org.opencms.ade.galleries.client
Class CmsGalleryController
java.lang.Object
org.opencms.ade.galleries.client.CmsGalleryController
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasValueChangeHandlers<org.opencms.ade.galleries.shared.CmsGallerySearchBean>,com.google.gwt.event.shared.HasHandlers
public class CmsGalleryController
extends Object
implements com.google.gwt.event.logical.shared.HasValueChangeHandlers<org.opencms.ade.galleries.shared.CmsGallerySearchBean>
Gallery dialog controller.
This class handles the communication between gallery dialog and the server. It contains the gallery data, but no references to the gallery dialog widget.
- Since:
- 8.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe current load results call id.protected org.opencms.ade.galleries.shared.CmsGalleryDataBeanThe gallery dialog bean.protected org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryModeThe gallery dialog mode.protected com.google.gwt.event.shared.SimpleEventBusThe event bus.protected CmsGalleryControllerHandlerThe gallery controller handler.protected booleanFlag to indicate that a load results request is currently running.protected org.opencms.ade.galleries.shared.CmsGallerySearchBeanThe gallery search object. -
Constructor Summary
ConstructorsConstructorDescriptionCmsGalleryController(CmsGalleryControllerHandler handler, org.opencms.ade.galleries.shared.CmsGalleryDataBean dialogBean, org.opencms.ade.galleries.shared.CmsGallerySearchBean searchBean) Constructor.CmsGalleryController(CmsGalleryControllerHandler handler, org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration conf) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategory(String categoryPath) Add category to search object.voidaddDateCreatedEnd(long end) Sets the created until date to the search object.voidaddDateCreatedStart(long start) Sets the created since date to the search object.voidaddDateModifiedEnd(long end) Sets the modified until date to the search object.voidaddDateModifiedStart(long start) Sets the modified since date to the search object.voidAdds a folder to the current search object.voidaddGallery(String galleryPath) Add gallery to search object.voidSets the locale to the search object.voidaddScope(org.opencms.ade.galleries.shared.CmsGallerySearchScope scope) Sets the search scope in the search object.voidaddSearchQuery(String searchQuery) Adds the search query from the search tab.voidAdd type to search object.com.google.gwt.event.shared.HandlerRegistrationaddValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<org.opencms.ade.galleries.shared.CmsGallerySearchBean> handler) voidRemoves all selected categories from the search object.voidclearFolders(boolean searchChanged) Removes all selected folders from the search object.voidRemoves all selected galleries from the search object.voidRemoves all full text search criteria from the search object.voidRemoves all selected types from the search object.static org.opencms.ade.galleries.shared.rpc.I_CmsGalleryServiceAsyncCreates a gallery service instance.voiddeleteResource(String resourcePath) Checks for broken links, ask for confirmation and finally deletes the given resource.voidfireEvent(com.google.gwt.event.shared.GwtEvent<?> event) List<org.opencms.ade.galleries.shared.CmsGalleryFolderBean> Gets the available galleries.Returns the available locales.org.opencms.ade.galleries.shared.CmsGallerySearchScopeGets the default search scope.Gets the default site root for the sitemap tab.Gets the default site root for the VFS tab.org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryModeReturns the gallery dialog mode.org.opencms.ade.galleries.shared.CmsGalleryFolderBeangetGalleryInfo(String galleryPath) Returns the gallery folder info to the given path.static org.opencms.ade.galleries.shared.rpc.I_CmsGalleryServiceAsyncReturns the gallery service instance.getPreselectOption(String siteRoot, List<org.opencms.ade.galleries.shared.CmsSiteSelectorOption> options) Gets the option which should be preselected for the site selector, or null.Returns the result view type.Returns the search locale.org.opencms.ade.galleries.shared.CmsGallerySearchScopeReturns the gallery search scope.List<org.opencms.ade.galleries.shared.CmsResourceTypeBean> Returns the searchable resource types.booleanReturns the default value for the "show expired" check box.List<org.opencms.ade.galleries.shared.CmsSiteSelectorOption> Gets the sitemap site selector options.Returns the start locale.Gets the start site root.voidgetSubEntries(String rootPath, boolean isRoot, String filter, I_CmsSimpleCallback<List<org.opencms.ade.galleries.shared.CmsSitemapEntryBean>> callback) Loads the sub entries for the given path.voidgetSubFolders(String folder, com.google.gwt.user.client.rpc.AsyncCallback<List<org.opencms.ade.galleries.shared.CmsVfsEntryBean>> callback) Retrieves the sub-folders of a given folder.org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryTabId[]Returns the configured tab id's.Gets the tree token, which is used to determine which tree state is loaded/saved for the VFS and sitemap tabs.org.opencms.ade.galleries.shared.CmsResourceTypeBeangetTypeInfo(String typeName) Returns the resource type info for the given resource type name.protected org.opencms.gwt.shared.rpc.I_CmsVfsServiceAsyncReturns the sitemap service instance.List<org.opencms.ade.galleries.shared.CmsSiteSelectorOption> Gets the site selector options.booleanReturns true if the galleries in the gallery tab should be selectable.booleanhasPreview(String resourceType) Returns if a preview is available for the given resource type.booleanReturns false if the results in the result tab should not be selectable.booleanReturns if folders should be selectable.booleanReturns if resource entries in the search result are selectable.protected voidinternalDeleteResource(String resourcePath) Deletes a resource.booleanReturns if files are included.booleanReturns if a load results request is currently running.booleanChecks if the gallery is first opened in results tab.booleanReturnstrue, if the search object was manipulated by the controllerfalseotherwise.booleanChecks if any search parameter are selected.booleanReturns true if the site selector should be shown.voidloadVfsEntryBean(String siteRoot, String filter, com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.ade.galleries.shared.CmsVfsEntryBean> asyncCallback) Loads the root VFS entry bean for a given site selector option.voidopenPreview(String resourcePath, String resourceType) Opens the preview for the given resource by the given resource type.static voidregisterPreviewFactory(String previewProviderName, I_CmsPreviewFactory factory) Registers a preview factory for the given name.voidremoveCategory(String categoryPath) Remove the category from the search object.voidRemoves the category from the search object.voidremoveFolder(String folder) Removes a folder from the current search object.voidremoveFolderParam(String key) Removes the folder from the search object.voidremoveGallery(String galleryPath) Remove the gallery from the search object.voidremoveGalleryParam(String key) Removes a selected gallery from the search object.voidRemoves the query.voidRemoves the search scope.protected voidremoveTab(org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryTabId tabId) Removes a tab id from the internal list of tab ids.voidRemoves the given full text search criteria from the search object.voidremoveType(String resourceType) Remove the type from the search object.voidremoveTypeParam(String key) Removes the type from the search object.protected voidRemoves the types tab from the list of configured tabs.voidsaveTreeState(String treeName, String siteRoot, Set<org.opencms.util.CmsUUID> openItemIds) Saves the tree state for a given tree on the server.voidsearchElement(String path, Runnable nextAction) Searches for a specific element and opens it's preview if found.voidselectResource(String resourcePath, org.opencms.util.CmsUUID structureId, String title, String resourceType) Selects the given resource and sets its path into the xml-content field or editor link.voidSelects the result tab.voidsetContainerInfoProvider(Supplier<org.opencms.gwt.shared.CmsGalleryContainerInfo> containerInfoProvider) Sets the function that provides the container information.voidsetHandler(CmsGalleryControllerHandler handler) Sets the controller handler for gallery dialog.voidsetIncludeExpired(boolean includeExpired, boolean fireEvent) Sets if the search should include expired or unreleased resources.voidsetResultViewType(String resultViewType) Stores the result view type.voidSets the search object changed flag totrue.voidsetShowSiteSelector(boolean isShowSiteSelector) Sets the "Show site selector" option.voidsetStartSite(String startSite) Sets the start site.voidsetTemplateContextInfoProvider(Supplier<org.opencms.gwt.shared.CmsTemplateContextInfo> provider) Sets the template context info provider.voidsortCategories(String sortParams, String filter) Sorts the categories according to given parameters and updates the list.voidsortGalleries(String sortParams, String filter) Sorts the galleries according to given parameters and updates the list.voidsortResults(String sortParams) Sorts the results according to given parameters and updates the list.voidSorts the types according to given parameters and updates the list.voidUpdates the size of the active tab.voidUpdates the content of the categories tab.voidUpdates the content of the galleries(folders) tab.voidupdateGalleryData(org.opencms.ade.galleries.shared.CmsGalleryDataBean data) Updates the gallery data.voidUpdates the gallery index and triggers a new search afterwards.voidupdateResultsTab(boolean isNextPage) Updates the content of the results tab.voidUpdates the content of the types tab.
-
Field Details
-
m_currentCallId
The current load results call id. -
m_dialogBean
The gallery dialog bean. -
m_dialogMode
The gallery dialog mode. -
m_eventBus
The event bus. -
m_handler
The gallery controller handler. -
m_loading
Flag to indicate that a load results request is currently running. -
m_searchObject
The gallery search object.
-
-
Constructor Details
-
Method Details
-
createGalleryService
Creates a gallery service instance.- Returns:
- the gallery service instance
-
getGalleryService
Returns the gallery service instance.- Returns:
- the gallery service instance
-
registerPreviewFactory
Registers a preview factory for the given name.- Parameters:
previewProviderName- the preview provider namefactory- the preview factory
-
addCategory
Add category to search object.- Parameters:
categoryPath- the id of the category to add
-
addDateCreatedEnd
Sets the created until date to the search object.- Parameters:
end- the created until date as long
-
addDateCreatedStart
Sets the created since date to the search object.- Parameters:
start- the created since date as long
-
addDateModifiedEnd
Sets the modified until date to the search object.- Parameters:
end- the modified until date as long
-
addDateModifiedStart
Sets the modified since date to the search object.- Parameters:
start- the modified since date as long
-
addFolder
Adds a folder to the current search object.- Parameters:
folder- the folder to add
-
addGallery
Add gallery to search object.- Parameters:
galleryPath- the id of the gallery to add
-
addLocale
Sets the locale to the search object.- Parameters:
locale- the locale to set
-
addSearchQuery
Adds the search query from the search tab.- Parameters:
searchQuery- the search query
-
addType
Add type to search object.- Parameters:
resourceType- the id(name?) of the resource type to add
-
clearCategories
Removes all selected categories from the search object. -
clearFolders
Removes all selected folders from the search object.- Parameters:
searchChanged- if true, marks the search parameters as changed
-
clearGalleries
Removes all selected galleries from the search object. -
clearTextSearch
Removes all full text search criteria from the search object. -
clearTypes
Removes all selected types from the search object. -
deleteResource
Checks for broken links, ask for confirmation and finally deletes the given resource.- Parameters:
resourcePath- the resource path of the resource to delete
-
getAvailableGalleries
Gets the available galleries.- Returns:
- the list of available galleries
-
getAvailableLocales
Returns the available locales.- Returns:
- the available locales
-
getDefaultScope
Gets the default search scope.- Returns:
- the default search scope
-
getDefaultSitemapTabSiteRoot
Gets the default site root for the sitemap tab.- Returns:
- the default site root for the sitemap tab
-
getDefaultVfsTabSiteRoot
Gets the default site root for the VFS tab.- Returns:
- the default site root for the VFS tab
-
getDialogMode
Returns the gallery dialog mode.- Returns:
- the gallery dialog mode
-
getGalleryInfo
Returns the gallery folder info to the given path.- Parameters:
galleryPath- the gallery folder path- Returns:
- the gallery folder info
-
getPreselectOption
public String getPreselectOption(String siteRoot, List<org.opencms.ade.galleries.shared.CmsSiteSelectorOption> options) Gets the option which should be preselected for the site selector, or null.- Parameters:
siteRoot- the site rootoptions- the list of options- Returns:
- the key for the option to preselect
-
getResultViewType
Returns the result view type.- Returns:
- the result view type
-
getSearchLocale
Returns the search locale.- Returns:
- the search locale
-
getSearchScope
Returns the gallery search scope.- Returns:
- the gallery search scope
-
getSearchTypes
Returns the searchable resource types.- Returns:
- the searchable resource types
-
getShowExpiredDefault
Returns the default value for the "show expired" check box.- Returns:
- the default value for "show expired"
-
getSitemapSiteSelectorOptions
Gets the sitemap site selector options.- Returns:
- the sitemap site selector options
-
getStartLocale
Returns the start locale.- Returns:
- the start locale
-
getStartSiteRoot
Gets the start site root.- Returns:
- the start site root
-
getSubEntries
public void getSubEntries(String rootPath, boolean isRoot, String filter, I_CmsSimpleCallback<List<org.opencms.ade.galleries.shared.CmsSitemapEntryBean>> callback) Loads the sub entries for the given path.- Parameters:
rootPath- the root pathisRoot-trueif the requested entry is the root entryfilter- the sitemap filter stringcallback- the callback to execute with the result
-
getSubFolders
public void getSubFolders(String folder, com.google.gwt.user.client.rpc.AsyncCallback<List<org.opencms.ade.galleries.shared.CmsVfsEntryBean>> callback) Retrieves the sub-folders of a given folder.- Parameters:
folder- the folder whose sub-folders should be retrievedcallback- the callback for processing the sub-folders
-
getTabIds
Returns the configured tab id's.- Returns:
- the configured tab id's
-
getTreeToken
Gets the tree token, which is used to determine which tree state is loaded/saved for the VFS and sitemap tabs.- Returns:
- the tree token
-
getTypeInfo
Returns the resource type info for the given resource type name.- Parameters:
typeName- the resource type name- Returns:
- the type info
-
getVfsSiteSelectorOptions
Gets the site selector options.- Returns:
- the site selector options
-
hasGalleriesSelectable
Returns true if the galleries in the gallery tab should be selectable.- Returns:
- true if the galleries should be selectable
-
hasPreview
Returns if a preview is available for the given resource type.- Parameters:
resourceType- the requested resource type- Returns:
trueif a preview is available for the given resource type
-
hasResultsSelectable
Returns false if the results in the result tab should not be selectable.- Returns:
- false if the results in the result tab should not be selectable
-
hasSelectFolder
Returns if folders should be selectable.- Returns:
trueif folders should be selectable
-
hasSelectResource
Returns if resource entries in the search result are selectable.- Returns:
- if resource entries in the search result are selectable
-
isIncludeFiles
Returns if files are included.- Returns:
trueif files are included
-
isLoading
Returns if a load results request is currently running.- Returns:
trueif a load results request is currently running
-
isOpenInResults
Checks if the gallery is first opened in results tab.- Returns:
- true if gallery is first opened in results tab, false otherwise
-
isSearchObjectChanged
Returnstrue, if the search object was manipulated by the controllerfalseotherwise.- Returns:
- the search object changed flag
-
isSearchObjectEmpty
Checks if any search parameter are selected.- Returns:
falseif any search parameter is selected,trueif there are no search parameter selected
-
isShowSiteSelector
Returns true if the site selector should be shown.- Returns:
- true if the site selector should be shown
-
loadVfsEntryBean
public void loadVfsEntryBean(String siteRoot, String filter, com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.ade.galleries.shared.CmsVfsEntryBean> asyncCallback) Loads the root VFS entry bean for a given site selector option.- Parameters:
siteRoot- the site root for which the VFS entry should be loadedfilter- the search filterasyncCallback- the callback to call with the result
-
openPreview
Opens the preview for the given resource by the given resource type.- Parameters:
resourcePath- the resource pathresourceType- the resource type name
-
removeCategory
Remove the category from the search object.- Parameters:
categoryPath- the category path as id
-
removeCategoryParam
Removes the category from the search object.- Parameters:
key- the category
-
removeFolder
Removes a folder from the current search object.- Parameters:
folder- the folder to remove
-
removeFolderParam
Removes the folder from the search object.- Parameters:
key- the folder
-
removeGallery
Remove the gallery from the search object.- Parameters:
galleryPath- the gallery path as id
-
removeGalleryParam
Removes a selected gallery from the search object.- Parameters:
key- the gallery key
-
removeQuery
Removes the query. -
removeScope
Removes the search scope. -
removeTextSearchParameter
Removes the given full text search criteria from the search object.- Parameters:
key- the key of the parameter to remove
-
removeType
Remove the type from the search object.- Parameters:
resourceType- the resource type as id
-
removeTypeParam
Removes the type from the search object.- Parameters:
key- the type
-
saveTreeState
public void saveTreeState(String treeName, String siteRoot, Set<org.opencms.util.CmsUUID> openItemIds) Saves the tree state for a given tree on the server.- Parameters:
treeName- the tree namesiteRoot- the site rootopenItemIds- the structure ids of opened items
-
searchElement
Searches for a specific element and opens it's preview if found.- Parameters:
path- the element pathnextAction- the next action to execute after the search data for the element has been loaded into the gallery dialog
-
selectResource
public void selectResource(String resourcePath, org.opencms.util.CmsUUID structureId, String title, String resourceType) Selects the given resource and sets its path into the xml-content field or editor link.- Parameters:
resourcePath- the resource pathstructureId- the structure idtitle- the resource titleresourceType- the resource type
-
selectResultTab
Selects the result tab. -
setContainerInfoProvider
public void setContainerInfoProvider(Supplier<org.opencms.gwt.shared.CmsGalleryContainerInfo> containerInfoProvider) Sets the function that provides the container information.- Parameters:
containerInfoProvider- the container info provider
-
setHandler
Sets the controller handler for gallery dialog.- Parameters:
handler- the handler to set
-
setIncludeExpired
Sets if the search should include expired or unreleased resources.- Parameters:
includeExpired- if the search should include expired or unreleased resourcesfireEvent- true if a change event should be fired after setting the value
-
setResultViewType
Stores the result view type.- Parameters:
resultViewType- the result view type
-
setSearchObjectChanged
Sets the search object changed flag totrue. -
setShowSiteSelector
Sets the "Show site selector" option.- Parameters:
isShowSiteSelector- the new value for the option
-
setStartSite
Sets the start site.- Parameters:
startSite- the start site
-
setTemplateContextInfoProvider
public void setTemplateContextInfoProvider(Supplier<org.opencms.gwt.shared.CmsTemplateContextInfo> provider) Sets the template context info provider.- Parameters:
provider- the template context info provider
-
sortCategories
Sorts the categories according to given parameters and updates the list.- Parameters:
sortParams- the sort parametersfilter- the filter to apply before sorting
-
sortGalleries
Sorts the galleries according to given parameters and updates the list.- Parameters:
sortParams- the sort parametersfilter- the filter to apply before sorting
-
sortResults
Sorts the results according to given parameters and updates the list.- Parameters:
sortParams- the sort parameters
-
sortTypes
Sorts the types according to given parameters and updates the list.- Parameters:
sortParams- the sort parameters
-
updateActiveTabSize
Updates the size of the active tab. -
updateCategoriesTab
Updates the content of the categories tab. -
updateGalleriesTab
Updates the content of the galleries(folders) tab. -
updateIndex
Updates the gallery index and triggers a new search afterwards. -
updateResultsTab
Updates the content of the results tab.- Parameters:
isNextPage- signals if the next page should be loaded
-
updatesTypesTab
Updates the content of the types tab. -
getVfsService
Returns the sitemap service instance.- Returns:
- the sitemap service instance
-
internalDeleteResource
Deletes a resource.- Parameters:
resourcePath- the path of the resource to delete
-
removeTypesTab
Removes the types tab from the list of configured tabs.This will only take effect when executed before tab initialization.
-