Oracle® Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) Part Number B31973-03 |
|
|
View PDF |
This chapter describes how to use an ADF hierarchy viewer component to display data, and the options for hierarchy view customization.
This chapter includes the following sections:
Section 29.5, "Adding Interactivity to a Hierarchy Viewer Component"
Section 29.7, "Customizing the Appearance of a Hierarchy Viewer"
For information about the data binding of ADF hierarchy viewers, see the "Creating Databound Hierarchy Viewers" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
A hierarchy viewer component can be used to visually display hierarchical data. Hierarchical data contains master-detail relationships within the data. For example, you could create a hierarchy viewer component that renders an organization chart from a data collection that contains information about the relationships between employees in an organization.
JDeveloper generates the following elements in JSF pages when you drag and drop components from the Component Gallery onto a JSF page or when you use the Create Hierarchy Viewer dialog to create a hierarchy viewer component as described in the "Creating Databound Hierarchy Viewers" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
dvt:hierarchyViewer
This element wraps the dvt:node
and the dvt:link
elements.
dvt:node
A node is a shape that references the data in a hierarchy (for example, employees in an organization or computers in a network). You configure the child elements of the dvt:node
element to reference whatever data you want to display. The dvt:node
element supports the use of one or more f:facet
elements that display content at different zoom levels (100%, 75%, 50%, and 25%). The f:facet
element supports the use of many ADF Faces components, such as af:outputText
, af:image
, and af:panelGroupLayout
in addition to the ADF Data Visualization dvt:panelCard
component.
At runtime, the node contains controls that allow users to navigate between nodes and to show or hide other nodes by default. For information about specifying node content and defining zoom levels, see Section 29.4.1, "How to Specify Node Content".
dvt:link
You set values for the attributes of the dvt:link
element to connect one node with another node.
dvt:panelCard
The f:facet
element supports the use of a dvt:panelCard
element. A dvt:panelCard
element in turn can contain one or more af:showDetailItem
elements that you can use to define multiple sets of content. At runtime, the end user uses the controls on the node to dynamically switch between the content that the af:showDetailItem
elements reference. For more information, see Section 29.6, "Using Panel Cards".
Note:
Unlike the other elements, thedvt:panelCard
element is not generated if you choose the default quick layout option when using the Create Hierarchy Viewer dialog.Figure 29-1 shows a segment of a hierarchy viewer component at runtime that includes a control panel, a number of nodes, and links that connect the nodes.
The Control Panel provides controls so that a user can manipulate the position and appearance of a hierarchy viewer component at runtime. By default, it appears in a hidden state in the upper left-hand corner of the hierarchy viewer component as illustrated by Figure 29-2.
You cannot configure the Control Panel to appear in another location. Users click the Hide or Show Control Panel button shown in Figure 29-2 to hide or expand the Control Panel. Figure 29-3 shows the expanded Control Panel.
You can configure the hierarchy viewer component so that the Control Panel does not appear to the user at runtime. For more information, see Section 29.7.3, "How to Configure the Display of the Control Panel".
Table 29-1 describes the functionality that the controls in the Control Panel provide to users. The Panel Selector is automatically enabled if a node in your hierarchy viewer component contains a dvt:panelCard
element with one or more af:showDetailItem
elements. The Layout Selector appears automatically if the hierarchy viewer component uses one of the following layouts:
Vertical Top Down
Horizontal Left to Right
Tree
For more information about layouts for a hierarchy viewer component, see Section 29.1.3, "Available Hierarchy Viewer Layout Options".
Table 29-1 Elements in the Control Panel
Control | Name | Description |
---|---|---|
![]() |
Pan control |
Allows user to reposition the hierarchy viewer component within the viewport. |
![]() |
Zoom to Fit |
Allows user to zoom a hierarchy viewer component so that all nodes are visible within the viewport. |
![]() |
Zoom Control |
Allows user to zoom the hierarchy viewer component. |
![]() |
Hide or Show |
Hides or shows the Control Panel. |
![]() |
Panel Selector |
Displays a list of node panels that you have defined. Users can use the panel selector to show the same panel on all nodes at once. |
![]() |
Layout Selector |
Allows a choice of layouts. Users can change the layout of the hierarchy viewer component from the layout you defined to one of the layout options presented by the hierarchy viewer component. For more information, see Section 29.1.3, "Available Hierarchy Viewer Layout Options". |
A hierarchy viewer component requires data collections where a master-detail relationship exists between one or more detail collections and a master detail collection. The hierarchy viewer component uses the same data model as the ADF Faces tree
component. You can test if it is possible to bind a data collection to a hierarchy viewer component by first binding it to an ADF Faces tree
component. If you can navigate the data collection using the ADF Faces tree
component, it should be possible to bind it to a hierarchy viewer component.
When you add a hierarchy viewer component to a JSF page, JDeveloper adds a tree binding to the page definition file for the JSF page. For information about how to populate nodes in a tree binding with data, see the "Using Trees to Display Master-Detail Objects" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
The data collections that you bind to nodes in a hierarchy viewer component must contain a recursive accessor if you want users to be able to navigate downward from the root node of the hierarchy viewer component. For more information about navigating a hierarchy viewer component, see Section 29.3, "Navigating in a Hierarchy Viewer".
By default, a hierarchy viewer component has downward navigation configured for root and inner nodes. You can configure the hierarchy viewer component to enable upward navigation and to determine the number of nodes to appear when a user navigates between nodes on the same level.
For more information about node types, see Section 29.4, "Managing Nodes in a Hierarchy Viewer".
If you want to configure upward navigation for a hierarchy view component, you configure a value for the hierarchy viewer component's navigateUpListener
property.
To configure upward navigation for a hierarchy viewer component:
In the Structure window, select dvt:hierarchyViewer and open the Property Inspector.
Expand the Behavior section of the Property Inspector and write a value for the hierarchy viewer component's Navigate Up property (navigateUpListener
) that specifies a method to update the data model so that it references the new anchor node when the user navigates up to a new anchor node.
Click OK.
Same-level navigation between the nodes in a hierarchy viewer component is enabled by default. You can configure the hierarchy viewer component to determine how many nodes to display at a time. When you do this, controls appear that enable users to navigate to the following:
Left or right to view the next set of nodes
First or last set of nodes in the collection of available nodes
To configure same-level navigation in a hierarchy viewer component:
In the Structure window, right-click the dvt:hierarchyViewer node and select Go to Properties.
Expand the Common section of the Property Inspector and specify the number of nodes that you want to appear at runtime in the Nodes Per Level field (levelFetchSize
).
For example, the following entry appears in the JSF page if you entered 3
as the number of nodes:
levelFetchSize="3"
Click OK.
At runtime, the hierarchy viewer component renders the number of nodes that you specified as a value for the hierarchy viewer component's levelFetchSize
property. It also renders controls that allow users to do the following:
Navigate to the left or right to view the next set of nodes
Navigate to the first or last set of nodes in the collection of available nodes
Figure 29-4 shows a runtime example where levelFetchSize="3"
. When a user moves the mouse over the control, as shown in the circled area in Figure 29-4, the control that allows users to navigate to the last set of nodes appears.
A node is a shape that represents the individual elements in a hierarchy viewer component at runtime. Examples of individual elements in a hierarchy viewer component include an employee in an organization chart or a computer in a network diagram. By default, each node in a hierarchy viewer component includes controls that allows users to do the following:
Navigate to other nodes in a hierarchy viewer component
The top of each node contains a single button (either Restore or Isolate). One exception is the node at the very top of the hierarchy viewer component, because this node has no parent nodes and may not be isolated.
Show or hide child nodes of the currently selected node in a hierarchy viewer component
The Show or Hide button appears on the bottom of every node that is a not a leaf node.
Figure 29-5 shows an example of a node with controls that allow an end user to navigate to another node or hide child nodes of the active node. For information about how to configure the controls on a node, see Section 29.4.2, "How to Configure the Controls on a Node".
There are four basic types of nodes:
Root nodes are the uppermost visible nodes in a hierarchy viewer component. A root node is always the root of the hierarchy returned from the tree component. Typically, only one root node is visible at a time. However, there could be more than one root node depending on the use case that you implement (for example, in a family tree).
An anchor node is the node that has focus whenever the hierarchy viewer component is rendered. There is always just one anchor node visible.
The anchor node may be the same as the root node if child nodes are defined for the tree node and the value of the hierarchy viewer component's displayLevelsAncestor
property is greater than 0
. If a user double-clicks another node at runtime that has a value specified for its setAnchorListener
property, that node becomes the anchor node. An anchor node may also be an inner or leaf node, depending on whether or not it has child nodes. For information about how to specify an anchor node, see Section 29.4.5, "Specifying Ancestor Levels for an Anchor Node".
You can specify one or more ancestor levels above the anchor node. For more information, see Section 29.4.5, "Specifying Ancestor Levels for an Anchor Node".
Figure 29-6 illustrates how a node can be a different type depending on the layout of the hierarchy viewer component.
Although a node contains controls by default that allow you to navigate to a node and show or hide nodes, nodes do not include content by default unless you used a quick start layout when creating the hierarchy viewer component. You must define what content a node renders at runtime. You can specify node content when you associate data bindings with the hierarchy viewer component as described in the "Creating Databound Hierarchy Viewers" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework. After you create a hierarchy viewer component by associating data bindings, you can add nodes to the hierarchy viewer component using the Component Palette.
By default, a hierarchy viewer component that you create contains one node with one facet element that has a zoom level of 100%:
<f:facet name="zoom100"/>
You can insert three more instances of the facet element into the hierarchy viewer component with the following zoom levels:
25%: zoom25
50%: zoom50
75%: zoom75
You can define a subset of the available data collection within one or more of the facet elements. For example, if you have a data collection with node attributes that references data about a company department such as its name or its number and location, you could specify a facet element with a zoom level of 50% that references the node attribute for the department's name.
Each of the facet elements that you insert can be used to reference other components. You can use one or more of the following components when you define content for a node in a hierarchy viewer component:
af:commandButton
af:commandImageLink
af:commandLink
af:commandMenuItem
af:goButton
af:goLink
af:image
For information about how to use the af:image
component, see Section 29.7.2, "How to Include Images in a Hierarchy Viewer".
af:menu
af:outputFormatted
af:outputText
af:panelFormLayout
af:panelGroupLayout
For information about how to use the panelGroupLayout
component, see Section 8.12.1, "How to Use the panelGroupLayout Component".
af:panelLabelAndMessage
af:separator
af:showDetailItem
af:showPopupBehavior
For information about how to use the af:showPopupBehavior
component, see Section 29.5.1, "Configure a Hierarchy Viewer to Invoke a Popup Window".
af:spacer
dvt:panelCard
For more information about how to use the dvt:panelCard
component, see Section 29.6, "Using Panel Cards".
The hierarchy viewer component renders in a Flash Player only. For this reason, certain properties of ADF Faces components that you specify as node content may not be supported and the component will not render as you expect.
To add a node to a hierarchy viewer component:
In the Structure window, right-click the dvt:hierarchyViewer node and select Insert inside dvt:hierarchyViewer > Node.
The following entry appears in the JSF page:
<dvt:node> <f:facet name="zoom100"/> </dvt:node>
In the Structure window, right-click the dvt:node and select Go to Properties.
Configure the appropriate properties in the Property Inspector.
For example, write a value for the type
property to specify a specific accessor for the node.
The node component (dvt:node
) exposes a number of properties that allow you to determine if controls such as Restore, Isolate, Show or Hide appear at runtime. It also exposes properties that determine the size and shape of the node at runtime.
To configure the controls on a node:
In the Structure window, select the dvt:node
component that you want to configure.
Configure properties in the Appearance section of the Property Inspector for the dvt:node
component as described in the following table.
To... | Set the following value for this property... |
---|---|
Configure so that the Hide or Show controls appear on a node. | Set showExpandChildren to True (default) to display the controls. |
Configure so that the Restore or Isolate controls appear on the node. | Set the showNavigateUp and showIsolate properties to True (default) to enable these controls on the node.
If you set the |
Configure the height and width of a node. | Set values for the width and height properties. |
Select the shape of the node. | Select a value from the Shape dropdown list. Available values are:
|
For information about configuring the properties in the Style section of the Property Inspector for the node component, see Section 20.4, "Changing the Style Properties of a Component".
By default, you associate a node component with an accessor when you use the Create Hierarchy Viewer dialog to create a hierarchy viewer component as described in the "Creating Databound Hierarchy Viewers" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework. The Create Hierarchy Viewer dialog sets the node component's type
property to a specific accessor.
You can configure a node component's type
property to use one or more specified accessors. Alternatively, you can configure a node component's rendered
property to use a node definition across accessors, as described in Section 29.4.4, "Associating a Node Definition with a Particular Set of Data Rows". When the hierarchy viewer component determines which node definition to use for a particular data row, it first checks for a match on the type
property:
If the type
property matches, the hierarchy viewer component uses the node definition.
If the type
property does not match, the hierarchy viewer component checks for a value of the rendered
property that evaluates to true
. The result of evaluating the rendered
property does not affect the type
property.
You can use a node component's rendered
property to associate the node with a particular set of data rows or a single data row. The rendered
property accepts a boolean value so you can write an EL expression that evaluates to true
or false
to determine what data rows you associate with a node definition. For example, assume that you want a node to display data based on job title. You write an EL expression for the node component's rendered
property similar to the following pseudo EL expression that evaluates to true
when job title matches the value you specify (in this example, CEO
):
#{node.title == 'CEO'}
When you use the node component's rendered
property in this way, you do not define a value for the node component's type
property.
The anchor node of a hierarchy viewer component is the root of the hierarchy returned by the tree binding. Depending on the use case, there can be multiple anchor nodes (for example, a hierarchy viewer component that renders an organization chart with one or more managers). When a hierarchy viewer component renders at runtime, the node that has focus is the anchor node. If a user clicks another node that has a value specified for its setActionListener
property, that node becomes the anchor node:
You can specify the number of ancestor levels for an anchor node.
To specify the number of ancestor levels for an anchor node:
In the Structure window, right-click the dvt:hierarchyViewer node and select Go to Properties.
Expand the Common section of the Property Inspector.
Specify the number of levels of ancestor nodes that you want to appear at runtime above the anchor node in the Ancestor Levels field (displayLevelsAncestor
).
For example, the following entry appears in the JSF page if you entered 2
as the number of ancestor levels for the anchor node.
displayLevelsAncestor="2"
Save changes to the JSF page.
You can configure a hierarchy viewer component to invoke popup windows and display menus with functionality and data from other pages in your Oracle Fusion web application.
You can invoke a popup window by specifying values for the af:showPopupBehavior
tag and invoking it from a command component (for example, af:commandButton
). You must nest the command component that invokes the popup window inside an f:facet
element in a node of the hierarchy viewer component. Note that the triggerType
property of an af:showPopupBehavior
tag used in this scenario supports only the following values:
action
mouseHover
For more information about using the af:showPopupBehavior
tag, see Section 13.3, "Using Command Components to Show Popup Elements".
You can configure a node component (dvt:node
) within a hierarchy viewer to invoke a menu by using the af:menu
component. You can configure one or more af:commandMenuItem
elements for the af:menu
component. Nodes within a hierarchy viewer component do not support the nesting of af:menu
components.
For more information about using the af:menu
component, see Chapter 13, "Using Popup Dialogs, Menus, and Windows".
You can use the panel card component in conjunction with the hierarchy viewer component to hold different sets of information for the nodes that the hierarchy viewer component references. The panel card component is a region inside the node element that can include one or more af:showDetailItem
elements.
Each of the af:showDetailItem
elements references a set of content. For example, a hierarchy viewer component that renders an organization chart would include a node for employees in the organization. This node could include a panel card component that references contact information using an af:showDetailItem
element and another af:showDetailItem
element that references salary information.
A panel card component displays the content referenced by one af:showDetailItem
element at runtime. The panel card component renders navigation buttons and other controls that allow the user to switch between the sets of data referenced by af:showDetailItem
elements. The controls that allow users to switch between different sets of data can be configured with optional transitional effects. For example, you can configure a panel card to horizontally slide between one set of data referenced by an af:showDetailItem
element to another set of data referenced by another af:showDetailItem
element.
You can insert a panel card component into the JSF page that renders the hierarchy viewer component by using the context menu that appears when you select the Facet zoom element in the Structure window for the JSF page.
To create a panel card:
In the Structure window, right-click the zoom level within the node where you want to create a panel card.
For example, select f:facet - zoom100.
Select Insert inside f:facet -zoom100 > Panel Card.
Use the Property Inspector to configure the properties of the panel card component.
For example, set a value for the Effect property in the Advanced properties for the panel card component. Valid values are:
Horizontal Slide (default)
Panel Flip
Node Flip
No Animation
In the Structure window, right-click dvt:panelCard and select Insert inside dvt:panelCard > Show Detail Item.
Repeat Step 4 as necessary.
Use the Property Inspector to configure the properties of the af:showDetailItem
elements that you insert.
At runtime, a node appears and displays one panel card component. Users can click the navigation buttons to navigate to the next set of content referenced by one of the panel card's af:showDetailItem
child elements.
Figure 29-7 shows a node with a panel card component where two different af:showDetailItem
child elements reference different sets of information (Contact and Address). The user can use the provided controls to navigate between the different sets of information.
You can customize the hierarchy viewer component size and appearance.
You can change the appearance of your hierarchy viewer component by changing skins and component style attributes as described in Chapter 20, "Customizing the Appearance Using Styles and Skins".
You can adjust the size of the hierarchy viewer component by setting values for a number of the hierarchy viewer component's attributes using the Property Inspector.
To adjust the size of a hierarchy viewer:
In the Structure window for the JSF page that contains the hierarchy viewer component, select the dvt:hierarchyViewer node.
In the Property Inspector, write values for the InlineStyle
property as described in the following list:
width
Write a value in percent (%) or pixels (px). For example, the default value for width is 100%.
height
Write a value in percent (%) or pixels (px). For example, the default value for height is 600px.
The final value that you enter for the InlineStyle
property must use the syntax shown in the following example:
width:100%;height:600px;
Save changes to the JSF page.
You can configure a hierarchy viewer component to display images in the nodes of a hierarchy viewer component at runtime. This can be useful where, for example, you want pictures to appear in an organization chart. Wrap the af:panelGroupLayout
component within an af:facet
component that is referenced by a dvt:node
component. The following code example shows an af:panelGroupLayout
component that references an instance of the af:image
component from within an af:facet
component. The af:image
component renders an image for the person referenced by node.PersonId
.
<af:panelGroupLayout> <af:image source="/render_image?person_id=#{node.PersonId}" inlineStyle="width:64px;height:90px;"/> </af:panelGroupLayout>
For more information about the af:panelGroupLayout
component, see Section 8.12.1, "How to Use the panelGroupLayout Component".
You can configure the hierarchy viewer component so that the Control Panel described in Section 29.1.2, "Hierarchy Viewer Elements and Terminology" acts as follows when the hierarchy viewer component renders at runtime:
Appears in an expanded or show state
Appears in a collapsed or hidden state
Does not appear to users
To configure the display of the Control Panel:
In the Structure window, right-click the dvt:hierarchyViewer node and select Go to Properties.
Expand the Appearance section and select one of the following values from the ControlPanelBehavior dropdown list:
hidden
Select this value if you do not want the Control Panel to appear at runtime.
initCollapsed
This is the default value. The Control Panel appears in a collapsed or hidden state at runtime.
initExpanded
Select this value if you want the Control Panel to appear in an expanded or show state at runtime.
Save changes to the JSF page.