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.

@FunctionalInterface public interface FormElementRenderer<T extends FormElement>
API to render a FormElement.
Since:
4.1.0
Author:
Sergio del Amo
  • Field Details

  • Method Details

    • render

      @NonNull @NonNull String render(@NonNull T formElement, @NonNull @NonNull Locale locale)
      Renders a Form Element as HTML.
      Parameters:
      formElement - Form Element
      locale - 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 Tag
      attributes - 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 Tag
      attributes - HTML attributes
      content - 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 label
      message - Message
      messageSource - Message Source
      locale - Locale
      Returns:
      localized content
    • renderOpenTag

      default String renderOpenTag(@NonNull @NonNull HtmlTag tag, @NonNull @NonNull List<HtmlAttribute> attributes)
      Parameters:
      tag - an HTML Tag
      attributes - HTML Attributes
      Returns:
      HTML
    • renderCloseTag

      default String renderCloseTag(@NonNull @NonNull HtmlTag tag)
      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 - Message
      messageSource - Message Source
      locale - Locale
      Returns:
      localized content
    • typeHtmlAttribute

      default HtmlAttribute typeHtmlAttribute(@NonNull @NonNull InputType type)
      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 - InputStringFormElement
      type - input type
      Returns:
      HTML Attributes