Advanced programmatic APIs

 

+

Search Tips   |   Advanced Search

 

Some functionality can be achieved programmatically for JSR compliant and IBM portlets. This functionality is implemented using the methods listed in this topic.

 

JSR compliant and IBM portlets

Actions which are registered are active by default as soon as the portlet is initialized and is active. Actions may be explicitly specified to be inactive when the portlet is initialized. Such actions may be selectively activated in individual sessions by invoking the activateActions() method on the PropertyBrokerService interface. The corresponding deactivateActions() call may be made to deactivate actions activated earlier for the session. Only target actions which are active for the current session are invoked to receive property values published by source portlets or passed via user triggers. Actions which are active may be deactivated in the current session by issuing the corresponding deactivateActions() method call on the PropertyBrokerService interface. Deactivated actions are not invoked by the property broker and do not appear in Click-to-Action menus.

Only the names and functions of the following methods are the same for both JSR compliant and IBM portlets. We cannot use a JSR compliant method on an IBM portlet, and we cannot use an IBM method on a JSR compliant portlet. These methods are grouped together only for documentation purposes.

  • Activation/Deactivation of Actions

    • Use activateAction() to explicitly activate an action that has been deactivated. This activates the action for the current session.

    • Use deactivateAction() to explicitly deactivate an action that is active. This deactivates the action for the current session. If actions are inactive, they will not be invoked as a result of wires being activated in the current session.

    Actions may be deactivated if the portlet needs to get into a certain state before activating the actions. In some cases, it may be appropriate to make the default behavior for certain actions to be inactive, so that they may be programmatically activated by the portlet when it reaches a certain state. This may be achieved by using the value "false" on the isActiveOnStartup attribute on the action element in the WSDL description, or by setting the corresponding property on the Action object if programmatic registration is used.

  • Wires

    Use these methods on the source portlet, not the target portlet.

    • Use areWiresActive() to determine if a property is currently wired to active actions.

    • Use areCrossPageWiresActive() to determine if a property is currently wired to active actions across pages. Cross-page wires allow portlets to exchange properties across pages. For more information on cross-page wires, see Using the Portlet Wiring Tool.

    • Use isWired() to determine if a property is wired.

    • Use isWiredAcrossPages() to determine if a property is wired across pages.

    • These methods will not create wires. In order to create a wire for either a JSR compliant portlet or an IBM portlet, use the Portlet Wiring tool.

    • For IBM portlets using Click-to-Action, a wire can also be created within the portlet by holding either ALT or CTRL while clicking on the Click-to-Action icon. The key you hold down depends on what browser you are using, However, the information from these methods may be used by the portlet that owns the property to surface additional visual elements, such as links, in its markup. This can in turn be used by end users to trigger wired actions. For information on configuring a wire see Wiring portlets section in Wiring cooperative portlets

    • We cannot wire a JSR compliant portlet to an IBM portlet.

    .

 

Click-to-Action portlets

For Click-to-Action, Java APIs can be used instead of JSP tags. Use Java APIs for advanced scenarios like transmitting a property value as an object rather than a string. With Java APIs a menu can be bound to any arbitrary clickable element in the markup. For more information, refer to the getActionTriggerMarkup or generateActionTriggerControl methods in the PropertyBrokerService interface. If the Java API callgetActionTriggerMarkup or generateActionTriggerControl is used instead of the tag, the property passed to the call must be a registered output property.

See the Destination Guide example in Included cooperative portlet samplesfor more information.

 

Related information