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 voidTriggers the dialog OK action.static voidenableEditorOk(boolean enabled) Enables the dialog OK button within the rich text editor (FCKEditor, CKEditor, ...).static voidexportFunctions(String previewName, I_CmsResourcePreview<?> preview) Exports the functions ofI_CmsResourcePreviewto the window object for use via JSNI.static StringReturns 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 CmsJSONMapReturns all available information of the selected image tag, or null, if no image is selected.static booleanReturns the availability of enhanced image options.static booleanReturns if the gallery widget is used in advanced mode.static booleanReturns if the image format selector should be shown within gallery widget mode.static voidTriggers the dialog OK action.static voidSets the image tag within the rich text editor (FCKEditor, CKEditor, ...).static voidSets the image link within the rich text editor (FCKEditor, CKEditor, ...).static voidSets the resource link within the rich text editor (FCKEditor, CKEditor, ...).static voidsetResourcePath(String path) Sets the path of the selected resource in the input field of the xmlcontent.static voidsetVfsImage(String path, String scale, String formatName, String ratio) Sets the path of the selected resource in the input field of the xmlcontent.static booleanReturns 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-trueto enable the button
-
exportFunctions
Exports the functions ofI_CmsResourcePreviewto 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:
trueif enhanced image options are available
-
isAdvancedWidget
Returns if the gallery widget is used in advanced mode.- Returns:
trueif format selector should be shown
-
isShowFormats
Returns if the image format selector should be shown within gallery widget mode.- Returns:
trueif 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:
trueif the select button should be shown
-