cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject [2/2] cayenne-modeler git commit: Generalized more dispatch code.
Date Fri, 09 Jun 2017 00:00:12 GMT
Generalized more dispatch code.


Project: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/commit/4b66c8b1
Tree: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/tree/4b66c8b1
Diff: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/diff/4b66c8b1

Branch: refs/heads/master
Commit: 4b66c8b1f5e76f1c3f5cab0c724b6a9f6747b53e
Parents: 039d075
Author: mrg <blacknext@gmail.com>
Authored: Thu Jun 8 09:31:28 2017 -0400
Committer: mrg <blacknext@gmail.com>
Committed: Thu Jun 8 09:31:28 2017 -0400

----------------------------------------------------------------------
 .../modeler/layout/DataDomainLayout.java        | 136 ++++++++-----------
 .../layout/DataNodeConfigurationTabLayout.java  |  37 +++--
 .../DataNodeDatabaseAdapterTabLayout.java       |  30 ++--
 .../cayenne/modeler/layout/DataNodeLayout.java  |  31 +++--
 .../DataNodePasswordEncoderTabLayout.java       |  18 +--
 .../layout/DatabaseEntityColumnsTabLayout.java  |  29 ++--
 .../modeler/layout/DatabaseEntityLayout.java    |  26 ++--
 .../layout/DatabaseEntityTableTabLayout.java    |  18 +--
 .../modeler/layout/DetailEditorSupport.java     |  18 ++-
 .../modeler/layout/MainWindowLayout.java        |  29 ++--
 .../layout/ObjectEntityAttributesTabLayout.java |  42 ++++--
 .../layout/ObjectEntityClassTabLayout.java      |  35 +++--
 .../modeler/layout/ObjectEntityLayout.java      |  42 +++---
 .../ObjectEntityRelationshipsTabLayout.java     |  43 ++++--
 14 files changed, 303 insertions(+), 231 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
index 9cdccfc..3e1c6e6 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
@@ -20,12 +20,13 @@
 package org.apache.cayenne.modeler.layout;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.cayenne.access.DataRowStore;
 import org.apache.cayenne.event.JMSBridgeFactory;
 import org.apache.cayenne.event.JavaGroupsBridgeFactory;
 import org.apache.cayenne.modeler.adapters.DataDomainAdapter;
-import org.apache.cayenne.modeler.notification.NotificationCenter;
 import org.apache.cayenne.modeler.notification.event.DataDomainChangeEvent;
 import org.apache.cayenne.modeler.notification.listener.DataDomainListener;
 import org.apache.commons.lang3.StringUtils;
@@ -82,6 +83,8 @@ public class DataDomainLayout
 
     private DataDomainAdapter dataDomainAdapter;
 
+    private List<Binding<?>> bindings;
+
     // Remote Change Notification groups.
     private static final String RCN_NONE        = "None";
     private static final String RCN_JAVA_GROUPS = "JavaGroups Multicast";
@@ -155,97 +158,74 @@ public class DataDomainLayout
     }
 
     @Override
-    public void beginEditing()
+    public void initializeBindings()
     {
-        LOGGER.debug("begin editing " + this);
-
-//        show(javaGroupsConfiguration, jmsConfiguration, customConfiguration);
+        bindings = new ArrayList<>();
 
-        nameTextField.textProperty().bindBidirectional(dataDomainAdapter.nameProperty());
-        objectValidationCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.validatingObjectsProperty());
+        bindings.add(new Binding<>(nameTextField.textProperty(), dataDomainAdapter.nameProperty()));
+        bindings.add(new Binding<>(objectValidationCheckBox.selectedProperty(), dataDomainAdapter.validatingObjectsProperty()));
+        bindings.add(new Binding<>(objectCacheSizeSpinner.getValueFactory().valueProperty(),
dataDomainAdapter.sizeOfObjectCacheProperty().asObject()));
+        bindings.add(new Binding<>(useSharedCacheCheckBox.selectedProperty(), dataDomainAdapter.useSharedCacheProperty()));
 
-        objectCacheSizeSpinner.getValueFactory().valueProperty().bindBidirectional(dataDomainAdapter.sizeOfObjectCacheProperty().asObject());
-        useSharedCacheCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.useSharedCacheProperty());
-//        remoteChangeNotificationsCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
-
-        configureRemoteNotifications(dataDomainAdapter.getUseSharedCache());
+        bindings.add(new Binding<>(customTransportFactoryClass.textProperty(), dataDomainAdapter.eventBridgeFactoryProperty()));
+        bindings.add(new Binding<>(multicastAddressTextField.textProperty(), dataDomainAdapter.javaGroupsMulticastAddressProperty()));
+        bindings.add(new Binding<>(multicastPortTextField.textProperty(), dataDomainAdapter.javaGroupsMulticastPortProperty()));
+        bindings.add(new Binding<>(jmsConnectionFactoryNameTextField.textProperty(),
dataDomainAdapter.jmsConnectionFactoryProperty()));
+    }
 
-        customTransportFactoryClass.textProperty().bindBidirectional(dataDomainAdapter.eventBridgeFactoryProperty());
-        multicastAddressTextField.textProperty().bindBidirectional(dataDomainAdapter.javaGroupsMulticastAddressProperty());
-        multicastPortTextField.textProperty().bindBidirectional(dataDomainAdapter.javaGroupsMulticastPortProperty());
-        jmsConnectionFactoryNameTextField.textProperty().bindBidirectional(dataDomainAdapter.jmsConnectionFactoryProperty());
+    @Override
+    public List<Binding<?>> getBindings()
+    {
+        return bindings;
     }
 
