Class MessagesRenderer

java.lang.Object
jakarta.faces.render.Renderer<OmniMessages>
org.omnifaces.renderer.MessagesRenderer

public class MessagesRenderer extends Renderer<OmniMessages>
This renderer is the default renderer of OmniMessages. It's basically copypasted from Mojarra 2.2, including the fix of tooltip rendering as described in issue 2164, and afterwards slightly rewritten, refactored and enhanced to take the new features into account.
Since:
1.5
Author:
Bauke Scholtz
  • Field Details

  • Constructor Details

    • MessagesRenderer

      public MessagesRenderer()
  • Method Details

    • getRendersChildren

      public boolean getRendersChildren()
      Returns true.
      Overrides:
      getRendersChildren in class Renderer<OmniMessages>
    • encodeChildren

      public void encodeChildren(FacesContext context, OmniMessages component) throws IOException
      Overrides:
      encodeChildren in class Renderer<OmniMessages>
      Throws:
      IOException
    • getMessages

      protected List<FacesMessage> getMessages(FacesContext context, OmniMessages component)
      Collect all messages associated with components identified by for attribute and return it. An empty list will be returned when there are no messages.
      Parameters:
      context - The involved faces context.
      component - The messages component.
      Returns:
      All messages associated with components identified by for attribute.
    • encodeMessagesRepeater

      protected void encodeMessagesRepeater(FacesContext context, OmniMessages component, List<FacesMessage> messages) throws IOException
      Encode the case when the var attribute is specified. This will render without any HTML markup and put the current message in the request scope as identified by the var attribute. Note: the iteration is by design completely stateless.
      Parameters:
      context - The involved faces context.
      component - The messages component.
      messages - The queued faces messages.
      Throws:
      IOException - When an I/O error occurs.
    • encodeEmptyMessages

      protected void encodeEmptyMessages(FacesContext context, OmniMessages component) throws IOException
      Encode the case when there are no messages. This will render a div when the ID is specified.
      Parameters:
      context - The involved faces context.
      component - The messages component.
      Throws:
      IOException - When an I/O error occurs.
    • encodeMessages

      protected void encodeMessages(FacesContext context, OmniMessages component, List<FacesMessage> messages, boolean table) throws IOException
      Encode the case when the faces messages are to be rendered as either a HTML table or a HTML list.
      Parameters:
      context - The involved faces context.
      component - The messages component.
      messages - The queued faces messages.
      table - Whether to render the messages as a HTML table or a HTML list.
      Throws:
      IOException - When an I/O error occurs.
    • encodeMessage

      protected void encodeMessage(FacesContext context, OmniMessages component, FacesMessage message, boolean table) throws IOException
      Encode a single faces message.
      Parameters:
      context - The involved faces context.
      component - The messages component.
      message - The queued faces message.
      table - Whether to render the messages as a HTML table or a HTML list.
      Throws:
      IOException - When an I/O error occurs.