コード例 #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 createBindings() {
   refreshPartitions();
   try {
     partitionsTable = (XulTree) document.getElementById("partitions-table");
     bf.setBindingType(Binding.Type.ONE_WAY);
     bf.createBinding(partitionList, "children", partitionsTable, "elements").fireSourceChanged();
     bf.createBinding(partitionsTable, "selectedItems", this, "enableButtons");
   } catch (Exception e) {
     // convert to runtime exception so it bubbles up through the UI
     throw new RuntimeException(e);
   }
 }
コード例 #3
0
  @Override
  protected boolean doLazyInit() {
    try {
      mainController = (MainController) this.getXulDomContainer().getEventHandler("mainController");
    } catch (XulException e) {
      return false;
    }

    try {
      setRepReadOnly(this.repository.getRepositoryMeta().getRepositoryCapabilities().isReadOnly());

      // Load the SWT Shell from the explorer dialog
      shell = ((SwtDialog) document.getElementById("repository-explorer-dialog")).getShell();
      bf = new DefaultBindingFactory();
      bf.setDocument(this.getXulDomContainer().getDocumentRoot());

      if (bf != null) {
        createBindings();
      }
      enableButtons(true, false, false);

      return true;
    } catch (Exception e) {
      if (mainController == null || !mainController.handleLostRepository(e)) {
        return false;
      }
    }

    return false;
  }
コード例 #4
0
  @Override
  protected void createBindings(
      SqoopImportConfig config,
      XulDomContainer container,
      BindingFactory bindingFactory,
      Collection<Binding> bindings) {
    super.createBindings(config, container, bindingFactory, bindings);

    bindings.add(bindingFactory.createBinding(config, TARGET_DIR, TARGET_DIR, "value"));
  }
コード例 #5
0
  private void createBindings() {
    refreshConnectionList();
    connectionsTable = (XulTree) document.getElementById("connections-table");

    // Bind the connection table to a list of connections
    bf.setBindingType(Binding.Type.ONE_WAY);

    // CHECKSTYLE:LineLength:OFF
    try {
      bf.createBinding(dbConnectionList, "children", connectionsTable, "elements")
          .fireSourceChanged();
      (bindButtonNew = bf.createBinding(this, "repReadOnly", "connections-new", "disabled"))
          .fireSourceChanged();
      (bindButtonEdit = bf.createBinding(this, "repReadOnly", "connections-edit", "disabled"))
          .fireSourceChanged();
      (bindButtonRemove = bf.createBinding(this, "repReadOnly", "connections-remove", "disabled"))
          .fireSourceChanged();

      if (repository != null) {
        bf.createBinding(connectionsTable, "selectedItems", this, "selectedConnections");
      }
    } catch (Exception ex) {
      if (mainController == null || !mainController.handleLostRepository(ex)) {
        // convert to runtime exception so it bubbles up through the UI
        throw new RuntimeException(ex);
      }
    }
  }
コード例 #6
0
  protected boolean doLazyInit() {
    // Load the SWT Shell from the explorer dialog
    shell = ((SwtDialog) document.getElementById("repository-explorer-dialog")).getShell();

    enableButtons(true, false, false);
    bf = new SwtBindingFactory();
    bf.setDocument(this.getXulDomContainer().getDocumentRoot());

    if (bf != null) {
      createBindings();
    }
    return true;
  }
コード例 #7
0
  /**
   * Initialize this dialog for the job entry instance provided.
   *
   * @param jobEntry The job entry this dialog supports.
   */
  protected void init(E jobEntry) throws XulException {
    SwtXulLoader swtXulLoader = new SwtXulLoader();
    // Register the settings manager so dialog position and size is restored
    swtXulLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
    swtXulLoader.registerClassLoader(getClass().getClassLoader());
    // Register Kettle's variable text box so we can reference it from XUL
    swtXulLoader.register("VARIABLETEXTBOX", ExtTextbox.class.getName());
    swtXulLoader.setOuterContext(shell);

    // Load the XUL document with the dialog defined in it
    XulDomContainer container = swtXulLoader.loadXul(getXulFile(), bundle);

    // Create the controller with a default binding factory for the document we just loaded
    BindingFactory bf = new DefaultBindingFactory();
    bf.setDocument(container.getDocumentRoot());
    controller = createController(container, jobEntry, bf);
    container.addEventHandler(controller);

    // Load up the SWT-XUL runtime and initialize it with our container
    final XulRunner runner = new SwtXulRunner();
    runner.addContainer(container);
    runner.initialize();
  }
コード例 #8
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();
    }
  }
コード例 #9
0
  public void xulLoaded(GwtXulRunner gwtXulRunner) {
    container = gwtXulRunner.getXulDomContainers().get(0);
    container.addEventHandler(this);

    BogoPojo bogo = new BogoPojo();
    service.gwtWorkaround(
        bogo,
        new XulServiceCallback<BogoPojo>() {
          public void success(BogoPojo retVal) {}

          public void error(String message, Throwable error) {}
        });

    datasourceService = new DSWDatasourceServiceGwtImpl();
    //    connectionService = new ConnectionServiceGwtImpl();
    csvService = (ICsvDatasourceServiceAsync) GWT.create(ICsvDatasourceService.class);

    if (wizard == null) {
      wizard = new EmbeddedWizard(false);

      wizard.setDatasourceService(datasourceService);
      //      wizard.setConnectionService(connectionService);
      wizard.setCsvDatasourceService(csvService);
      wizard.init(null);
    }

    messages = new GwtModelerMessages((ResourceBundle) container.getResourceBundles().get(0));
    try {
      ModelerMessagesHolder.setMessages(messages);
    } catch (Exception ignored) {
      // Messages may have been set earlier, ignore.
    }

    IModelerWorkspaceHelper workspacehelper = model.getWorkspaceHelper();

    controller = new ModelerController(model);
    controller.setWorkspaceHelper(workspacehelper);
    //    controller.setMessages(messages);
    final BindingFactory bf = new GwtBindingFactory(container.getDocumentRoot());
    controller.setBindingFactory(bf);
    container.addEventHandler(controller);
    try {
      controller.init();
    } catch (ModelerException e) {
      e.printStackTrace();
    }

    bf.setBindingType(Binding.Type.ONE_WAY);
    bf.createBinding(
        model,
        "valid",
        "modeler_dialog_accept",
        "disabled",
        new BindingConvertor<Boolean, Boolean>() {
          @Override
          public Boolean sourceToTarget(Boolean value) {
            return !value;
          }

          @Override
          public Boolean targetToSource(Boolean value) {
            return !value;
          }
        });

    bf.setBindingType(Binding.Type.BI_DIRECTIONAL);

    // go get the geocontext from the server. Prop forms are initialized after this call returns as
    // they
    // may need them to create the UI
    datasourceService.getGeoContext(
        new XulServiceCallback<GeoContext>() {
          public void success(GeoContext geoContext) {
            model.setGeoContext(geoContext);
            ModelerUiHelper.configureControllers(
                container, model, bf, controller, new ColResolverController());
            ModelerDialog.this.constructorListener.asyncConstructorDone(ModelerDialog.this);
          }

          public void error(String s, Throwable throwable) {
            throwable.printStackTrace();
            // put in a stub to ensure the rest of the dialog works
            model.setGeoContext(new GeoContext());
            ModelerUiHelper.configureControllers(
                container, model, bf, controller, new ColResolverController());
            ModelerDialog.this.constructorListener.asyncConstructorDone(ModelerDialog.this);
          }
        });
  }