-    @Deprecated
-    private void beginEditingNotCalled()
+    @Override
+    public void beginEditing()
     {
-        LOGGER.debug("begin editing");
+//        LOGGER.debug("begin editing " + this);
+        DetailEditorSupport.super.beginEditing();
+//        show(javaGroupsConfiguration, jmsConfiguration, customConfiguration);
 
-        nameTextField.setText(getMainWindow().getCayenneProject().getDataDomainName());
-        nameTextField.textProperty().addListener((observable, oldValue, newValue) ->
-            {
-                getMainWindow().getCayenneProject().setDataDomainName(newValue);
-                final DataDomainChangeEvent ddce = new DataDomainChangeEvent(getMainWindow().getCayenneProject(),
this, DataDomainChangeEvent.Type.NAME, oldValue, newValue);
-                NotificationCenter.broadcastProjectEvent(getMainWindow().getCayenneProject(),
ddce);
-//            System.out.println("DataDomain Name Text Changed (newValue: " + newValue +
")");
-            });
+//        nameTextField.textProperty().bindBidirectional(dataDomainAdapter.nameProperty());
+//        objectValidationCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.validatingObjectsProperty());
 
-        objectValidationCheckBox.setSelected(getMainWindow().getCayenneProject().isDataDomainValidatingObjects());
-        objectValidationCheckBox.setOnAction((event) ->
-        {
-            final Boolean selected = objectValidationCheckBox.isSelected();
-            getMainWindow().getCayenneProject().setDataDomainValidatingObjects(selected);
-            final DataDomainChangeEvent ddce = new DataDomainChangeEvent(getMainWindow().getCayenneProject(),
this, DataDomainChangeEvent.Type.VALIDATION, !selected, selected);
-            NotificationCenter.broadcastProjectEvent(getMainWindow().getCayenneProject(),
ddce);
-        });
+//        objectCacheSizeSpinner.getValueFactory().valueProperty().bindBidirectional(dataDomainAdapter.sizeOfObjectCacheProperty().asObject());
+//        useSharedCacheCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.useSharedCacheProperty());
+//        remoteChangeNotificationsCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
 
+        configureRemoteNotifications(dataDomainAdapter.getUseSharedCache());
 
-//        BeanPathAdapter<CayenneModel> dataDomainAdapter = getDataDomainPropertyAdapterMap(getMainWindow().getCayenneModel());
+//        customTransportFactoryClass.textProperty().bindBidirectional(dataDomainAdapter.eventBridgeFactoryProperty());
+//        multicastAddressTextField.textProperty().bindBidirectional(dataDomainAdapter.javaGroupsMulticastAddressProperty());
+//        multicastPortTextField.textProperty().bindBidirectional(dataDomainAdapter.javaGroupsMulticastPortProperty());
+//        jmsConnectionFactoryNameTextField.textProperty().bindBidirectional(dataDomainAdapter.jmsConnectionFactoryProperty());
+    }
+
+//    @Override
+//    public void endEditing()
+//    {
+//        LOGGER.debug("end editing " + this);
 //
-//        dataDomainAdapter.bindBidirectional("dataDomainName", dataDomainNameTextField.textProperty());
-//        dataDomainAdapter.bindBidirectional("dataDomainValidatingObjects", objectValidationCheckBox.selectedProperty());
+//        nameTextField.textProperty().unbindBidirectional(dataDomainAdapter.nameProperty());
+//        objectValidationCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.validatingObjectsProperty());
 //
-////        new ChangeListener<FieldPathValue>() {
-////            @Override
-////            public void changed(
-////                            ObservableValue<? extends FieldPathValue> observable,
-////                            FieldPathValue oldValue,
-////                            FieldPathValue newValue) {
-////                    dumpPojo(oldValue, newValue, personPA);
-////            }
-////    });
+//        objectCacheSizeSpinner.getValueFactory().valueProperty().unbindBidirectional(dataDomainAdapter.sizeOfObjectCacheProperty().asObject());
+//        useSharedCacheCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.useSharedCacheProperty());
+////        remoteChangeNotificationsCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
 //
