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 Details

    • m_currentCallId

      protected int m_currentCallId
      The current load results call id.
    • m_dialogBean

      protected org.opencms.ade.galleries.shared.CmsGalleryDataBean m_dialogBean
      The gallery dialog bean.
    • m_dialogMode

      protected org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode m_dialogMode
      The gallery dialog mode.
    • m_eventBus

      protected com.google.gwt.event.shared.SimpleEventBus m_eventBus
      The event bus.
    • m_handler

      The gallery controller handler.
    • m_loading

      protected boolean m_loading
      Flag to indicate that a load results request is currently running.
    • m_searchObject

      protected org.opencms.ade.galleries.shared.CmsGallerySearchBean m_searchObject
      The gallery search object.
  • Constructor Details

    • CmsGalleryController

      public CmsGalleryController(CmsGalleryControllerHandler handler, org.opencms.ade.galleries.shared.CmsGalleryDataBean dialogBean, org.opencms.ade.galleries.shared.CmsGallerySearchBean searchBean)
      Constructor.

      Parameters:
      handler - the controller handler
      dialogBean - the gallery data
      searchBean - the prefetched search
    • CmsGalleryController

      public CmsGalleryController(CmsGalleryControllerHandler handler, org.opencms.ade.galleries.shared.I_CmsGalleryConfiguration conf)
      Constructor.

      Parameters:
      handler - the controller handler
      conf - the gallery configuration
  • Method Details

    • createGalleryService

      public static org.opencms.ade.galleries.shared.rpc.I_CmsGalleryServiceAsync createGalleryService()
      Creates a gallery service instance.

      Returns:
      the gallery service instance
    • getGalleryService

      public static org.opencms.ade.galleries.shared.rpc.I_CmsGalleryServiceAsync getGalleryService()
      Returns the gallery service instance.

      Returns:
      the gallery service instance
    • registerPreviewFactory

      public static void registerPreviewFactory(String previewProviderName, I_CmsPreviewFactory factory)
      Registers a preview factory for the given name.
      Parameters:
      previewProviderName - the preview provider name
      factory - the preview factory
    • addCategory

      public void addCategory(String categoryPath)
      Add category to search object.

      Parameters:
      categoryPath - the id of the category to add
    • addDateCreatedEnd

      public void addDateCreatedEnd(long end)
      Sets the created until date to the search object.

      Parameters:
      end - the created until date as long
    • addDateCreatedStart

      public void addDateCreatedStart(long start)
      Sets the created since date to the search object.

      Parameters:
      start - the created since date as long
    • addDateModifiedEnd

      public void addDateModifiedEnd(long end)
      Sets the modified until date to the search object.

      Parameters:
      end - the modified until date as long
    • addDateModifiedStart

      public void addDateModifiedStart(long start)
      Sets the modified since date to the search object.

      Parameters:
      start - the modified since date as long
    • addFolder

      public void addFolder(String folder)
      Adds a folder to the current search object.

      Parameters:
      folder - the folder to add
    • addGallery

      public void addGallery(String galleryPath)
      Add gallery to search object.

      Parameters:
      galleryPath - the id of the gallery to add
    • addLocale

      public void addLocale(String locale)
      Sets the locale to the search object.

      Parameters:
      locale - the locale to set
    • addScope

      public void addScope(org.opencms.ade.galleries.shared.CmsGallerySearchScope scope)
      Sets the search scope in the search object.

      Parameters:
      scope - the search scope
    • addSearchQuery

      public void addSearchQuery(String searchQuery)
      Adds the search query from the search tab.

      Parameters:
      searchQuery - the search query
    • addType

      public void addType(String resourceType)
      Add type to search object.

      Parameters:
      resourceType - the id(name?) of the resource type to add
    • addValueChangeHandler

      public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<org.opencms.ade.galleries.shared.CmsGallerySearchBean> handler)
      Specified by:
      addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<org.opencms.ade.galleries.shared.CmsGallerySearchBean>
      See Also:
      • HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
    • clearCategories

      public void clearCategories()
      Removes all selected categories from the search object.

    • clearFolders

      public void clearFolders(boolean searchChanged)
      Removes all selected folders from the search object.

      Parameters:
      searchChanged - if true, marks the search parameters as changed
    • clearGalleries

      public void clearGalleries()
      Removes all selected galleries from the search object.

    • clearTextSearch

      public void clearTextSearch()
      Removes all full text search criteria from the search object.

    • clearTypes

      public void clearTypes()
      Removes all selected types from the search object.

    • deleteResource

      public void deleteResource(String resourcePath)
      Checks for broken links, ask for confirmation and finally deletes the given resource.

      Parameters:
      resourcePath - the resource path of the resource to delete
    • fireEvent

      public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
      Specified by:
      fireEvent in interface com.google.gwt.event.shared.HasHandlers
      See Also:
      • HasHandlers.fireEvent(com.google.gwt.event.shared.GwtEvent)
    • getAvailableGalleries

      public List<org.opencms.ade.galleries.shared.CmsGalleryFolderBean> getAvailableGalleries()
      Gets the available galleries.

      Returns:
      the list of available galleries
    • getAvailableLocales

      Returns the available locales.

      Returns:
      the available locales
    • getDefaultScope

      public org.opencms.ade.galleries.shared.CmsGallerySearchScope 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

      public org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode getDialogMode()
      Returns the gallery dialog mode.

      Returns:
      the gallery dialog mode
    • getGalleryInfo

      public org.opencms.ade.galleries.shared.CmsGalleryFolderBean getGalleryInfo(String galleryPath)
      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 root
      options - 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

      public org.opencms.ade.galleries.shared.CmsGallerySearchScope getSearchScope()
      Returns the gallery search scope.

      Returns:
      the gallery search scope
    • getSearchTypes

      public List<org.opencms.ade.galleries.shared.CmsResourceTypeBean> getSearchTypes()
      Returns the searchable resource types.

      Returns:
      the searchable resource types
    • getShowExpiredDefault

      public boolean getShowExpiredDefault()
      Returns the default value for the "show expired" check box.

      Returns:
      the default value for "show expired"
    • getSitemapSiteSelectorOptions

      public List<org.opencms.ade.galleries.shared.CmsSiteSelectorOption> 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 path
      isRoot - true if the requested entry is the root entry
      filter - the sitemap filter string
      callback - 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 retrieved
      callback - the callback for processing the sub-folders
    • getTabIds

      public org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryTabId[] getTabIds()
      Returns the configured tab id's.

      Returns:
      the configured tab id's
    • getTreeToken

      public String 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

      public org.opencms.ade.galleries.shared.CmsResourceTypeBean getTypeInfo(String typeName)
      Returns the resource type info for the given resource type name.

      Parameters:
      typeName - the resource type name
      Returns:
      the type info
    • getVfsSiteSelectorOptions

      public List<org.opencms.ade.galleries.shared.CmsSiteSelectorOption> getVfsSiteSelectorOptions()
      Gets the site selector options.

      Returns:
      the site selector options
    • hasGalleriesSelectable

      public boolean hasGalleriesSelectable()
      Returns true if the galleries in the gallery tab should be selectable.

      Returns:
      true if the galleries should be selectable
    • hasPreview

      public boolean hasPreview(String resourceType)
      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

      public boolean 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

      public boolean hasSelectFolder()
      Returns if folders should be selectable.

      Returns:
      true if folders should be selectable
    • hasSelectResource

      public boolean hasSelectResource()
      Returns if resource entries in the search result are selectable.

      Returns:
      if resource entries in the search result are selectable
    • isIncludeFiles

      public boolean isIncludeFiles()
      Returns if files are included.

      Returns:
      true if files are included
    • isLoading

      public boolean isLoading()
      Returns if a load results request is currently running.

      Returns:
      true if a load results request is currently running
    • isOpenInResults

      public boolean isOpenInResults()
      Checks if the gallery is first opened in results tab.

      Returns:
      true if gallery is first opened in results tab, false otherwise
    • isSearchObjectChanged

      public boolean isSearchObjectChanged()
      Returns true, if the search object was manipulated by the controller false otherwise.

      Returns:
      the search object changed flag
    • isSearchObjectEmpty

      public boolean 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

      public boolean 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 loaded
      filter - the search filter
      asyncCallback - the callback to call with the result
    • openPreview

      public void openPreview(String resourcePath, String resourceType)
      Opens the preview for the given resource by the given resource type.

      Parameters:
      resourcePath - the resource path
      resourceType - the resource type name
    • removeCategory

      public void removeCategory(String categoryPath)
      Remove the category from the search object.

      Parameters:
      categoryPath - the category path as id
    • removeCategoryParam

      public void removeCategoryParam(String key)
      Removes the category from the search object.

      Parameters:
      key - the category
    • removeFolder

      public void removeFolder(String folder)
      Removes a folder from the current search object.

      Parameters:
      folder - the folder to remove
    • removeFolderParam

      public void removeFolderParam(String key)
      Removes the folder from the search object.

      Parameters:
      key - the folder
    • removeGallery

      public void removeGallery(String galleryPath)
      Remove the gallery from the search object.

      Parameters:
      galleryPath - the gallery path as id
    • removeGalleryParam

      public void removeGalleryParam(String key)
      Removes a selected gallery from the search object.

      Parameters:
      key - the gallery key
    • removeQuery

      public void removeQuery()
      Removes the query.
    • removeScope

      public void removeScope()
      Removes the search scope.
    • removeTextSearchParameter

      public void removeTextSearchParameter(String key)
      Removes the given full text search criteria from the search object.

      Parameters:
      key - the key of the parameter to remove
    • removeType

      public void removeType(String resourceType)
      Remove the type from the search object.

      Parameters:
      resourceType - the resource type as id
    • removeTypeParam

      public void removeTypeParam(String key)
      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 name
      siteRoot - the site root
      openItemIds - the structure ids of opened items
    • searchElement

      public void searchElement(String path, Runnable nextAction)
      Searches for a specific element and opens it's preview if found.

      Parameters:
      path - the element path
      nextAction - 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 path
      structureId - the structure id
      title - the resource title
      resourceType - the resource type
    • selectResultTab

      public void 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

      public void setHandler(CmsGalleryControllerHandler handler)
      Sets the controller handler for gallery dialog.

      Parameters:
      handler - the handler to set
    • setIncludeExpired

      public void setIncludeExpired(boolean includeExpired, boolean fireEvent)
      Sets if the search should include expired or unreleased resources.

      Parameters:
      includeExpired - if the search should include expired or unreleased resources
      fireEvent - true if a change event should be fired after setting the value
    • setResultViewType

      public void setResultViewType(String resultViewType)
      Stores the result view type.

      Parameters:
      resultViewType - the result view type
    • setSearchObjectChanged

      public void setSearchObjectChanged()
      Sets the search object changed flag to true.

    • setShowSiteSelector

      public void setShowSiteSelector(boolean isShowSiteSelector)
      Sets the "Show site selector" option.

      Parameters:
      isShowSiteSelector - the new value for the option
    • setStartSite

      public void setStartSite(String startSite)
      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

      public void sortCategories(String sortParams, String filter)
      Sorts the categories according to given parameters and updates the list.

      Parameters:
      sortParams - the sort parameters
      filter - the filter to apply before sorting
    • sortGalleries

      public void sortGalleries(String sortParams, String filter)
      Sorts the galleries according to given parameters and updates the list.

      Parameters:
      sortParams - the sort parameters
      filter - the filter to apply before sorting
    • sortResults

      public void sortResults(String sortParams)
      Sorts the results according to given parameters and updates the list.

      Parameters:
      sortParams - the sort parameters
    • sortTypes

      public void sortTypes(String sortParams)
      Sorts the types according to given parameters and updates the list.

      Parameters:
      sortParams - the sort parameters
    • updateActiveTabSize

      public void updateActiveTabSize()
      Updates the size of the active tab.

    • updateCategoriesTab

      public void updateCategoriesTab()
      Updates the content of the categories tab.

    • updateGalleriesTab

      public void updateGalleriesTab()
      Updates the content of the galleries(folders) tab.

    • updateGalleryData

      public void updateGalleryData(org.opencms.ade.galleries.shared.CmsGalleryDataBean data)
      Updates the gallery data.

      Parameters:
      data - the gallery data
    • updateIndex

      public void updateIndex()
      Updates the gallery index and triggers a new search afterwards.

    • updateResultsTab

      public void updateResultsTab(boolean isNextPage)
      Updates the content of the results tab.

      Parameters:
      isNextPage - signals if the next page should be loaded
    • updatesTypesTab

      public void updatesTypesTab()
      Updates the content of the types tab.

    • getVfsService

      protected org.opencms.gwt.shared.rpc.I_CmsVfsServiceAsync getVfsService()
      Returns the sitemap service instance.

      Returns:
      the sitemap service instance
    • internalDeleteResource

      protected void internalDeleteResource(String resourcePath)
      Deletes a resource.

      Parameters:
      resourcePath - the path of the resource to delete
    • removeTab

      protected void removeTab(org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryTabId tabId)
      Removes a tab id from the internal list of tab ids.

      Parameters:
      tabId - the id of the tab to remove
    • removeTypesTab

      protected void removeTypesTab()
      Removes the types tab from the list of configured tabs.

      This will only take effect when executed before tab initialization.