2.14 PropertyListener interface

 <  Day Day Up  >  

This interface is implemented for cooperative portlets using the programmatic approach. This interface may optionally be implemented by portlets. It is an alternate mechanism by which interested portlets may be notified of changed properties.

Other options are to be notified through portlet actions (the actionPerformed method of the ActionListener interface), or Struts actions. The PropertyListener interface may be implemented by portlets that only wish to update their current state based on property changes, rather than execute an action immediately. For more information and a sample scenario of a portlet using this interface, see Chapter 13, "Advanced cooperative portlets" on page 413.

Note: The PropertyListener interface requires that you implement the setProperties method to be notified of property changes.

setProperties

Invoked by the Property Broker to deliver new property values which were changed in the current event cycle of the current request. The Property Broker may be notified of such changes when a portlet invokes the changedProperties in the PropertyBrokerService interface (explicit notification), or when a portlet action which has declared output parameters is invoked (implicit notification).

This method is only invoked during the event phase. Since multiple explicit or implicit property change notifications may be made during an event cycle, one or more setProperties calls may be invoked on a single portlet instance during a single event cycle. The runtime may batch property values from multiple changedProperties calls in a single setProperties call. All properties are guaranteed to be delivered before the first endEventPhase call is delivered, which marks the start of the render phase.

Source cooperative portlets report property changes may be made by using the changedProperties method.

changedProperties method

This method publishes changes in properties and may be used during the portlet's event phase only. This includes the beginEventPhase method of the EventPhaseListener interface, the actionPerformed method of the ActionListener interface, and the setProperties method of the PropertyListener interface.

All properties must have been registered earlier, implicitly or explicitly. A simpler alternative to explicitly invoking this method is often applicable . For example, declare output parameters for registered actions (either programmatically or via an WSDL declaration). In this case, the action may bind the values of the output parameters on invocation, and at runtime the values will be transferred as if the changedProperties method had been explicitly invoked.

 <  Day Day Up  >  


IBM WebSphere Portal V5 A Guide for Portlet Application Development
IBM Websphere Portal V5: A Guide for Portlet Application Development
ISBN: 0738498513
EAN: 2147483647
Year: 2004
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net