Professional Documents
Culture Documents
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Objectives
Objectives
One of the goals in Web development is to design attractive and usable pages. This lesson
describes how to use complex layout components and styles to achieve a desired appearance.
Students also learn to use dynamic page layout techniques.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 2
Using ADF Faces Layout Components
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 3
Adding Spaces and Lines
<af:form>
<af:spacer width="10"/>
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 4
Stretching Components
Stretching Components
By default, the maximized attribute on af:document is set to true. Upon rendering
content, any outer margin, border, and padding are removed, and the body is stretched to fill the
entire browser window.
However, this does not mean that setting maximized to true is sufficient when you want
your page contents to fill a browser window. When the user resizes the browser window, the
af:document component does not reposition and resize its children components accordingly.
If you want a component to fill an area, such as the browser or a designated part of another
component, you must enable stretching for that component.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 5
Enabling Automatic Component Stretching
Table on page:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 6
Stretching a Table Column
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 7
Creating Resizable Panes
Panel Splitters
Horizontal af:panelSplitter Vertical
orientation: Nested: orientation:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 8
Printing Layout Panel Content
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 9
Creating Collapsible Panes
with the Panel Splitter Component
Attributes:
collapsed positionedFromEnd Behavior
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 10
Creating Collapsible Panes
with the Panel Accordion
Characteristics of panel
With default settings
accordion component:
• Does not automatically
stretch it children
• Panes cannot be resized at
run time, only expand or
<af:panelAccordion>
<af:showDetailItem text="This is a pane"/>
<af:showDetailItem text="This is another pane"/>
</af:panelAccordion>
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 11
Creating Collapsible Panes with the Panel Accordion Component (continued)
The discloseMany attribute governs how many panes can be visible at once:
• Set to true if you want users to be able to expand and see the contents of more than one
pane at the same time.
• By default, discloseMany is false. This means only one pane can be expanded at
any one time. For example, suppose there is one expanded pane A and one collapsed pane
B when the page first loads. If the user expands pane B, pane A will be collapsed, as only
one pane can be expanded at any time.
The discloseNone attribute governs whether users can collapse all panes.
• Set the discloseNone attribute to true to enable users to collapse all panes.
• By default, discloseNone is false. This means one pane must remain expanded at any
time.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 12
Panel Accordion Overflow
Automatic overflow
icons to display
content out of view
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 13
Setting Panel Accordion Properties
<af:showDetailItem <af:showDetailItem
text="Browse Products" text="Selected Product"
inlineStyle="width:100%; inlineStyle="width:100%;
height:100%;" flex=“1"> height:100%;" flex="2">
With discloseMany="true"
discloseNone="true"
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 14
Arranging Items in Columns or Grids
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 15
Arranging Items in Columns or Grids (continued)
• maxColumns: The maximum number of columns to display the children components.
The default is 3 (2 on PDAs). For nested panel form layout components, the inner
component’s maxColumns value is always 1.
The row-column split is based solely on the number of rendered children and not on their size. If
the number of rendered children does not fit in the number of rows and columns specified,
ADF Faces automatically increases the number of rows to accommodate the number of children.
To add content below the children input components, insert the desired component into the
footer facet of af:panelFormLayout. Facets accept only one child. If you have to insert
more than one footer child, use af:panelGroupLayout or af:group to wrap the
footer children.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 16
Creating Stacked Tabs
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 17
Hiding and Displaying Groups of Content
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 18
Hiding and Displaying Groups of Content (continued)
An org.apache.myfaces.trinidad.event.DiscloserEvent is raised when the user
clicks the toggle icon. You can perform special handling of this event by binding the
component’s disclosureListener attribute to a DisclosureListener method in a
backing bean. The DisclosureListener method must be a public method with a single
DisclosureEvent event object and a void return type, as shown in the following example:
public void some_disclosureListener(DisclosureEvent
disclosureEvent) {
// Add event handling code here
}
By default, DisclosureEvent events are usually delivered in the Invoke Application phase,
unless the component’s immediate attribute is set to true. When immediate is true, the
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 19
Arranging Items Horizontally or Vertically, with
Scrollbars
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 20
Arranging Items Horizontally or Vertically, with Scrollbars (continued)
To provide scrollbars when flowing the children components, wrap the children in the
af:panelGroupLayout component with its layout attribute set to scroll, and then
place the af:panelGroupLayout component inside the af:panelSplitter or
af:panelStretchLayout facet. The second example in the slide shows a panel splitter
that is stretched. It contains a panel group layout with its layout attribute set to scroll.
Although the child table is not stretched, it displays scrollbars to enable users to see all of its
content.
When layout is set to scroll on af:panelGroupLayout, ADF Faces automatically
provides a scrollbar at run time when the contents contained by the af:panelGroupLayout
component are larger than the af:panelGroupLayout itself. You do not have to write any
code to enable the scrollbars, or set any inline styles to control the overflow.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 21
Displaying Table Menus, Toolbars, and Status
Bars
Use panelCollection for table with menus and toolbars:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 22
Displaying Table Menus, Toolbars, and Status Bars (continued)
The example shown in the slide has the following source code:
<af:panelCollection binding="#{editor.component}">
<f:facet name="menus">
<af:menu text="Actions">
<af:commandMenuItem text="Add..." />
<af:commandMenuItem text="Create.." />
<af:commandMenuItem text="Update..." disabled="true"/>
<af:commandMenuItem text="Copy"/>
<af:commandMenuItem text="Delete"/>
<af:commandMenuItem text="Remove" accelerator="control A"/>
<af:commandMenuItem text="Preferences"/>
</af:menu>
</f:facet>
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 23
Creating Titled Sections and Subsections
Panel header
component with
sections and
subsections:
af:panelHeader
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 24
Grouping Semantically Related Components
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 28
Arranging Items Around a Central Area (continued)
• right: Renders children on the right of the center area between top and bottom facet
children. If the reading direction is left-to-right, right has precedence over end if both
right and end facets are used. If the reading direction is right-to-left, right also has
precedence over start if both right and start facets are used.
• innerTop: Renders children above the center area but below the top facet children
• innerBottom: Renders children below the center area but above the bottom facet
children
• innerLeft: Similar to left, but renders between innerTop and innerBottom,
and between left and the center area
• innerRight: Similar to right, but renders between innerTop and innerBottom,
and between right and the center area
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 29
Using ADF Faces Skins
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 30
Using Dynamic Page Layout
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 31
Using Expression Language to Conditionally
Display Components
• You can use EL for any of a component’s attributes.
• Example of setting attributes with EL:
<af:selectOneChoice
value="#{bindings.CardTypeCode.inputValue}"
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 32
Characteristics of Partial Page Rendering (PPR)
PPR:
• Is enabled by ADF Faces
• Enables redrawing only a portion of a page
• Requires server round-trip:
– Re-renders only a portion of the server-side component tree
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 33
Enabling PPR Declaratively
Triggering component:
(must have unique ID and
cause a Submit)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 34
Enabling PPR Declaratively (continued)
To enable a component to partially refresh another component:
1. On the trigger component:
- Set the id attribute to a unique value.
- If it is an input component in a form, set the autoSubmit attribute of the
component to true. Otherwise, set the partialSubmit attribute of the
component to true.
2. On the target component that you want to partially refresh when the trigger command
component is activated, set the partialTriggers attribute to the ID of the trigger
component. If the component refresh is to be triggered by more than one other component,
list their IDs separated by spaces. It is recommended that you use the partial trigger editor
for choosing the ID values. If the target component is inside a *container* component, the
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 35
Native PPR Example
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 36
Declarative PPR Example
<af:commandToolbarButton <af:commandToolbarButton
id="deleteToolbarButton" id="updateToolbarButton"
text="Delete“/> text="Update Shopping Cart"/>
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 37
Declarative PPR Example (continued)
<af:table value="#{bindings.ShoppingCartItem1.collectionModel}"
var="row" rows="#{bindings.ShoppingCartItem1.rangeSize}"
first="#{bindings.ShoppingCartItem1.rangeStart}"
emptyText="#{bindings.ShoppingCartItem1.viewable ? 'No rows yet.' :
'Access Denied.'}"
fetchSize="#{bindings.ShoppingCartItem1.rangeSize}“
selectedRowKeys=
"#{bindings.ShoppingCartItem1.collectionModel.selectedRow}"
selectionListener=
"#{bindings.ShoppingCartItem1.collectionModel.makeCurrent}"
rowSelection="single" id="table1" inlineStyle="width:100%"
contextMenuId="tablePopup"
partialTriggers="deleteToolbarButton menuDelete updateToolbarButton">
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 38
Enabling PPR Programmatically
Why?
• You need logic to determine if the component should
refresh.
• Refresh should occur on only one of several events that a
triggering component may fire (for example, on row
selection in table, use a selection listener).
• Purposes of PPR:
– Improve application performance
– Improve the user experience
• Guidelines for using PPR:
http://www.oracle.com/technology/tech/blaf/
specs/ppr.html
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 40
Summary
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle Fusion Middleware 11g: Build Java EE Applications B - 41
Oracle University and DBQuest, Inc. use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED