Class CmsCroppingParamBean


  • public class CmsCroppingParamBean
    extends java.lang.Object
    Scale parameter data bean.

    Since:
    8.0.0
    • Method Detail

      • parseImagePath

        public static CmsCroppingParamBean parseImagePath​(java.lang.String selectedPath)
        Parses an image scale parameter and returns the parsed data.

        Parameters:
        selectedPath - the image path including the scale parameter
        Returns:
        the cropping data
      • parseScaleParam

        public static CmsCroppingParamBean parseScaleParam​(java.lang.String param)
        Parses an image scale parameter and returns the parsed data.

        Parameters:
        param - the image path including the scale parameter
        Returns:
        the cropping data
      • getCropHeight

        public int getCropHeight()
        Returns the cropping height parameter.

        Returns:
        the cropping height parameter
      • getCropWidth

        public int getCropWidth()
        Returns the cropping width parameter.

        Returns:
        the cropping width parameter
      • getCropX

        public int getCropX()
        Returns the cropping X parameter.

        Returns:
        the cropping X parameter
      • getCropY

        public int getCropY()
        Returns the cropping Y parameter.

        Returns:
        the cropping Y parameter
      • getFormatName

        public java.lang.String getFormatName()
        Returns the used format name.

        Returns:
        the used format name
      • getOrgHeight

        public int getOrgHeight()
        Returns the original image height.

        Returns:
        the original image height
      • getOrgWidth

        public int getOrgWidth()
        Returns the original image width.

        Returns:
        the original image width
      • getRatio

        public double getRatio()
        Returns the resulting image ratio.

        Returns:
        the image ratio
      • getRestrictedSizeParam

        public CmsCroppingParamBean getRestrictedSizeParam​(int maxHeight,
                                                           int maxWidth)
        Returns a cropping bean with a restricted maximum target size.

        Parameters:
        maxHeight - the max height
        maxWidth - the max width
        Returns:
        the cropping bean
      • getRestrictedSizeScaleParam

        public java.lang.String getRestrictedSizeScaleParam​(int maxHeight,
                                                            int maxWidth)
        Returns the scale parameter to this bean for a restricted maximum target size.

        TODO: This does not work correctly if there isn't any cropping/scaling defined.

        Parameters:
        maxHeight - the max height
        maxWidth - the max width
        Returns:
        the scale parameter
      • getResultingHeight

        public int getResultingHeight()
        Returns the resulting height of the cropped image.

        Returns:
        the height
      • getResultingWidth

        public int getResultingWidth()
        Returns the resulting width of the cropped image.

        Returns:
        the width
      • getScaleParam

        public java.lang.String getScaleParam()
        Returns the scale parameter.

        Returns:
        the scale parameter
      • getTargetHeight

        public int getTargetHeight()
        Returns the target height.

        Returns:
        the target height
      • getTargetWidth

        public int getTargetWidth()
        Returns the target width.

        Returns:
        the target width
      • isCropped

        public boolean isCropped()
        Returns if contained parameters indicate a cropped image.

        Returns:
        true if contained parameters indicate a cropped image
      • isScaled

        public boolean isScaled()
        Returns if the given cropping parameters would scale the image.

        Returns:
        true if the image is scaled
      • reset

        public void reset()
        Resets the cropping parameters to no cropping.

      • setCropHeight

        public void setCropHeight​(int cropHeight)
        Sets the cropping height parameter.

        Parameters:
        cropHeight - the cropping height parameter to set
      • setCropWidth

        public void setCropWidth​(int cropWidth)
        Sets the cropping width parameter.

        Parameters:
        cropWidth - the cropping width parameter to set
      • setCropX

        public void setCropX​(int cropX)
        Sets the cropping X parameter.

        Parameters:
        cropX - the cropping X parameter to set
      • setCropY

        public void setCropY​(int cropY)
        Sets the cropping Y parameter.

        Parameters:
        cropY - the cropping Y parameter to set
      • setFormatName

        public void setFormatName​(java.lang.String formatName)
        Sets the used format name.

        Parameters:
        formatName - the used format name to set
      • setOrgHeight

        public void setOrgHeight​(int orgHeight)
        Sets the original image height.

        Parameters:
        orgHeight - the original image height to set
      • setOrgWidth

        public void setOrgWidth​(int orgWidth)
        Sets the original image width.

        Parameters:
        orgWidth - the original image width to set
      • setTargetHeight

        public void setTargetHeight​(int targetHeight)
        Sets the target height.

        Parameters:
        targetHeight - the target height to set
      • setTargetWidth

        public void setTargetWidth​(int targetWidth)
        Sets the target width.

        Parameters:
        targetWidth - the target width to set
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()