Search in sources :

Example 11 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(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();
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) BindingBuilder(org.apache.cayenne.swing.BindingBuilder) ActionEvent(java.awt.event.ActionEvent)

Example 12 with BindingBuilder

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

the class DataSourceWizard method initBindings.

protected void initBindings() {
    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 13 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 14 with BindingBuilder

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

the class DataSourceEditor method initBindings.

protected void initBindings() {
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    builder.setDelegate(nodeChangeProcessor);
    prepareBindings(builder);
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder)

Example 15 with BindingBuilder

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

the class InferRelationshipsTabController method initBindings.

protected void initBindings() {
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    builder.bindToAction(view.getCheckAll(), "checkAllAction()");
    TableBindingBuilder tableBuilder = new TableBindingBuilder(builder);
    tableBuilder.addColumn("", "parent.setCurrentEntity(#item), selected", Boolean.class, true, Boolean.TRUE);
    tableBuilder.addColumn("Source", "#item.getSource().getName()", String.class, false, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    tableBuilder.addColumn("Target", "#item.getTarget().getName()", String.class, false, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    tableBuilder.addColumn("Join", "parent.getJoin(#item)", String.class, false, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    tableBuilder.addColumn("Name", "#item.getName()", String.class, false, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    tableBuilder.addColumn("To Many", "parent.getToMany(#item)", String.class, false, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    this.tableBinding = tableBuilder.bindToTable(view.getTable(), "parent.entities");
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder) TableBindingBuilder(org.apache.cayenne.swing.TableBindingBuilder) TableBindingBuilder(org.apache.cayenne.swing.TableBindingBuilder)

Aggregations

BindingBuilder (org.apache.cayenne.swing.BindingBuilder)29 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)5 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 DataNodeDisplayEvent (org.apache.cayenne.modeler.event.DataNodeDisplayEvent)3 DataNodeDisplayListener (org.apache.cayenne.modeler.event.DataNodeDisplayListener)3 DataMapDefaults (org.apache.cayenne.modeler.pref.DataMapDefaults)3 ChangeEvent (javax.swing.event.ChangeEvent)2 ChangeListener (javax.swing.event.ChangeListener)2 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 KeyEvent (java.awt.event.KeyEvent)1 KeyListener (java.awt.event.KeyListener)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 File (java.io.File)1