Package com.oorian.html.layout
Class StoryLayout
java.lang.Object
A layout with alternating image/text sections for product storytelling.
StoryLayout provides a structure optimized for marketing pages and product tours where content alternates between image and text sections. This creates a visually engaging narrative flow commonly seen on landing pages.
Structure:
┌──────────────────────────────────────┐ │ Header (optional) │ ├──────────────────────────────────────┤ │ ┌──────────────┬──────────────┐ │ │ │ Image │ Text │ │ Section 1 │ └──────────────┴──────────────┘ │ ├──────────────────────────────────────┤ │ ┌──────────────┬──────────────┐ │ │ │ Text │ Image │ │ Section 2 (reversed) │ └──────────────┴──────────────┘ │ ├──────────────────────────────────────┤ │ ┌──────────────┬──────────────┐ │ │ │ Image │ Text │ │ Section 3 │ └──────────────┴──────────────┘ │ └──────────────────────────────────────┘
Features:
- Alternating image-left/image-right sections
- Optional header section
- Configurable section spacing
- 50/50 or custom split ratios
- Vertical alignment options
Usage:
// Basic story layout
StoryLayout story = new StoryLayout();
story.addSection(image1, text1) // Image left
.addSection(image2, text2) // Image right (auto-alternates)
.addSection(image3, text3); // Image left
// With header
StoryLayout story = new StoryLayout();
story.header(heroSection)
.addSection(feature1Img, feature1Text)
.addSection(feature2Img, feature2Text);
// Custom split ratio
StoryLayout story = new StoryLayout();
story.setSplitRatio("40%", "60%") // 40% image, 60% text
.addSection(img, text);
// Disable alternating
story.setAlternating(false); // All sections image-left
- Since:
- 2025
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSection(Element<?> image, Element<?> text) Adds a story section with image and text content.addSection(Element<?> image, Element<?> text, boolean imageFirst) Adds a story section with explicit image position.addSectionImageLeft(Element<?> image, Element<?> text) Adds a section with image on the left.addSectionImageRight(Element<?> image, Element<?> text) Adds a section with image on the right.Returns the header area for advanced customization.intReturns the number of sections added.Returns the sections container for advanced customization.Sets the header content.protected voidBuilds the element tree for the layout.Applies narrow content width (960px) - focused storytelling.Applies normal content width (1200px).setAlternating(boolean alternating) Enables or disables automatic alternating of image position.Configures for a blog/article style with smaller images and more text.Configures for balanced image and text presentation.Applies compact spacing (smaller gaps between and within sections).setContentPadding(int padding) Sets padding for the sections container.setContentPadding(String padding) Sets padding for the sections container.Sets equal 50/50 split ratio.Configures for a feature tour style with large images and compact text.Applies full width content (no max width constraint).setInnerGap(int gap) Sets the gap between image and text within sections.setInnerGap(String gap) Sets the gap between image and text within sections.Sets a 60/40 split ratio (larger image, smaller text).setMaxWidth(int maxWidth) Sets maximum width for the sections (for centered content).setMaxWidth(String maxWidth) Sets maximum width for the sections (for centered content).setSectionGap(int gap) Sets the gap between sections.setSectionGap(String gap) Sets the gap between sections.Sets a 40/60 split ratio (smaller image, larger text).Applies spacious spacing (larger gaps for dramatic effect).setSplitRatio(String imageWidth, String textWidth) Sets the split ratio between image and text panes.Applies standard spacing (the default).Applies wide content width (1440px).Methods inherited from class com.oorian.html.layout.PageLayout
createPane, createPane, setBackgroundColor, setFillParent, setFillViewport, setMinHeightMethods inherited from class com.oorian.html.StyledElement
addClass, addStyle, addStyle, addStyleAttribute, addTransition, animate, clearTransitions, getActiveStyle, getCssClass, getDisabledStyle, getFocusStyle, getFocusVisibleStyle, getHoverStyle, getHtml, getStyle, getStyleAttribute, hidden, hide, isDisplayed, isTransitionForwardActive, onHide, onRemovedFromPage, onShow, removeClass, setActiveStyle, setAlignContent, setAlignContent, setAlignItems, setAlignItems, setAlignSelf, setAlignSelf, setAnimation, setAnimationDelay, setAnimationDelay, setAnimationDelay, setAnimationDirection, setAnimationDirection, setAnimationDuration, setAnimationDuration, setAnimationDuration, setAnimationFillMode, setAnimationFillMode, setAnimationIterationCount, setAnimationIterationCount, setAnimationIterationCount, setAnimationName, setAnimationPlayState, setAnimationPlayState, setAnimationTimingFunction, setAnimationTimingFunction, setAnimationTimingFunction, setAnimationTimingFunction, setBackdropFilter, setBackdropFilter, setBackfaceVisibility, setBackfaceVisibility, setBackground, setBackground, setBackgroundAttachment, setBackgroundAttachment, setBackgroundBlendMode, setBackgroundBlendMode, setBackgroundClip, setBackgroundClip, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBackgroundOrigin, setBackgroundOrigin, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundRepeat, setBackgroundRepeat, setBackgroundSize, setBackgroundSize, setBackgroundSize, setBackgroundSize, setBackgroundSize, setBlur, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottomColor, setBorderBottomColor, setBorderBottomLeftRadius, setBorderBottomLeftRadius, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderBottomRightRadius, setBorderBottomRightRadius, setBorderBottomStyle, setBorderBottomStyle, setBorderBottomWidth, setBorderBottomWidth, setBorderBottomWidth, setBorderBottomWidth, setBorderColor, setBorderColor, setBorderColor, setBorderColor, setBorderImage, setBorderImage, setBorderImageOutset, setBorderImageRepeat, setBorderImageSlice, setBorderImageSource, setBorderImageWidth, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeftColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftStyle, setBorderLeftWidth, setBorderLeftWidth, setBorderLeftWidth, setBorderLeftWidth, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRightColor, setBorderRightColor, setBorderRightStyle, setBorderRightStyle, setBorderRightWidth, setBorderRightWidth, setBorderRightWidth, setBorderRightWidth, setBorderStyle, setBorderStyle, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTopColor, setBorderTopColor, setBorderTopLeftRadius, setBorderTopLeftRadius, setBorderTopLeftRadius, setBorderTopRightRadius, setBorderTopRightRadius, setBorderTopRightRadius, setBorderTopStyle, setBorderTopStyle, setBorderTopWidth, setBorderTopWidth, setBorderTopWidth, setBorderTopWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBottom, setBottom, setBottom, setBoxShadow, setBoxShadow, setBoxShadow, setBoxShadow, setBoxShadow, setBoxSizing, setBoxSizing, setBreakAfter, setBreakBefore, setBreakInside, setBrightness, setClass, setClear, setClear, setClip, setClipPath, setClipPath, setColGap, setColGap, setColor, setColor, setColumnCount, setColumnCount, setColumnFill, setColumnFill, setColumnGap, setColumnRule, setColumnRuleColor, setColumnRuleColor, setColumnRuleStyle, setColumnRuleStyle, setColumnRuleWidth, setColumnRuleWidth, setColumns, setColumns, setColumns, setColumnSpan, setColumnWidth, setColumnWidth, setColumnWidth, setContrast, setCounterIncrement, setCounterReset, setCursor, setCursor, setDirection, setDirection, setDisabledStyle, setDisplay, setDisplay, setFilter, setFilter, setFilterOpacity, setFlex, setFlexBasis, setFlexDirection, setFlexDirection, setFlexFlow, setFlexGrow, setFlexGrow, setFlexShrink, setFlexShrink, setFlexWrap, setFlexWrap, setFloat, setFloat, setFocusStyle, setFocusVisibleStyle, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFontFace, setFontFamily, setFontFamily, setFontFeatureSettings, setFontKerning, setFontLanguageOverride, setFontSize, setFontSize, setFontSize, setFontSizeAdjust, setFontStretch, setFontStretch, setFontStyle, setFontStyle, setFontSynthesis, setFontVariant, setFontVariant, setFontVariantAlternates, setFontVariantCaps, setFontVariantEastAsian, setFontVariantLigatures, setFontVariantNumeric, setFontVariantPosition, setFontWeight, setFontWeight, setGap, setGap, setGap, setGap, setGrayscale, setHangingPunctuation, setHangingPunctuation, setHeight, setHeight, setHeight, setHoverStyle, setHueRotate, setHyphens, setImageOrientation, setImageRendering, setImageResolution, setImeMode, setInvert, setJustifyContent, setJustifyContent, setKeyFrames, setLeft, setLeft, setLeft, setLetterSpacing, setLetterSpacing, setLetterSpacing, setLetterSpacing, setLineBreak, setLineHeight, setLineHeight, setLineHeight, setLineHeight, setMargin, setMargin, setMargin, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMarginTop, setMark, setMarkAfter, setMarkBefore, setMarks, setMarqueeDirection, setMarqueePlayCount, setMarqueeSpeed, setMarqueeStyle, setMask, setMaskType, setMaxHeight, setMaxHeight, setMaxHeight, setMaxHeightToWindowHeight, setMaxWidth, setMaxWidthToWindowWidth, setMinHeight, setMinHeight, setMinHeightToWindowHeight, setMinWidth, setMinWidth, setMinWidth, setMinWidthToWindowWidth, setNavDown, setNavIndex, setNavIndex, setNavLeft, setNavRight, setNavUp, setObjectFit, setObjectPosition, setOnClickNavigateBack, setOnClickNavigateBack, setOnClickNavigateBack, setOnClickNavigateForward, setOnClickNavigateForward, setOnClickNavigateForward, setOnClickNavigateTo, setOnDblClick, setOnDblClickChange, setOpacity, setOpacity, setOrder, setOrder, setOrphans, setOutline, setOutline, setOutline, setOutline, setOutlineColor, setOutlineColor, setOutlineOffset, setOutlineOffset, setOutlineOffset, setOutlineStyle, setOutlineStyle, setOutlineWidth, setOutlineWidth, setOutlineWidth, setOutlineWidth, setOverflow, setOverflow, setOverflow, setOverflowWrap, setOverflowX, setOverflowX, setOverflowY, setOverflowY, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPaddingTop, setPageBreakAfter, setPageBreakAfter, setPageBreakBefore, setPageBreakBefore, setPageBreakInside, setPageBreakInside, setPerspective, setPerspective, setPerspective, setPerspectiveOrigin, setPerspectiveOrigin, setPerspectiveOrigin, setPerspectiveOrigin, setPhonemes, setPosition, setPosition, setPosition, setPosition, setPosition, setQuotes, setResize, setResize, setResizeToWindowHeight, setResizeToWindowHeight, setResizeToWindowWidth, setRest, setRestAfter, setRestBefore, setRight, setRight, setRight, setRotate, setRotate, setRowGap, setRowGap, setSaturate, setScale, setScale, setSepia, setShow, setSize, setSize, setSize, setSkewX, setSkewY, setStyle, setStyle, setTabSize, setTabSize, setTabSize, setTabSize, setTextAlign, setTextAlign, setTextAlignLast, setTextAlignLast, setTextCombineUpright, setTextCombineWeight, setTextDecoration, setTextDecoration, setTextDecorationColor, setTextDecorationColor, setTextDecorationLine, setTextDecorationLine, setTextDecorationStyle, setTextDecorationStyle, setTextIndent, setTextIndent, setTextIndent, setTextIndent, setTextJustify, setTextJustify, setTextOrientation, setTextOverflow, setTextOverflow, setTextSelectDisabled, setTextShadow, setTextShadow, setTextShadow, setTextShadow, setTextShadow, setTextTransform, setTextTransform, setTextUnderlinePosition, setTop, setTop, setTop, setTransform, setTransform, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformStyle, setTransformStyle, setTransition, setTransitionDelay, setTransitionDelay, setTransitionDelay, setTransitionDuration, setTransitionDuration, setTransitionDuration, setTransitionProperty, setTransitionTimingFunction, setTransitionTimingFunction, setTransitionTimingFunction, setTransitionTimingFunction, setTranslateX, setTranslateY, setTranslateZ, setUnicodeBidi, setUnicodeBidi, setVerticalAlign, setVerticalAlign, setVisibility, setVisibility, setVoiceBalance, setVoiceDuration, setVoicePitch, setVoicePitchRange, setVoiceRate, setVoiceStress, setVoiceVolume, setWhiteSpace, setWhiteSpace, setWidows, setWidth, setWidth, setWidth, setWordBreak, setWordBreak, setWordSpacing, setWordSpacing, setWordSpacing, setWordSpacing, setWordWrap, setWordWrap, setWritingMode, setZIndex, setZIndex, show, shown, stopAnimation, transitionForward, transitionForward, transitionReverse, transitionReverse, updateStyle, updateStyle, updateStyleIfChangedMethods inherited from class com.oorian.html.VisualElement
clearOnClick, click, disable, enable, getAccessKey, getAutoCapitalize, getEnterKeyHint, getInputMode, getPopover, getRole, getTabIndex, getTitle, isAutoFocus, isContentEditable, isDisabled, isDraggable, isHidden, isInert, isSpellCheck, onDisabled, onEnabled, setAccessKey, setAriaAtomic, setAriaBusy, setAriaChecked, setAriaCheckedMixed, setAriaControls, setAriaCurrent, setAriaDescribedBy, setAriaDisabled, setAriaErrorMessage, setAriaExpanded, setAriaHasPopup, setAriaHasPopup, setAriaHidden, setAriaInvalid, setAriaLabel, setAriaLabelledBy, setAriaLevel, setAriaLive, setAriaModal, setAriaOwns, setAriaPressed, setAriaRequired, setAriaSelected, setAriaValueRange, setAriaValueText, setAutoCapitalize, setAutoFocus, setConsumeEvent, setContentEditable, setDisabled, setDraggable, setDropAllowed, setEnterKeyHint, setFocus, setHidden, setInert, setInputMode, setOnAnimationCancel, setOnAnimationEnd, setOnAnimationIteration, setOnAnimationStart, setOnAuxClick, setOnBeforeInput, setOnBeforeToggle, setOnBlur, setOnChange, setOnClick, setOnClickChange, setOnCompositionEnd, setOnCompositionStart, setOnCompositionUpdate, setOnContextMenu, setOnCopy, setOnCut, setOnDocumentResize, setOnFocus, setOnFocusIn, setOnFocusOut, setOnFormData, setOnGotPointerCapture, setOnInput, setOnInvalid, setOnKeyDown, setOnKeyPressed, setOnKeyUp, setOnLostPointerCapture, setOnMouseDown, setOnMouseEnter, setOnMouseLeave, setOnMouseMove, setOnMouseOut, setOnMouseOutChangeClass, setOnMouseOutChangeStyle, setOnMouseOutChangeStyle, setOnMouseOver, setOnMouseOverChangeClass, setOnMouseOverChangeStyle, setOnMouseOverChangeStyle, setOnMouseOverShow, setOnMouseUp, setOnPageLoad, setOnPaste, setOnPointerCancel, setOnPointerDown, setOnPointerEnter, setOnPointerLeave, setOnPointerMove, setOnPointerOut, setOnPointerOver, setOnPointerUp, setOnResize, setOnScroll, setOnScrollEnd, setOnSelect, setOnSelectionChange, setOnSelectStart, setOnToggle, setOnTouchCancel, setOnTouchEnd, setOnTouchMove, setOnTouchStart, setOnTransitionCancel, setOnTransitionEnd, setOnTransitionRun, setOnTransitionStart, setOnWheel, setOnWindowResize, setPopover, setRole, setRole, setSpellCheck, setTabIndex, setTitle, setTooltipMethods inherited from class com.oorian.html.Element
addAttribute, addAttribute, addAttribute, addAttribute, addElement, addLineBreak, addLineOfText, addLineOfText, addLineOfText, addParagraph, addParagraph, addSpacer, addText, addText, addText, addText, assignId, containsElement, containsElement, create, dispatchEvent, dispatchEvent, dispatchEvent, dispatchEvent, equals, excludeId, executeJs, executeJs, executeJs, getAccept, getAllElements, getAncestor, getAttribute, getAttributes, getComponent, getDir, getElement, getElementById, getElementCount, getElementCount, getElements, getElements, getElementsByComponentName, getElementsByTagName, getHtml, getId, getInnerHtml, getInnerHtml, getIs, getItemId, getItemProp, getItemRef, getItemType, getLang, getNextSibling, getPage, getParent, getPart, getPrevSibling, getSlot, getTagName, getTextContent, getUrl, hasAttribute, hasElements, insertElement, isChildOf, isClosedTag, isCreated, isDescendantOf, isDescendantOf, isInitialized, isItemScope, isTranslate, onCallback, onCreated, onElementAdded, onElementRemoved, onHashChange, onHidden, onInitialized, onJsReturn, onPageLoaded, onPageUnloaded, onRefresh, onShown, onUpdated, onUserEvent, prewrite, recreate, refresh, refresh, registerAddition, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerSubtraction, registerUpdate, removeAllElements, removeAttribute, removeAttribute, removeElement, removeElement, removeFromParent, requestCallback, requestCallback, requestCallback, requestCallback, resetId, scrollTo, scrollToBottom, scrollToTop, self, sendCommand, sendUpdate, setAccept, setComponent, setDir, setDir, setElement, setId, setIs, setItemId, setItemProp, setItemRef, setItemScope, setItemType, setLang, setOnError, setOnLoad, setPage, setParent, setPart, setSlot, setTagName, setText, setText, setText, setText, setTranslate, toString, unregisterListener, update, updateAttributes
-
Constructor Details
-
StoryLayout
public StoryLayout()Constructs a StoryLayout with default configuration.
-
-
Method Details
-
initialize
protected void initialize()Builds the element tree for the layout.- Overrides:
initializein classStyledElement<StoryLayout>
-
header
Sets the header content.- Parameters:
header- the header element (hero section, title, etc.)- Returns:
- this StoryLayout for method chaining
-
addSection
Adds a story section with image and text content.Sections automatically alternate between image-left and image-right when alternating mode is enabled (default).
- Parameters:
image- the image/media elementtext- the text/content element- Returns:
- this StoryLayout for method chaining
-
addSection
Adds a story section with explicit image position.- Parameters:
image- the image/media elementtext- the text/content elementimageFirst- true to place image on the left, false for right- Returns:
- this StoryLayout for method chaining
-
addSectionImageLeft
Adds a section with image on the left.- Parameters:
image- the image/media elementtext- the text/content element- Returns:
- this StoryLayout for method chaining
-
addSectionImageRight
Adds a section with image on the right.- Parameters:
image- the image/media elementtext- the text/content element- Returns:
- this StoryLayout for method chaining
-
setAlternating
Enables or disables automatic alternating of image position.- Parameters:
alternating- true to alternate, false for consistent positioning- Returns:
- this StoryLayout for method chaining
-
setSplitRatio
Sets the split ratio between image and text panes.- Parameters:
imageWidth- the image pane width (e.g., "40%", "300px")textWidth- the text pane width (e.g., "60%", "1fr")- Returns:
- this StoryLayout for method chaining
-
setEqualSplit
Sets equal 50/50 split ratio.- Returns:
- this StoryLayout for method chaining
-
setSmallImageSplit
Sets a 40/60 split ratio (smaller image, larger text).- Returns:
- this StoryLayout for method chaining
-
setLargeImageSplit
Sets a 60/40 split ratio (larger image, smaller text).- Returns:
- this StoryLayout for method chaining
-
setSectionGap
Sets the gap between sections.- Parameters:
gap- the gap in pixels- Returns:
- this StoryLayout for method chaining
-
setSectionGap
Sets the gap between sections.- Parameters:
gap- the gap value (e.g., "64px", "4rem")- Returns:
- this StoryLayout for method chaining
-
setInnerGap
Sets the gap between image and text within sections.- Parameters:
gap- the gap in pixels- Returns:
- this StoryLayout for method chaining
-
setInnerGap
Sets the gap between image and text within sections.- Parameters:
gap- the gap value (e.g., "48px", "3rem")- Returns:
- this StoryLayout for method chaining
-
setContentPadding
Sets padding for the sections container.- Parameters:
padding- the padding in pixels- Returns:
- this StoryLayout for method chaining
-
setContentPadding
Sets padding for the sections container.- Parameters:
padding- the padding value (e.g., "48px", "3rem")- Returns:
- this StoryLayout for method chaining
-
setMaxWidth
Sets maximum width for the sections (for centered content).- Overrides:
setMaxWidthin classStyledElement<StoryLayout>- Parameters:
maxWidth- the max width in pixels- Returns:
- this StoryLayout for method chaining
-
setMaxWidth
Sets maximum width for the sections (for centered content).- Overrides:
setMaxWidthin classStyledElement<StoryLayout>- Parameters:
maxWidth- the max width value (e.g., "1200px", "80%")- Returns:
- this StoryLayout for method chaining
-
getHeaderArea
Returns the header area for advanced customization.- Returns:
- the header area div
-
getSectionsContainer
Returns the sections container for advanced customization.- Returns:
- the sections container div
-
getSectionCount
public int getSectionCount()Returns the number of sections added.- Returns:
- the section count
-
setCompactSpacing
Applies compact spacing (smaller gaps between and within sections).- Returns:
- this StoryLayout for method chaining
-
setStandardSpacing
Applies standard spacing (the default).- Returns:
- this StoryLayout for method chaining
-
setSpaciousSpacing
Applies spacious spacing (larger gaps for dramatic effect).- Returns:
- this StoryLayout for method chaining
-
narrowContent
Applies narrow content width (960px) - focused storytelling.- Returns:
- this StoryLayout for method chaining
-
normalContent
Applies normal content width (1200px).- Returns:
- this StoryLayout for method chaining
-
wideContent
Applies wide content width (1440px).- Returns:
- this StoryLayout for method chaining
-
setFullWidth
Applies full width content (no max width constraint).- Returns:
- this StoryLayout for method chaining
-
setFeatureTourStyle
Configures for a feature tour style with large images and compact text.- Returns:
- this StoryLayout for method chaining
-
setArticleStyle
Configures for a blog/article style with smaller images and more text.- Returns:
- this StoryLayout for method chaining
-
setBalancedStyle
Configures for balanced image and text presentation.- Returns:
- this StoryLayout for method chaining
-