notify.xhtml 3.09 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:notify="http://richfaces.org/sandbox/notify"
        >
<head>
    <title>Notify sample</title>
    <style type="text/css">
        .bottomLeft {
            bottom: 10px;
            left: 10px;
            top: auto;
            right: auto;
        }

        .bottomRight {
            bottom: 10px;
            right: 10px;
            top: auto;
            left: auto;
        }
    </style>
</head>
<body class="rich-container">
<ui:include src="menu.xhtml"/>

<p>
    Here we have notify displaying all messages (not only global).
    Severity is reflected in overriden style classes.
</p>
<h:form>
    <notify:notify sticky="false" stayTime="5000"
                   title="Default stack"
                   text="Details of the message"
                   nonblockingOpacity="0"/>
    <notify:notify title="Before stack definition"
                   text="This message is defined in code before stack"
                   stack="bottomLeftStack"/>
    <notify:notify title="Left bottom stack 2"
                   text="This message alos should be displayed in the left bottom corner"
                   showCloseButton="true" stack="bottomLeftStack"/>
    <notify:notifyStack id="bottomLeftStack" styleClass="bottomLeft" stackDir1="up"
                        stackDir2="right" push="top">
        <notify:notify sticky="true"
                       title="Left bottom stack"
                       text="This message should be displayed in the left bottom corner
                               and should stay until you close it"
                       showCloseButton="true"/>
        <notify:notify title="Nonblocking"
                       nonblocking="true"/>
    </notify:notifyStack>
    <notify:notifyMessages interval="1000" stack="bottomRightStack" ajaxRendered="true"/>
    <notify:notifyStack id="bottomRightStack" styleClass="bottomRight" stackDir1="up"
                        stackDir2="left" push="bottom"/>
    Leave this blank for error:
    <br/>
    <h:outputLabel for="greeting" value="Greeting"/>
    <h:inputText id="greeting" value="#{greeter.greeting}" required="true"/>* <h:message for="greeting"/>
    <br/>
    <h:outputLabel for="surname" value="Surname"/>
    <h:inputText id="surname" required="true">
        <f:validateLongRange minimum="5" maximum="10"/>
    </h:inputText>* <h:message for="surname"/>
    <br/>
    <a4j:commandButton value="Say Hello" action="#{greeter.sayHello}"/>
    <a4j:commandButton value="Warn me" action="#{greeter.warnMe}"/>
    <a4j:commandButton value="Say error" action="#{greeter.sayError}"/>
    <a4j:commandButton value="Say fatal" action="#{greeter.sayFatal}"/>
</h:form>

<rich:insert src="/notify.xhtml" highlight="xhtml" rendered="#{showSource!=false}"/>

</body>
</html>