DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • How To Create React JS Form Using Hooks and PrimeReact/Primefaces UI Components
  • How to Create Skeleton in ReactJs Using PrimeReact/Primefaces UI

Trending

  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  • Breaking Bottlenecks: Applying the Theory of Constraints to Software Development
  • A Modern Stack for Building Scalable Systems
  • Performance Optimization Techniques for Snowflake on AWS

How to Customize the Growl PrimeFaces Component

By 
A. Programmer user avatar
A. Programmer
·
Jul. 25, 11 · Interview
Likes (3)
Comment
Save
Tweet
Share
56.5K Views

Join the DZone community and get the full member experience.

Join For Free

I believe that every JSF fan has heard about PrimeFaces, the open source component suite for Java Server Faces (PrimeFaces). From my point of view, it is a real pleasure to explore PrimeFaces components and to get play with their capabilities. Recently, I had to use a customized growl component, meaning that I needed to make it appear in different locations and changing it’s aspect. Let me share this experience with you!
The final result (after customization) is shown in the below image:


- Replacing the default info icon with a custom image can be accomplished by using the infoIcon attribute of <p:growl> component:

<p:growl id="growl" infoIcon="./imgs/user.png" />
- In addition, you can customize the image’s CSS properties, like width and height, by modifying the CSS class ui-growl-image:
.ui-growl-image { 
    width: 100px;
    height: 95px;
    float: left;
}

- By default, the growl’s message will be displayed for 6000 ms and after that will be hidden. You can change this period by setting the sticky attribute to true (the message will never get hide) or changing the duration in the life attribute.
<p:growl id="growl" infoIcon="./imgs/user.png" showDetail="true"
                                          sticky="false" life="10000" />
- The growl background it is also customizable through CSS. This time operate over ui-growl-item-container class:
.ui-growl-item-container {
    background-image: url('./imgs/background.jpg');
}

- The growl closing icon is set by default in the top left corner. If you want it to appear in a different place, like top right corner, you need to modify the CSS ui-growl-icon-close class:
.ui-growl-icon-close {
    cursor: pointer;
    position: absolute;
    left: 335px;
    top: 15px;
}


- You can also change the font and style of the summary and the detail message, like below:
.ui-growl-title {
    font: 28px "Lucida Console", Monaco, monospace;
    text-align: center;
}
.ui-growl-message p {
    font: 20px "Lucida Console", Monaco, monospace;
    letter-spacing: -1px;
}
- Finally, you can place the growl anywhere you want, top left, bottom left, bottom right, center and so on by ui-growl class:
.ui-growl {   
    position:fixed;
    top: 40%;
    left: 37%;
    width: 360px;
    height: 110px;
    z-index:9999; 
}

That’s it ! Hope you like it!

 

From http://e-blog-java.blogspot.com/2011/07/how-to-customize-growl-primefaces.html

PrimeFaces

Opinions expressed by DZone contributors are their own.

Related

  • How To Create React JS Form Using Hooks and PrimeReact/Primefaces UI Components
  • How to Create Skeleton in ReactJs Using PrimeReact/Primefaces UI

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!