Class EditableRow
- All Implemented Interfaces:
Component
The supplied row retains its own attributes, content and renderer. Registrations are independent content, not edits to that row; callers must avoid registering content already present there.
Lifecycle: module list is mutable via configuration methods; the registered-module row/column structure is rebuilt on each render call with equal-width columns (fill columns above twelve).
Rendering uses a temporary tag and does not change stored wrapper attributes or children. Generic inherited children remain stored but are not emitted; only the supplied row and generated registration/add-control composition is emitted. Templates retain this renderer live. Finish mutable configuration before sharing; supplied custom renderers, modules and request contexts retain their own lifecycle and sharing obligations.
-
Field Summary
Fields inherited from class HtmlTag
attributes, children, id, innerText, innerTextSlot, selfClosing, tagName, trustedHtml -
Method Summary
Modifier and TypeMethodDescriptionaddEditableModule(Module module, String moduleId) Adds independent content to the generated row, wrapped at render time, and assigns its module id.render()Renders this component with an empty context.render(RenderContext context) Renders the supplied row, then rebuilt editable-module columns and an optional add control.withAddModuleFormUrlTemplate(String template) Sets the add-module-form URL template (default/api/pages/{pageId}/rows/{rowId}/add-module-form).withCanAddModule(boolean canAddModule) Sets whether the add-module control is rendered.withEditMode(EditMode mode) Sets edit mode applied to generatedEditableModulewrappers.withMaxModules(int max) Sets max registrations allowed in the generated row; source-row children do not count.withModuleDeleteUrlTemplate(String template) Sets the module-delete URL template (default/api/pages/{pageId}/modules/{moduleId}/delete).withModuleEditUrlTemplate(String template) Sets the module-edit URL template (default/api/pages/{pageId}/modules/{moduleId}/edit).static EditableRowCreates a wrapper containing the supplied row, then a separate registered-module row and an optional add-module control.Methods inherited from class HtmlTag
addClass, addStyle, addTrustedStyle, getChildrenStream, getId, hxDelete, hxGet, hxInclude, hxPatch, hxPost, hxPushUrl, hxPut, hxScrollTargetTop, hxSwap, hxTarget, hxTrigger, withAttribute, withChild, withClass, withId, withInnerText, withInnerText, withMaxWidth, withMinWidth, withUnsafeHtml, withWidth
-
Method Details
-
wrap
Creates a wrapper containing the supplied row, then a separate registered-module row and an optional add-module control.A non-null
rowis rendered once per wrapper render with the same render context, including customHtmlTag.render(RenderContext)overrides and rendering through a template. This wrapper does not copy or mutate the supplied row's structure. Its id, classes and other attributes remain on the supplied row, distinct from the outer wrapper's attributes.Modules registered with
addEditableModule(Module, String)belong only to the separate generated row. No merging or deduplication occurs; callers must not register content already present in the supplied row. Registration still assigns the supplied module's module id.- Parameters:
row- independent source row; an empty row is retained, whilenullomits itrowId- identifier used for the outer wrapper id and add-module endpointpageId- identifier used for generated editing endpoints- Returns:
- a new mutable, non-thread-safe wrapper
-
withMaxModules
Sets max registrations allowed in the generated row; source-row children do not count.- Throws:
IllegalArgumentException- whenmax < 1
-
withModuleEditUrlTemplate
Sets the module-edit URL template (default/api/pages/{pageId}/modules/{moduleId}/edit). Supports{pageId},{rowId}and{moduleId}only as whole path segments or whole query values; repeated/omitted tokens and fixed URLs are allowed. In browser-relevant structure, token-bearing absolute URLs requirescheme://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.Templates are validated here; raw ids are validated and UTF-8 percent-encoded only when interpolated during render. Used ids must be non-null, nonempty, nonblank, not exactly
.or.., and valid UTF-16. No trimming, normalization or decoding occurs; literal percent signs are encoded. Unused ids and DOM ids are unaffected. Literal URL text is preserved. Applications own routing, server decoding, authorization and CSRF.- Parameters:
template- caller-owned module-edit URL template- Returns:
- this row
- Throws:
IllegalArgumentException- for null templates, unsupported tokens or token placements
-
withModuleDeleteUrlTemplate
Sets the module-delete URL template (default/api/pages/{pageId}/modules/{moduleId}/delete). Supports{pageId},{rowId}and{moduleId}with the placement, encoding and render-time id validation described inwithModuleEditUrlTemplate(String). Configuring this operation does not change the edit or add-form template.- Parameters:
template- caller-owned module-delete URL template- Returns:
- this row
- Throws:
IllegalArgumentException- for null templates, unsupported tokens or token placements
-
withAddModuleFormUrlTemplate
Sets the add-module-form URL template (default/api/pages/{pageId}/rows/{rowId}/add-module-form). Supports only{pageId}and{rowId}, using the placement, encoding and render-time id validation described inwithModuleEditUrlTemplate(String). This template is expanded only when the add control is eligible to render.- Parameters:
template- caller-owned add-form URL template- Returns:
- this row
- Throws:
IllegalArgumentException- for null templates, unsupported tokens or token placements
-
withEditMode
Sets edit mode applied to generatedEditableModulewrappers. -
withCanAddModule
Sets whether the add-module control is rendered. -
addEditableModule
Adds independent content to the generated row, wrapped at render time, and assigns its module id. This does not make existing source-row content editable or deduplicate it.- Throws:
IllegalStateException- when module limit is reached
-
render
Renders the supplied row, then rebuilt editable-module columns and an optional add control. -
render
-