Class MediaMarkupBuilderUtil


  • @ProviderType
    public final class MediaMarkupBuilderUtil
    extends java.lang.Object
    Helper methods for MediaMarkupBuilder implementations.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Set<java.lang.String> DEFAULT_ALLOWED_IPE_EDITOR_TYPES
      List of OOTB IPE editor types for images.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addDiffDecoration​(@NotNull io.wcm.handler.commons.dom.HtmlElement mediaElement, @NotNull org.apache.sling.api.resource.Resource resource, @NotNull java.lang.String refProperty, @NotNull org.apache.sling.api.SlingHttpServletRequest request, @Nullable MediaHandlerConfig mediaHandlerConfig)
      Adds CSS classes that denote the changes to the media element when compared to a different version.
      static boolean canApplyDragDropSupport​(@NotNull MediaRequest mediaRequest, @Nullable com.day.cq.wcm.api.components.ComponentContext wcmComponentContext)
      Implements check whether to apply drag&drop support as described in DragDropSupport.
      static boolean canSetCustomIPECropRatios​(@NotNull MediaRequest mediaRequest, @Nullable com.day.cq.wcm.api.components.ComponentContext wcmComponentContext)
      Implements check whether to set customized IPE cropping ratios as described in IPERatioCustomize.
      static boolean canSetCustomIPECropRatios​(@NotNull MediaRequest mediaRequest, @Nullable com.day.cq.wcm.api.components.ComponentContext wcmComponentContext, @NotNull java.util.Set<java.lang.String> allowedIpeEditorTypes)
      Implements check whether to set customized IPE cropping ratios as described in IPERatioCustomize.
      static @NotNull Dimension getMediaformatDimension​(@NotNull Media media)
      Get dimension from first media format defined in media args.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_ALLOWED_IPE_EDITOR_TYPES

        public static final java.util.Set<java.lang.String> DEFAULT_ALLOWED_IPE_EDITOR_TYPES
        List of OOTB IPE editor types for images.
    • Method Detail

      • addDiffDecoration

        public static void addDiffDecoration​(@NotNull
                                             @NotNull io.wcm.handler.commons.dom.HtmlElement mediaElement,
                                             @NotNull
                                             @NotNull org.apache.sling.api.resource.Resource resource,
                                             @NotNull
                                             @NotNull java.lang.String refProperty,
                                             @NotNull
                                             @NotNull org.apache.sling.api.SlingHttpServletRequest request,
                                             @Nullable
                                             @Nullable MediaHandlerConfig mediaHandlerConfig)
        Adds CSS classes that denote the changes to the media element when compared to a different version. If no diff has been requested by the WCM UI, there won't be any changes to the element.
        Parameters:
        mediaElement - Element to be decorated
        resource - Resource pointing to JCR node
        refProperty - Name of property for media library item reference. If null, default name is used.
        request - Servlet request
        mediaHandlerConfig - Media handler config (can be null, but should not be null)
      • getMediaformatDimension

        @NotNull
        public static @NotNull Dimension getMediaformatDimension​(@NotNull
                                                                 @NotNull Media media)
        Get dimension from first media format defined in media args. Fall back to dummy min. dimension if none specified.
        Parameters:
        media - Media metadata
        Returns:
        Dimension
      • canApplyDragDropSupport

        public static boolean canApplyDragDropSupport​(@NotNull
                                                      @NotNull MediaRequest mediaRequest,
                                                      @Nullable
                                                      @Nullable com.day.cq.wcm.api.components.ComponentContext wcmComponentContext)
        Implements check whether to apply drag&drop support as described in DragDropSupport.
        Parameters:
        mediaRequest - Media request
        wcmComponentContext - WCM component context
        Returns:
        true if drag&drop can be applied.
      • canSetCustomIPECropRatios

        public static boolean canSetCustomIPECropRatios​(@NotNull
                                                        @NotNull MediaRequest mediaRequest,
                                                        @Nullable
                                                        @Nullable com.day.cq.wcm.api.components.ComponentContext wcmComponentContext)
        Implements check whether to set customized IPE cropping ratios as described in IPERatioCustomize.
        Parameters:
        mediaRequest - Media request
        wcmComponentContext - WCM component context
        Returns:
        true if customized IP cropping ratios can be set
      • canSetCustomIPECropRatios

        public static boolean canSetCustomIPECropRatios​(@NotNull
                                                        @NotNull MediaRequest mediaRequest,
                                                        @Nullable
                                                        @Nullable com.day.cq.wcm.api.components.ComponentContext wcmComponentContext,
                                                        @NotNull
                                                        @NotNull java.util.Set<java.lang.String> allowedIpeEditorTypes)
        Implements check whether to set customized IPE cropping ratios as described in IPERatioCustomize.
        Parameters:
        mediaRequest - Media request
        wcmComponentContext - WCM component context
        allowedIpeEditorTypes - Allowed editor types for image IPE (in-place editor).
        Returns:
        true if customized IP cropping ratios can be set