To perform the tasks in this chapter, you must be a portal manager or a portal member with the portal-level permission
Basic Services: Edit Page Access, Structure, and Content (standard permissions) or
Pages: Edit Pages (advanced permissions).
For more information about permissions, see About Roles and Permissions for a Portal.
In this chapter, component refers collectively to ADF components (such as buttons), web development components (such as hyperlinks), task flows, and portlets.
Often a page needs information from a component on the page, or a region needs information from another region. While you can pass parameters through the page URL to obtain that information, doing so makes sense only when the parameters are well-known and the inputs are accessible to the page through Expression Language (EL). For more information, see Passing Parameter Values Through the Page URL.
Consider the case where you have a task flow with multiple page fragments that contain various interesting values that could be used as input on a page. For example, consider a page devoted to the display of information specific to the company that a user specifies in an input form. If you were to use parameters to pass the value, the task flow must surface output parameters for the union of each of the interesting values on each and every fragment. This is where component wiring becomes useful. Instead, for each fragment that contains the needed information, you can use component wiring to define a contextual event that is raised when the input is submitted. The page or fragment that requires the information can then subscribe to the various events and receive the information through the event.
Component wiring is useful for synchronizing the content of a page with its components, or the content of one component to another. For example, you can wire a Parameter Form portlet so that the event of clicking its OK button triggers the passing of its user-entered values to another component on the page. One way to apply this model is to pass a user-entered name to a task flow or portlet that displays details relevant to that name. This is known as contextual event wiring (events within the current context trigger the action of the event handler).
To clarify what happens when an event occurs, it helps to think of one component as the producer and the other component as the consumer. The producer component provides the data (referred to as the payload) that the consumer component consumes. For example, a form portlet is typically a producer. Its payload is the data that users enter into the form. An event defined on the producer triggers the passing of the producer's payload to the consumer. Consumer components use the payload in various ways. For example, as a display string, a master in a master-detail relationship, and so on. How a consumer component uses the payload is specified in an event handler that was defined when the consumer component was created.
the Content Manager task flow is a consumer
the Data Visualization task flow is both a consumer and producer when properly configured to a REST URL
The page editor provides tools for wiring pages and components through the page Parameters tab and component Parameters dialogs. You can wire pages and components together in the following ways:
Wire events in a producer task flow or portlet to parameters in a consumer task flow (see Wiring Events to Component Parameters).
Pass values from a page parameter to a component on that page (see Wiring Components and Page Parameters).
Pass values to page components by specifying parameter values in the page's URL (see Passing Parameter Values Through the Page URL).
An event defined on a producer component has associated payload values that can be used to set the parameter values in consumer task flow or portlet components. As soon as the event is triggered, the associated parameter values are dynamically passed to the consumer task flow or portlet and can be exposed as needed.
As described in About Page and Component Wiring, application developers define component events and event handlers.
To wire an event (in a producer component) to a parameter in a consumer task flow or portlet:
Navigate to the page containing the producer component(s), and open it in the page editor (see Opening a Page in the Page Editor). Figure 14-1 illustrates a Data Visualization task flow producer component (list) and consumer component (pie chart) in the sample AviIntranet portal.
Figure 14-1 Producer and Consumer Components
If the consumer task flow or portlet is not already on the page, add it (see Adding Components to a Page).
Figure 14-2 View Actions Menu on a Consumer Task Flow
In the Parameters dialog, the settings you see are available only when there is a producer and consumer task flow on the page. For each parameter defined for the consumer task flow or portlet that you want to wire to an event:
Click the Value field icon and select Event.
Click the Event list, and select the event that is associated with the payload value that you want to pass to the parameter. The Event list shows all of the events that are defined for all components on the page.
To specify that the consumer task flow or portlet "listens" for the event from only one producer component, click the from list and select the associated producer component. Otherwise, leave from with the default value of
Any Component to allow the parameter to be set when any producer component on the page triggers the specified event.
Click the payload list, and select an event payload value. This selection becomes the input value for the associated parameter, passed dynamically when the event triggers.
For example, the event of selecting a row in a Data Visualization task flow (producer) triggers a
DPRowSelection event that updates a consumer task flow. In this case, the consumer task flow is a pie chart, which refreshes with data associated with the selected row (Figure 14-3).
Figure 14-3 Parameters Dialog for a Consumer Task Flow
Click OK and then Save.
Test your wiring by triggering the event and observing the results in the consumer task flow or portlet.
This section describes how to create and consume page parameters in the following subsections:
Page parameters and page variables enable communication between components and the pages that contain them.
For example, imagine a page that contains stock ticker and stock news components. You want the ticker and the news components to both consume the same parameter value so that they both show information for the same company. Page parameters and page variables are part of a simple mechanism for setting this up.
Page parameters provide a means of storing values for passing to page components that have been configured to consume them. Create page parameters through the page editor at application runtime.
Page variables contain output values that are produced by portlets. Page variables are created at application design time.
Use the Parameters tab in the page editor to create page parameters.
To create a new page parameter, refer to Adding or Modifying Page Parameters.
You can configure a task flow component to consume page parameters.
Before you can take the steps outlined in this section, you must create a page parameter and provide it with a value. For more information, see Creating Page Parameters.
To consume a page parameter (wiring a task flow to a page parameter):
Figure 14-4 The Expression Editor
The task flow is refreshed, now displaying the result of the value passed through the page parameter.
You can provide Expression Language (EL) expressions in place of other types of values to component parameters. This option can provide a much more dynamic response. For example, the page could set a page parameter based on a component on the page. In this case, you would want the other components on the page to be refreshed whenever this value changed. You can take this capability one step further by passing parameter values with your page URLs.
This section provides one scenario, which you can use as a model for other parameter passing situations.
To pass parameter values through a page URL:
value represents the value you want to pass, for example,