private void setupPage(int index) {
    String html = getHTMLString(pages.get(index));

    html = replaceVariables(html);
    htmlPanel.setHTMLString(html, base);
    setupActionPanelKeys(index);
    regionsContainer.removeRegionContent(Region.SOUTH);

    // setup views
    regionsContainer.setRegionContent(Region.CENTER, htmlPanel);
    if (duration == 0) {
      regionsContainer.setRegionContent(Region.SOUTH, actionPanel);
    }

    regionsContainer.setRegionContentVisibility(Region.CENTER, true);
    regionsContainer.setRegionContentVisibility(Region.SOUTH, true);

    // enable the actions
    if (duration == 0) {
      actionPanel.enableActionPanel();
    }
    currentIndex = index;

    // start timer
    if (timeoutHandler != null) {
      timeoutHandler.startTimeout(getExecutionContext());
    }
  }
 private void doCleanup() {
   if (timeoutHandler != null) {
     timeoutHandler.cancelTimeout();
   }
   actionPanel.disableActionPanel();
   regionsContainer.removeRegionContent(Region.SOUTH);
   regionsContainer.removeRegionContent(Region.CENTER);
 }
  @Override
  protected void startExecutionAWT() {
    context = getExecutionContext();
    currLocale = context.getExecutionData().getModule().getMessages().getLocale();
    execTimer = new Timer();
    regionsContainer = ContainerUtils.getRegionsContainer();
    SwingExecutionDisplay display = ExecutionDisplayUtils.getDisplay(context);
    ContainerUtils.showRegionsContainer(display);
    regionsContainer.setRegionVisibility(Region.NORTH, false);

    TimerTask endTimerTask =
        new TimerTask() {
          public void run() {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    if (getFinishExecutionLock()) {
                      cancelExecutionAWT();
                      doCleanup();
                      finishExecution();
                    }
                  }
                });
          }
        };

    if (duration > 0) {
      execTimer.schedule(endTimerTask, duration);
    }

    setupPage(0);
  }