PrimeFaces Cookbook

Book description

Here are over 100 recipes for PrimeFaces, the ultimate JSF framework. It’s a great practical introduction to leading-edge Java web development, taking you from the basics right through to writing custom components.

  • The first PrimeFaces book that concentrates on practical approaches rather than the theoretical ones
  • Readers will gain all the PrimeFaces insights required to complete their JSF projects successfully
  • Written in a clear, comprehensible style and addresses a wide audience on modern, trend-setting Java/JEE web development

In Detail

PrimeFaces is the de facto standard in the Java web development. PrimeFaces is a lightweight library with one jar, zero-configuration, and no required dependencies. You just need to download PrimeFaces, add the primefaces-{version}.jar to your classpath and import the namespace to get started. This cookbook provides a head start by covering all the knowledge needed for working with PrimeFaces components in the real world.

"PrimeFaces Cookbook" covers over 100 effective recipes for PrimeFaces 3.x which is a leading component suite to boost JSF applications. The book’s range is wide‒ from AJAX basics, theming, and input components to advanced usage of datatable, menus, drag & drop, and charts. It also includes creating custom components and PrimeFaces Extensions.

You will start with the basic concepts such as installing PrimeFaces, configuring it, and writing a first simple page. You will learn PrimeFaces' theming concept and common inputs and selects components. After that more advanced components and use cases will be discussed. The topics covered are grouping content with panels, data iteration components, endless menu variations, working with files and images, using drag & drop, creating charts, and maps. The last chapters describe solutions for frequent, advanced scenarios and give answers on how to write custom components based on PrimeFaces and also show the community-driven open source project PrimeFaces Extension in action.

