Class EditablePage

java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.editing.EditablePage
All Implemented Interfaces:
Component

public class EditablePage extends HtmlTag
Editable page wrapper that emits rows plus row-insert controls.

Lifecycle: row state is mutated via addEditableRow(EditableRow) and markup is rebuilt on each render call.

Rendering composes temporary markup without changing stored attributes or children. Generic inherited children remain stored but are not emitted. Templates retain this renderer live, including later row and URL configuration. Finish configuration before sharing; row delegates, descendants and request contexts retain their own sharing obligations.

  • Method Details

    • create

      public static EditablePage create(String pageId)
      Creates an editable page wrapper for the given page id.
    • withInsertRowUrlTemplate

      public EditablePage withInsertRowUrlTemplate(String template)
      Sets the insert-control URL template (default /api/pages/{pageId}/rows/insert?position={position}).

      Only {pageId} and {position} are supported, as whole path segments or whole query values. Repeated/omitted tokens and fixed URLs are allowed. Literal URL text is preserved. In browser-relevant structure, token-bearing absolute URLs require scheme://nonempty-literal-authority; protocol-relative, root-relative, relative-path and query-only references are supported. Placement is also checked after browser-style control/space and path-backslash handling, without rewriting the output. Scheme shorthands, empty authorities and opaque templated URLs are unsupported; fixed URLs do not acquire structural validation. This configures only this page's insert controls, not supplied rows.

      The raw page id is UTF-8 percent-encoded when interpolated during render, not at creation. It must be non-null, nonempty, nonblank, not exactly . or .., and valid UTF-16. It is not trimmed, normalized or decoded; a literal percent is encoded too. Omitted tokens do not validate their ids. DOM ids are unchanged. Applications own routes, server decoding, authorization and CSRF enforcement.

      Parameters:
      template - caller-owned URL template
      Returns:
      this page
      Throws:
      IllegalArgumentException - for null templates, unsupported tokens or token placements
    • addEditableRow

      public EditablePage addEditableRow(EditableRow row)
      Appends an editable row to this page.
    • render

      public String render(RenderContext context)
      Renders temporary page-builder markup for current rows. Empty pages emit position zero; nonempty pages emit positions one through the row count, after their respective rows.
      Specified by:
      render in interface Component
      Overrides:
      render in class HtmlTag
      Parameters:
      context - context used for slot resolution and render policy
      Returns:
      rendered HTML for this component
    • render

      public String render()
      Description copied from interface: Component
      Renders this component with an empty context.
      Returns:
      rendered HTML for this component
    • getPageId

      public String getPageId()
      Returns the page identifier backing this wrapper.
    • getRowCount

      public int getRowCount()
      Returns current editable-row count.