-//        dataDomainAdapter.fieldPathValueProperty().addListener(changeObserver);
-
-        // Register for notifications.
-        NotificationCenter.addProjectListener(getMainWindow().getCayenneProject(), this);
-    }
-
-    @Override
-    public void endEditing()
-    {
-        LOGGER.debug("end editing " + this);
-
-        nameTextField.textProperty().unbindBidirectional(dataDomainAdapter.nameProperty());
-        objectValidationCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.validatingObjectsProperty());
-
-        objectCacheSizeSpinner.getValueFactory().valueProperty().unbindBidirectional(dataDomainAdapter.sizeOfObjectCacheProperty().asObject());
-        useSharedCacheCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.useSharedCacheProperty());
-//        remoteChangeNotificationsCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
-
-        customTransportFactoryClass.textProperty().unbindBidirectional(dataDomainAdapter.eventBridgeFactoryProperty());
-        multicastAddressTextField.textProperty().unbindBidirectional(dataDomainAdapter.javaGroupsMulticastAddressProperty());
-        multicastPortTextField.textProperty().unbindBidirectional(dataDomainAdapter.javaGroupsMulticastPortProperty());
-        jmsConnectionFactoryNameTextField.textProperty().unbindBidirectional(dataDomainAdapter.jmsConnectionFactoryProperty());
-
-//        NotificationCenter.removeProjectListener(getMainWindow().getCayenneProject(), this);
-////        BeanPathAdapter<CayenneModel> dataDomainAdapter = getDataDomainPropertyAdapterMap(getMainWindow().getCayenneModel());
-////
-////        dataDomainAdapter.fieldPathValueProperty().removeListener(changeObserver);
-////
-////        dataDomainAdapter.unBindBidirectional("dataDomainName", dataDomainNameTextField.textProperty());
-////        dataDomainAdapter.unBindBidirectional("dataDomainValidatingObjects", objectValidationCheckBox.selectedProperty());
-    }
+//        customTransportFactoryClass.textProperty().unbindBidirectional(dataDomainAdapter.eventBridgeFactoryProperty());
+//        multicastAddressTextField.textProperty().unbindBidirectional(dataDomainAdapter.javaGroupsMulticastAddressProperty());
+//        multicastPortTextField.textProperty().unbindBidirectional(dataDomainAdapter.javaGroupsMulticastPortProperty());
+//        jmsConnectionFactoryNameTextField.textProperty().unbindBidirectional(dataDomainAdapter.jmsConnectionFactoryProperty());
+//
+////        NotificationCenter.removeProjectListener(getMainWindow().getCayenneProject(),
this);
+//////        BeanPathAdapter<CayenneModel> dataDomainAdapter = getDataDomainPropertyAdapterMap(getMainWindow().getCayenneModel());
+//////
+//////        dataDomainAdapter.fieldPathValueProperty().removeListener(changeObserver);
+//////
+//////        dataDomainAdapter.unBindBidirectional("dataDomainName", dataDomainNameTextField.textProperty());
+//////        dataDomainAdapter.unBindBidirectional("dataDomainValidatingObjects", objectValidationCheckBox.selectedProperty());
+//    }
 
 
     @Override

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DataNodeConfigurationTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DataNodeConfigurationTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/DataNodeConfigurationTabLayout.java
index cb4c3be..d182f10 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DataNodeConfigurationTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DataNodeConfigurationTabLayout.java
@@ -20,6 +20,8 @@
 package org.apache.cayenne.modeler.layout;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy;
 import org.apache.cayenne.access.dbsync.SkipSchemaUpdateStrategy;
@@ -33,7 +35,6 @@ import org.apache.commons.logging.LogFactory;
 
 import de.jensd.fx.glyphs.GlyphsDude;
 import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
-import javafx.event.Event;
 import javafx.fxml.FXML;
 import javafx.scene.control.Button;
 import javafx.scene.control.ComboBox;
@@ -86,6 +87,8 @@ public class DataNodeConfigurationTabLayout
     private DataNodeAdapter dataNodeAdapter;
 //    private final DataNodeLayout parent;
 
+    private List<Binding<?>> bindings;
+
     private static final String[] standardSchemaUpdateStrategies =
         {
             SkipSchemaUpdateStrategy.class.getName(),
@@ -162,11 +165,11 @@ public class DataNodeConfigurationTabLayout
             });
     }
 
-    public void tabChanged(final Event event)
-    {
-        LOGGER.debug("event: " + event);
-        getMainWindow().getCayenneProject().getDataMaps();
-    }
+//    public void tabChanged(final Event event)
+//    {
+//        LOGGER.debug("event: " + event);
+//        getMainWindow().getCayenneProject().getDataMaps();
+//    }
 
     @Override
     public void setPropertyAdapter(final DataNodeAdapter dataNodeAdapter)
@@ -175,14 +178,28 @@ public class DataNodeConfigurationTabLayout
     }
 
     @Override
-    public void beginEditing()
+    public void initializeBindings()
     {
-        nameTextField.textProperty().bindBidirectional(dataNodeAdapter.nameProperty());
+        bindings = new ArrayList<>();
+
+        bindings.add(new Binding<>(nameTextField.textProperty(), dataNodeAdapter.nameProperty()));
     }
 
     @Override
-    public void endEditing()
+    public List<Binding<?>> getBindings()
     {
-        nameTextField.textProperty().unbindBidirectional(dataNodeAdapter.nameProperty());
+        return bindings;
     }
+
+//    @Override
+//    public void beginEditing()
+//    {
+//        nameTextField.textProperty().bindBidirectional(dataNodeAdapter.nameProperty());
+//    }
+//
+//    @Override
+//    public void endEditing()
+//    {
+//        nameTextField.textProperty().unbindBidirectional(dataNodeAdapter.nameProperty());
+//    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DataNodeDatabaseAdapterTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DataNodeDatabaseAdapterTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/DataNodeDatabaseAdapterTabLayout.java
index 26adafb..56e5e33 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DataNodeDatabaseAdapterTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DataNodeDatabaseAdapterTabLayout.java
@@ -25,8 +25,6 @@ import org.apache.cayenne.modeler.adapters.DataNodeAdapter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javafx.event.Event;
-
 public class DataNodeDatabaseAdapterTabLayout
     extends AbstractViewLayout
     implements DetailEditorSupport<DataNodeAdapter>
@@ -47,11 +45,11 @@ public class DataNodeDatabaseAdapterTabLayout
 //        super.initializeView();
 //    }
 
-    public void tabChanged(final Event event)
-    {
-        LOGGER.debug("event: " + event);
-        getMainWindow().getCayenneProject().getDataMaps();
-    }
+//    public void tabChanged(final Event event)
+//    {
+//        LOGGER.debug("event: " + event);
+//        getMainWindow().getCayenneProject().getDataMaps();
+//    }
 
     @Override
     public void setPropertyAdapter(final DataNodeAdapter dataNodeAdapter)
@@ -59,13 +57,13 @@ public class DataNodeDatabaseAdapterTabLayout
         this.dataNodeAdapter = dataNodeAdapter;
     }
 
