Class CmsPreviewUtil
java.lang.Object
org.opencms.ade.galleries.client.preview.CmsPreviewUtil
Utility class for resource preview.
- Since:
- 8.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Triggers the dialog OK action.static void
enableEditorOk
(boolean enabled) Enables the dialog OK button within the rich text editor (FCKEditor, CKEditor, ...).static void
exportFunctions
(String previewName, I_CmsResourcePreview<?> preview) Exports the functions ofI_CmsResourcePreview
to the window object for use via JSNI.static String
Returns the xml-content field id.static String[]
Returns the available image format names for gallery widget mode.static String[]
Returns the available image formats for gallery widget mode.static CmsJSONMap
Returns all available information of the selected image tag, or null, if no image is selected.static boolean
Returns the availability of enhanced image options.static boolean
Returns if the gallery widget is used in advanced mode.static boolean
Returns if the image format selector should be shown within gallery widget mode.static void
Triggers the dialog OK action.static void
Sets the image tag within the rich text editor (FCKEditor, CKEditor, ...).static void
Sets the image link within the rich text editor (FCKEditor, CKEditor, ...).static void
Sets the resource link within the rich text editor (FCKEditor, CKEditor, ...).static void
setResourcePath
(String path) Sets the path of the selected resource in the input field of the xmlcontent.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.static boolean
Returns if the select button should be shown.
-
Method Details
-
closeDialog
Triggers the dialog OK action. -
enableEditorOk
Enables the dialog OK button within the rich text editor (FCKEditor, CKEditor, ...).- Parameters:
enabled
-true
to enable the button
-
exportFunctions
Exports the functions ofI_CmsResourcePreview
to the window object for use via JSNI.- Parameters:
previewName
- the preview namepreview
- the preview
-
getFieldId
Returns the xml-content field id.- Returns:
- the field id
-
getFormatNames
Returns the available image format names for gallery widget mode.- Returns:
- the available image format names
-
getFormats
Returns the available image formats for gallery widget mode.- Returns:
- the available image formats
-
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
Returns the availability of enhanced image options.- Returns:
true
if enhanced image options are available
-
isAdvancedWidget
Returns if the gallery widget is used in advanced mode.- Returns:
true
if format selector should be shown
-
isShowFormats
Returns if the image format selector should be shown within gallery widget mode.- Returns:
true
if format selector should be shown
-
setDataAndCloseDialog
Triggers the dialog OK action. -
setImage
Sets the image tag within the rich text editor (FCKEditor, CKEditor, ...).- Parameters:
path
- the image pathattributes
- 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 pathattributes
- the image tag attributeslinkPath
- the link pathtarget
- the link target attribute
-
setLink
Sets the resource link within the rich text editor (FCKEditor, CKEditor, ...).- Parameters:
path
- the link pathtitle
- the link titletarget
- the link target attribute
-
setResourcePath
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
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 resourcescale
- the scale parameterformatName
- the selected format nameratio
- the image ratio (width/height)
-
shouldShowSelectButton
Returns if the select button should be shown.- Returns:
true
if the select button should be shown
-