Class MjCarouselImage
java.lang.Object
dev.jcputney.mjml.component.BaseComponent
dev.jcputney.mjml.component.BodyComponent
dev.jcputney.mjml.component.interactive.MjCarouselImage
A single image in a carousel (
<mj-carousel-image>). Renders an image element with an
optional link wrapper. The thumbnails-src attribute can specify an alternate thumbnail
image for the carousel navigation.
When rendered by the parent MjCarousel, each image produces output like:
<a href="HREF" target="TARGET">
<img title="TITLE" src="SRC" alt="ALT"
style="border-radius:RADIUS;display:block;width:WIDTHpx;max-width:100%;height:auto;"
width="WIDTH_INT" border="0" />
</a>
-
Field Summary
Fields inherited from class BaseComponent
globalContext, node, renderContext -
Constructor Summary
ConstructorsConstructorDescriptionMjCarouselImage(MjmlNode node, GlobalContext globalContext, RenderContext renderContext) -
Method Summary
Modifier and TypeMethodDescriptionReturns the default attribute values for this component.Returns the MJML tag name this component handles.render()Renders this component to HTML.renderImage(String borderRadius, int width) Renders this carousel image.Methods inherited from class BodyComponent
addBorderStyles, addIfPresent, addIfPresent, buildAttributes, buildResponsiveClass, buildStyle, escapeAttr, escapeHref, getBoxModel, getChildrenByTags, getContentWidth, orderedMap, parseWidth, registerMediaQuery, renderChildren, resolveShorthandSide, sanitizeContent, sanitizeHrefMethods inherited from class BaseComponent
getAttribute, getAttribute, getNode
-
Constructor Details
-
MjCarouselImage
-
-
Method Details
-
getTagName
Description copied from class:BaseComponentReturns the MJML tag name this component handles.- Specified by:
getTagNamein classBaseComponent- Returns:
- the MJML tag name
-
getDefaultAttributes
Description copied from class:BaseComponentReturns the default attribute values for this component.- Specified by:
getDefaultAttributesin classBaseComponent- Returns:
- a map of attribute names to their default values
-
renderImage
Renders this carousel image. The parent MjCarousel calls this method and wraps the result in the appropriate carousel image div.- Parameters:
borderRadius- the border-radius inherited from the parent mj-carouselwidth- the pixel width of the image (container width)- Returns:
- the rendered HTML for this image
-
render
Description copied from class:BodyComponentRenders this component to HTML.- Specified by:
renderin classBodyComponent- Returns:
- the rendered HTML string
-