Show TOC

Procedure documentationImplementing Methods Locate this document in the navigation structure

 

In this step, you implement the navigation methods of your wizard.

Procedure

Implementing the ChangePane Method

Perform the following steps in the IWizard window:

  1. Add a method as follows:

    1. In the Methods area of the Methods view, click New.

    2. For Method Type, select Method, and then click Next.

    3. In the Name field, enter changePane.

    4. In the Return Type field, select void, and then click Next.

    5. Add a parameter called paneNumber of type integer.

    6. Click Finish.

  2. 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 Syntax

    1. 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
      }
      
    End of the code.
Implementing Methods for Responding to User Actions
  1. Create and map the following context attribute:

    1. Component Controller -- paneNumber (integer): The current pane to display.

    2. In the IWizard window -- paneNumber (integer): The current pane to display. Map this attribute to the paneNumber attribute in the component controller.

  2. In the component controller's Properties view, add the following as a required controllers:

    1. The component interface controller for each predefined pane added to the project.

    2. The IWizard window controller.

  3. 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 Syntax

      1. 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
        }
        
      End of the code.
    • 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 Syntax

      1. 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
        }
        
      End of the code.
    • 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.

  4. In the IWizard window's wdDoInit() method, navigate to the first pane, as follows;

    Syntax Syntax

    1. public voidwdDoInit()
      {
        //@@begin wdDoInit()
        wdContext.currentContextElement().setPaneNumber(1);
        wdThis.wdFirePlugGeneralProperties();
        //@@end
      }
      
    End of the code.

To complete the implementation of the wizard, proceed to Creating Wizards.