Table of contents

  1. PrimeFaces Cookbook
    1. Table of Contents
    2. PrimeFaces Cookbook
    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. Errata
        3. Piracy
        4. Questions
    8. 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. 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. PrimeFaces Cookbook Showcase application
      4. Internationalization (i18n) and Localization (L10n)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. PrimeFaces Cookbook Showcase application
      5. Improved resource ordering
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. PrimeFaces Cookbook Showcase application
      6. PrimeFaces scaffolding with Spring Roo
        1. Getting ready
        2. How to do it...
        3. How it works...
    9. 2. Theming Concept
      1. Introduction
      2. Understanding the 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 theme styles
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
        4. See also
      5. Customizing default styles on input components
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      6. Adjusting the font and size throughout the web application
        1. How to do it...
        2. How it works...
        3. See also
      7. Why does the theme look different in Internet Explorer?
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Simple ways to create a new theme
        1. Getting ready
        2. How to do it...
        3. How it works...
      9. Default stateless theme switcher
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
        4. See also
      10. Alternative stateful theme switchers
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
        4. See also
    10. 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. 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. PrimeFaces Cookbook Showcase application
      4. Usable features of inputTextArea
        1. How to do it...
        2. How it works...
        3. There's more...
          1. 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. 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
      7. 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
      8. 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. AJAX behavior events on slider
          4. PrimeFaces Cookbook Showcase application
        3. See also
      9. Rich text editing with 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
      10. Advanced editing with in-place editor
        1. How to do it...
        2. There's more...
          1. Giving effects to the in-place input
          2. PrimeFaces Cookbook Showcase application
      11. Enhanced password input
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      12. Star-based rating input
        1. How to do it...
        2. There's more...
          1. PrimeFaces Cookbook Showcase application
        3. See also
    11. 4. Grouping Content with Panels
      1. Introduction
      2. Grouping content with a standard panel
        1. How to do it...
        2. How it works...
        3. There's more...
          1. AJAX behavior events on panel
          2. PrimeFaces Cookbook Showcase application
        4. See also
      3. Panel grid with colspan and rowspan support
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      4. Vertical stacked panels with accordion
        1. How to do it...
        2. How it works...
          1. Dynamic content loading
          2. Dynamic tabbing
          3. PrimeFaces Cookbook Showcase application
      5. Displaying overflowed content with scrollPanel
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      6. Working with a tabbed panel
        1. How to do it...
        2. How it works...
          1. Orientation of the tabs
          2. Dynamic tabbing
          3. Transition effects
          4. PrimeFaces Cookbook Showcase application
      7. Grouping of buttons and more with toolbar
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      8. Simulating the portal environment with dashboard
        1. How to do it...
        2. How it works...
          1. Having fixed-sized columns
          2. PrimeFaces Cookbook Showcase application
      9. 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
    12. 5. Data Iteration Components
      1. Introduction
      2. Selecting rows in dataTable
        1. How to do it...
        2. There's more...
          1. Single selection with radio buttons
          2. Multiple selection with checkboxes
          3. PrimeFaces Cookbook Showcase application
      3. Sorting and filtering data in dataTable
        1. How to do it...
        2. There's more...
          1. Options for filtering
          2. Global filtering
          3. PrimeFaces Cookbook Showcase application
      4. In-cell editing with dataTable
        1. How to do it...
        2. There's more...
          1. PrimeFaces Cookbook Showcase application
      5. Conditional coloring in dataTable
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      6. Handling tons of data – LazyDataModel
        1. How to do it...
          1. PrimeFaces Cookbook Showcase application
      7. Listing data with dataList
        1. How to do it...
        2. There's more...
          1. Pagination
          2. PrimeFaces Cookbook Showcase application
      8. Listing data with pickList
        1. How to do it...
        2. There's more...
          1. POJO support
          2. Enabling captions
          3. Transition effects
          4. Executing custom JavaScript on transfer
          5. PrimeFaces Cookbook Showcase application
      9. Listing data with orderList
        1. How to do it...
        2. There's more...
          1. Transition effects
          2. PrimeFaces Cookbook Showcase application
      10. Visualizing data with tree
        1. How to do it...
        2. There's more...
          1. Node type support
          2. Node selection
          3. AJAX behavior events
          4. Context menu support
          5. PrimeFaces Cookbook Showcase application
      11. Visualizing data with treeTable
        1. How to do it...
        2. There's more...
          1. Node selection
          2. AJAX behavior events
          3. Context menu support
          4. PrimeFaces Cookbook Showcase application
      12. Exporting data in various formats
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Pre and post processor of documents
          2. Monitoring export status
          3. PrimeFaces Cookbook Showcase application
      13. Visualizing data with carousel
        1. How to do it...
        2. There's more...
          1. Transition effects
          2. Sliding tabs
          3. Defining header and footer
          4. PrimeFaces Cookbook Showcase application
      14. Visualizing data with ring
        1. How to do it...
        2. There's more...
          1. Effects with easing
          2. PrimeFaces Cookbook Showcase application
    13. 6. Endless Menu Variations
      1. Introduction
      2. Static and dynamic positioned menus
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      3. Creating a programmatic menu
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Context menu with nested items
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
        4. See also
      5. Context menu integration
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
        4. See also
      6. SlideMenu – menu in iPod style
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
        4. See also
      7. TieredMenu – submenus in nested overlays
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
        4. See also
      8. MegaMenu – multicolumn menu
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      9. PanelMenu – hybrid of accordion and tree
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      10. Accessing commands via Menubar
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      11. Displaying checkboxes in SelectCheckboxMenu
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      12. Dock menu for Mac OS fans
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
    14. 7. Working with Files and Images
      1. Introduction
      2. Basic, automatic, and multiple file upload
        1. How to do it...
        2. There's more...
          1. Restricting file upload by type
          2. Limiting maximum size
          3. Uploading multiple files
          4. Handling with client-side callbacks
          5. PrimeFaces Cookbook Showcase application
        3. See also
      3. Uploading a file with drag-and-drop
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      4. Downloading files
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Monitoring download status
          2. PrimeFaces Cookbook Showcase application
      5. Cropping images
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      6. Displaying a collection of images
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Transition effects
          2. Customizing filmstrip
          3. Enabling captions and overlays
          4. Viewing custom content
          5. PrimeFaces Cookbook Showcase application
      7. Capturing images with photoCam
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      8. Comparing images
        1. How to do it...
        2. How it works...
        3. There’s More
          1. PrimeFaces Cookbook Showcase application
    15. 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...
          1. PrimeFaces Cookbook Showcase application
        4. See also
      3. Restricting dragging by axis, grid, and containment
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
        3. See also
      4. Snapping to the edges of the 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
    16. 9. Creating Charts and Maps
      1. Introduction
      2. Creating a line chart
        1. How to do it...
        2. There's more...
          1. Positioning the legend
          2. Labels and positioning
          3. Minimum and maximum values on the axes
          4. Breaking lines at null values
          5. Styling lines
          6. Filling under lines
          7. Customizing data tips
          8. Animating and zooming
          9. PrimeFaces Cookbook Showcase application
      3. Creating a bar chart
        1. How to do it...
        2. There's more...
          1. Positioning the legend
          2. Labels and positioning
          3. Styling bars
          4. Orientation
          5. Stacked bar chart
          6. Customizing data tips
          7. Animating and zooming
          8. PrimeFaces Cookbook Showcase application
      4. Creating a pie chart
        1. How to do it...
        2. There's more...
          1. Positioning the legend
          2. Styling slices
          3. Showing data labels
          4. Adjusting pie appearance
          5. PrimeFaces Cookbook Showcase application
      5. Creating a bubble chart
        1. How to do it...
        2. There's more...
          1. Styling bubbles
          2. Labels and positioning
          3. PrimeFaces Cookbook Showcase application
      6. Creating a donut (doughnut) chart
        1. How to do it...
        2. There's more...
          1. Positioning the legend
          2. Adjusting donut appearance
          3. PrimeFaces Cookbook Showcase application
      7. Creating a meter gauge chart
        1. How to do it...
        2. There's more...
          1. Customizing the look of the gauge
          2. PrimeFaces Cookbook Showcase application
      8. Creating an OHLC chart
        1. How to do it...
        2. There's more...
          1. Labels and positioning
          2. Candlestick mode
          3. PrimeFaces Cookbook Showcase application
      9. Updating live data in charts with polling
        1. How to do it...
          1. PrimeFaces Cookbook Showcase application
      10. Interacting with charts through AJAX
        1. How to do it...
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
        3. See also
      11. Creating dynamic image streaming programmatically
        1. How to do it...
        2. How it works…
          1. PrimeFaces Cookbook Showcase application
      12. Mapping with Google Maps
        1. How to do it...
        2. How it works…
        3. There's more...
          1. Placing markers
          2. Drawing polylines
          3. Drawing polygons
          4. Drawing circles
          5. Handling events
          6. Placing the information window
          7. Controlling the map
          8. Enabling the street view
          9. PrimeFaces Cookbook Showcase application
        4. See also
    17. 10. Miscellaneous, Advanced Use Cases
      1. Introduction
      2. The power of the PrimeFaces selectors
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      3. Programmatic updating and scrolling with RequestContext
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      4. Two ways to trigger JavaScript execution
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      5. Adding AJAX callback parameters – validation within a dialog
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      6. Navigating to another page in AJAX calls
        1. How to do it...
        2. How it works...
      7. Polling – sending periodical AJAX requests
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      8. 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
      9. Remembering current menu selection
        1. How to do it...
        2. How it works...
        3. See also
          1. PrimeFaces Cookbook Showcase application
      10. Controlling form submission by DefaultCommand
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      11. Clever focus management in forms
        1. How to do it...
        2. How it works...
        3. There's more...
          1. PrimeFaces Cookbook Showcase application
      12. Layout pitfalls with menus and dialogs
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
        3. See also
      13. Targetable messages with severity levels
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
      14. Leveraging Schedule's lazy loading feature
        1. How to do it...
        2. How it works...
          1. PrimeFaces Cookbook Showcase application
    18. Index

Product information

  • Title: PrimeFaces Cookbook
  • Author(s): Oleg Varaksin, Mert Çalışkan
  • Release date: January 2013
  • Publisher(s): Packt Publishing
  • ISBN: 9781849519281