Class Page.PageBuilder

java.lang.Object
io.mindspice.simplypages.layout.Page.PageBuilder
Enclosing class:
Page

public static class Page.PageBuilder extends Object
Fluent builder for Page layouts.

Ordering matters: if sticky sidebar mode is enabled, rows/components added afterward are routed to the dedicated main-content container.

  • Constructor Details

    • PageBuilder

      public PageBuilder()
  • Method Details

    • addRow

      public Page.PageBuilder addRow(Row row)
      Appends a row to page content. When sticky mode is enabled, appends to sticky main area.
      Parameters:
      row - row to append
      Returns:
      this builder
    • addRow

      public Page.PageBuilder addRow(Consumer<Row> rowConsumer)
      Builds a new row via consumer and appends it using the same routing as addRow(Row).
      Parameters:
      rowConsumer - consumer that mutates a fresh row
      Returns:
      this builder
    • addComponents

      public Page.PageBuilder addComponents(Component... components)
      Appends multiple components in argument order.

      Components are routed to sticky main content when sticky mode is active.

      Parameters:
      components - components to append
      Returns:
      this builder
    • withIndependentScrolling

      public Page.PageBuilder withIndependentScrolling()
      Enables page-area independent scrolling by adding framework class hooks.
      Returns:
      this builder
    • withStickySidebar

      public Page.PageBuilder withStickySidebar(Component stickyComponent, int mainWidth, int sidebarWidth)
      Enables sticky-sidebar layout with explicit 12-grid widths.

      Calling this method also enables independent scrolling. Call before addRow/addComponents so subsequent content is routed to the sticky main area.

      One native details/summary disclosure starts closed. Framework JS opens it at widths of 769px and above; fresh mobile disclosures through 768px remain closed, and each element's observed native/application open preference is remembered. Replacement elements initialize independently; ordinary nested details are unchanged. This is separate from the shell's mobile drawer.

      The generated aside has tabindex -1 for programmatic focus fallback, not a Tab stop. Caller details attributes are preserved. Without JS, the disclosure starts closed at all widths and its summary remains keyboard-operable; a focused open desktop summary stays visible for native keyboard recovery.

      Parameters:
      stickyComponent - component rendered in the sidebar
      mainWidth - main-area width in [1,12]
      sidebarWidth - sidebar width in [1,12]
      Returns:
      this builder
      Throws:
      IllegalArgumentException - when widths are out of range or sum above 12
    • withStickySidebar

      public Page.PageBuilder withStickySidebar(Component stickyComponent)
      Enables sticky-sidebar layout with default widths (8 main, 4 sidebar).
      Parameters:
      stickyComponent - component rendered in the sidebar
      Returns:
      this builder
    • build

      public Page build()
      Finalizes and returns the configured page.

      Build is idempotent for unchanged builder state. Sticky-sidebar layout containers and scroll classes are only attached once.

      Returns:
      configured page instance