How Do I: Establish Interportlet Communications with WebLogic Workshop?

The easiest way to implement communication between portlets is by adding event handlers to your portlet by using the Portlet Event Handlers dialog box in WebLogic Workshop. These handlers will listen for events on any portlet in your application and react to those events as required. This tool allows you to visually add event handlers to your portal applications without the need to do any actual coding in your source files. This is the recommended way to implement interportlet communications with WebLogic Portal.

Note: You should avoid having multiple portlets fire incompatible actions when listening on the same event. For example, a poor portal design would be to have two portlets which are both instructed to maximize when a given event happens (or which both cause page change events).

For more information on interportlet communications and WebLogic Portal, please refer to the Interportlet Communications Guide.

To Implement Interportlet Communications by Using WebLogic Workshop:

Note: Before starting this procedure, ensure that WebLogic Workshop is running and you have a portlet displayed in the design view.

  1. In the Properties Editor, locate and highlight Event Handlers.

  1. Click the ellipsis (...) next to the data field.


    The Portlet Event Handlers dialog box appears.

  2. Click Add Handler...

    The Add Handler... context menu appears below the button.

  3. Click the type of event you want to handle.

    Event detail fields for the selected event appear in the right portion of the Portlet Event Handlers dialog box and the event type will be listed in the Events: list box and as the detail panel label.

  4. If desired, highlight and change the Event Label. This must be a unique identifier within this portlet.
  5. If desired, type a brief description of the event in Description.
  6. Select when to execute the event handler by checking:

    These conditions are optional; if you do not check either or both of them, the event handler will listen to events on all portlets in the application.

  7. If you did not select From Self Instance Only, specify the portlet to which this portlet should listen. You have two options:
  8. Open the Event drop-down menu and select the event that will trigger the handler.

    The event (or events) determine the action that a portlet takes when an event is handled. An event handler can have any number of fire event children.

    Only the Portal Event Handler will display existing events, as shown in the image above. These events are:

    This event...

    Fires an action when the portlet...

    onActivation

    Becomes visible.

    onDeactivation Ceases to be visible.
    onMinimize Is minimized
    onMaximize Is maximized
    onNormal Returns to its normal state from either a maximized or minimized state
    onDelete Is deleted from the portal.
    onHelp Is in the help mode
    onEdit Is in the edit mode
    onView Is in the view mode
    onRefresh Is refreshed

    For other event handlers, you need to enter a unique event identifier with which the portlets that this portlet intends to communicate can recognize.

  9. Click Add Action... to select the action that will occur when the selected event fires.

    The Add Action context menu appears below the button.



    Note: Depending upon the event type you selected, the list of available actions will be different.
  10. Select the action you want to fire.

    The Portlet Event Handlers dialog box reformats for selecting an action.



    Depending upon the action you added, the appearance of the Portlet Event Handlers dialog box will differ; for example:

    In this example, the selected action is Change Window State (note that the action name is added to the Events list and is used as the detail label).

  11. Open the New State drop-down menu and select the window state you want to use.

    Note: Depending upon the action you selected, this drop-down will have a different label and contents or might require that you enter the action name, in the case of a generic event, custom event, or Page Flow event.



    The selected state appears in the New State data field.
  12. Click OK.

The The Portlet Event Handlers dialog box closes and the event handler just added appears in the Properties Editor.

  1. To add more actions to this event, click the Event Handlers ellipsis (..) button to display the Portal Events Handlers dialog box and repeat steps 10 through 13.

Related Topics

Portal Key Concepts and Architecture

How Do I: Establish Interportlet Communication Programatically?

Developing Portal Applications