コード例 #1
0
  protected void updateBindings() {
    // Destroy any old bindings
    if (nextButtonBinding != null) {
      nextButtonBinding.destroyBindings();
    }
    if (finishedButtonBinding != null) {
      finishedButtonBinding.destroyBindings();
    }

    // Create new binding to the current wizard panel
    bf.setBindingType(Binding.Type.ONE_WAY);
    nextButtonBinding =
        bf.createBinding(
            getStep(getActiveStep()),
            VALID_PROPERTY_NAME,
            NEXT_BTN_ELEMENT_ID,
            DISABLED_PROPERTY_NAME,
            notDisabledBindingConvertor);

    finishedButtonBinding =
        bf.createBinding(
            activeDatasource,
            FINISHABLE_PROPERTY_NAME,
            FINISH_BTN_ELEMENT_ID,
            DISABLED_PROPERTY_NAME,
            notDisabledBindingConvertor);

    try {
      nextButtonBinding.fireSourceChanged();
      finishedButtonBinding.fireSourceChanged();
    } catch (Exception e) {
      // TODO add some exception handling here.
    }
  }
コード例 #2
0
  public void setRepReadOnly(boolean isRepReadOnly) {
    try {
      if (this.isRepReadOnly != isRepReadOnly) {
        this.isRepReadOnly = isRepReadOnly;

        if (initialized) {
          bindButtonNew.fireSourceChanged();
          bindButtonEdit.fireSourceChanged();
          bindButtonRemove.fireSourceChanged();
        }
      }
    } catch (Exception e) {
      if (mainController == null || !mainController.handleLostRepository(e)) {
        // convert to runtime exception so it bubbles up through the UI
        throw new RuntimeException(e);
      }
    }
  }
コード例 #3
0
  public void init() {

    // We need the SelectDatasourceStep at all times, add it now

    wizardDialog = (XulDialog) document.getElementById("main_wizard_window");

    summaryDialog = (XulDialog) document.getElementById("summaryDialog");

    finishButton = (XulButton) document.getElementById(FINISH_BTN_ELEMENT_ID);

    datasourceName = (XulTextbox) document.getElementById("datasourceName"); // $NON-NLS-1$
    bf.createBinding(datasourceName, "value", wizardModel, "datasourceName");
    wizardModel.addPropertyChangeListener(
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            if (propertyChangeEvent.getPropertyName().equals("datasourceName")) {
              steps.get(activeStep).setValid(steps.get(activeStep).isValid());
            }
          }
        });

    bf.setBindingType(Binding.Type.ONE_WAY);

    datatypeMenuList = (XulMenuList) document.getElementById("datatypeMenuList");

    Binding datasourceBinding =
        bf.createBinding(wizardModel, "datasources", datatypeMenuList, "elements");
    bf.setBindingType(Binding.Type.ONE_WAY);
    bf.createBinding(datatypeMenuList, "selectedItem", wizardModel, "selectedDatasource");

    bf.setBindingType(Binding.Type.ONE_WAY);
    bf.createBinding(wizardModel, "selectedDatasource", this, "selectedDatasource");
    bf.createBinding(
        this,
        ACTIVE_STEP_PROPERTY_NAME,
        BACK_BTN_ELEMENT_ID,
        DISABLED_PROPERTY_NAME,
        new BackButtonBindingConverter());

    dummyDatasource = ((DummyDatasource) wizardModel.getDatasources().iterator().next());
    activeDatasource = dummyDatasource;
    selectDatasourceStep = dummyDatasource.getSelectDatasourceStep();

    try {
      for (IWizardDatasource datasource : wizardModel.getDatasources()) {
        datasource.init(getXulDomContainer(), wizardModel);
      }
      steps.add(selectDatasourceStep);
      selectDatasourceStep.activating();
      setActiveStep(0);
      datasourceBinding.fireSourceChanged();
      setSelectedDatasource(dummyDatasource);
      datasourceService.getDatasourceIllegalCharacters(
          new XulServiceCallback<String>() {
            @Override
            public void success(String retVal) {}

            @Override
            public void error(String message, Throwable error) {}
          });
    } catch (XulException e) {
      MessageHandler.getInstance().showErrorDialog("Error", e.getMessage());
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      MessageHandler.getInstance().showErrorDialog("Error", e.getMessage());
      e.printStackTrace();
    }
  }