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 Object implements com.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsCroppingParamBean>
Image format form handler.

Since:
8.0.0
  • Constructor Details

    • CmsImageFormatHandler

      public CmsImageFormatHandler(org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode galleryMode, CmsGalleryDialog dialog, String selectedPath, int imageHeight, int imageWidth)
      Constructor.

      Parameters:
      galleryMode - the gallery mode
      dialog - the gallery dialog
      selectedPath - the selected gallery path
      imageHeight - the image height
      imageWidth - the image width
  • Method Details

    • addValueChangeHandler

      public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsCroppingParamBean> handler)
      Specified by:
      addValueChangeHandler in interface com.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 interface com.google.gwt.event.shared.HasHandlers
      See Also:
      • HasHandlers.fireEvent(com.google.gwt.event.shared.GwtEvent)
    • getCroppingParam

      Returns the current cropping parameter.

      Returns:
      the current cropping parameter
    • getCurrentFormat

      Returns the current format.

      Returns:
      the current format
    • getFormats

      Returns the formats.

      Returns:
      the formats
    • getImageAttributes

      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 form
      croppingDialog - 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(String formatKey)
      Execute on format change.

      Parameters:
      formatKey - the new format value
    • onHeightChange

      public void onHeightChange(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(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 type
      handler - the handler
      Returns:
      HandlerRegistration used to remove the handler
    • fireValueChangedEvent

      protected void fireValueChangedEvent()
      Helper method for firing a 'value changed' event.