Package org.omnifaces.renderer
Class MessagesRenderer
- 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 String
RENDERER_TYPE
The 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 void
encodeChildren(FacesContext context, UIComponent component)
protected void
encodeEmptyMessages(FacesContext context, OmniMessages component)
Encode the case when there are no messages.protected void
encodeMessage(FacesContext context, OmniMessages component, FacesMessage message, boolean table)
Encode a single faces message.protected void
encodeMessages(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 void
encodeMessagesRepeater(FacesContext context, OmniMessages component, List<FacesMessage> messages)
Encode the case when thevar
attribute is specified.protected List<FacesMessage>
getMessages(FacesContext context, OmniMessages component)
Collect all messages associated with components identified byfor
attribute and return it.boolean
getRendersChildren()
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:
getRendersChildren
in classRenderer
-
encodeChildren
public void encodeChildren(FacesContext context, UIComponent component) throws IOException
- Overrides:
encodeChildren
in classRenderer
- Throws:
IOException
-
getMessages
protected List<FacesMessage> getMessages(FacesContext context, OmniMessages component)
Collect all messages associated with components identified byfor
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 thevar
attribute is specified. This will render without any HTML markup and put the current message in the request scope as identified by thevar
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.
-
-