blob: 96ade147f9bfaa3f9510edeec26f3630d5e9e6fc [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<ui:composition template="/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:param name="hideGlobalMessages" value="true"/>
<p>Messages are displayed via <code class="language-markup">&lt;tc:messages/></code> tag.</p>
<tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png"
link="#{apiController.tldBase}/#{apiController.currentRelease}/tld/tc/messages.html"/>
<tc:section label="Show Messages in different style">
<tc:box label="Create a message">
<tc:buttons>
<tc:button label="Fatal" action="#{messagesController.createFatalMessage}"/>
<tc:button label="Error" action="#{messagesController.createErrorMessage}"/>
<tc:button label="Warn" action="#{messagesController.createWarnMessage}"/>
<tc:button label="Info" action="#{messagesController.createInfoMessage}"/>
<tc:button id="add7messages" label="7 Messages" action="#{messagesController.createSevenMessages}"/>
<tc:button label="7 Messages (Ajax)" action="#{messagesController.createSevenMessages}">
<f:ajax render="tabGroup"/>
</tc:button>
<tc:button label="Summary/Details" action="#{messagesController.createSummaryDetailMessages}"/>
</tc:buttons>
<p>To create messages, press one of the buttons. The message will be displayed in the tab group below.</p>
</tc:box>
<p>
<tc:badge value="Hint" markup="warning"/>
If you are using AJAX, make sure to udpate the <code class="language-markup">&lt;tc:message/></code> tag.
</p>
</tc:section>
<tc:tabGroup id="tabGroup" switchType="client">
<tc:tab id="woAttr" label="Without attributes">
<p>On this tab, you can see how messages are displayed if no attribute are set for the
<code class="language-markup">&lt;tc:messages/></code> tag.</p>
<tc:messages id="woAttrMessage"/>
</tc:tab>
<tc:tab label="Number of messages">
<p>A limit for the number of messages can be set with the <code>maxNumber</code> attribute.</p>
<demo-highlight language="markup">&lt;tc:messages maxNumber="2"/></demo-highlight>
<tc:messages maxNumber="2"/>
</tc:tab>
<tc:tab label="Severity">
<p>The range, which severities are displayed, can be set with <code>minSeverity</code> and
<code>maxSeverity</code>. In this example, only warnings and error should be displayed.</p>
<demo-highlight language="markup">&lt;tc:messages minSeverity="#{messagesController.severityWarn}" maxSeverity="#{messagesController.severityError}"/></demo-highlight>
<tc:messages minSeverity="#{messagesController.severityWarn}" maxSeverity="#{messagesController.severityError}"/>
</tc:tab>
<tc:tab label="Details">
<p>A message can also contain 'details', you can show it with <code>showDetail</code>.</p>
<demo-highlight language="markup">&lt;tc:messages showDetail="true"/></demo-highlight>
<tc:messages showDetail="true"/>
</tc:tab>
<tc:tab label="Hide summary">
<p>In this example, only the details are shown. To hide the summary, use <code>showSummary</code>.</p>
<demo-highlight language="markup">&lt;tc:messages showSummary="false" showDetail="true"/></demo-highlight>
<tc:messages showSummary="false" showDetail="true"/>
</tc:tab>
<tc:tab label="Order">
<tc:segmentLayout medium="6seg 6seg">
<tc:box label="severity">
<p>By default, messages are sorted by severity.
Therefor, the <code>orderBy</code> attribute is not needed in this case.</p>
<demo-highlight language="markup">&lt;tc:messages orderBy="severity"/></demo-highlight>
<tc:messages orderBy="severity"/>
</tc:box>
<tc:box label="occurrence">
<p>Messages displayed in the order they occurred.</p>
<demo-highlight language="markup">&lt;tc:messages orderBy="occurrence"/></demo-highlight>
<tc:messages orderBy="occurrence"/>
</tc:box>
</tc:segmentLayout>
</tc:tab>
</tc:tabGroup>
</ui:composition>