Skip navigation.

Establishing Interportlet Communications

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

Overview of Interportlet Communications

Interportlet communications (IPC)—also called portlet-to-portlet communications—refers to how an event in one portlet controls some aspect of behavior in another portlet. Some examples of interportlet communications are:

Service Pack 4 of BEA WebLogic Portal 8.1 introduced a relatively simple tool for implementing interportlet communications. This tool—a dialog box in WebLogic Workshop—allows you to easily add event handlers to a portlet and then add actions for those handlers to fire when they detect the event on another portlet.

This document described how to establish IPC by implementing event handlers. It contains these subjects:

 


The WebLogic Portal IPC Model

Earlier versions of WebLogic Portal allowed you to establish interportlet communications by using such techniques are adding listenTo() methods or backing files on page flow portlets. WebLogic Portal 8.1 with Service Pack 4 introduced a new IPC model based upon event handlers, Java objects that listen for predefined events on other portlets in the portal and fire actions when that event occurs.

Event Handlers

Event handlers "listen" for events raised on subscribed portlets and fire an action when a specific event is detected. Event handlers can listen and react to the following types of events:

Portal Event Actions

Event actions depend upon the type of event being raised. Except for portal events, all other events can be identified in the Events field on the Event Handler tool. Events available with the portal event handler are listed in Table 1-1.


 

Table 1-1 Events Available to a Portal Event Handler

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

Enters the help mode

onEdit

Enters the edit mode

onView

Enters the view mode

onRefresh

Is refreshed


 

Custom Events

A custom event is an event that you define; in other words, it is not an event provided out-of-the-box with WebLogic Portal 8.1. A custom event can pass a developer-defined payload or fire any other predefined action. Custom events can be fired declaratively or based on a methods called in a backing file. A user will be able to specify that an event should be handled by a method in a backing file.

 


Event Actions

The event handlers fire an action on the listening portlets when that handler detects an event from another portlet in the application; for example, when the user minimizes the appropriate portlet a portal event called onMinimize might cause the handler listening for it to fire an action that invokes a backing file attached to it.

Table 1-2 lists the event actions available.


 

Table 1-2 Event Actions

This action...

Does this...

Change Window Mode

Changes the mode from its current mode to a user-specified mode; for example, from help mode to edit mode.

Change Window State

Changes the state from its current state to a user-specified state; for example, from maximized to delete state.

Activate Page

Opens a user-specified page.

Fire Generic Event

Fires a user-specified generic event.

Fire Custom Event

Fires a user-defined custom event. This event needs to be included in the portlet file.

Invoke BackingFile Method

Runs a method in the backing file attached to the portlet. Backing files allow you to programatically add functionality to a portlet to enable preprocessing (for example, authentication) prior to rendering the portal controls. For more information, please refer to Chapter 5, Understanding Backing Files.


 

 


How IPC is Implemented

The IPC Tool included in WebLogic Workshop makes implementing event handlers relatively easy. To launch the tool, do the following:

  1. Open a portlet in WebLogic Workshop.
  2. In the Property Editor for that portlet, click the ellipses button (...) next to Event Handlers (if no event handlers have been added, the Event handler field will show that. If any event handlers have been added, the field will indicate the number added).
  3. The tool will appear, as shown in Figure 1-1.

    Figure 1-1 Event Handler Tool

    Event Handler Tool


     
  4. Click Add Handler to open the event handler drop-down menu and select a handler.
  5. The dialog box will expand, opening up additional fields you can use to set up the handler (Figure 1-2).

    Figure 1-2 Expanded Event Handler Tool

    Expanded Event Handler Tool


     

The entire process of setting up an event handler can all be handled by using this tool. What you need to do is:

  1. Select an event handler.
  2. Determine the portlet(s) to which that handler will listen.
  3. Select an event that the handler will listen for.
  4. Select and configure an action to fire when the event occurs.
  5. Save the event handler

For specific details on using the event handler tool, please refer to How Do I: Establish Interportlet Communications with WebLogic Workshop? in the WebLogic Workshop online help.

 

Skip navigation bar  Back to Top Previous Next