-    @Override
-    public void beginEditing()
-    {
-    }
-
-    @Override
-    public void endEditing()
-    {
-    }
+//    @Override
+//    public void beginEditing()
+//    {
+//    }
+//
+//    @Override
+//    public void endEditing()
+//    {
+//    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DataNodeLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DataNodeLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/DataNodeLayout.java
index 5544f33..e7da80b 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DataNodeLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DataNodeLayout.java
@@ -25,7 +25,6 @@ import org.apache.cayenne.modeler.adapters.DataNodeAdapter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javafx.event.Event;
 import javafx.fxml.FXML;
 import javafx.scene.control.Tab;
 import javafx.scene.layout.AnchorPane;
@@ -83,36 +82,40 @@ public class DataNodeLayout
     {
         this.dataNodeAdapter = dataNodeAdapter;
 
-        dataNodeConfigurationTabLayout.setPropertyAdapter(dataNodeAdapter);
-        dataNodeDatabaseAdapterTabLayout.setPropertyAdapter(dataNodeAdapter);
-        dataNodePasswordEncoderTabLayout.setPropertyAdapter(dataNodeAdapter);
+//        dataNodeConfigurationTabLayout.setPropertyAdapter(dataNodeAdapter);
+//        dataNodeDatabaseAdapterTabLayout.setPropertyAdapter(dataNodeAdapter);
+//        dataNodePasswordEncoderTabLayout.setPropertyAdapter(dataNodeAdapter);
     }
 
     @Override
     public void beginEditing()
     {
-        LOGGER.debug("begin editing " + this);
+        DetailEditorSupport.super.beginEditing();
 
-        dataNodeConfigurationTabLayout.beginEditing();
-        dataNodeDatabaseAdapterTabLayout.beginEditing();
-        dataNodePasswordEncoderTabLayout.beginEditing();
+        dataNodeConfigurationTabLayout.showEditor(dataNodeAdapter);
+        dataNodeDatabaseAdapterTabLayout.showEditor(dataNodeAdapter);
+        dataNodePasswordEncoderTabLayout.showEditor(dataNodeAdapter);
+
+//        dataNodeConfigurationTabLayout.beginEditing();
+//        dataNodeDatabaseAdapterTabLayout.beginEditing();
+//        dataNodePasswordEncoderTabLayout.beginEditing();
     }
 
     @Override
     public void endEditing()
     {
-        LOGGER.debug("end editing " + this);
+        DetailEditorSupport.super.endEditing();
 
         dataNodeConfigurationTabLayout.endEditing();
         dataNodeDatabaseAdapterTabLayout.endEditing();
         dataNodePasswordEncoderTabLayout.endEditing();
     }
 
-    public void tabChanged(final Event event)
-    {
-        LOGGER.debug("event: " + event);
-        getMainWindow().getCayenneProject().getDataMaps();
-    }
+//    public void tabChanged(final Event event)
+//    {
+//        LOGGER.debug("event: " + event);
+//        getMainWindow().getCayenneProject().getDataMaps();
+//    }
 
     public void disablePasswordEncoderTab()
     {

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DataNodePasswordEncoderTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DataNodePasswordEncoderTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/DataNodePasswordEncoderTabLayout.java
index 0146aaf..9979b00 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DataNodePasswordEncoderTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DataNodePasswordEncoderTabLayout.java
@@ -110,13 +110,13 @@ public class DataNodePasswordEncoderTabLayout
         this.dataNodeAdapter = dataNodeAdapter;
     }
 
-    @Override
-    public void beginEditing()
-    {
-    }
-
-    @Override
-    public void endEditing()
-    {
-    }
+//    @Override
+//    public void beginEditing()
+//    {
+//    }
+//
+//    @Override
+//    public void endEditing()
+//    {
+//    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityColumnsTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityColumnsTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityColumnsTabLayout.java
index f7b1f23..6fc8fce 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityColumnsTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityColumnsTabLayout.java
@@ -32,7 +32,6 @@ import de.jensd.fx.glyphs.GlyphsDude;
 import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
 import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
-import javafx.event.Event;
 import javafx.fxml.FXML;
 import javafx.scene.control.TableColumn;
 
@@ -170,11 +169,11 @@ public class DatabaseEntityColumnsTabLayout
     }
 
 //    public void tabChanged(ActionEvent event)
-    public void tabChanged(final Event event)
-    {
-        LOGGER.debug("event: " + event);
-        getMainWindow().getCayenneProject().getDataMaps();
-    }
+//    public void tabChanged(final Event event)
+//    {
+//        LOGGER.debug("event: " + event);
+//        getMainWindow().getCayenneProject().getDataMaps();
+//    }
 
     @Override
     public void setPropertyAdapter(final DatabaseEntityAdapter databaseEntityAdapter)
@@ -182,13 +181,13 @@ public class DatabaseEntityColumnsTabLayout
         this.databaseEntityAdapter = databaseEntityAdapter;
     }
 
-    @Override
-    public void beginEditing()
-    {
-    }
-
-    @Override
-    public void endEditing()
-    {
-    }
+//    @Override
+//    public void beginEditing()
+//    {
+//    }
+//
+//    @Override
+//    public void endEditing()
+//    {
+//    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityLayout.java
index 2908d40..bb991c6 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityLayout.java
@@ -25,7 +25,6 @@ import org.apache.cayenne.modeler.adapters.DatabaseEntityAdapter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javafx.event.Event;
 import javafx.fxml.FXML;
 import javafx.scene.layout.AnchorPane;
 
@@ -70,31 +69,38 @@ public class DatabaseEntityLayout
         }
     }
 
