
Before you can use the content and contextual panel components you have created, you need to register them as Web Dynpro components. Consequently, you use these Web Dynpro components when you create your runtime view configuration.
The procedure below offers only a temporary registration of runtime view components and configurations, using an application.
You can also register these components using an HTTP servlet. For more information, see Registering Runtime Views Using Servlets .
IGPWDComponent
| Registering a Content Component as a Web Dynpro Component |
|---|
importcom.sap.caf.eu.gp.wdcomponent.api.IGPWDComponentManager; importcom.sap.caf.eu.gp.wdcomponent.api.GPWDComponentFactory; importcom.sap.caf.eu.gp.wdcomponent.api.IGPWDComponent; // instantiate the WDComponent manager IGPWDComponentManagermgr = GPWDComponentFactory.getWDComponentManager(); // get the resource accessor (user-defined) ContentPaneResourceAccessoraccessor = new ContentPaneResourceAccessor( "com.sap.caf.eu.gp.runtime.resource.ContentPane"); // register the content component as a WDComponent IGPWDComponentcontentComponent = mgr.createWDComponent( // component ID, not null, must be unique "MyOwnContentPane", // component name "com.sap.caf.eu.gp.runtime.view.CContentPane", // DC name "sap.com/caf~eu~gp~runtime~view", accessor, // frame title key "FrameTitle" ); |
| Creating a Runtime View |
|---|
importcom.sap.caf.eu.gp.rtview.api.GPRTViewFactory; importcom.sap.caf.eu.gp.rtview.api.IGPRTView; importcom.sap.caf.eu.gp.rtview.api.IGPRTViewManager; importjava.util.Enumeration; importcom.sap.tc.webdynpro.services.sal.um.api.WDUMException; importcom.sap.caf.eu.gp.exception.api.GPEngineException; importcom.sap.caf.eu.gp.exception.api.GPInvocationException; IGPRTViewManagervManager = GPRTViewFactory.getRTViewManager(); booleanisRegistered = false; try{String viewId = "MyViewConfiguration"; // check if view is already registered: Enumeration rViews = vManager.getRTViews(); while (rViews.hasMoreElements()){IGPRTView view = (IGPRTView)rViews.nextElement(); if (view.getRTViewId().equals(viewId)){isRegistered = true; break; } } // if it is not registered if (isRegistered == false) {// create a WD component // -- place registration code from step 1 here -- // create a runtime view configuration IGPRTView viewConfiguration = vManager.createRTView( // view ID, not null, must be unique viewId, // default WD content component, created above contentComponent, accessor, // the title for the view switch "PaneTitle", // the tool tip for the view switch "PaneDescription", // enable this view as mandatory IGPRTView.MANDATORY_GROUP_PROCESS_STRUCTURE, // do not set it as default view false ); // register the view vManager.registerRTView(viewConfiguration); } }catch (WDUMException ex) {}catch (GPInvocationException ex) {}catch (GPEngineException ex) {} |
Contextual panel components can be more than one and should be attached to the view configuration after it is created.
| Adding Contextual Panel Components to the Runtime View |
|---|
// register the contextual panel component as a WDComponent IGPWDComponentctxPanelComponent = mgr.createWDComponent( "MyOwnContextualComponent", // component name "com.sap.caf.eu.gp.runtime.view.CtxNavigation", // DC name "sap.com/caf~eu~gp~runtime~view", accessor, // frame title key "Title" ); // add the component to the view viewConfiguration.addCPComponent(ctxPanelComponent); |