Package io.micronaut.views.fields.render
Interface FormElementRenderer<T extends FormElement>
- Type Parameters:
T- Form element
- All Known Implementing Classes:
InputCheckboxFormElementRenderer,InputCheckboxViewsFormElementRenderer,InputDateFormElementRenderer,InputDateTimeLocalFormElementRenderer,InputDateTimeLocalViewsFormElementRenderer,InputDateViewsFormElementRenderer,InputEmailFormElementRenderer,InputEmailViewsFormElementRenderer,InputHiddenFormElementRenderer,InputHiddenViewsFormElementRenderer,InputNumberFormElementRenderer,InputNumberViewsFormElementRenderer,InputPasswordFormElementRenderer,InputPasswordViewsFormElementRenderer,InputRadioFormElementRenderer,InputRadioViewsFormElementRenderer,InputSubmitFormElementRenderer,InputSubmitViewsFormElementRenderer,InputTelFormElementRenderer,InputTelViewsFormElementRenderer,InputTextFormElementRenderer,InputTextViewsFormElementRenderer,InputTimeFormElementRenderer,InputTimeViewsFormElementRenderer,InputUrlFormElementRenderer,InputUrlViewsFormElementRenderer,OptionFormElementRenderer,OptionViewsFormElementRenderer,SelectFormElementRenderer,SelectViewsFormElementRenderer,TextareaFormElementRenderer,TextareaViewsFormElementRenderer,TrixEditorFormElementRenderer,TrixEditorViewsFormElementRenderer,ViewsFormElementRenderer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
API to render a
FormElement.- Since:
- 4.1.0
- Author:
- Sergio del Amo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringHTML Attribute checked.static final StringHTML Attribute cols.static final StringHTML Attribute disabled.static final StringHTML Attribute for.static final StringHTML Attribute id.static final StringHTML Attribute max.static final StringHTML Attribute maxlength.static final StringHTML Attribute min.static final StringHTML Attribute minlength.static final StringHTML Attribute name.static final StringHTML Attribute pattern.static final StringHTML Attribute placeholder.static final StringHTML Attribute readonly.static final StringHTML Attribute required.static final StringHTML Attribute rows.static final StringHTML Attribute selected.static final StringHTML Attribute size.static final StringHTML Attribute step.static final StringHTML Attribute type.static final StringHTML Attribute value.static final StringGreater than sign.static final StringLower than sign.static final StringSlash.static final StringSpace. -
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull List<HtmlAttribute>attributes(@NonNull InputStringFormElement el, @NonNull InputType type) default Stringcontent(@NonNull Message message, @NonNull io.micronaut.context.MessageSource messageSource, @NonNull Locale locale) default @NonNull Stringrender(@NonNull HtmlTag tag, @NonNull List<HtmlAttribute> attributes) Renders an HTML Tag.default @NonNull Stringrender(@NonNull HtmlTag tag, @NonNull List<HtmlAttribute> attributes, @NonNull String content) Renders an HTML Tag.@NonNull StringRenders a Form Element as HTML.default StringrenderCloseTag(@NonNull HtmlTag tag) default StringrenderLabel(@Nullable String id, @NonNull Message message, @NonNull io.micronaut.context.MessageSource messageSource, @NonNull Locale locale) default StringrenderOpenTag(@NonNull HtmlTag tag, @NonNull List<HtmlAttribute> attributes) default HtmlAttributetypeHtmlAttribute(@NonNull InputType type)
-
Field Details
-
ATTR_FOR
HTML Attribute for.- See Also:
-
ATTR_VALUE
HTML Attribute value.- See Also:
-
ATTR_SELECTED
HTML Attribute selected.- See Also:
-
ATTR_DISABLED
HTML Attribute disabled.- See Also:
-
ATTR_ID
HTML Attribute id.- See Also:
-
ATTR_ROWS
HTML Attribute rows.- See Also:
-
ATTR_COLS
HTML Attribute cols.- See Also:
-
ATTR_PLACEHOLDER
HTML Attribute placeholder.- See Also:
-
ATTR_STEP
HTML Attribute step.- See Also:
-
ATTR_REQUIRED
HTML Attribute required.- See Also:
-
ATTR_READ_ONLY
HTML Attribute readonly.- See Also:
-
ATTR_MAX_LENGTH
HTML Attribute maxlength.- See Also:
-
ATTR_MIN_LENGTH
HTML Attribute minlength.- See Also:
-
ATTR_MAX
HTML Attribute max.- See Also:
-
ATTR_MIN
HTML Attribute min.- See Also:
-
ATTR_PATTERN
HTML Attribute pattern.- See Also:
-
ATTR_SIZE
HTML Attribute size.- See Also:
-
ATTR_NAME
HTML Attribute name.- See Also:
-
ATTR_CHECKED
HTML Attribute checked.- See Also:
-
ATTR_TYPE
HTML Attribute type.- See Also:
-
LESS_THAN
Lower than sign.- See Also:
-
GREATER_THAN
Greater than sign.- See Also:
-
SLASH
Slash.- See Also:
-
SPACE
Space.- See Also:
-
-
Method Details
-
render
Renders a Form Element as HTML.- Parameters:
formElement- Form Elementlocale- Locale- Returns:
- HTML
-
render
@NonNull default @NonNull String render(@NonNull @NonNull HtmlTag tag, @NonNull @NonNull List<HtmlAttribute> attributes) Renders an HTML Tag.- Parameters:
tag- HTML Tagattributes- HTML attributes- Returns:
- HTML
-
render
@NonNull default @NonNull String render(@NonNull @NonNull HtmlTag tag, @NonNull @NonNull List<HtmlAttribute> attributes, @NonNull @NonNull String content) Renders an HTML Tag.- Parameters:
tag- HTML Tagattributes- HTML attributescontent- Content- Returns:
- HTML
-
renderLabel
default String renderLabel(@Nullable @Nullable String id, @NonNull @NonNull Message message, @NonNull @NonNull io.micronaut.context.MessageSource messageSource, @NonNull @NonNull Locale locale) - Parameters:
id- element id referenced by the labelmessage- MessagemessageSource- Message Sourcelocale- Locale- Returns:
- localized content
-
renderOpenTag
default String renderOpenTag(@NonNull @NonNull HtmlTag tag, @NonNull @NonNull List<HtmlAttribute> attributes) - Parameters:
tag- an HTML Tagattributes- HTML Attributes- Returns:
- HTML
-
renderCloseTag
- Parameters:
tag- an HTML Tag- Returns:
- HTML
-
content
default String content(@NonNull @NonNull Message message, @NonNull @NonNull io.micronaut.context.MessageSource messageSource, @NonNull @NonNull Locale locale) - Parameters:
message- MessagemessageSource- Message Sourcelocale- Locale- Returns:
- localized content
-
typeHtmlAttribute
- Parameters:
type- Input type- Returns:
- An HTML attribute with key type and value the parameter
-
attributes
@NonNull default @NonNull List<HtmlAttribute> attributes(@NonNull @NonNull InputStringFormElement el, @NonNull @NonNull InputType type) - Parameters:
el- InputStringFormElementtype- input type- Returns:
- HTML Attributes
-