-    public void tabChanged(final Event event)
-    {
-        LOGGER.debug("event: " + event);
-        getMainWindow().getCayenneProject().getDataMaps();
-    }
+//    public void tabChanged(final Event event)
+//    {
+//        LOGGER.debug("event: " + event);
+//        getMainWindow().getCayenneProject().getDataMaps();
+//    }
 
     @Override
     public void setPropertyAdapter(final DatabaseEntityAdapter databaseEntityAdapter)
     {
         this.databaseEntityAdapter = databaseEntityAdapter;
 
-        databaseEntityTableTabLayout.setPropertyAdapter(databaseEntityAdapter);
-        databaseEntityColumnsTabLayout.setPropertyAdapter(databaseEntityAdapter);
+//        databaseEntityTableTabLayout.setPropertyAdapter(databaseEntityAdapter);
+//        databaseEntityColumnsTabLayout.setPropertyAdapter(databaseEntityAdapter);
     }
 
     @Override
     public void beginEditing()
     {
-        databaseEntityTableTabLayout.beginEditing();
-        databaseEntityColumnsTabLayout.beginEditing();
+        DetailEditorSupport.super.beginEditing();
+
+        databaseEntityTableTabLayout.showEditor(databaseEntityAdapter);
+        databaseEntityColumnsTabLayout.showEditor(databaseEntityAdapter);
+
+//        databaseEntityTableTabLayout.beginEditing();
+//        databaseEntityColumnsTabLayout.beginEditing();
     }
 
     @Override
     public void endEditing()
     {
+        DetailEditorSupport.super.endEditing();
+
         databaseEntityTableTabLayout.endEditing();
         databaseEntityColumnsTabLayout.endEditing();
     }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityTableTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityTableTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityTableTabLayout.java
index 0c9ace1..f861ed4 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityTableTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DatabaseEntityTableTabLayout.java
@@ -48,13 +48,13 @@ public class DatabaseEntityTableTabLayout
         this.databaseEntityAdapter = databaseEntityAdapter;
     }
 
-    @Override
-    public void beginEditing()
-    {
-    }
-
-    @Override
-    public void endEditing()
-    {
-    }
+//    @Override
+//    public void beginEditing()
+//    {
+//    }
+//
+//    @Override
+//    public void endEditing()
+//    {
+//    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/DetailEditorSupport.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DetailEditorSupport.java b/src/main/java/org/apache/cayenne/modeler/layout/DetailEditorSupport.java
index b1cf376..6e876dc 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DetailEditorSupport.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DetailEditorSupport.java
@@ -47,19 +47,29 @@ public interface DetailEditorSupport<T extends CayennePropertyAdapter>
         return new ArrayList<>();
     }
 
-    void setPropertyAdapter(T propertyAdapter);
-
     default void beginEditing()
     {
         LOGGER.debug("begin editing " + this);
 
-        getBindings().stream().forEach(binding -> binding.bind());
+        bind(getBindings());
     }
 
     default void endEditing()
     {
         LOGGER.debug("end editing " + this);
 
-        getBindings().stream().forEach(binding -> binding.unbind());
+        unbind(getBindings());
+    }
+
+    default void bind(List<Binding<?>> bindings)
+    {
+        bindings.stream().forEach(binding -> binding.bind());
+    }
+
+    default void unbind(List<Binding<?>> bindings)
+    {
+        bindings.stream().forEach(binding -> binding.unbind());
     }
+
+    void setPropertyAdapter(T propertyAdapter);
 }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
index 2bfc747..5bc7be7 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
@@ -196,6 +196,7 @@ public class MainWindowLayout
                         observable.getValue().getParent();
 
 //                      displayDataDomain((DataDomainTreeItem) newValue);
+//                      displayDataMap((DataMapTreeItem) newValue);
 //                      displayObjectEntity((ObjectEntityTreeItem) newValue);
 //                      displayDatabaseEntity((DatabaseEntityTreeItem) newValue);
 //                      displayDataNode((DataNodeTreeItem) newValue);
@@ -203,7 +204,7 @@ public class MainWindowLayout
                         if (newValue instanceof DataDomainTreeItem)
                             displayDetailEditor(getDataDomainDetail(), ((DataDomainTreeItem)
newValue).getPropertyAdapter());
                         else if (newValue instanceof DataMapTreeItem)
-                            displayDataMap((DataMapTreeItem) newValue);
+                            displayDetailEditor(getDataMapDetail(), ((DataMapTreeItem) newValue).getPropertyAdapter());
                         else if (newValue instanceof ObjectEntityTreeItem)
                             displayDetailEditor(getObjectEntityDetail(), ((ObjectEntityTreeItem)
newValue).getPropertyAdapter());
                         else if (newValue instanceof DatabaseEntityTreeItem)
@@ -310,16 +311,10 @@ public class MainWindowLayout
         final DataNodeTreeItem dataMapBranch = new DataNodeTreeItem(dataNodeAdapter, dataDomainBranch);
     }
 
-    private <T extends CayennePropertyAdapter> void displayDetailEditor(DetailEditorSupport<T>
des, T cpa)
+    private <T extends CayennePropertyAdapter> void displayDetailEditor(DetailEditorSupport<T>
detailEditor, T propertyAdapter)
     {
-//        @SuppressWarnings("unchecked")
-//        DetailEditorSupport<? extends CayennePropertyAdapter> des = (DetailEditorSupport<?
extends CayennePropertyAdapter>) avl;
-
-//        T<? extends CayennePropertyAdapter> cpa2;
-
-        displayDetailView((Node) des);
-        des.setPropertyAdapter(cpa);
-        des.beginEditing();
+        displayDetailView((Node) detailEditor);
+        detailEditor.showEditor(propertyAdapter);
     }
 //    private void displayDataDomain(final DataDomainTreeViewModel domain)
 //    private void displayDataDomain(final DataDomainTreeItem dataDomainTreeItem) throws
