Package io.wcm.handler.media.markup
Class MediaMarkupBuilderUtil
- java.lang.Object
-
- io.wcm.handler.media.markup.MediaMarkupBuilderUtil
-
@ProviderType public final class MediaMarkupBuilderUtil extends java.lang.Object
Helper methods forMediaMarkupBuilder
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 inDragDropSupport
.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 inIPERatioCustomize
.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 inIPERatioCustomize
.static @NotNull Dimension
getMediaformatDimension(@NotNull Media media)
Get dimension from first media format defined in media args.
-
-
-
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 decoratedresource
- Resource pointing to JCR noderefProperty
- Name of property for media library item reference. If null, default name is used.request
- Servlet requestmediaHandlerConfig
- 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 inDragDropSupport
.- Parameters:
mediaRequest
- Media requestwcmComponentContext
- 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 inIPERatioCustomize
.- Parameters:
mediaRequest
- Media requestwcmComponentContext
- 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 inIPERatioCustomize
.- Parameters:
mediaRequest
- Media requestwcmComponentContext
- WCM component contextallowedIpeEditorTypes
- Allowed editor types for image IPE (in-place editor).- Returns:
- true if customized IP cropping ratios can be set
-
-