Class CmsImagePreviewHandler
java.lang.Object
org.opencms.ade.galleries.client.preview.A_CmsPreviewHandler<org.opencms.ade.galleries.shared.CmsImageInfoBean>
org.opencms.ade.galleries.client.preview.CmsImagePreviewHandler
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.ValueChangeHandler<CmsCroppingParamBean>,com.google.gwt.event.shared.EventHandler,I_CmsPreviewHandler<org.opencms.ade.galleries.shared.CmsImageInfoBean>,I_CmsPropertiesHandler
public class CmsImagePreviewHandler
extends A_CmsPreviewHandler<org.opencms.ade.galleries.shared.CmsImageInfoBean>
implements com.google.gwt.event.logical.shared.ValueChangeHandler<CmsCroppingParamBean>
Image preview dialog controller handler.
Delegates the actions of the preview controller to the preview dialog.
- Since:
- 8.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of image tag attribute names.static classEncapsulates information used to update the preview image's scaling parameters. -
Field Summary
Fields inherited from class org.opencms.ade.galleries.client.preview.A_CmsPreviewHandler
m_resourceInfo, m_resourcePreview -
Constructor Summary
ConstructorsConstructorDescriptionCmsImagePreviewHandler(CmsImageResourcePreview resourcePreview) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCroppingChangeHandler(Runnable action) Adds a handler for cropping changes.voidaddImagePointChangeHandler(Runnable onImagePointChanged) Adds a handler for focal point changes.static final StringappendQuality(String text) Appends quality parameter to a set of scaling parameters, unless the input is the empty string or already contains a quality parameter.Returns the image cropping parameter bean.Gets the focal point controller.Gets the format handler.Returns the name of the currently selected image format.voidgetImageAttributes(I_CmsSimpleCallback<Map<String, String>> callback) Returns image tag attributes to set for editor plugins.intReturns the structure id hash of the previewed image.org.opencms.ade.galleries.shared.CmsImageInfoBeanGets the image information.getPreviewImageUpdate(int imageHeight, int imageWidth) Gets the information to update the preview image.getPreviewScaleParam(int imageHeight, int imageWidth, int density) Returns the cropping parameter.voidonValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent<CmsCroppingParamBean> event) voidsetFormatHandler(CmsImageFormatHandler formatHandler) Sets the image format handler.voidsetImageContainerSize(int offsetWidth, int offsetHeight) Sets the dimensions of the area the image is going to be placed in.Methods inherited from class org.opencms.ade.galleries.client.preview.A_CmsPreviewHandler
closePreview, getAdditionalWidgetForPropertyTab, getGalleryDialog, saveProperties, selectResource, setDataInEditor, showData
-
Constructor Details
-
CmsImagePreviewHandler
Constructor.- Parameters:
resourcePreview- the resource preview instance
-
-
Method Details
-
appendQuality
Appends quality parameter to a set of scaling parameters, unless the input is the empty string or already contains a quality parameter.- Parameters:
text- the input scaling parameters- Returns:
- the modified scaling parameters
-
addCroppingChangeHandler
Adds a handler for cropping changes.- Parameters:
action- the handler to add
-
addImagePointChangeHandler
Adds a handler for focal point changes.- Parameters:
onImagePointChanged- the handler to add
-
getCroppingParam
Returns the image cropping parameter bean.- Returns:
- the image cropping parameter bean
-
getFocalPointController
Gets the focal point controller.- Returns:
- the focal point controller
-
getFormatHandler
Gets the format handler.- Returns:
- the format handler
-
getFormatName
Returns the name of the currently selected image format.- Returns:
- the format name
-
getImageAttributes
Returns image tag attributes to set for editor plugins.- Parameters:
callback- the callback to execute
-
getImageIdHash
Returns the structure id hash of the previewed image.- Returns:
- the structure id hash
-
getImageInfo
Gets the image information.- Returns:
- the image information
-
getPreviewImageUpdate
public CmsImagePreviewHandler.PreviewImageUpdate getPreviewImageUpdate(int imageHeight, int imageWidth) Gets the information to update the preview image.- Parameters:
imageHeight- the original image heightimageWidth- the original image width- Returns:
- the preview update information
-
getPreviewScaleParam
Returns the cropping parameter.- Parameters:
imageHeight- the original image heightimageWidth- the original image widthdensity- the pixel density (acts as a multiplier for available space)- Returns:
- the cropping parameter
-
setFormatHandler
Sets the image format handler.- Parameters:
formatHandler- the format handler
-
setImageContainerSize
Sets the dimensions of the area the image is going to be placed in.- Parameters:
offsetWidth- the container widthoffsetHeight- the container height
-