IOException
@@ -329,13 +324,13 @@ public class MainWindowLayout
 //        getDataDomainDetail().beginEditing();
 //    }
 
-    private void displayDataMap(final DataMapTreeItem dataMapTreeItem) throws IOException
-    {
-        displayDetailView(getDataMapDetail());
-        getDataMapDetail().showEditor(dataMapTreeItem.getPropertyAdapter());
-//        getDataMapDetail().setPropertyAdapter(dataMapTreeItem.getPropertyAdapter());
-//        getDataMapDetail().beginEditing();
-    }
+//    private void displayDataMap(final DataMapTreeItem dataMapTreeItem) throws IOException
+//    {
+//        displayDetailView(getDataMapDetail());
+//        getDataMapDetail().showEditor(dataMapTreeItem.getPropertyAdapter());
+////        getDataMapDetail().setPropertyAdapter(dataMapTreeItem.getPropertyAdapter());
+////        getDataMapDetail().beginEditing();
+//    }
 
 //    private void displayDataNode(final DataNodeTreeItem dataNodeTreeItem) throws IOException
 //    {

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityAttributesTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityAttributesTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityAttributesTabLayout.java
index e3d368e..1e38739 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityAttributesTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityAttributesTabLayout.java
@@ -20,6 +20,8 @@
 package org.apache.cayenne.modeler.layout;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.cayenne.modeler.adapters.ObjectAttributeAdapter;
 import org.apache.cayenne.modeler.adapters.ObjectEntityAdapter;
@@ -221,15 +223,27 @@ public class ObjectEntityAttributesTabLayout
         this.objectEntityAdapter = objectEntityAdapter;
     }
 
