- java.lang.Object
-
- jakarta.faces.render.Renderer
-
- org.omnifaces.renderer.MessagesRenderer
-
public class MessagesRenderer extends Renderer
This renderer is the default renderer ofOmniMessages. 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 Summary
Fields Modifier and Type Field Description static StringRENDERER_TYPEThe standard renderer type.-
Fields inherited from class jakarta.faces.render.Renderer
PASSTHROUGH_RENDERER_LOCALNAME_KEY
-
-
Constructor Summary
Constructors Constructor Description MessagesRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencodeChildren(FacesContext context, UIComponent component)protected voidencodeEmptyMessages(FacesContext context, OmniMessages component)Encode the case when there are no messages.protected voidencodeMessage(FacesContext context, OmniMessages component, FacesMessage message, boolean table)Encode a single faces message.protected voidencodeMessages(FacesContext context, OmniMessages component, List<FacesMessage> messages, boolean table)Encode the case when the faces messages are to be rendered as either a HTML table or a HTML list.protected voidencodeMessagesRepeater(FacesContext context, OmniMessages component, List<FacesMessage> messages)Encode the case when thevarattribute is specified.protected List<FacesMessage>getMessages(FacesContext context, OmniMessages component)Collect all messages associated with components identified byforattribute and return it.booleangetRendersChildren()Returnstrue.-
Methods inherited from class jakarta.faces.render.Renderer
convertClientId, decode, encodeBegin, encodeEnd, getConvertedValue
-
-
-
-
Field Detail
-
RENDERER_TYPE
public static final String RENDERER_TYPE
The standard renderer type.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRendersChildren
public boolean getRendersChildren()
Returnstrue.- Overrides:
getRendersChildrenin classRenderer
-
encodeChildren
public void encodeChildren(FacesContext context, UIComponent component) throws IOException
- Overrides:
encodeChildrenin classRenderer- Throws:
IOException
-
getMessages
protected List<FacesMessage> getMessages(FacesContext context, OmniMessages component)
Collect all messages associated with components identified byforattribute 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
forattribute.
-
encodeMessagesRepeater
protected void encodeMessagesRepeater(FacesContext context, OmniMessages component, List<FacesMessage> messages) throws IOException
Encode the case when thevarattribute is specified. This will render without any HTML markup and put the current message in the request scope as identified by thevarattribute. 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.
-
-