4 Replies Latest reply on Jul 18, 2013 11:04 AM by liumin hu

    some questions about rich:notifymessags

    liumin hu Master

      hi guys,

       

      2 questions about rich:notifymessags:

       

      1. there is not closebutton for rich:notifymessage even showclosebutton is true, is it normal ?

      2. Is there a way to give the message different staytime by this severity?

       

      thanks in advance

       

      liu

        • 1. Re: some questions about rich:notifymessags
          Michal Petrov Master
          1. the button appears when you hover over the message, have you tried that?
          2. there is not, but if you have control over the FacesMessage you could send it to a specific id with set stayTime
          • 2. Re: some questions about rich:notifymessags
            liumin hu Master

            1. i tried. rich:notify has a default close button, but not rich:notifymessage(s).

             

            2 i dont understand. could your give me more detail?

            • 3. Re: some questions about rich:notifymessags
              Michal Petrov Master

              1.

               

              weird, the button does not show when the message is non-blocking, but it should show otherwise, and if you can see the button on rich:notify it means the image is there, have you tried another browser?

               

               

              2.

               

              I mean something like this:

               

              <h:inputHidden id="error" binding="#{bean.error}"/>
                  <h:inputHidden id="warning" binding="#{bean.warning}"/>
                  <h:inputHidden id="info" binding="#{bean.info}"/>
                  <rich:notifyStack id="stack" position="topLeft">
                      <rich:notifyMessage for="error" detail="Detail" satyTime="500" />
                      <rich:notifyMessage for="warning" stack="stack" stayTime="5000"/>
                      <rich:notifyMessage for="info" stack="stack" stayTime="2000" />
              </rich:notifyStack>
              
              <a4j:commandButton actionListener="#{bean.message}" value="Send messages" execute="@this"/>
              

               

               

                  private UIComponent error;
                  private UIComponent warning;
                  private UIComponent info;
                      // with setters and getters
                  
                  public void message() {
                      FacesContext fc = FacesContext.getCurrentInstance();
              
                      fc.addMessage(error.getClientId(fc), new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error message", "and message detail"));
                      fc.addMessage(warning.getClientId(fc), new FacesMessage(FacesMessage.SEVERITY_WARN, "Warning message", "and message detail"));
                      fc.addMessage(info.getClientId(fc), new FacesMessage(FacesMessage.SEVERITY_INFO, "Info message", "and message detail"));
                  }
              

               

              Then you can send error messages to id "error" and so on.

              1 of 1 people found this helpful
              • 4. Re: some questions about rich:notifymessags
                liumin hu Master

                1.there is not the close button neither in IE.

                 

                2 your solution is useful. but in my case, i want it works with the other normal jsf error message(validation,required etc) too.