예제 #1
0
  private void initController() {
    BindingBuilder builder =
        new BindingBuilder(eventController.getApplication().getBindingFactory(), this);

    builder.bindToStateChange(dbEntity, "dbEntityFilter").updateView();
    builder.bindToStateChange(objEntity, "objEntityFilter").updateView();
    builder.bindToStateChange(embeddable, "embeddableFilter").updateView();
    builder.bindToStateChange(procedure, "procedureFilter").updateView();
    builder.bindToStateChange(query, "queryFilter").updateView();
    builder.bindToStateChange(all, "allFilter").updateView();

    dbEntity.addActionListener(new CheckListener("dbEntity"));
    objEntity.addActionListener(new CheckListener("objEntity"));
    embeddable.addActionListener(new CheckListener("embeddable"));
    procedure.addActionListener(new CheckListener("procedure"));
    query.addActionListener(new CheckListener("query"));

    all.setEnabled(false);
    all.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            dbEntity.setSelected(true);
            objEntity.setSelected(true);
            embeddable.setSelected(true);
            procedure.setSelected(true);
            query.setSelected(true);
            all.setEnabled(false);

            filterController.getTreeModel().setFiltered(filterController.getFilterMap());
            filterController.getTree().updateUI();
          }
        });
  }
  protected void initBindings() {

    // bind actions
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);

    builder.bindToAction(view.getGenerationMode(), "updateModeAction()");

    CayenneProjectPreferences cayPrPref = application.getCayenneProjectPreferences();

    this.preferences =
        (PreferenceDetail)
            cayPrPref.getProjectDetailObject(
                PreferenceDetail.class, getViewPreferences().node("controller"));

    if (Util.isEmptyString(preferences.getProperty("mode"))) {
      preferences.setProperty("mode", STANDARD_OBJECTS_MODE);
    }

    builder
        .bindToComboSelection(view.getGenerationMode(), "preferences.property['mode']")
        .updateView();

    updateModeAction();
  }
예제 #3
0
  protected void initController() {
    view.getDataSourceDetail().add(defaultSubeditor.getView(), "default");
    view.getFactories().setEditable(true);
    // init combo box choices
    view.getFactories().setModel(new DefaultComboBoxModel(standardDataSourceFactories));

    view.getSchemaUpdateStrategy().setEditable(true);
    view.getSchemaUpdateStrategy().setModel(new DefaultComboBoxModel(standardSchemaUpdateStrategy));

    // init listeners
    ((ProjectController) getParent())
        .addDataNodeDisplayListener(
            new DataNodeDisplayListener() {

              public void currentDataNodeChanged(DataNodeDisplayEvent e) {
                refreshView(e.getDataNode());
              }
            });

    getView()
        .addComponentListener(
            new ComponentAdapter() {

              public void componentShown(ComponentEvent e) {
                refreshView(
                    node != null ? node : ((ProjectController) getParent()).getCurrentDataNode());
              }
            });

    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);

    localDataSourceBinding =
        builder.bindToComboSelection(
            view.getLocalDataSources(),
            "parent.dataNodePreferences.localDataSource",
            NO_LOCAL_DATA_SOURCE);

    // use delegate for the rest of them

    builder.setDelegate(nodeChangeProcessor);

    bindings = new ObjectBinding[3];
    bindings[0] = builder.bindToTextField(view.getDataNodeName(), "nodeName");
    bindings[1] = builder.bindToComboSelection(view.getFactories(), "factoryName");
    bindings[2] =
        builder.bindToComboSelection(view.getSchemaUpdateStrategy(), "schemaUpdateStrategy");

    // one way bindings
    builder.bindToAction(view.getConfigLocalDataSources(), "dataSourceConfigAction()");
  }