Growler Control Example

Does anyone have an example project that includes the Growler control?

I’ve came across the PrimeFaces Growler control example, sample code below:


<h:form>  
                  
    <p:growl id="growl" showDetail="true" sticky="true" />  
      
    <p:panel header="Growl">  
        <h:panelGrid columns="2">  
            <h:outputText value="Your Name: *" />   
            <p:inputText value="#{growlBean.text}" required="true" label="Name"/>  
        </h:panelGrid>  
  
        <p:commandButton value="Save" actionListener="#{growlBean.save}" update="growl"/>  
    </p:panel>  
      
</h:form>  

package org.primefaces.examples.view;  
  
import javax.faces.application.FacesMessage;  
import javax.faces.context.FacesContext;  
import javax.faces.event.ActionEvent;  
  
public class GrowlBean {  
  
    private String text;  
      
    public String getText() {  
        return text;  
    }  
    public void setText(String text) {  
        this.text = text;  
    }  
  
    public void save(ActionEvent actionEvent) {  
        FacesContext context = FacesContext.getCurrentInstance();  
          
        context.addMessage(null, new FacesMessage("Successful", "Hello " + text));  
        context.addMessage(null, new FacesMessage("Second Message", "Additional Info Here..."));  
    }  
}  

It seems that PrimeFaces sample code uses FacesMessage object and displays the values in the growler that is declared in the view. The commandbutton looks like it associates the ajax callback function to the growl control. I was wondering if CAF’s version works in similar fashion.

  1. Drag a Growler control onto the screen.

  2. Put a button on the page, with the following onclick code:

CAF.Growler.growl('#{activePageBean.clientIds["growler"]}', "This is a Growler message!");
  1. Publish, refresh page, click the button :slight_smile:

Thanks for the reply, I was able to figure out how to do a static growler call. I’m looking for more dynamic message coming back from the manage bean to the growler in a similar way as the posted example code.