コード例 #1
0
  @Bindable
  public void setSelectedDatasource(IWizardDatasource datasource) {
    if (datasource instanceof DummyDatasource) {
      this.datasourceDeck.setSelectedIndex(0);
      this.datasource = null;
      this.wrappedStep = null;
      return;
    }
    if (datasource == null) {
      return;
    }
    if (this.datasource != null) {
      this.wrappedStep.removePropertyChangeListener(validListener);
      this.datasource.removePropertyChangeListener(finishableListener);
    }
    this.wrappedStep = datasource.getSteps().get(0);
    this.datasource = datasource;
    this.wrappedStep.addPropertyChangeListener(validListener);
    this.datasource.addPropertyChangeListener(finishableListener);

    this.datasourceDeck.setSelectedIndex(
        datasourceDeck.getChildNodes().indexOf(datasource.getSteps().get(0).getUIComponent()));
    datasource.getSteps().get(0).refresh();
    firePropertyChange("valid", !isValid(), isValid());
  }
コード例 #2
0
  public void setActiveStep(final int step) {
    try {
      if (this.steps == null || steps.isEmpty()) {
        return;
      }
      final int oldActiveStep = this.activeStep;
      if (oldActiveStep >= 0) {
        final IWizardStep deactivatingWizardStep = steps.get(oldActiveStep);
        if (step > oldActiveStep) {
          if (!deactivatingWizardStep.stepDeactivatingForward()) {
            return;
          }
        } else {
          if (!deactivatingWizardStep.stepDeactivatingReverse()) {
            return;
          }
        }
      }

      this.activeStep = step;
      final IWizardStep activatingWizardStep = steps.get(activeStep);
      updateBindings();

      // update the controller panel
      final XulDeck deck = (XulDeck) document.getElementById(CONTENT_DECK_ELEMENT_ID);
      int index = deck.getChildNodes().indexOf(activatingWizardStep.getUIComponent());
      deck.setSelectedIndex(index);
      selectDataSourceMenuList(activatingWizardStep, index);
      activatingWizardStep.refresh();

      if (activeStep > oldActiveStep) {
        activatingWizardStep.stepActivatingForward();
      } else {
        activatingWizardStep.stepActivatingReverse();
      }

      this.firePropertyChange(ACTIVE_STEP_PROPERTY_NAME, oldActiveStep, this.activeStep);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }