Search in sources :

Example 1 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class GeneratorTabController method initBindings.

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();
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder) CayenneProjectPreferences(org.apache.cayenne.pref.CayenneProjectPreferences)

Example 2 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class MergerOptions method initController.

protected void initController() {
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    sqlBinding = builder.bindToTextArea(view.getSql(), "textForSQL");
    builder.bindToAction(view.getGenerateButton(), "generateSchemaAction()");
    builder.bindToAction(view.getSaveSqlButton(), "storeSQLAction()");
    builder.bindToAction(view.getCancelButton(), "closeAction()");
    // refresh SQL if different tables were selected
    view.getTabs().addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            if (view.getTabs().getSelectedIndex() == 1) {
                // this assumes that some tables where checked/unchecked... not very
                // efficient
                refreshGeneratorAction();
            }
        }
    });
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) BindingBuilder(org.apache.cayenne.swing.BindingBuilder) ChangeListener(javax.swing.event.ChangeListener)

Example 3 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class DataSourceWizard method initBindings.

protected void initBindings() {
    final BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    dataSourceBinding = builder.bindToComboSelection(view.getDataSources(), "dataSourceKey");
    builder.bindToAction(view.getCancelButton(), "cancelAction()");
    builder.bindToAction(view.getOkButton(), "okAction()");
    builder.bindToAction(view.getConfigButton(), "dataSourceConfigAction()");
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder)

Example 4 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class InferRelationshipsController method initBindings.

protected void initBindings() {
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    builder.bindToAction(view.getCancelButton(), "cancelAction()");
    builder.bindToAction(view.getGenerateButton(), "generateAction()");
    builder.bindToAction(this, "entitySelectedAction()", SELECTED_PROPERTY);
    builder.bindToAction(view.getStrategyCombo(), "strategyComboAction()");
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder)

Example 5 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class FilterDialog method initController.

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(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();
    });
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder)

Aggregations

BindingBuilder (org.apache.cayenne.swing.BindingBuilder)31 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)4 TableBindingBuilder (org.apache.cayenne.swing.TableBindingBuilder)4 ComponentAdapter (java.awt.event.ComponentAdapter)3 ComponentEvent (java.awt.event.ComponentEvent)3 Entry (java.util.Map.Entry)3 DataMap (org.apache.cayenne.map.DataMap)3 ProjectController (org.apache.cayenne.modeler.ProjectController)3 DataMapDefaults (org.apache.cayenne.modeler.pref.DataMapDefaults)3 ChangeEvent (javax.swing.event.ChangeEvent)2 ChangeListener (javax.swing.event.ChangeListener)2 DataNodeDisplayEvent (org.apache.cayenne.modeler.event.DataNodeDisplayEvent)2 DataNodeDisplayListener (org.apache.cayenne.modeler.event.DataNodeDisplayListener)2 CardLayout (java.awt.CardLayout)1 Component (java.awt.Component)1 KeyEvent (java.awt.event.KeyEvent)1 KeyListener (java.awt.event.KeyListener)1 File (java.io.File)1 Iterator (java.util.Iterator)1 Vector (java.util.Vector)1