Class CmsCoreProvider

java.lang.Object
org.opencms.gwt.shared.CmsCoreData
org.opencms.gwt.client.CmsCoreProvider
All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable

public final class CmsCoreProvider extends org.opencms.gwt.shared.CmsCoreData
Client side core data provider.

Since:
8.0.0
See Also:
  • CmsGwtActionElement
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.opencms.gwt.shared.CmsCoreData

    org.opencms.gwt.shared.CmsCoreData.AdeContext, org.opencms.gwt.shared.CmsCoreData.ModuleKey, org.opencms.gwt.shared.CmsCoreData.UserInfo
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.opencms.gwt.shared.I_CmsAutoBeanFactory
    AutoBean factory instance.
    static final CmsMediaQuery
    Media query do detect device with no hover capability.
    static final String
    The media query string to detect touch only devices.
    static final String
    Path to system folder.

    Fields inherited from class org.opencms.gwt.shared.CmsCoreData

    DICT_NAME, KEY_GWT_BUILDID, m_serverTime, m_userInfo, META_PARAM_MODULE_KEY, PARAM_PATH, PARAM_RETURNCODE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Prevent instantiation.
  • Method Summary

    Modifier and Type
    Method
    Description
    addSiteRoot(String sitePath)
    Adds the current site root of this context to the given resource name.
    void
    createUUID(com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.util.CmsUUID> callback)
    Creates a new CmsUUID.
    void
    fireEvent(com.google.web.bindery.event.shared.Event<?> event)
    Fires a client side event.
    get()
    Returns the client message instance.
    getAdjustedSiteRoot(String siteRoot, String resourcename)
    Returns the adjusted site root for a resource using the provided site root as a base.
    long
    Returns the approximate time on the server.
    com.google.web.bindery.event.shared.EventBus
    Gets the core event bus.
    Returns the link to view the given resource in the file explorer.
    Gets the unique active item container which holds a reference to the currently active content element flyout menu.
    org.opencms.util.CmsUUID
    Gets the page id that was last stored in sessionStorage.
    static String
    Gets the content attribute of a meta tag with a given name.
    void
    getResourceState(org.opencms.util.CmsUUID structureId, com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.db.CmsResourceState> callback)
    Fetches the state of a resource from the server.
    Returns the resource type name for a given filename.
    Gets the resource type icon for the given path.
    Returns the resource type name for a given filename.
    static org.opencms.gwt.shared.rpc.I_CmsCoreServiceAsync
    Returns the core service instance.
    static org.opencms.gwt.shared.rpc.I_CmsVfsServiceAsync
    Returns the vfs service instance.
    boolean
    Returns if the current user agent is IE7.
    static boolean
    Checks if the client is touch-only.
    link(String sitePath)
    Returns an absolute link given a site path.
    void
    lock(String sitePath, long loadTime, I_CmsSimpleCallback<Boolean> callback)
    Locks the given resource with a temporary lock.
    void
    lock(org.opencms.util.CmsUUID structureId, long loadTime, I_CmsSimpleCallback<Boolean> callback)
    Locks the given resource with a temporary lock.
    void
    lock(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<Boolean> callback)
    Locks the given resource with a temporary lock.
    void
    lockOrReturnError(String sitePath, long loadTime, I_CmsSimpleCallback<String> callback)
    Tries to lock a resource with a given site path and returns an error if the locking fails.
    void
    Tries to lock a resource with a given site path and returns an error if the locking fails.
    void
    lockOrReturnError(org.opencms.util.CmsUUID structureId, long loadTime, I_CmsSimpleCallback<String> callback)
    Tries to lock a resource with a given structure id and returns an error if the locking fails.
    void
    lockOrReturnError(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<String> callback)
    Tries to lock a resource with a given structure id and returns an error if the locking fails.
    Removes the current site root prefix from the given root path, that is adjusts the resource name for the current site root.
    void
    setShowEditorHelp(boolean show)
     
    void
    Returns the absolute link to the given root path.
    boolean
    unlock(String sitePath)
    Unlocks the given resource, synchronously.
    boolean
    unlock(org.opencms.util.CmsUUID structureId)
    Unlocks the given resource, synchronously.

    Methods inherited from class org.opencms.gwt.shared.CmsCoreData

    getAboutLink, getAdeParameters, getCategoryBaseFolder, getContentEditorBacklinkUrl, getContentEditorUrl, getDefaultWorkplaceLink, getEmbeddedDialogsUrl, getExtensionMapping, getFileExplorerLink, getIconMapping, getLocale, getLoginURL, getNavigationUri, getProjectId, getServerTime, getSharedFolder, getSiteRoot, getStructureId, getTinymce, getUploadFileSizeLimit, getUploadRestriction, getUri, getUserInfo, getVfsPrefix, getWorkplaceResourcesPrefix, getWpLanguage, getWpLocale, isHideDisabledGalleryTypes, isKeepAlive, isShowEditorHelp, isToolbarVisible, isUploadDisabled, isWarnWhenEditingReusedElement, setTinymce, setWarnWhenEditingReusedElement

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CmsCoreProvider

      protected CmsCoreProvider() throws com.google.gwt.user.client.rpc.SerializationException
      Prevent instantiation.

      Throws:
      com.google.gwt.user.client.rpc.SerializationException - if deserialization failed
  • Method Details

    • get

      public static CmsCoreProvider get()
      Returns the client message instance.

      Returns:
      the client message instance
    • getMetaElementContent

      public static String getMetaElementContent(String nameToFind)
      Gets the content attribute of a meta tag with a given name.

      Parameters:
      nameToFind - the name of the meta tag
      Returns:
      the content attribute value of the found meta tag, or null if no meta tag with the given name was found
    • getService

      public static org.opencms.gwt.shared.rpc.I_CmsCoreServiceAsync getService()
      Returns the core service instance.

      Returns:
      the core service instance
    • getVfsService

      public static org.opencms.gwt.shared.rpc.I_CmsVfsServiceAsync getVfsService()
      Returns the vfs service instance.

      Returns:
      the vfs service instance
    • isTouchOnly

      public static boolean isTouchOnly()
      Checks if the client is touch-only.

      This uses media queries, but the touch-only status can also be forcibly turned on with the request parameter __touchOnly=1.

      Returns:
      true if the client is touch-only
    • addSiteRoot

      public String addSiteRoot(String sitePath)
      Adds the current site root of this context to the given resource name.

      Parameters:
      sitePath - the resource name
      Returns:
      the translated resource name including site root
      See Also:
    • createUUID

      public void createUUID(com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.util.CmsUUID> callback)
      Creates a new CmsUUID.

      Parameters:
      callback - the callback to execute
    • fireEvent

      public void fireEvent(com.google.web.bindery.event.shared.Event<?> event)
      Fires a client side event.

      Parameters:
      event - the event to fire
    • getAdjustedSiteRoot

      public String getAdjustedSiteRoot(String siteRoot, String resourcename)
      Returns the adjusted site root for a resource using the provided site root as a base.

      Usually, this would be the site root for the current site. However, if a resource from the /system/ folder is requested, this will be the empty String.

      Parameters:
      siteRoot - the site root of the current site
      resourcename - the resource name to get the adjusted site root for
      Returns:
      the adjusted site root for the resource
    • getEstimatedServerTime

      public long getEstimatedServerTime()
      Returns the approximate time on the server.

      Returns:
      the approximate server time
    • getEventBus

      public com.google.web.bindery.event.shared.EventBus getEventBus()
      Gets the core event bus.

      Returns:
      the core event bus
    • getExplorerLink

      public String getExplorerLink(String sitePath)
      Returns the link to view the given resource in the file explorer.

      Parameters:
      sitePath - the resource site path
      Returns:
      the link
    • getFlyoutMenuContainer

      Gets the unique active item container which holds a reference to the currently active content element flyout menu.

      Returns:
      the unique active item container for flyout menus
    • getLastPageId

      public org.opencms.util.CmsUUID getLastPageId()
      Gets the page id that was last stored in sessionStorage.
      Returns:
      the page id that was last stored in session storage
    • getResourceState

      public void getResourceState(org.opencms.util.CmsUUID structureId, com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.db.CmsResourceState> callback)
      Fetches the state of a resource from the server.

      Parameters:
      structureId - the structure id of the resource
      callback - the callback which should receive the result
    • getResourceType

      Returns the resource type name for a given filename.

      Parameters:
      file - the file info
      Returns:
      the resource type name
    • getResourceTypeIcon

      Returns the resource type name for a given filename.

      Parameters:
      file - the file info
      Returns:
      the resource type name
    • getResourceTypeIcon

      Gets the resource type icon for the given path.
      Parameters:
      path - a path
      Returns:
      the resource type icon
    • isIe7

      public boolean isIe7()
      Returns if the current user agent is IE7.

      Returns:
      true if the current user agent is IE7
    • link

      public String link(String sitePath)
      Returns an absolute link given a site path.

      Parameters:
      sitePath - the site path
      Returns:
      the absolute link
    • lock

      public void lock(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<Boolean> callback)
      Locks the given resource with a temporary lock.

      Parameters:
      structureId - the resource structure id
      callback - the callback to execute
    • lock

      public void lock(org.opencms.util.CmsUUID structureId, long loadTime, I_CmsSimpleCallback<Boolean> callback)
      Locks the given resource with a temporary lock.

      Parameters:
      structureId - the resource structure id
      loadTime - the time when the requested resource was loaded
      callback - the callback to execute
    • lock

      public void lock(String sitePath, long loadTime, I_CmsSimpleCallback<Boolean> callback)
      Locks the given resource with a temporary lock.

      Parameters:
      sitePath - the site path of the resource to lock
      loadTime - the time when the requested resource was loaded
      callback - the callback to execute
    • lockOrReturnError

      public void lockOrReturnError(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<String> callback)
      Tries to lock a resource with a given structure id and returns an error if the locking fails.

      Parameters:
      structureId - the structure id of the resource to lock
      callback - the callback to execute
    • lockOrReturnError

      public void lockOrReturnError(org.opencms.util.CmsUUID structureId, long loadTime, I_CmsSimpleCallback<String> callback)
      Tries to lock a resource with a given structure id and returns an error if the locking fails.

      Parameters:
      structureId - the structure id of the resource to lock
      loadTime - the time when the requested resource was loaded
      callback - the callback to execute
    • lockOrReturnError

      public void lockOrReturnError(String sitePath, I_CmsSimpleCallback<String> callback)
      Tries to lock a resource with a given site path and returns an error if the locking fails.

      If the resource does not exist yet, the next existing ancestor folder will be checked if it is lockable.

      Parameters:
      sitePath - the site path of the resource to lock
      callback - the callback to execute
    • lockOrReturnError

      public void lockOrReturnError(String sitePath, long loadTime, I_CmsSimpleCallback<String> callback)
      Tries to lock a resource with a given site path and returns an error if the locking fails.

      If the resource does not exist yet, the next existing ancestor folder will be checked if it is lockable.

      Parameters:
      sitePath - the site path of the resource to lock
      loadTime - the time when the requested resource was loaded
      callback - the callback to execute
    • removeSiteRoot

      public String removeSiteRoot(String rootPath)
      Removes the current site root prefix from the given root path, that is adjusts the resource name for the current site root.

      If the resource name does not start with the current site root, it is left untouched.

      Parameters:
      rootPath - the resource name
      Returns:
      the resource name adjusted for the current site root
      See Also:
    • setShowEditorHelp

      public void setShowEditorHelp(boolean show)
      Overrides:
      setShowEditorHelp in class org.opencms.gwt.shared.CmsCoreData
      See Also:
      • CmsCoreData.setShowEditorHelp(boolean)
    • substituteLinkForRootPath

      public void substituteLinkForRootPath(String rootPath, I_CmsSimpleCallback<String> callback)
      Returns the absolute link to the given root path.

      Parameters:
      rootPath - the root path
      callback - the callback to execute
    • unlock

      public boolean unlock(org.opencms.util.CmsUUID structureId)
      Unlocks the given resource, synchronously.

      Parameters:
      structureId - the resource structure id
      Returns:
      true if succeeded, if not a a warning is already shown to the user
    • unlock

      public boolean unlock(String sitePath)
      Unlocks the given resource, synchronously.

      Parameters:
      sitePath - the resource site path
      Returns:
      true if succeeded, if not a a warning is already shown to the user