Class CmsCroppingParamBean
java.lang.Object
org.opencms.ade.galleries.client.preview.CmsCroppingParamBean
Scale parameter data bean.
- Since:
- 8.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.CmsCroppingParamBean(int orgHeight, int orgWidth) Constructor.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionconvertToScalingParam(boolean highRes) Converts this bean to a scaling parameter string.intReturns the cropping height parameter.intReturns the cropping width parameter.intgetCropX()Returns the cropping X parameter.intgetCropY()Returns the cropping Y parameter.Returns the used format name.intReturns the original image height.intReturns the original image width.doublegetRatio()Returns the resulting image ratio.getRestrictedSizeParam(int maxHeight, int maxWidth) Returns a cropping bean with a restricted maximum target size.getRestrictedSizeScaleParam(int maxHeight, int maxWidth) Returns the scale parameter to this bean for a restricted maximum target size.intReturns the resulting height of the cropped image.intReturns the resulting width of the cropped image.getScaleParam(boolean highres) Returns the scale parameter.intReturns the target height.intReturns the target width.booleanReturns if contained parameters indicate a cropped image.booleanisScaled()Returns if the given cropping parameters would scale the image.static CmsCroppingParamBeanparseImagePath(String selectedPath) Parses an image scale parameter and returns the parsed data.static CmsCroppingParamBeanparseScaleParam(String param) Parses an image scale parameter and returns the parsed data.voidreset()Resets the cropping parameters to no cropping.voidsetCropHeight(int cropHeight) Sets the cropping height parameter.voidsetCropWidth(int cropWidth) Sets the cropping width parameter.voidsetCropX(int cropX) Sets the cropping X parameter.voidsetCropY(int cropY) Sets the cropping Y parameter.voidsetFormatName(String formatName) Sets the used format name.voidsetOrgHeight(int orgHeight) Sets the original image height.voidsetOrgWidth(int orgWidth) Sets the original image width.voidsetTargetHeight(int targetHeight) Sets the target height.voidsetTargetWidth(int targetWidth) Sets the target width.toString()
-
Constructor Details
-
CmsCroppingParamBean
public CmsCroppingParamBean()Constructor. -
CmsCroppingParamBean
Copy constructor.- Parameters:
copy- the copy values to use
-
CmsCroppingParamBean
Constructor.- Parameters:
orgHeight- the original image heightorgWidth- the original image width
-
-
Method Details
-
parseImagePath
Parses an image scale parameter and returns the parsed data.- Parameters:
selectedPath- the image path including the scale parameter- Returns:
- the cropping data
-
parseScaleParam
Parses an image scale parameter and returns the parsed data.- Parameters:
param- the image path including the scale parameter- Returns:
- the cropping data
-
convertToScalingParam
Converts this bean to a scaling parameter string.- Parameters:
highRes- true if we want the high-resolution version- Returns:
- the scaling parameter string
-
getCropHeight
Returns the cropping height parameter.- Returns:
- the cropping height parameter
-
getCropWidth
Returns the cropping width parameter.- Returns:
- the cropping width parameter
-
getCropX
Returns the cropping X parameter.- Returns:
- the cropping X parameter
-
getCropY
Returns the cropping Y parameter.- Returns:
- the cropping Y parameter
-
getFormatName
Returns the used format name.- Returns:
- the used format name
-
getOrgHeight
Returns the original image height.- Returns:
- the original image height
-
getOrgWidth
Returns the original image width.- Returns:
- the original image width
-
getRatio
Returns the resulting image ratio.- Returns:
- the image ratio
-
getRestrictedSizeParam
Returns a cropping bean with a restricted maximum target size.- Parameters:
maxHeight- the max heightmaxWidth- the max width- Returns:
- the cropping bean
-
getRestrictedSizeScaleParam
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
Returns the resulting height of the cropped image.- Returns:
- the height
-
getResultingWidth
Returns the resulting width of the cropped image.- Returns:
- the width
-
getScaleParam
Returns the scale parameter.- Parameters:
highres- true if we want the high resolution version- Returns:
- the scale parameter
-
getTargetHeight
Returns the target height.- Returns:
- the target height
-
getTargetWidth
Returns the target width.- Returns:
- the target width
-
isCropped
Returns if contained parameters indicate a cropped image.- Returns:
trueif contained parameters indicate a cropped image
-
isScaled
Returns if the given cropping parameters would scale the image.- Returns:
trueif the image is scaled
-
reset
Resets the cropping parameters to no cropping. -
setCropHeight
Sets the cropping height parameter.- Parameters:
cropHeight- the cropping height parameter to set
-
setCropWidth
Sets the cropping width parameter.- Parameters:
cropWidth- the cropping width parameter to set
-
setCropX
Sets the cropping X parameter.- Parameters:
cropX- the cropping X parameter to set
-
setCropY
Sets the cropping Y parameter.- Parameters:
cropY- the cropping Y parameter to set
-
setFormatName
Sets the used format name.- Parameters:
formatName- the used format name to set
-
setOrgHeight
Sets the original image height.- Parameters:
orgHeight- the original image height to set
-
setOrgWidth
Sets the original image width.- Parameters:
orgWidth- the original image width to set
-
setTargetHeight
Sets the target height.- Parameters:
targetHeight- the target height to set
-
setTargetWidth
Sets the target width.- Parameters:
targetWidth- the target width to set
-
toString
-