Show TOC

Background documentationDelegation Locate this document in the navigation structure

 

Instead of implementing a method within your portal component for a specific mode, you can specify another component to be called when your component is called in a specific mode.

This delegation is specified in the component's deployment descriptor:

Syntax Syntax

  1. <component name="mycomp">
        <component-config>
            <property name="ClassName" value="com.sap.MyComponent"></property>
            <property name="mode">
                <property name="edit">
                    <property name="delegate" value="myApp.editDelegate"></property>
                </property>    
                <property name="help">
                    <property name="delegate" value="myApp.helpDelegate"></property>
                </property>    
            </property>
        </component-config>
    </component>
End of the code.

When delegating for XXX mode, the doXxx() method is called on the delegate component. In the above example, doEdit() is called on DelegateComponent.default.

The subsequent request events are also sent to the delegate component until the mode is set to default.

From within the delegate component, you can obtain the context of the original component, as follows:

Syntax Syntax

  1. request.getComponentContext(NodeMode.DEFAULT_MODE);
End of the code.
Mode Delegation

You can create a component that serves as the delegate component for all components that are called in a specific mode.

To specify a delegate, add a registry entry with the name of the delegate component in a subcontext named for the mode, and place this subcontext under the /runtime/prt.modes subcontext.

The following example shows how to specify the myApp.adminDelegate component as the delegate for all components that are called in admin mode:

Syntax Syntax

  1. <registry>
  2.   <entry path="/runtime/prt.modes/admin" name="myApp.adminDelegate"
  3.     type="component" rebind="false"/>
  4. </registry>
End of the code.