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
Modifier and TypeFieldDescriptionprotected int
The current load results call id.protected org.opencms.ade.galleries.shared.CmsGalleryDataBean
The gallery dialog bean.protected org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode
The gallery dialog mode.protected com.google.gwt.event.shared.SimpleEventBus
The event bus.protected CmsGalleryControllerHandler
The gallery controller handler.protected boolean
Flag to indicate that a load results request is currently running.protected org.opencms.ade.galleries.shared.CmsGallerySearchBean
The gallery search object. -
Constructor Summary
ConstructorDescriptionCmsGalleryController
(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 TypeMethodDescriptionvoid
addCategory
(String categoryPath) Add category to search object.void
addDateCreatedEnd
(long end) Sets the created until date to the search object.void
addDateCreatedStart
(long start) Sets the created since date to the search object.void
addDateModifiedEnd
(long end) Sets the modified until date to the search object.void
addDateModifiedStart
(long start) Sets the modified since date to the search object.void
Adds a folder to the current search object.void
addGallery
(String galleryPath) Add gallery to search object.void
Sets the locale to the search object.void
addScope
(org.opencms.ade.galleries.shared.CmsGallerySearchScope scope) Sets the search scope in the search object.void
addSearchQuery
(String searchQuery) Adds the search query from the search tab.void
Add type to search object.com.google.gwt.event.shared.HandlerRegistration
addValueChangeHandler
(com.google.gwt.event.logical.shared.ValueChangeHandler<org.opencms.ade.galleries.shared.CmsGallerySearchBean> handler) void
Removes all selected categories from the search object.void
clearFolders
(boolean searchChanged) Removes all selected folders from the search object.void
Removes all selected galleries from the search object.void
Removes all full text search criteria from the search object.void
Removes all selected types from the search object.static org.opencms.ade.galleries.shared.rpc.I_CmsGalleryServiceAsync
Creates a gallery service instance.void
deleteResource
(String resourcePath) Checks for broken links, ask for confirmation and finally deletes the given resource.void
fireEvent
(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.CmsGallerySearchScope
Gets 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.GalleryMode
Returns the gallery dialog mode.org.opencms.ade.galleries.shared.CmsGalleryFolderBean
getGalleryInfo
(String galleryPath) Returns the gallery folder info to the given path.static org.opencms.ade.galleries.shared.rpc.I_CmsGalleryServiceAsync
Returns 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.CmsGallerySearchScope
Returns the gallery search scope.List<org.opencms.ade.galleries.shared.CmsResourceTypeBean>
Returns the searchable resource types.boolean
Returns 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.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.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.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.CmsResourceTypeBean
getTypeInfo
(String typeName) Returns the resource type info for the given resource type name.protected org.opencms.gwt.shared.rpc.I_CmsVfsServiceAsync
Returns the sitemap service instance.List<org.opencms.ade.galleries.shared.CmsSiteSelectorOption>
Gets the site selector options.boolean
Returns true if the galleries in the gallery tab should be selectable.boolean
hasPreview
(String resourceType) Returns if a preview is available for the given resource type.boolean
Returns false if the results in the result tab should not be selectable.boolean
Returns if folders should be selectable.boolean
Returns if resource entries in the search result are selectable.protected void
internalDeleteResource
(String resourcePath) Deletes a resource.boolean
Returns if files are included.boolean
Returns if a load results request is currently running.boolean
Checks if the gallery is first opened in results tab.boolean
Returnstrue
, if the search object was manipulated by the controllerfalse
otherwise.boolean
Checks if any search parameter are selected.boolean
Returns true if the site selector should be shown.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.void
openPreview
(String resourcePath, String resourceType) Opens the preview for the given resource by the given resource type.static void
registerPreviewFactory
(String previewProviderName, I_CmsPreviewFactory factory) Registers a preview factory for the given name.void
removeCategory
(String categoryPath) Remove the category from the search object.void
Removes the category from the search object.void
removeFolder
(String folder) Removes a folder from the current search object.void
removeFolderParam
(String key) Removes the folder from the search object.void
removeGallery
(String galleryPath) Remove the gallery from the search object.void
removeGalleryParam
(String key) Removes a selected gallery from the search object.void
Removes the query.void
Removes the search scope.protected void
removeTab
(org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryTabId tabId) Removes a tab id from the internal list of tab ids.void
Removes the given full text search criteria from the search object.void
removeType
(String resourceType) Remove the type from the search object.void
removeTypeParam
(String key) Removes the type from the search object.protected void
Removes the types tab from the list of configured tabs.void
saveTreeState
(String treeName, String siteRoot, Set<org.opencms.util.CmsUUID> openItemIds) Saves the tree state for a given tree on the server.void
searchElement
(String path, Runnable nextAction) Searches for a specific element and opens it's preview if found.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.void
Selects the result tab.void
setContainerInfoProvider
(Supplier<org.opencms.gwt.shared.CmsGalleryContainerInfo> containerInfoProvider) Sets the function that provides the container information.void
setHandler
(CmsGalleryControllerHandler handler) Sets the controller handler for gallery dialog.void
setIncludeExpired
(boolean includeExpired, boolean fireEvent) Sets if the search should include expired or unreleased resources.void
setResultViewType
(String resultViewType) Stores the result view type.void
Sets the search object changed flag totrue
.void
setShowSiteSelector
(boolean isShowSiteSelector) Sets the "Show site selector" option.void
setStartSite
(String startSite) Sets the start site.void
setTemplateContextInfoProvider
(Supplier<org.opencms.gwt.shared.CmsTemplateContextInfo> provider) Sets the template context info provider.void
sortCategories
(String sortParams, String filter) Sorts the categories according to given parameters and updates the list.void
sortGalleries
(String sortParams, String filter) Sorts the galleries according to given parameters and updates the list.void
sortResults
(String sortParams) Sorts the results according to given parameters and updates the list.void
Sorts the types according to given parameters and updates the list.void
Updates the size of the active tab.void
Updates the content of the categories tab.void
Updates the content of the galleries(folders) tab.void
updateGalleryData
(org.opencms.ade.galleries.shared.CmsGalleryDataBean data) Updates the gallery data.void
Updates the gallery index and triggers a new search afterwards.void
updateResultsTab
(boolean isNextPage) Updates the content of the results tab.void
Updates 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
-true
if 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:
true
if 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:
true
if 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:
true
if files are included
-
isLoading
Returns if a load results request is currently running.- Returns:
true
if 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 controllerfalse
otherwise.- Returns:
- the search object changed flag
-
isSearchObjectEmpty
Checks if any search parameter are selected.- Returns:
false
if any search parameter is selected,true
if 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.
-