Class CmsImageFormatHandler
- java.lang.Object
-
- org.opencms.ade.galleries.client.preview.CmsImageFormatHandler
-
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsCroppingParamBean>
,com.google.gwt.event.shared.HasHandlers
public class CmsImageFormatHandler extends java.lang.Object implements com.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsCroppingParamBean>
Image format form handler.- Since:
- 8.0.0
-
-
Constructor Summary
Constructors Constructor Description CmsImageFormatHandler(org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode galleryMode, CmsGalleryDialog dialog, java.lang.String selectedPath, int imageHeight, int imageWidth)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <H extends com.google.gwt.event.shared.EventHandler>
com.google.gwt.event.shared.HandlerRegistrationaddHandler(H handler, com.google.gwt.event.shared.GwtEvent.Type<H> type)
Adds this handler to the widget.com.google.gwt.event.shared.HandlerRegistration
addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsCroppingParamBean> handler)
void
fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
protected void
fireValueChangedEvent()
Helper method for firing a 'value changed' event.CmsCroppingParamBean
getCroppingParam()
Returns the current cropping parameter.I_CmsFormatRestriction
getCurrentFormat()
Returns the current format.java.util.Map<java.lang.String,I_CmsFormatRestriction>
getFormats()
Returns the formats.java.util.Map<java.lang.String,java.lang.String>
getImageAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Adds necessary attributes to the map.int
getOriginalHeight()
Returns the original height.int
getOriginalWidth()
Returns the original width.void
init(CmsImageFormatsForm formatForm, CmsCroppingDialog croppingDialog)
Initializes the format form handler.boolean
isUseFormats()
Returns if scaling formats may be selected for the image.void
onFormatChange(java.lang.String formatKey)
Execute on format change.void
onHeightChange(java.lang.String height)
Execute on height change.void
onLockRatio(boolean locked)
Execute when the lock image ratio is clicked.void
onRemoveCropping()
Execute when cropping is removed.void
onResetSize()
Execute to reset image format and size input.void
onWidthChange(java.lang.String width)
Execute on width change.void
openCropping()
Shows the image cropping dialog.void
setCropping(CmsCroppingParamBean croppingParam)
Sets the given cropping parameter.void
setOriginalWidth(int originalWidth)
Sets the original width.
-
-
-
Constructor Detail
-
CmsImageFormatHandler
public CmsImageFormatHandler(org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode galleryMode, CmsGalleryDialog dialog, java.lang.String selectedPath, int imageHeight, int imageWidth)
Constructor.- Parameters:
galleryMode
- the gallery modedialog
- the gallery dialogselectedPath
- the selected gallery pathimageHeight
- the image heightimageWidth
- the image width
-
-
Method Detail
-
addValueChangeHandler
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsCroppingParamBean> handler)
- Specified by:
addValueChangeHandler
in interfacecom.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsCroppingParamBean>
- See Also:
HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
-
fireEvent
public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
- Specified by:
fireEvent
in interfacecom.google.gwt.event.shared.HasHandlers
- See Also:
HasHandlers.fireEvent(com.google.gwt.event.shared.GwtEvent)
-
getCroppingParam
public CmsCroppingParamBean getCroppingParam()
Returns the current cropping parameter.- Returns:
- the current cropping parameter
-
getCurrentFormat
public I_CmsFormatRestriction getCurrentFormat()
Returns the current format.- Returns:
- the current format
-
getFormats
public java.util.Map<java.lang.String,I_CmsFormatRestriction> getFormats()
Returns the formats.- Returns:
- the formats
-
getImageAttributes
public java.util.Map<java.lang.String,java.lang.String> getImageAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Adds necessary attributes to the map.- Parameters:
attributes
- the attribute map- Returns:
- the attribute map
-
getOriginalHeight
public int getOriginalHeight()
Returns the original height.- Returns:
- the original height
-
getOriginalWidth
public int getOriginalWidth()
Returns the original width.- Returns:
- the original width
-
init
public void init(CmsImageFormatsForm formatForm, CmsCroppingDialog croppingDialog)
Initializes the format form handler.- Parameters:
formatForm
- the format formcroppingDialog
- the cropping dialog
-
isUseFormats
public boolean isUseFormats()
Returns if scaling formats may be selected for the image.- Returns:
true
if scaling formats may be selected for the image
-
onFormatChange
public void onFormatChange(java.lang.String formatKey)
Execute on format change.- Parameters:
formatKey
- the new format value
-
onHeightChange
public void onHeightChange(java.lang.String height)
Execute on height change.- Parameters:
height
- the new height
-
onLockRatio
public void onLockRatio(boolean locked)
Execute when the lock image ratio is clicked.- Parameters:
locked
-true
if ratio is locked
-
onRemoveCropping
public void onRemoveCropping()
Execute when cropping is removed.
-
onResetSize
public void onResetSize()
Execute to reset image format and size input.
-
onWidthChange
public void onWidthChange(java.lang.String width)
Execute on width change.- Parameters:
width
- the new width
-
openCropping
public void openCropping()
Shows the image cropping dialog.
-
setCropping
public void setCropping(CmsCroppingParamBean croppingParam)
Sets the given cropping parameter.- Parameters:
croppingParam
- the cropping parameter
-
setOriginalWidth
public void setOriginalWidth(int originalWidth)
Sets the original width.- Parameters:
originalWidth
- the original width to set
-
addHandler
protected final <H extends com.google.gwt.event.shared.EventHandler> com.google.gwt.event.shared.HandlerRegistration addHandler(H handler, com.google.gwt.event.shared.GwtEvent.Type<H> type)
Adds this handler to the widget.- Type Parameters:
H
- the type of handler to add- Parameters:
type
- the event typehandler
- the handler- Returns:
HandlerRegistration
used to remove the handler
-
fireValueChangedEvent
protected void fireValueChangedEvent()
Helper method for firing a 'value changed' event.
-
-