Book Image

Primefaces Cookbook Second Edition

Book Image

Primefaces Cookbook Second Edition

Overview of this book

Table of Contents (20 chapters)
PrimeFaces Cookbook Second Edition
Credits
Foreword
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Grouping of buttons and more with toolbar


A horizontal grouping component, toolbar can be used to group commands and other components. In this recipe, we will create a toolbar with two groups that bundle buttons and menu items.

How to do it…

A definition of a toolbar with multiple groups would be as follows:

<p:toolbar>
  <p:toolbarGroup align="left">
    <p:commandButton type="push" value="New" 
      icon="ui-icon-document" />
    <p:commandButton type="push" value="Open" 
      icon="ui-icon-folder-open"/>
    <p:separator />
    <p:commandButton type="push" title="Save" 
      icon="ui-icon-disk"/>
    <p:commandButton type="push" title="Delete" 
      icon="ui-icon-trash"/>
    <p:commandButton type="push" title="Print" 
      icon="ui-icon-print"/>
  </p:toolbarGroup>
    <p:toolbarGroup align="right">
      <p:menuButton value="Navigate">
        <p:menuitem value="Home" url="#" />
        <p:menuitem value="Logout...