O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

PrimeFaces Theme Development

Book Description

Create, package, and customize stunning themes using PrimeFaces

About This Book

  • Build PrimeFaces themes that meet the industry standards
  • Customize your themes for mobile web applications with PrimeFaces Mobile
  • A precise, example-oriented guide to help you create interesting themes using the PrimeFaces tools

Who This Book Is For

If you are a Web Designer who wants to create and modify PrimeFaces themes then this book is for you. Basic knowledge of JSF, CSS, and HTML is assumed.

What You Will Learn

  • Use Maven to create JSF Projects
  • Create a custom theme using JQuery UI tools
  • Package your theme for distribution and use your PrimeFaces-based web applications as drop in libraries
  • Develop additional dynamic look and feel elements that themes do not already supply
  • Apply look and feel elements dynamically to views without causing page refreshes
  • Reduce code repetition by applying page templates to your JSF project

In Detail

Developing stunning themes for web applications has never been easier! PrimeFaces delivers a powerful set of features that enables JSF developers to create and customize awesome themes on the web. It is very easy to use because it comes as a single JAR file and requires no mandatory XML configuration. With more than 30 out-of-the-box themes, jQuery integration, a mobile UI toolkit, Ajax Push technology, and much more, PrimeFaces takes JSF application development to a whole new level!

This book is a hands-on example-rich guide to creating and customizing PrimeFaces themes using available tools.

Beginning with creating a JSF project and integrating the PrimeFaces library, this book will introduce you to the features of theme components, how these are structured, and how PrimeFaces uses JQuery UI to apply a theme to your application. You will learn to examine and change the CSS rules and get creative by setting standard icons and adding new icons to them. You will use a combination of JavaScript and CSS to enhance your application with help of scheduler component and go on to adapt and package your custom theme so that it is compatible with the Resource Manager.

Finally, you will explore PrimeFaces mobile apps, ensuring themes are compatible with your mobile applications best practices for theme design.

Style and approach

This book is a concise, hands-on guide to developing PrimeFaces themes, working from the ground up with examples in each topic implemented in a web application. You will be encouraged to explore areas of your own interest without the requirement to stick to the letter of the chapter.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. PrimeFaces Theme Development
    1. Table of Contents
    2. PrimeFaces Theme Development
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. To Skin an App
      1. Why we need to create an app
      2. The PrimeFaces library
      3. Creating a NetBeans Maven JSF project
      4. Adding the PrimeFaces library and related dependencies to our project
      5. Building the project
      6. Running the project
      7. Summary
    9. 2. Introducing PrimeFaces Themes
      1. The difference between standard JSF and PrimeFaces components
      2. Adding additional PrimeFaces themes
      3. The PrimeFaces ThemeSwitcher component
      4. Creating the CurrentTheme Bean
      5. Extending the ThemeService Bean
      6. Creating a Facelets Template
      7. Creating a Mini Showcase page
      8. Adding buttons that change the theme without using ThemeSwitcher
      9. Summary
    10. 3. jQuery UI, ThemeRoller, and the Anatomy of a Theme
      1. jQuery UI and its standard CSS rules
      2. The difference between a layout and the look and feel of UI components
      3. How PrimeFaces uses the jQuery UI CSS rules
      4. Changing the initial font and font size
      5. Creating a theme and downloading it
      6. Comparing our theme to a PrimeFaces one
      7. Packaging and adding our custom theme to the project
      8. Adding the new theme to the ThemeSwitcher class
      9. Summary
    11. 4. A PrimeFaces inputText Component in Detail
      1. Creating a new JSF page and adding a standard inputText component
      2. Examining the UI element using the browser developer tool
      3. Adding a PrimeFaces inputText component to the page and comparing these two elements
      4. Turning a standard component into a PrimeFaces one
      5. Summary
    12. 5. Let's Get Creative
      1. Creating a new JSF page
      2. Using your unpackaged theme and applying it to your application
      3. Changing the initial font and font size in your theme
      4. Changing the foreground and background colors
      5. Changing the highlighted, active, and selected CSS rules
      6. Changing the rounding rules
      7. Changing the shadow effects
      8. Changing the menu background
      9. Summary
    13. 6. Icons
      1. Introducing the standard theme icon set
      2. Creating a set of icons of our own
      3. Adding the new icons to your theme
      4. Using custom icons in the commandButton components
      5. Using custom icons in a menu component
      6. The Font Awesome icons as an alternative to the ThemeRoller icons
      7. Summary
    14. 7. Dynamic Changes – a Working Example
      1. Introducing the schedule component
      2. A lack of skinning support for date and event selection
      3. Creating a CSS rule to set the background color in an HTML element
      4. Creating a JavaScript function to apply CSS rules to a specific HTML element
      5. Executing a client-side JavaScript function from the server-side – the power of AJAX and RequestContext
      6. Summary
    15. 8. Mobile Web Apps
      1. The demand of creating a powerful mobile website
      2. Restrictions of real estate mobile device screens are simply smaller
      3. Introducing PrimeFaces Mobile for JSF-based applications
      4. The differences between PrimeFaces Mobile and normal PrimeFaces
      5. Creating customized mobile themes – the power of jQuery Mobile ThemeRoller
      6. Applying customized mobile themes to PrimeFaces Mobile
      7. Summary
    16. 9. The Final Touches
      1. The PrimeFaces showcase
      2. See what you don’t like in the showcase and apply the changes
      3. See what you do like in the showcase and make everything look that way
      4. Do the changes same way for PrimeFaces Mobile
      5. Packaging your custom theme
      6. Creating CSS files that provide variations on a theme
      7. Summary
    17. 10. Theme Design Best Practices
      1. Introduction of WAI for good web design
      2. Colors, icon sets, background, and foreground
      3. Fonts make the text stand out
      4. Rich Internet applications versus desktop applications
      5. Functions per page
      6. Components you will be using
      7. Some important PrimeFaces CSS classes
      8. Going beyond the standard PrimeFaces theme
      9. Override PrimeFaces CSS classes
      10. Override specific component CSS styles
      11. Preview the theme styles before going to use
      12. Considerations for mobile applications
      13. Busy UI versus data-dominated UI
      14. Feedback from potential users
      15. Miscellaneous best practices
      16. Summary
    18. 11. Premium Themes and Layouts, and Third-party Converter Tools
      1. Introducing premium themes and layouts
      2. Setting up and installing premium themes
      3. Using CSS Less support to customize CSS styles easily
      4. Brand new themes based on Google Material Design language
      5. A brief coverage of different premium themes and layouts features
      6. Third-party theme converters
      7. Summary
    19. Index