PrimeFaces Cookbook - Second Edition

Book description

Over 100 practical recipes to learn PrimeFaces 5.x ? the most popular JSF component library on the planet

In Detail

PrimeFaces is the most popular component library used in the JSF ecosystem. It is a lightweight library with one JAR, zero configuration, and no required dependencies.

This book covers over 100 effective recipes for PrimeFaces 5.2, which is a leading component suite to boost JSF-based applications. The book starts with an introduction to PrimeFaces and its concepts, such as AJAX processing, the selector mechanism, partial view submit, and i18n support. Later chapters then focus on theming and the usage of over 100 input and output components, such as tables, charts, menus, and so on.

This cookbook provides a solid foundation by covering all the knowledge needed to work with PrimeFaces components in the real world.

What You Will Learn

  • Understand basic concepts such as AJAX processing and partial view submit so that you can work with PrimeFaces
  • Go beyond the basics and discover more interesting features of PrimeFaces: PrimeFaces selectors, RequestContext, Dialog Framework, and more
  • Delve deep into over 100 rich UI components with all the required details
  • Get practical solutions to complex problems that arise in a JSF ecosystem
  • Use best practices, avoid pitfalls, and get performance tips when working with the component suite

Table of contents

  1. PrimeFaces Cookbook Second Edition
    1. Table of Contents
    2. PrimeFaces Cookbook Second Edition
    3. Credits
    4. Foreword
    5. Foreword
    6. About the Authors
    7. About the Reviewers
    8. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    9. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    10. 1. Getting Started with PrimeFaces
      1. Introduction
      2. Setting up and configuring the PrimeFaces library
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
          1. The PrimeFaces Cookbook Showcase application
      3. AJAX basics with process and update
        1. How to do it...
        2. How it works…
        3. There's more…
          1. The PrimeFaces Cookbook Showcase application
      4. PrimeFaces selectors
        1. How to do it…
        2. How it works…
        3. There's more…
          1. The PrimeFaces Cookbook Showcase application
      5. Partial process and update with fragments
        1. How to do it…
        2. How it works…
          1. The PrimeFaces Cookbook Showcase application
      6. Partial view submit
        1. How to do it…
        2. How it works…
        3. There's more…
          1. The PrimeFaces Cookbook Showcase application
      7. Internationalization (i18n) and Localization (L10n)
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
          1. The PrimeFaces Cookbook Showcase application
        5. Right to left language support
        6. How to do it...
        7. How it works…
        8. There's more…
          1. The PrimeFaces Cookbook Showcase application
      8. Improved resource ordering
        1. How to do it…
        2. How it works…
        3. There's more…
          1. The PrimeFaces Cookbook Showcase application
    11. 2. Theming Concepts
      1. Introduction
      2. Understanding structural and skinning CSS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      3. Installing themes
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Customizing default theme styles
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
        4. See also
      5. Adjusting the font and size throughout the web application
        1. How to do it…
        2. How it works…
        3. See also
      6. Simple ways to create a new theme
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Stateless and stateful theme switchers
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      8. Integrating Font Awesome with PrimeFaces
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
    12. 3. Enhanced Inputs and Selects
      1. Introduction
      2. Formatted input with inputMask
        1. How to do it...
        2. How it works…
        3. There's more…
          1. Using the asterisk (*) character
          2. Making a part of the mask optional
          3. Dynamically changing the mask value
          4. PrimeFaces Cookbook Showcase application
      3. Auto suggestion with autoComplete
        1. How to do it…
        2. There's more…
          1. Instant AJAX selection
          2. Multiple selection
          3. Adding item tip
          4. Grouping on items
          5. PrimeFaces Cookbook Showcase application
      4. Usable features of inputTextArea
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Autocomplete on content
          2. PrimeFaces Cookbook Showcase application
      5. Discovering selectBooleanCheckbox and selectManyCheckbox
        1. How to do it…
        2. There's more…
          1. Selection with AJAX behavior on selectBooleanCheckbox
          2. PrimeFaces Cookbook Showcase application
        3. See also
      6. Choosing a single item with selectOneMenu
        1. How to do it…
        2. There's more...
          1. Filtering on items
          2. PrimeFaces Cookbook Showcase application
      7. Basic and advanced calendar scenarios
        1. How to do it…
        2. There's more...
          1. Localization of the calendar
          2. Effects with the calendar
          3. Picking time with the calendar
          4. PrimeFaces Cookbook Showcase application
        3. See also
      8. Spinner – different ways to provide input
        1. How to do it…
        2. There's more…
          1. Adding prefix and suffix
          2. Applying boundaries to the input
          3. Adjusting the width of the spinner
          4. AJAX update with spinner
          5. PrimeFaces Cookbook Showcase application
      9. Slider – different ways to provide input
        1. How to do it…
        2. There's more...
          1. Displaying the value of the slider
          2. Disabling manual input with the slider
          3. Selecting a range with slider
          4. AJAX behavior events on slider
          5. PrimeFaces Cookbook Showcase application
        3. See also
      10. Rich text editing with the editor
        1. How to do it…
        2. There's more…
          1. Clearing the contents of the editor
          2. Embedding the editor inside a dialog box
          3. PrimeFaces Cookbook Showcase application
      11. Advanced editing with an in-place editor
        1. How it works…
        2. There's more…
          1. Editing with confirmation buttons
          2. Giving effects to the in-place input
          3. Adding facets
          4. AJAX behavior events
          5. PrimeFaces Cookbook Showcase application
      12. Enhanced password input
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      13. Star-based rating input
        1. How to do it…
        2. There's more…
          1. AJAX behavior events
          2. PrimeFaces Cookbook Showcase application
        3. See also
    13. 4. Grouping Content with Panels
      1. Introduction
      2. Grouping content with a standard panel
        1. How to do it…
        2. There's more…
          1. Custom actions
          2. AJAX behavior events on panel
          3. PrimeFaces Cookbook Showcase application
        3. See also
      3. PanelGrid with colspan and rowspan support
        1. How to do it…
        2. There's more…
          1. PrimeFaces Cookbook Showcase application
      4. Vertical stacked panels with accordion
        1. How to do it...
        2. There's more…
          1. Dynamic content loading
          2. Dynamic tabbing
          3. AJAX behavior events on accordion
          4. PrimeFaces Cookbook Showcase application
        3. See also
      5. Displaying overflowed content with scrollPanel
        1. How to do it…
          1. PrimeFaces Cookbook Showcase application
      6. Working with a tabbed panel
        1. How to do it...
        2. There's more…
          1. Orientation of the tabs
          2. Dynamic tabbing
          3. Transition effects
          4. AJAX behavior events on tabView
          5. PrimeFaces Cookbook Showcase application
        3. See also
      7. Grouping of buttons and more with toolbar
        1. How to do it…
          1. PrimeFaces Cookbook Showcase application
      8. The multipurpose output panel
        1. How to do it…
        2. There's more…
          1. Using panel as a placeholder component
          2. PrimeFaces Cookbook Showcase application
      9. Simulating the portal environment with dashboard
        1. How to do it…
        2. There's more…
          1. Creating new widgets
          2. Having fixed-sized columns
          3. PrimeFaces Cookbook Showcase application
        3. See also
      10. Creating complex layouts
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Element-based layouts
          2. Nested layouts
          3. AJAX behavior events on layout
          4. PrimeFaces Cookbook Showcase application
        4. See also
      11. Responsive layout with Grid CSS
        1. How to do it…
        2. There's more…
          1. Nesting div elements
          2. The PrimeFaces Cookbook Showcase application
    14. 5. Data Iteration Components
      1. Introduction
      2. Selecting rows in dataTable
        1. How to do it…
        2. There's more…
          1. Single selection with a row click
          2. Single selection with radio buttons
          3. Multiple selection with checkboxes
          4. Instant row selection
          5. PrimeFaces Cookbook Showcase application
        3. See also
      3. Sorting and filtering data in dataTable
        1. How to do it…
        2. There's more…
          1. Custom filtering
          2. Options for filtering
          3. Global filtering
          4. Postprocessing events on sorting/filtering
          5. PrimeFaces Cookbook Showcase application
      4. In-cell editing with dataTable
        1. How to do it…
        2. There's more…
          1. Editing rows according to a condition
          2. AJAX behavior events
          3. PrimeFaces Cookbook Showcase application
        3. See also
      5. Resizing, reordering, and toggling columns in dataTable
        1. How to do it…
        2. There's more…
          1. AJAX behavior events on resize
          2. AJAX behavior events on row and column reordering
          3. Toggling columns
          4. AJAX behavior event on column toggling
          5. Adding state for column toggling
          6. PrimeFaces Cookbook Showcase application
        3. See also
      6. Making dataTable responsive
        1. How to do it…
        2. There's more…
          1. PrimeFaces Cookbook Showcase application
      7. Using subTable for grouping
        1. How to do it…
          1. PrimeFaces Cookbook Showcase application
      8. Handling tons of data – LazyDataModel
        1. How to do it…
        2. There's more…
          1. PrimeFaces Cookbook Showcase application
      9. Listing data with dataList
        1. How to do it…
        2. There's more…
          1. Pagination
          2. PrimeFaces Cookbook Showcase application
      10. Listing data with pickList
        1. How to do it…
        2. There's more…
          1. Control buttons visibility
          2. POJO support
          3. Transition effects
          4. Executing custom JavaScript on transfer
          5. AJAX behavior events
          6. PrimeFaces Cookbook Showcase application
        3. See also
      11. Listing data with orderList
        1. How to do it…
        2. There's more…
          1. Transition effects
          2. PrimeFaces Cookbook Showcase application
      12. Visualizing data with tree
        1. How to do it…
        2. There's more…
          1. Node type support
          2. Node selection
          3. Drag and drop
          4. AJAX behavior events
          5. Context menu support
          6. Horizontal layout
          7. PrimeFaces Cookbook Showcase application
      13. Visualizing data with treeTable
        1. How to do it…
        2. There's more…
          1. Node selection
          2. Sorting
          3. Context menu support
          4. AJAX behavior events
          5. PrimeFaces Cookbook Showcase application
      14. Exporting data in various formats
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Preprocessing and postprocessing of documents
          2. Monitoring export status
          3. PrimeFaces Cookbook Showcase application
      15. Managing events with schedule by leveraging lazy loading
        1. How to do it…
        2. How it works…
        3. There's more…
          1. AJAX behavior events
          2. Locale support
          3. PrimeFaces Cookbook Showcase application
        4. See also
      16. Visualizing data with dataScroller
        1. How to do it…
        2. There's more…
          1. Providing buffer
          2. Loading with a button
          3. Lazy loading
          4. PrimeFaces Cookbook Showcase application
    15. 6. Endless Menu Variations
      1. Introduction
      2. Statically and dynamically positioned menus
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
      3. Creating programmatic menus
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      4. The context menu with nested items
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
      5. Integrating the context menu
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
      6. Breadcrumb – providing contextual information about page hierarchy
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      7. SlideMenu – menu in the iPod style
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
      8. TieredMenu – submenus in nested overlays
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
      9. MegaMenu – the multicolumn menu
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      10. PanelMenu – hybrid of accordion and tree
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      11. MenuButton – multiple items in a popup
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      12. Accessing commands via menubar
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      13. Displaying checkboxes in selectCheckboxMenu
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
    16. 7. Working with Files, Images, and Multimedia
      1. Introduction
      2. Basic, automatic, drag and drop, and multiple file uploading
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Accessing files with a listener
          2. Restricting file upload by type
          3. Limiting maximum size
          4. Uploading multiple files
          5. Handling upload with client-side callbacks
          6. Uploading files with drag-and-drop
          7. PrimeFaces Cookbook Showcase application
        4. See also
      3. Downloading files
        1. How to do it…
        2. There's more…
          1. Monitoring download status
          2. PrimeFaces Cookbook Showcase application
      4. Cropping images
        1. How to do it...
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      5. Creating dynamic image streaming programmatically
        1. How to do it…
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      6. Displaying a collection of images with galleria
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Transition effects
          2. Displaying a collection of images
          3. Displaying captions on items
          4. PrimeFaces Cookbook Showcase application
      7. Displaying a collection of images with imageSwitch
        1. How to do it…
        2. There's more…
          1. Displaying a collection of images
          2. PrimeFaces Cookbook Showcase application
      8. Displaying a collection of images with contentFlow
        1. How to do it…
        2. There's more…
          1. Displaying captions with images
          2. PrimeFaces Cookbook Showcase application
      9. Embedding the multimedia content in JSF pages
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Dynamic content streaming
          2. PrimeFaces Cookbook Showcase application
      10. Capturing images with photoCam
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Authorizing access to the camera
          2. PrimeFaces Cookbook Showcase application
    17. 8. Drag Me, Drop Me
      1. Introduction
      2. Making a component draggable
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
      3. Restricting dragging by axis, grid, and containment
        1. How to do it…
        2. How it works…
        3. See also
          1. PrimeFaces Cookbook Showcase application
      4. Snapping to the edges of nearest elements
        1. How to do it…
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
      5. Defining droppable targets
        1. How to do it…
        2. How it works…
        3. See also
          1. PrimeFaces Cookbook Showcase application
      6. Restricting dropping by tolerance and acceptance
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      7. AJAX-enhanced drag and drop
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      8. Integrating drag and drop with data iteration components
        1. How to do it…
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
    18. 9. Creating Charts and Maps
      1. Introduction
      2. Creating line, area, bar, and pie charts
        1. How to do it…
        2. There's more…
          1. Creating area charts
          2. Creating bar charts
          3. Creating pie charts
          4. PrimeFaces Cookbook Showcase application
      3. Creating combined charts
        1. How to do it…
          1. PrimeFaces Cookbook Showcase application
      4. Updating live data in charts with polling
        1. How to do it…
          1. PrimeFaces Cookbook Showcase application
      5. Interacting with charts via AJAX
        1. How to do it…
          1. PrimeFaces Cookbook Showcase application
      6. Basic mapping with GMaps
        1. How to do it…
        2. How it works…
        3. There's more…
          1. Configuring controls
          2. PrimeFaces Cookbook Showcase application
      7. Adding, selecting, and dragging markers in maps
        1. How to do it…
        2. There's more…
          1. Selecting markers
          2. Dragging markers
          3. PrimeFaces Cookbook Showcase application
      8. Creating rectangles, circles, polylines, and polygons in maps
        1. How to do it…
          1. PrimeFaces Cookbook Showcase application
      9. Enabling InfoWindow and streetView on maps
        1. How to do it…
        2. There's more…
          1. PrimeFaces Cookbook Showcase application
    19. 10. Client-side Validation
      1. Introduction
      2. Configuring and getting started with CSV
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
          1. PrimeFaces Cookbook Showcase application
      3. Instant validation with p:clientValidator
        1. How to do it…
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
      4. Bean Validation and transformation
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
          1. PrimeFaces Cookbook Showcase application
      5. Extending CSV with JSF
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
      6. Extending CSV with Bean Validation
        1. How to do it…
        2. How it works…
        3. There's more…
        4. See also
          1. PrimeFaces Cookbook Showcase application
    20. 11. Miscellaneous Advanced Use Cases
      1. Introduction
      2. Programmatic updating and scrolling with RequestContext
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      3. Two ways of triggering the JavaScript execution
        1. How to do it…
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
      4. Adding AJAX callback parameters – validation within a dialog
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      5. Opening external pages in dynamically generated dialogs
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
          1. PrimeFaces Cookbook Showcase application
      6. Polling – sending periodical AJAX requests
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      7. Blocking page pieces during long-running AJAX calls
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      8. Controlling form submission using defaultCommand
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      9. Clever focus management in forms
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      10. Layout pitfalls of menus and dialogs
        1. How to do it…
        2. How it works…
        3. See also
          1. PrimeFaces Cookbook Showcase application
      11. Targetable messages with severity levels
        1. How to do it…
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
      12. Conditional coloring in dataTable
        1. How to do it…
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
      13. Sticking a component when scrolling
        1. How to do it…
        2. How it works…
        3. There's more…
          1. PrimeFaces Cookbook Showcase application
      14. Reducing page load time using content caching
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
          1. PrimeFaces Cookbook Showcase application
      15. Possibilities for exception handling in PrimeFaces
        1. Getting ready
        2. How to do it…
        3. How it works…
          1. PrimeFaces Cookbook Showcase application
    21. Index

Product information

  • Title: PrimeFaces Cookbook - Second Edition
  • Author(s): Mert Çalışkan, Oleg Varaksin
  • Release date: May 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781784393427