Class MediaMarkupBuilderUtil


  • @ProviderType
    public final class MediaMarkupBuilderUtil
    extends Object
    Helper methods for MediaMarkupBuilder implementations.
    • Method Detail

      • addDiffDecoration

        @Deprecated
        public static void addDiffDecoration​(@NotNull
                                             @NotNull io.wcm.handler.commons.dom.HtmlElement<?> mediaElement,
                                             @NotNull
                                             @NotNull org.apache.sling.api.resource.Resource resource,
                                             @NotNull
                                             @NotNull String refProperty,
                                             @NotNull
                                             @NotNull org.apache.sling.api.SlingHttpServletRequest request)
        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
      • 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 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