cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: Java 8 style
Date Sat, 23 Sep 2017 16:00:16 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 84358ab8f -> 588c23744


Java 8 style


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

Branch: refs/heads/master
Commit: 588c237443cc5e18031a62c233707b75612f717c
Parents: 84358ab
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Sat Sep 23 19:00:06 2017 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Sat Sep 23 19:00:06 2017 +0300

----------------------------------------------------------------------
 .../modeler/graph/extension/GraphHandler.java   | 52 +++++++++-----------
 1 file changed, 23 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/588c2374/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/extension/GraphHandler.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/extension/GraphHandler.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/extension/GraphHandler.java
index ea388b3..ef36fbc 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/extension/GraphHandler.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/extension/GraphHandler.java
@@ -18,13 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.modeler.graph.extension;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.swing.undo.UndoableEdit;
-
-import org.apache.cayenne.configuration.DataChannelDescriptor;
-import org.apache.cayenne.configuration.xml.DataChannelLoaderListener;
 import org.apache.cayenne.configuration.xml.NamespaceAwareNestedTagHandler;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.graph.GraphBuilder;
@@ -37,6 +30,10 @@ import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
+import javax.swing.undo.UndoableEdit;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Class to load graph from XML
  */
@@ -54,31 +51,28 @@ class GraphHandler extends NamespaceAwareNestedTagHandler {
             
     public GraphHandler(NamespaceAwareNestedTagHandler parent, final Application application)
{
         super(parent);
-        loaderContext.addDataChannelListener(new DataChannelLoaderListener() {
-            @Override
-            public void onDataChannelLoaded(DataChannelDescriptor dataChannelDescriptor)
{
-                GraphRegistry registry = application.getMetaData().get(dataChannelDescriptor,
GraphRegistry.class);
-                if(registry == null) {
-                    registry = new GraphRegistry();
-                    application.getMetaData().add(dataChannelDescriptor, registry);
-                }
-
-                GraphMap map = registry.getGraphMap(dataChannelDescriptor);
-                //apply changes
-                GraphBuilder builder = map.createGraphBuilder(graphType, false);
-                builder.getGraph().setScale(scale);
+        loaderContext.addDataChannelListener(dataChannelDescriptor -> {
+            GraphRegistry registry = application.getMetaData().get(dataChannelDescriptor,
GraphRegistry.class);
+            if(registry == null) {
+                registry = new GraphRegistry();
+                application.getMetaData().add(dataChannelDescriptor, registry);
+            }
 
-                // lookup
-                Map<DefaultGraphCell, Map<String, ?>> propertiesMap = new HashMap<>();
-                for(Map.Entry<String, Map<String, ?>> entry : GraphHandler.this.propertiesMap.entrySet())
{
-                    DefaultGraphCell cell = builder.getEntityCell(entry.getKey());
-                    propertiesMap.put(cell, entry.getValue());
-                }
+            GraphMap map = registry.getGraphMap(dataChannelDescriptor);
+            //apply changes
+            GraphBuilder builder = map.createGraphBuilder(graphType, false);
+            builder.getGraph().setScale(scale);
 
-                builder.getGraph().getGraphLayoutCache().getModel().removeUndoableEditListener(builder);
-                builder.getGraph().getGraphLayoutCache().edit(propertiesMap, null, null,
new UndoableEdit[0]);
-                builder.getGraph().getGraphLayoutCache().getModel().addUndoableEditListener(builder);
+            // lookup
+            Map<DefaultGraphCell, Map<String, ?>> propertiesMap = new HashMap<>();
+            for(Map.Entry<String, Map<String, ?>> entry : GraphHandler.this.propertiesMap.entrySet())
{
+                DefaultGraphCell cell = builder.getEntityCell(entry.getKey());
+                propertiesMap.put(cell, entry.getValue());
             }
+
+            builder.getGraph().getGraphLayoutCache().getModel().removeUndoableEditListener(builder);
+            builder.getGraph().getGraphLayoutCache().edit(propertiesMap, null, null, new
UndoableEdit[0]);
+            builder.getGraph().getGraphLayoutCache().getModel().addUndoableEditListener(builder);
         });
     }
 


Mime
View raw message