Java Reference
In-Depth Information
• A value of
west
will render to the left of the page. The height of the section
will automatically cover all available vertical space. This value is used on the
Left
section on the NetBeans-generated markup.
• A value of
south
will result in the layout unit being rendered at the
bottom of the page. The width of the section will span through all available
horizontal space. This value is used to generate the
Footer
section on the
NetBeans-generated markup.
• A value of
center
will result in a layout that renders in the center of the
page. Both the width and the height of the section will expand to take all
available horizontal and vertical space, respectively.
• We can also use a value of
east
for the
position
attribute of
<p:layoutUnit>
(not used in the NetBeans-generated markup). This value
will generate a section rendered on the right side of the page, with its vertical
size expanding to take all available vertical space.
The
<p:layoutUnit>
component has a
size
attribute that we can use to set the
width (for a
position
attribute value of
east
or
west
) or height (for a
position
attribute value of
north
or
south
) of the layout unit. When using
center
as the
value of the
position
attribute, the value of the
size
attribute is ignored and the
layout unit expands to take all available vertical and horizontal space.
The
<p:layoutUnit>
component also has
resizable
,
closeable
, and
collapsible
attributes; setting these attributes to
true
allows us to resize, close, and collapse the
rendered section, respectively.
The NetBeans-generated PrimeFaces markup also employs the
<p:menu>
PrimeFaces
component. This component allows us to easily create menus to aid the users
navigate though our application.
We can use one or more nested
<p:submenu>
components inside
<p:menu>
. This tag
allows us to group related menu items together. The
<p:submenu>
component has
a
label
attribute we can use to label our menu items. In the NetBeans-generated
markup, a
<p:submenu>
component with a label of
Resources
is used. We can add
one or more
<p:menuitem>
tags inside
<p:submenu>
, one for each menu item. The
<p:submenu>
component has a
value
attribute, whose value will render as the text
of the menu item, and a
url
attribute that we can use to set the URL of the page the
menu will navigate to.
PrimeFaces has drop-in replacements for most standard JSF components, for
example, there is a PrimeFaces-specific
<p:inputText>
tag that is analogous to the
standard
<h:inputText>
tag. This fact makes porting standard JSF applications to
PrimeFaces very easy, mostly by replacing the
h:
prefix of standard JSF applications
with the PrimeFaces-specific
p:
prefix.