Search in sources :

Example 1 with DataNodeDisplayListener

use of org.apache.cayenne.modeler.event.DataNodeDisplayListener in project cayenne by apache.

the class AdapterEditor method initController.

protected void initController() {
    // init bindings
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    adapterNameBinding = builder.bindToTextField(view.getCustomAdapter(), "adapterName");
    ((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());
        }
    });
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder) DataNodeDisplayListener(org.apache.cayenne.modeler.event.DataNodeDisplayListener) DataNodeDisplayEvent(org.apache.cayenne.modeler.event.DataNodeDisplayEvent) ComponentEvent(java.awt.event.ComponentEvent) ProjectController(org.apache.cayenne.modeler.ProjectController) ComponentAdapter(java.awt.event.ComponentAdapter)

Example 2 with DataNodeDisplayListener

use of org.apache.cayenne.modeler.event.DataNodeDisplayListener in project cayenne by apache.

the class MainDataNodeEditor method initController.

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()");
}
Also used : DataNodeDisplayListener(org.apache.cayenne.modeler.event.DataNodeDisplayListener) DataNodeDisplayEvent(org.apache.cayenne.modeler.event.DataNodeDisplayEvent) BindingBuilder(org.apache.cayenne.swing.BindingBuilder) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) ComponentEvent(java.awt.event.ComponentEvent) ProjectController(org.apache.cayenne.modeler.ProjectController) ComponentAdapter(java.awt.event.ComponentAdapter)

Example 3 with DataNodeDisplayListener

use of org.apache.cayenne.modeler.event.DataNodeDisplayListener in project cayenne by apache.

the class PasswordEncoderEditor method initController.

protected void initController() {
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    builder.setDelegate(nodeChangeProcessor);
    bindings = new ObjectBinding[4];
    bindings[0] = builder.bindToComboSelection(view.getPasswordEncoder(), "node.dataSourceDescriptor.passwordEncoderClass");
    bindings[1] = builder.bindToTextField(view.getPasswordKey(), "node.dataSourceDescriptor.passwordEncoderKey");
    bindings[2] = builder.bindToComboSelection(view.getPasswordLocation(), "node.dataSourceDescriptor.passwordLocation");
    bindings[3] = builder.bindToTextField(view.getPasswordSource(), "node.dataSourceDescriptor.passwordSource");
    ((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());
        }
    });
    builder.bindToAction(view.getPasswordEncoder(), "validatePasswordEncoderAction()");
    builder.bindToAction(view.getPasswordLocation(), "passwordLocationChangedAction()");
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder) DataNodeDisplayListener(org.apache.cayenne.modeler.event.DataNodeDisplayListener) DataNodeDisplayEvent(org.apache.cayenne.modeler.event.DataNodeDisplayEvent) ComponentEvent(java.awt.event.ComponentEvent) ProjectController(org.apache.cayenne.modeler.ProjectController) ComponentAdapter(java.awt.event.ComponentAdapter)

Aggregations

ComponentAdapter (java.awt.event.ComponentAdapter)3 ComponentEvent (java.awt.event.ComponentEvent)3 ProjectController (org.apache.cayenne.modeler.ProjectController)3 DataNodeDisplayEvent (org.apache.cayenne.modeler.event.DataNodeDisplayEvent)3 DataNodeDisplayListener (org.apache.cayenne.modeler.event.DataNodeDisplayListener)3 BindingBuilder (org.apache.cayenne.swing.BindingBuilder)3 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1