Message

Messages that can be shown from either server or client. It can be set to disappear after a certain period of time, or to stay put until the user closes it.

It works as a replacement for the <h:messages tag, but can also be used to show arbitrary messages generated client side via the Widget API.

Error message Warning message Success message

Message also support an optional icon to be displayed with the message, and an optional closable attribute that will override the default for the message container. To support this server side, TornadoFaces comes with a NotificationMessage class that extends FacesMessage.

Markup
Controller
Documentation

<t:message id="msgs" widgetVar="msgs" closable="true"/>

<a href="#" class="button alert" onclick="TW('msgs').show('Ouch!', 'An error occured', 'ERROR')">Error message</a>
<a href="#" class="button warning" onclick="TW('msgs').show('Danger!', 'Be warned', 'WARN')">Warning message</a>
<a href="#" class="button success" onclick="TW('msgs').show('Success!', 'Victory!', 'SUCCESS')">Success message</a>

<h:form>
    <t:commandButton value="Server info" action="#{controller.alert}" render=":msgs"/>
</h:form>

public class alert() {
    FacesContext.getCurrentInstance().addMessage(null, new NotificationMessage(
        "Success!",
        "A successfull server generated message",
        "http://url/to/image.png").closable(false));
}

Messages that can be shown from either server or client. It can be set to disappear after a certain period of time, or to stay put until the user closes it.

Info
Tag name message
Component type io.tornadofaces.component.Message
Renderer type io.tornadofaces.component.MessageRenderer
Attributes
NameDescriptionRequired
styleClassStyles to apply to the message div.false
timeoutThe timeout in milliseconds for the message to stay visible. Defaults to 0 for a sticky message. false
closableNon closable notifications cannot be closed by the user once the are visible, but will dissapear when the timeout is reached, or never if timeout is 0. Defaults to false. false
widgetVarWidget variable name, accessible via TW('widgetVar') and TornadoFaces.widgets.widgetVar. false
renderedShould this component be rendered?false
Client Side API

Widget: TornadoFaces.widget.Message

Method Params Return type Description
show(summary) summary: The title of the message void Show a message with just a title
show(summary, detail) summary: The title, detail: The body of the message void Show a message with a title and body
show(summary, detail, severity) summary: The title, detail: The body, severity: The severity of the message void Show a message with a title, body and the given severity. Valid severity levels are INFO, WARN, ERROR.
show(summary, detail, severity, image) summary: The title, detail: The body, severity: The severity, image: The icon of the messge void Show a message with a title, body, severity and the given image.
show(message) message: A configuration object containing one or more of summary, detail and severity void Show a message with the given configuration.