Show TOC

Runtime View Component InterfacesLocate this document in the navigation structure

With the component interfaces described below, you can access and configure different components in your custom runtime views. You can also configure the events they raise at runtime.

To be able to work with runtime content, you have to instantiate the runtime content manager first.

Instantiating RTContentManager
importcom.sap.caf.eu.gp.rtcontent.api.GPRTContentFactory;
importcom.sap.caf.eu.gp.rtcontent.api.IGPRTContentManager;
 
// instantiate the content manager
IGPRTContentManagerrtContentManager = GPRTContentFactory.getContentManager();
 

Content Component ( IGPRTContentComponent )

You use this interface to access the instances of content components attached to your custom runtime views. A content component instance is automatically created by the GP framework whenever you select a view switch from the contextual panel, or fire a contextual panel event to which a start component is assigned. The content component is bound to the corresponding Web Dynpro content component using the setContentComponent() method.

For more information, see Interface Methods for Component Initialization .

Consequently, you can use the instance in your implementation to retrieve the current process instance, phase and activity, as well as the contextual panel event that called the content component.

Example
Retrieving Instance, Phase and Activity
importcom.sap.caf.eu.gp.process.api.IGPProcessInstance;
importcom.sap.caf.eu.gp.process.api.IGPActivityInstance;
importcom.sap.caf.eu.gp.process.api.IGPBlockInstance;
importcom.sap.caf.eu.gp.rtcontent.api.IGRTContentComponent;
 
// retrieve current instance, phase and activity
IGPProcessInstanceinstance= contentComponent.getProcessInstance();
IGPBlockInstancecurrentPhase= contentComponent.getCurrentPhase();
IGPActivityInstancecurrentActivity= contentComponent.getCurrentActivity();
// get the contextual panel event from the content component
IGPRTCPEvent event = contentComponent.getRTCPEvent();
 

The content component can raise the following events:

  • Complete Activity

    This event is raised at activity completion to reload the process and refresh all components with the updated information.

  • Refresh View

    This event is raised to refresh the contextual panel components that hold information about the current process, phase and activity.

Example
Creating Content Component Events
importcom.sap.caf.eu.gp.rtcontent.api.IGRTContentComponentEvent;
 
// create a Complete Activity event
IGPRTContentComponentEventcompleteActivityEvent = rtContentManager.createCompleteActivityEvent();
// create a Refresh View event
IGPRTContentComponentEventrefreshEvent = rtContentManager.createRefreshEvent();
// fire an event
wdThis.wdFireRuntimeEvent(refreshEvent);
 

Contextual Panel Component ( IGPRTCPComponent )

You use this interface to access the contextual panel components of your custom runtime view.

Contextual panel component instances are automatically created by the GP runtime framework when you choose a particular runtime view using the view switch in the contextual panel. They are bound to the corresponding Web Dynpro components using the setCtxPanelComponent() method.

For more information, see Interface Methods for Component Initialization .

Through the contextual panel component, you can set or retrieve the current process instance, phase and activity.

Example
Retrieving Process Instance, Phase and Activity of the Contextual Panel Component
// set attributes
ctxPanelComponent.setProcessInstance(instance);
ctxPanelComponent.setSelectedPhase(currentPhase);
ctxPanelComponent.setSelectedActivity(currentActivity);
// retrieve attributes
IGPProcessInstanceinstance= ctxPanelComponent.getProcessInstance();
IGPBlockInstancecurrentPhase= ctxPanelComponent.getSelectedPhase();
IGPActivityInstancecurrentActivity= ctxPanelComponent.getSelectedActivity();
 

Contextual panel components can raise runtime events which you can create using the GP API. You can also configure these events so that they are related to, for example, a particular activity, info callable object and so on.

Example
Creating and Configuring A Contextual Panel Component Event
// create a contextual panel component event
IGPRTCPEventevent = ctxPanelComponent.createRTCPEvent(eventId);
// set the activity for which the event will be available
event.addParameter(IGPRTCPEvent.PARAM_CURRENT_ACTIVITY, currentActivity);
// set info callable object
event.addParameter(IGPRTCPEvent.PARAM_CURRENT_INFO_CO, "sap.com/caf~eu~gp~ui~rt");     
// fire the event
wdThis.wdFireCtxPanelEvent(event);
 

Events raised by the contextual panel components are caught by the GP runtime and handed over to the content components. Having the event itself, the content component can retrieve the contextual panel component that raised the event, as well as all information related to it (such as current phase, activity and so on).

Example
Retrieving a Contextual Panel Component from an Event
// get the contextual panel component from the event
IGPRTCPComponentctxPanelComponent = event.getRTCtxPanelComponent();
 

For each contextual panel event, you can set a content component, called a start component, which is displayed in the content area once the user chooses an option from the corresponding contextual panel component. This is a way of having more than one content component in one runtime view configuration.

Example
Adding a Start Component to an Event
importcom.sap.caf.eu.gp.wdcomponent.api.IGPWDComponent;
 
StringapplName = "com.sap.caf.eu.gp.runtime.view.Pane";
StringdcName = "sap.com/caf~eu~gp~runtime~view";
event.setStartComponent(applName, dcName);
 
IGPWDComponentstartComponent = event.getStartComponent();