-    private final ChangeListener<ObjectAttributeAdapter> attributesTableViewSelectionListener
= (obs, oldSelection, newSelection) ->
+    private List<Binding<?>> getSelectedAttributeBindings(ObjectAttributeAdapter
adapter)
+    {
+        List<Binding<?>> bindings = new ArrayList<>();
+
+        bindings.add(new Binding<>(javaAttributeNameTextField.textProperty(), adapter.nameProperty()));
+        bindings.add(new Binding<>(javaTypeComboBox.valueProperty(), adapter.javaTypeProperty()));
+        bindings.add(new Binding<>(optimisticLockingCheckBox.selectedProperty(), adapter.usedForLockingProperty()));
+
+        return bindings;
+    }
+
+    private final ChangeListener<ObjectAttributeAdapter> attributesTableViewSelectionListener
= (observable, oldSelection, newSelection) ->
         {
             final String[] javaTypes = ObjectEntityUtilities.getRegisteredTypeNames();
 
             if (oldSelection != null)
             {
-                javaAttributeNameTextField.textProperty().unbindBidirectional(oldSelection.nameProperty());
-                javaTypeComboBox.valueProperty().unbindBidirectional(oldSelection.javaTypeProperty());
-                optimisticLockingCheckBox.selectedProperty().unbindBidirectional(oldSelection.usedForLockingProperty());
+                unbind(getSelectedAttributeBindings(oldSelection));
+//                javaAttributeNameTextField.textProperty().unbindBidirectional(oldSelection.nameProperty());
+//                javaTypeComboBox.valueProperty().unbindBidirectional(oldSelection.javaTypeProperty());
+//                optimisticLockingCheckBox.selectedProperty().unbindBidirectional(oldSelection.usedForLockingProperty());
             }
 
             javaTypeComboBox.getItems().clear();
@@ -238,9 +252,11 @@ public class ObjectEntityAttributesTabLayout
             {
                 javaTypeComboBox.getItems().addAll(javaTypes);
 
-                javaAttributeNameTextField.textProperty().bindBidirectional(newSelection.nameProperty());
-                javaTypeComboBox.valueProperty().bindBidirectional(newSelection.javaTypeProperty());
-                optimisticLockingCheckBox.selectedProperty().bindBidirectional(newSelection.usedForLockingProperty());
+                bind(getSelectedAttributeBindings(newSelection));
+
+//                javaAttributeNameTextField.textProperty().bindBidirectional(newSelection.nameProperty());
+//                javaTypeComboBox.valueProperty().bindBidirectional(newSelection.javaTypeProperty());
+//                optimisticLockingCheckBox.selectedProperty().bindBidirectional(newSelection.usedForLockingProperty());
                 databaseTypeLabel.setText(newSelection.getDatabaseType());
             }
 
@@ -252,6 +268,8 @@ public class ObjectEntityAttributesTabLayout
     @Override
     public void beginEditing()
     {
+        DetailEditorSupport.super.beginEditing();
+
         disable(javaAttributeNameTextField);
         javaAttributeNameTextField.setText(null);
 
@@ -275,13 +293,17 @@ public class ObjectEntityAttributesTabLayout
     @Override
     public void endEditing()
     {
+        DetailEditorSupport.super.endEditing();
+
         final ObjectAttributeAdapter currentObjectAttributeAdapter = attributesTableView.getSelectionModel().getSelectedItem();
 
         if (currentObjectAttributeAdapter != null)
         {
-            javaAttributeNameTextField.textProperty().unbindBidirectional(currentObjectAttributeAdapter.nameProperty());
-            javaTypeComboBox.valueProperty().unbindBidirectional(currentObjectAttributeAdapter.javaTypeProperty());
-            optimisticLockingCheckBox.selectedProperty().unbindBidirectional(currentObjectAttributeAdapter.usedForLockingProperty());
+            unbind(getSelectedAttributeBindings(currentObjectAttributeAdapter));
+
+//            javaAttributeNameTextField.textProperty().unbindBidirectional(currentObjectAttributeAdapter.nameProperty());
+//            javaTypeComboBox.valueProperty().unbindBidirectional(currentObjectAttributeAdapter.javaTypeProperty());
+//            optimisticLockingCheckBox.selectedProperty().unbindBidirectional(currentObjectAttributeAdapter.usedForLockingProperty());
         }
 
         attributesTableView.getSelectionModel().selectedItemProperty().removeListener(attributesTableViewSelectionListener);

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityClassTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityClassTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityClassTabLayout.java
index e1896e4..a483e5d 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityClassTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityClassTabLayout.java
@@ -20,6 +20,8 @@
 package org.apache.cayenne.modeler.layout;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.cayenne.modeler.adapters.ObjectEntityAdapter;
 import org.apache.commons.logging.Log;
@@ -47,6 +49,8 @@ public class ObjectEntityClassTabLayout
 
     private ObjectEntityAdapter objectEntityAdapter;
 
+    private List<Binding<?>> bindings;
+
     public ObjectEntityClassTabLayout(final MainWindowSupport parentComponent) throws IOException
     {
         super(parentComponent, "/layouts/ObjectEntityClassTabLayout.fxml");
@@ -70,21 +74,34 @@ public class ObjectEntityClassTabLayout
         this.objectEntityAdapter = objectEntityAdapter;
     }
 
-
     @Override
-    public void beginEditing()
+    public void initializeBindings()
     {
-        LOGGER.debug("begin editing " + this);
+        bindings = new ArrayList<>();
 
-        abstractClassCheckbox.selectedProperty().bindBidirectional(objectEntityAdapter.abstractClassProperty());
+        bindings.add(new Binding<>(abstractClassCheckbox.selectedProperty(), objectEntityAdapter.abstractClassProperty()));
     }
 
-
     @Override
-    public void endEditing()
+    public List<Binding<?>> getBindings()
     {
-        LOGGER.debug("end editing " + this);
-
-        abstractClassCheckbox.selectedProperty().unbindBidirectional(objectEntityAdapter.abstractClassProperty());
+        return bindings;
     }
+
+//    @Override
+//    public void beginEditing()
+//    {
+//        LOGGER.debug("begin editing " + this);
+//
+//        abstractClassCheckbox.selectedProperty().bindBidirectional(objectEntityAdapter.abstractClassProperty());
+//    }
+
+
+//    @Override
+//    public void endEditing()
+//    {
+//        LOGGER.debug("end editing " + this);
+//
+//        abstractClassCheckbox.selectedProperty().unbindBidirectional(objectEntityAdapter.abstractClassProperty());
+//    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityLayout.java
index 44ce183..19118d9 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityLayout.java
@@ -21,12 +21,10 @@ package org.apache.cayenne.modeler.layout;
 
 import java.io.IOException;
 
-import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.modeler.adapters.ObjectEntityAdapter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javafx.event.Event;
 import javafx.fxml.FXML;
 import javafx.scene.layout.AnchorPane;
 
@@ -72,43 +70,47 @@ public class ObjectEntityLayout
         }
     }
 
-    @Deprecated // Unused?
-    public void display(final ObjEntity objEntity)
-    {
-        LOGGER.debug("trying to display: " + objEntity);
-    }
+//    @Deprecated // Unused?
+//    public void display(final ObjEntity objEntity)
+//    {
+//        LOGGER.debug("trying to display: " + objEntity);
+//    }
 
 //    public void tabChanged(ActionEvent event)
-    public void tabChanged(final Event event)
-    {
-        LOGGER.debug("event: " + event);
-        getMainWindow().getCayenneProject().getDataMaps();
-    }
+//    public void tabChanged(final Event event)
+//    {
+//        LOGGER.debug("event: " + event);
+//        getMainWindow().getCayenneProject().getDataMaps();
+//    }
 
     @Override
     public void setPropertyAdapter(final ObjectEntityAdapter objectEntityAdapter)
     {
         this.objectEntityAdapter = objectEntityAdapter;
 
-        objectEntityClassTabLayout.setPropertyAdapter(objectEntityAdapter);
-        objectEntityAttributesTabLayout.setPropertyAdapter(objectEntityAdapter);
-        objectEntityRelationshipsTabLayout.setPropertyAdapter(objectEntityAdapter);
+//        objectEntityClassTabLayout.setPropertyAdapter(objectEntityAdapter);
+//        objectEntityAttributesTabLayout.setPropertyAdapter(objectEntityAdapter);
+//        objectEntityRelationshipsTabLayout.setPropertyAdapter(objectEntityAdapter);
     }
 
     @Override
     public void beginEditing()
     {
-        LOGGER.debug("begin editing " + this);
+        DetailEditorSupport.super.beginEditing();
+
+        objectEntityClassTabLayout.showEditor(objectEntityAdapter);
+        objectEntityAttributesTabLayout.showEditor(objectEntityAdapter);
+        objectEntityRelationshipsTabLayout.showEditor(objectEntityAdapter);
 
-        objectEntityClassTabLayout.beginEditing();
-        objectEntityAttributesTabLayout.beginEditing();
-        objectEntityRelationshipsTabLayout.beginEditing();
+//        objectEntityClassTabLayout.beginEditing();
+//        objectEntityAttributesTabLayout.beginEditing();
+//        objectEntityRelationshipsTabLayout.beginEditing();
     }
 
     @Override
     public void endEditing()
     {
-        LOGGER.debug("end editing " + this);
+        DetailEditorSupport.super.endEditing();
 
         objectEntityClassTabLayout.endEditing();
         objectEntityAttributesTabLayout.endEditing();

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/4b66c8b1/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityRelationshipsTabLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityRelationshipsTabLayout.java
b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityRelationshipsTabLayout.java
index 96ef74a..acbc2bb 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityRelationshipsTabLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/ObjectEntityRelationshipsTabLayout.java
@@ -20,6 +20,8 @@
 package org.apache.cayenne.modeler.layout;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.cayenne.modeler.adapters.ObjectAttributeAdapter;
 import org.apache.cayenne.modeler.adapters.ObjectEntityAdapter;
@@ -193,15 +195,28 @@ public class ObjectEntityRelationshipsTabLayout
         this.objectEntityAdapter = objectEntityAdapter;
     }
 
-    private final ChangeListener<ObjectAttributeAdapter> attributesTableViewSelectionListener
= (obs, oldSelection, newSelection) ->
+    private List<Binding<?>> getSelectedAttributeBindings(ObjectAttributeAdapter
adapter)
+    {
+        List<Binding<?>> bindings = new ArrayList<>();
+
+        bindings.add(new Binding<>(javaAttributeNameTextField.textProperty(), adapter.nameProperty()));
+        bindings.add(new Binding<>(javaTypeComboBox.valueProperty(), adapter.javaTypeProperty()));
+        bindings.add(new Binding<>(optimisticLockingCheckBox.selectedProperty(), adapter.usedForLockingProperty()));
+
+        return bindings;
+    }
+
+    private final ChangeListener<ObjectAttributeAdapter> attributesTableViewSelectionListener
= (observable, oldSelection, newSelection) ->
         {
             final String[] javaTypes = ObjectEntityUtilities.getRegisteredTypeNames();
 
             if (oldSelection != null)
             {
-                javaAttributeNameTextField.textProperty().unbindBidirectional(oldSelection.nameProperty());
-                javaTypeComboBox.valueProperty().unbindBidirectional(oldSelection.javaTypeProperty());
-                optimisticLockingCheckBox.selectedProperty().unbindBidirectional(oldSelection.usedForLockingProperty());
+                unbind(getSelectedAttributeBindings(oldSelection));
+
+//                javaAttributeNameTextField.textProperty().unbindBidirectional(oldSelection.nameProperty());
+//                javaTypeComboBox.valueProperty().unbindBidirectional(oldSelection.javaTypeProperty());
+//                optimisticLockingCheckBox.selectedProperty().unbindBidirectional(oldSelection.usedForLockingProperty());
             }
 
             javaTypeComboBox.getItems().clear();
@@ -210,9 +225,11 @@ public class ObjectEntityRelationshipsTabLayout
             {
                 javaTypeComboBox.getItems().addAll(javaTypes);
 
-                javaAttributeNameTextField.textProperty().bindBidirectional(newSelection.nameProperty());
-                javaTypeComboBox.valueProperty().bindBidirectional(newSelection.javaTypeProperty());
-                optimisticLockingCheckBox.selectedProperty().bindBidirectional(newSelection.usedForLockingProperty());
+                bind(getSelectedAttributeBindings(newSelection));
+
+//                javaAttributeNameTextField.textProperty().bindBidirectional(newSelection.nameProperty());
+//                javaTypeComboBox.valueProperty().bindBidirectional(newSelection.javaTypeProperty());
+//                optimisticLockingCheckBox.selectedProperty().bindBidirectional(newSelection.usedForLockingProperty());
                 databaseTypeLabel.setText(newSelection.getDatabaseType());
             }
 
@@ -224,6 +241,8 @@ public class ObjectEntityRelationshipsTabLayout
     @Override
     public void beginEditing()
     {
+        DetailEditorSupport.super.beginEditing();
+
         disable(javaAttributeNameTextField);
         javaAttributeNameTextField.setText(null);
 
@@ -247,13 +266,17 @@ public class ObjectEntityRelationshipsTabLayout
     @Override
     public void endEditing()
     {
+        DetailEditorSupport.super.endEditing();
+
         final ObjectAttributeAdapter currentObjectAttributeAdapter = relationshipsTableView.getSelectionModel().getSelectedItem();
 
         if (currentObjectAttributeAdapter != null)
         {
-            javaAttributeNameTextField.textProperty().unbindBidirectional(currentObjectAttributeAdapter.nameProperty());
-            javaTypeComboBox.valueProperty().unbindBidirectional(currentObjectAttributeAdapter.javaTypeProperty());
-            optimisticLockingCheckBox.selectedProperty().unbindBidirectional(currentObjectAttributeAdapter.usedForLockingProperty());
+            unbind(getSelectedAttributeBindings(currentObjectAttributeAdapter));
+
+//            javaAttributeNameTextField.textProperty().unbindBidirectional(currentObjectAttributeAdapter.nameProperty());
+//            javaTypeComboBox.valueProperty().unbindBidirectional(currentObjectAttributeAdapter.javaTypeProperty());
+//            optimisticLockingCheckBox.selectedProperty().unbindBidirectional(currentObjectAttributeAdapter.usedForLockingProperty());
         }
 
         relationshipsTableView.getSelectionModel().selectedItemProperty().removeListener(attributesTableViewSelectionListener);


Mime
View raw message