Class CmsCroppingParamBean
- java.lang.Object
-
- org.opencms.ade.galleries.client.preview.CmsCroppingParamBean
-
public class CmsCroppingParamBean extends java.lang.Object
Scale parameter data bean.- Since:
- 8.0.0
-
-
Constructor Summary
Constructors Constructor Description CmsCroppingParamBean()
Constructor.CmsCroppingParamBean(int orgHeight, int orgWidth)
Constructor.CmsCroppingParamBean(CmsCroppingParamBean copy)
Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCropHeight()
Returns the cropping height parameter.int
getCropWidth()
Returns the cropping width parameter.int
getCropX()
Returns the cropping X parameter.int
getCropY()
Returns the cropping Y parameter.java.lang.String
getFormatName()
Returns the used format name.int
getOrgHeight()
Returns the original image height.int
getOrgWidth()
Returns the original image width.double
getRatio()
Returns the resulting image ratio.CmsCroppingParamBean
getRestrictedSizeParam(int maxHeight, int maxWidth)
Returns a cropping bean with a restricted maximum target size.java.lang.String
getRestrictedSizeScaleParam(int maxHeight, int maxWidth)
Returns the scale parameter to this bean for a restricted maximum target size.int
getResultingHeight()
Returns the resulting height of the cropped image.int
getResultingWidth()
Returns the resulting width of the cropped image.java.lang.String
getScaleParam()
Returns the scale parameter.int
getTargetHeight()
Returns the target height.int
getTargetWidth()
Returns the target width.boolean
isCropped()
Returns if contained parameters indicate a cropped image.boolean
isScaled()
Returns if the given cropping parameters would scale the image.static CmsCroppingParamBean
parseImagePath(java.lang.String selectedPath)
Parses an image scale parameter and returns the parsed data.static CmsCroppingParamBean
parseScaleParam(java.lang.String param)
Parses an image scale parameter and returns the parsed data.void
reset()
Resets the cropping parameters to no cropping.void
setCropHeight(int cropHeight)
Sets the cropping height parameter.void
setCropWidth(int cropWidth)
Sets the cropping width parameter.void
setCropX(int cropX)
Sets the cropping X parameter.void
setCropY(int cropY)
Sets the cropping Y parameter.void
setFormatName(java.lang.String formatName)
Sets the used format name.void
setOrgHeight(int orgHeight)
Sets the original image height.void
setOrgWidth(int orgWidth)
Sets the original image width.void
setTargetHeight(int targetHeight)
Sets the target height.void
setTargetWidth(int targetWidth)
Sets the target width.java.lang.String
toString()
-
-
-
Constructor Detail
-
CmsCroppingParamBean
public CmsCroppingParamBean()
Constructor.
-
CmsCroppingParamBean
public CmsCroppingParamBean(CmsCroppingParamBean copy)
Copy constructor.- Parameters:
copy
- the copy values to use
-
CmsCroppingParamBean
public CmsCroppingParamBean(int orgHeight, int orgWidth)
Constructor.- Parameters:
orgHeight
- the original image heightorgWidth
- the original image width
-
-
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 heightmaxWidth
- 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 heightmaxWidth
- 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 classjava.lang.Object
- See Also:
Object.toString()
-
-