Class AvatarRenderer

    • Constructor Detail

      • AvatarRenderer

        public AvatarRenderer()
    • Method Detail

      • encodeEnd

        public void encodeEnd​(javax.faces.context.FacesContext context,
                              javax.faces.component.UIComponent component)
                       throws IOException
        Overrides:
        encodeEnd in class javax.faces.render.Renderer
        Throws:
        IOException
      • encodeDefaultContent

        protected void encodeDefaultContent​(javax.faces.context.FacesContext context,
                                            Avatar avatar,
                                            String label)
                                     throws IOException
        Throws:
        IOException
      • encodeChildren

        public void encodeChildren​(javax.faces.context.FacesContext context,
                                   javax.faces.component.UIComponent component)
                            throws IOException
        Overrides:
        encodeChildren in class javax.faces.render.Renderer
        Throws:
        IOException
      • getRendersChildren

        public boolean getRendersChildren()
        Overrides:
        getRendersChildren in class javax.faces.render.Renderer
      • calculateLabel

        protected String calculateLabel​(javax.faces.context.FacesContext context,
                                        Avatar avatar)
        Generates a label based on the text if its more than 2 characters. Example: PrimeFaces Rocks = PR
        Parameters:
        avatar - the Avatar component
        Returns:
        the calculated label text.
      • generateBackgroundColor

        protected String generateBackgroundColor​(Avatar avatar)
        Generates a dynamic color based on the hash of the label.
        Parameters:
        avatar - to generate the color for
        Returns:
        the new color and background color styles
      • generateGravatar

        protected String generateGravatar​(javax.faces.context.FacesContext context,
                                          Avatar avatar)
        Generate a Gravatar URL for an email addressed based on API docs.
        Parameters:
        context - the Face
        avatar - the Avatar to create a Gravatar for
        Returns:
        the URL to retrieve the Gravatar image
        See Also:
        Image Requests