notify.jspx 2.92 KB
<?xml version="1.0" encoding="UTF-8"?>
<f:root
        xmlns:f="http://jsf.exadel.com/template"
        xmlns:vcp=" http://jsf.exadel.com/vcp"
        xmlns:ui=" http://jsf.exadel.com/ui"
        xmlns:x=" http://jsf.exadel.com/vcp"
        xmlns:u="http://jsf.exadel.com/util"
        xmlns:h="http://jsf.exadel.com/header"
        component="org.richfaces.component.UINotify"
        baseclass="org.ajax4jsf.renderkit.HeaderResourcesRendererBase"
        class="org.richfaces.renderkit.html.NotifyRenderer">
    <jsp:directive.page import="javax.faces.application.FacesMessage"/>

    <h:scripts>/org/richfaces/renderkit/html/scripts/jquery-1.4.2.js,
        /org/richfaces/renderkit/html/scripts/jquery.pnotify.js</h:scripts>
    <h:styles>/org/richfaces/renderkit/html/css/jquery.pnotify.xcss</h:styles>
    <f:clientid var="clientId"/>

    <div id="#{clientId}">
        <jsp:scriptlet>
<![CDATA[
            variables.setVariable("details", component.getDetails());
            variables.setVariable("summary", component.getSummary());
            variables.setVariable("showHistory", component.isShowHistory());
            variables.setVariable("nonblocking", component.isNonblocking());
            variables.setVariable("shadow", component.isShowShadow());
            variables.setVariable("closeButton", component.isShowCloseButton());
            variables.setVariable("nonblockingOpacity", component.getNonblockingOpacity());
            variables.setVariable("appearAnimation", component.getAppearAnimation());
            variables.setVariable("hideAnimation", component.getHideAnimation());
            variables.setVariable("animationSpeed", component.getAnimationSpeed());
            variables.setVariable("stackDirVertical", component.getStackDirVertical());
            variables.setVariable("stackDirHorizontal", component.getStackDirHorizontal());
            variables.setVariable("stackPush", component.getStackPush());
            variables.setVariable("time", component.getStayTime() != null ? component.getStayTime() : 0);
            variables.setVariable("styleClass", component.getStyleClass() == null ? "" : component.getStyleClass());
]]>
        </jsp:scriptlet>
        <script type="text/javascript">
            jQuery.pnotify({
                pnotify_title: '#{summary}',
                pnotify_text :'#{details}',
                pnotify_addclass:'#{styleClass}',
                pnotify_hide:!#{sticky},
                pnotify_nonblock:#{nonblocking},
                pnotify_shadow:#{shadow},
                pnotify_closer:#{closeButton},
                pnotify_nonblock_opacity:#{nonblockingOpacity},
                pnotify_animation:{effect_in:'#{appearAnimation}',effect_out:'#{hideAnimation}'},
                pnotify_animate_speed:#{animationSpeed},
                pnotify_history:#{showHistory},
                pnotify_delay:#{time},
                pnotify_stack:#{stack}
            });
        </script>
    </div>
</f:root>