In this step, you implement the navigation methods of your wizard.
Perform the following steps in the IWizard window:
Add a method as follows:
In the Methods area of the Methods view, click New.
For Method Type, select Method, and then click Next.
In the Name field, enter changePane.
In the Return Type field, select void, and then click Next.
Add a parameter called paneNumber of type integer.
Click Finish.
In the changePane() method, add code to change the pane based on the paneNumber parameter.
For example, the following checks the paneNumber parameter and fires the plug for the corresponding view:
Syntax
public voidchangePane(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, intpaneNumber ) { //@@begin changePane(ServerEvent) switch(paneNumber) { case 1: wdThis.wdFirePlugGeneralProperties(); break; case 2: wdThis.wdFirePlugCustom(); break; case 3: wdThis.wdFirePlugSummary(); break; default: break; } //@@end }
Create and map the following context attribute:
Component Controller -- paneNumber (integer): The current pane to display.
In the IWizard window -- paneNumber (integer): The current pane to display. Map this attribute to the paneNumber attribute in the component controller.
In the component controller's Properties view, add the following as a required controllers:
The component interface controller for each predefined pane added to the project.
The IWizard window controller.
In the component controller, implement the following methods. You must implement all methods except doFinish(), because they have return values but no default implementations.
doBeforeNext() / doBeforePrevious(): Called when Next or Previous is clicked. Use these methods to validate the user input and determine if the wizard should navigate to the next or previous pane.
Return true to invoke the doNext() / doPrevious() method.
doNext() / doPrevious(): Called after the doBeforeNext() / doBeforePrevious() method returns true. Use these methods to navigate to the next or previous pane.
For example:
Syntax
publiccom.sap.portal.adminstudio.wizardfwapi.PaneController doNext( ) { //@@begin doNext() wdContext.currentContextElement() .setPaneNumber(wdContext.currentContextElement().getPaneNumber()+1); wdThis.wdGetIWizardController() .changePane(wdContext.currentContextElement().getPaneNumber()); return null; //@@end }
doBeforeFinish(): Called when the Finish button is clicked. Use this method to validate the user input and determine whether the wizard can finish executing.
Return true to invoke doFinish() method.
doFinish(): Called after the doBeforeFinish() returns true.
useFinishPane(): Indicates whether to display the predefined Finish pane. If the Finish pane is to be displayed, the method specifies the options for the pane.
For more information, see Customizing the Finish Pane.
getInitialStepsList(): Specifies the names of the steps in the wizard road map.
For example:
Syntax
publiccom.sap.portal.adminstudio.iroadmap.utils.RoadMapSteps getInitialStepsList( ) { //@@begin getInitialStepsList() RoadMapSteps roadmapsteps = new RoadMapSteps(); roadmapsteps.addStep(wdThis .wdGetIGeneralPropertiesInterface().getStepName()); roadmapsteps.addStep("My Custom pane"); roadmapsteps.addStep(wdThis.wdGetISummaryInterface().getStepName()); returnroadmapsteps; //@@end }
getSubstepsList(): Specifies substeps for a split road map.
For more information, see Creating a Split Road Map.
getActions(): Specifies dynamic actions to add to the Portal Catalog while the wizard runs, similar to adding actions for a work unit. For more information, see Adding Actions Dynamically.
In the IWizard window's wdDoInit() method, navigate to the first pane, as follows;
Syntax
public voidwdDoInit() { //@@begin wdDoInit() wdContext.currentContextElement().setPaneNumber(1); wdThis.wdFirePlugGeneralProperties(); //@@end }
To complete the implementation of the wizard, proceed to Creating Wizards.