Class CmsPreviewUtil

java.lang.Object
org.opencms.ade.galleries.client.preview.CmsPreviewUtil

public final class CmsPreviewUtil extends Object
Utility class for resource preview.

Since:
8.0.0
  • Method Details

    • closeDialog

      public static void closeDialog()
      Triggers the dialog OK action.

    • enableEditorOk

      public static void enableEditorOk(boolean enabled)
      Enables the dialog OK button within the rich text editor (FCKEditor, CKEditor, ...).

      Parameters:
      enabled - true to enable the button
    • exportFunctions

      public static void exportFunctions(String previewName, I_CmsResourcePreview<?> preview)
      Exports the functions of I_CmsResourcePreview to the window object for use via JSNI.

      Parameters:
      previewName - the preview name
      preview - the preview
    • getFieldId

      public static String getFieldId()
      Returns the xml-content field id.

      Returns:
      the field id
    • getFormatNames

      public static String[] getFormatNames()
      Returns the available image format names for gallery widget mode.

      Returns:
      the available image format names
    • getFormats

      public static String[] getFormats()
      Returns the available image formats for gallery widget mode.

      Returns:
      the available image formats
    • getImageAttributes

      public static CmsJSONMap getImageAttributes()
      Returns all available information of the selected image tag, or null, if no image is selected.

      Returns:
      a map with the following keys:

      alt, class, height, hspace, linkPath, linkTarget, longDesc, style, title, vspace, width

      all keys represent a tag attribute by the same name, only linkPath and linkTarget contain information on an surrounding link tag

    • hasEnhancedImageOptions

      public static boolean hasEnhancedImageOptions()
      Returns the availability of enhanced image options.

      Returns:
      true if enhanced image options are available
    • isAdvancedWidget

      public static boolean isAdvancedWidget()
      Returns if the gallery widget is used in advanced mode.

      Returns:
      true if format selector should be shown
    • isShowFormats

      public static boolean isShowFormats()
      Returns if the image format selector should be shown within gallery widget mode.

      Returns:
      true if format selector should be shown
    • setDataAndCloseDialog

      public static void setDataAndCloseDialog()
      Triggers the dialog OK action.

    • setImage

      public static void setImage(String path, Map<String,String> attributes)
      Sets the image tag within the rich text editor (FCKEditor, CKEditor, ...).

      Parameters:
      path - the image path
      attributes - the image tag attributes
    • setImageLink

      public static void setImageLink(String path, Map<String,String> attributes, String linkPath, String target)
      Sets the image link within the rich text editor (FCKEditor, CKEditor, ...).

      Parameters:
      path - the image path
      attributes - the image tag attributes
      linkPath - the link path
      target - the link target attribute
    • setLink

      public static void setLink(String path, String title, String target)
      Sets the resource link within the rich text editor (FCKEditor, CKEditor, ...).

      Parameters:
      path - the link path
      title - the link title
      target - the link target attribute
    • setResourcePath

      public static void setResourcePath(String path)
      Sets the path of the selected resource in the input field of the xmlcontent.

      Widget mode: Use this function inside the xmlcontent.

      Parameters:
      path - the path to the selected resource
    • setVfsImage

      public static void setVfsImage(String path, String scale, String formatName, String ratio)
      Sets the path of the selected resource in the input field of the xmlcontent.

      Widget mode: Use this function inside the xmlcontent.

      Parameters:
      path - the path to the selected resource
      scale - the scale parameter
      formatName - the selected format name
      ratio - the image ratio (width/height)
    • shouldShowSelectButton

      public static boolean shouldShowSelectButton()
      Returns if the select button should be shown.

      Returns:
      true if the select button should be shown