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
  • Constructor Details

  • Method Details

    • addCroppingChangeHandler

      public void addCroppingChangeHandler(Runnable action)
      Adds a handler for cropping changes.

      Parameters:
      action - the handler to add
    • addImagePointChangeHandler

      public void addImagePointChangeHandler(Runnable onImagePointChanged)
      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

      public int getImageIdHash()
      Returns the structure id hash of the previewed image.

      Returns:
      the structure id hash
    • getImageInfo

      public org.opencms.ade.galleries.shared.CmsImageInfoBean getImageInfo()
      Gets the image information.

      Returns:
      the image information
    • getPreviewScaleParam

      public String getPreviewScaleParam(int imageHeight, int imageWidth)
      Returns the cropping parameter.

      Parameters:
      imageHeight - the original image height
      imageWidth - the original image width
      Returns:
      the cropping parameter
    • onValueChange

      public void onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent<CmsCroppingParamBean> event)
      Specified by:
      onValueChange in interface com.google.gwt.event.logical.shared.ValueChangeHandler<CmsCroppingParamBean>
      See Also:
      • ValueChangeHandler.onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)
    • setFormatHandler

      public void setFormatHandler(CmsImageFormatHandler formatHandler)
      Sets the image format handler.

      Parameters:
      formatHandler - the format handler
    • setImageContainerSize

      public void setImageContainerSize(int offsetWidth, int offsetHeight)
      Sets the dimensions of the area the image is going to be placed in.
      Parameters:
      offsetWidth - the container width
      offsetHeight - the container height