cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject cayenne-modeler git commit: Generalized more dispatch code.
Date Sun, 04 Jun 2017 15:18:31 GMT
Repository: cayenne-modeler
Updated Branches:
  refs/heads/master 1edef7d53 -> e59fb943e


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/e59fb943
Tree: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/tree/e59fb943
Diff: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/diff/e59fb943

Branch: refs/heads/master
Commit: e59fb943efc517900a795e5240d7789ad6362b1d
Parents: 1edef7d
Author: mgentry <michael.r.gentry20.ctr@mail.mil>
Authored: Sun Jun 4 11:06:48 2017 -0400
Committer: mgentry <michael.r.gentry20.ctr@mail.mil>
Committed: Sun Jun 4 11:06:48 2017 -0400

----------------------------------------------------------------------
 .../modeler/layout/DetailEditorSupport.java     |  4 +-
 .../modeler/layout/MainWindowLayout.java        | 77 ++++++++++++--------
 2 files changed, 50 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/e59fb943/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 5073f86..b1cf376 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DetailEditorSupport.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DetailEditorSupport.java
@@ -30,7 +30,7 @@ public interface DetailEditorSupport<T extends CayennePropertyAdapter>
 {
     static final Log LOGGER = LogFactory.getLog(DetailEditorSupport.class);
 
-    default void showLayout(final T propertyAdapter)
+    default void showEditor(final T propertyAdapter)
     {
         setPropertyAdapter(propertyAdapter);
         initializeBindings();
@@ -47,7 +47,7 @@ public interface DetailEditorSupport<T extends CayennePropertyAdapter>
         return new ArrayList<>();
     }
 
-    void setPropertyAdapter(final T propertyAdapter);
+    void setPropertyAdapter(T propertyAdapter);
 
     default void beginEditing()
     {

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/e59fb943/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 b818cb3..2bfc747 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.Optional;
 
 import org.apache.cayenne.modeler.CayenneModeler;
+import org.apache.cayenne.modeler.adapters.CayennePropertyAdapter;
 import org.apache.cayenne.modeler.adapters.DataMapAdapter;
 import org.apache.cayenne.modeler.adapters.DataNodeAdapter;
 import org.apache.cayenne.modeler.adapters.DatabaseEntityAdapter;
@@ -194,16 +195,21 @@ public class MainWindowLayout
                     {
                         observable.getValue().getParent();
 
+//                      displayDataDomain((DataDomainTreeItem) newValue);
+//                      displayObjectEntity((ObjectEntityTreeItem) newValue);
+//                      displayDatabaseEntity((DatabaseEntityTreeItem) newValue);
+//                      displayDataNode((DataNodeTreeItem) newValue);
+
                         if (newValue instanceof DataDomainTreeItem)
-                            displayDataDomain((DataDomainTreeItem) newValue);
+                            displayDetailEditor(getDataDomainDetail(), ((DataDomainTreeItem)
newValue).getPropertyAdapter());
                         else if (newValue instanceof DataMapTreeItem)
                             displayDataMap((DataMapTreeItem) newValue);
                         else if (newValue instanceof ObjectEntityTreeItem)
-                            displayObjectEntity((ObjectEntityTreeItem) newValue);
+                            displayDetailEditor(getObjectEntityDetail(), ((ObjectEntityTreeItem)
newValue).getPropertyAdapter());
                         else if (newValue instanceof DatabaseEntityTreeItem)
-                            displayDatabaseEntity((DatabaseEntityTreeItem) newValue);
+                            displayDetailEditor(getDatabaseEntityDetail(), ((DatabaseEntityTreeItem)
newValue).getPropertyAdapter());
                         else if (newValue instanceof DataNodeTreeItem)
-                            displayDataNode((DataNodeTreeItem) newValue);
+                            displayDetailEditor(getDataNodeDetail(), ((DataNodeTreeItem)
newValue).getPropertyAdapter());
 //                    if (newValue.getValue() instanceof DataDomainTreeViewModel)
 //                        displayDataDomain((DataDomainTreeViewModel) newValue.getValue());
 //                    else if (newValue.getValue() instanceof DataMapTreeViewModel)
@@ -303,41 +309,54 @@ public class MainWindowLayout
     {
         final DataNodeTreeItem dataMapBranch = new DataNodeTreeItem(dataNodeAdapter, dataDomainBranch);
     }
-//    private void displayDataDomain(final DataDomainTreeViewModel domain)
-    private void displayDataDomain(final DataDomainTreeItem dataDomainTreeItem) throws IOException
+
+    private <T extends CayennePropertyAdapter> void displayDetailEditor(DetailEditorSupport<T>
des, T cpa)
     {
-        displayDetailView(getDataDomainDetail());
-        getDataDomainDetail().setPropertyAdapter(dataDomainTreeItem.getPropertyAdapter());
-        getDataDomainDetail().beginEditing();
+//        @SuppressWarnings("unchecked")
+//        DetailEditorSupport<? extends CayennePropertyAdapter> des = (DetailEditorSupport<?
extends CayennePropertyAdapter>) avl;
+
+//        T<? extends CayennePropertyAdapter> cpa2;
+
+        displayDetailView((Node) des);
+        des.setPropertyAdapter(cpa);
+        des.beginEditing();
     }
+//    private void displayDataDomain(final DataDomainTreeViewModel domain)
+//    private void displayDataDomain(final DataDomainTreeItem dataDomainTreeItem) throws
IOException
+//    {
+//        displayDetailView(getDataDomainDetail());
+//        getDataDomainDetail().setPropertyAdapter(dataDomainTreeItem.getPropertyAdapter());
+//        getDataDomainDetail().beginEditing();
+//    }
 
     private void displayDataMap(final DataMapTreeItem dataMapTreeItem) throws IOException
     {
         displayDetailView(getDataMapDetail());
-        getDataMapDetail().setPropertyAdapter(dataMapTreeItem.getPropertyAdapter());
-        getDataMapDetail().beginEditing();
+        getDataMapDetail().showEditor(dataMapTreeItem.getPropertyAdapter());
+//        getDataMapDetail().setPropertyAdapter(dataMapTreeItem.getPropertyAdapter());
+//        getDataMapDetail().beginEditing();
     }
 
-    private void displayDataNode(final DataNodeTreeItem dataNodeTreeItem) throws IOException
-    {
-        displayDetailView(getDataNodeDetail());
-        getDataNodeDetail().setPropertyAdapter(dataNodeTreeItem.getPropertyAdapter());
-        getDataNodeDetail().beginEditing();
-    }
+//    private void displayDataNode(final DataNodeTreeItem dataNodeTreeItem) throws IOException
+//    {
+//        displayDetailView(getDataNodeDetail());
+//        getDataNodeDetail().setPropertyAdapter(dataNodeTreeItem.getPropertyAdapter());
+//        getDataNodeDetail().beginEditing();
+//    }
 
-    private void displayObjectEntity(final ObjectEntityTreeItem objectEntityTreeItem) throws
IOException
-    {
-        displayDetailView(getObjectEntityDetail());
-        getObjectEntityDetail().setPropertyAdapter(objectEntityTreeItem.getPropertyAdapter());
-        getObjectEntityDetail().beginEditing();
-    }
+//    private void displayObjectEntity(final ObjectEntityTreeItem objectEntityTreeItem) throws
IOException
+//    {
+//        displayDetailView(getObjectEntityDetail());
+//        getObjectEntityDetail().setPropertyAdapter(objectEntityTreeItem.getPropertyAdapter());
+//        getObjectEntityDetail().beginEditing();
+//    }
 
-    private void displayDatabaseEntity(final DatabaseEntityTreeItem databaseEntityTreeItem)
throws IOException
-    {
-        displayDetailView(getDatabaseEntityDetail());
-        getDatabaseEntityDetail().setPropertyAdapter(databaseEntityTreeItem.getPropertyAdapter());
-        getDatabaseEntityDetail().beginEditing();
-    }
+//    private void displayDatabaseEntity(final DatabaseEntityTreeItem databaseEntityTreeItem)
throws IOException
+//    {
+//        displayDetailView(getDatabaseEntityDetail());
+//        getDatabaseEntityDetail().setPropertyAdapter(databaseEntityTreeItem.getPropertyAdapter());
+//        getDatabaseEntityDetail().beginEditing();
+//    }
 
     private void displayDetailView(final Node detailView)
     {


Mime
View raw message