cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r810422 [3/3] - in /cayenne/main/trunk/framework: cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/ cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ cayenne-modeler/src/main/java/org/apache/cayenne/m...
Date Wed, 02 Sep 2009 08:52:40 GMT
Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/EmbeddableDisplayListener.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/EmbeddableDisplayListener.java?rev=810422&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/EmbeddableDisplayListener.java
(added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/EmbeddableDisplayListener.java
Wed Sep  2 08:52:39 2009
@@ -0,0 +1,26 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.event;
+
+import java.util.EventListener;
+
+public interface EmbeddableDisplayListener extends EventListener {
+
+    public void currentEmbeddableChanged(EmbeddableDisplayEvent e);
+}

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CellRenderers.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CellRenderers.java?rev=810422&r1=810421&r2=810422&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CellRenderers.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CellRenderers.java
Wed Sep  2 08:52:39 2009
@@ -38,6 +38,7 @@
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.Embeddable;
 import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.map.MappingNamespace;
 import org.apache.cayenne.map.ObjEntity;
@@ -65,6 +66,7 @@
     protected static ImageIcon attributeIcon;
     protected static ImageIcon procedureIcon;
     protected static ImageIcon queryIcon;
+    protected static ImageIcon embeddableIcon;
 
     static {
         domainIcon = ModelerUtil.buildIcon("icon-dom.gif");
@@ -76,6 +78,7 @@
         queryIcon = ModelerUtil.buildIcon("icon-query.gif");
         relationshipIcon = ModelerUtil.buildIcon("icon-relationship.gif");
         attributeIcon = ModelerUtil.buildIcon("icon-attribute.gif");
+        embeddableIcon = ModelerUtil.buildIcon("icon-embeddable.gif");
     }
 
     public static ImageIcon iconForObject(Object object) {
@@ -113,6 +116,9 @@
         else if (object instanceof Attribute) {
             return attributeIcon;
         }
+        else if (object instanceof Embeddable) {
+            return embeddableIcon;
+        }
 
         return null;
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java?rev=810422&r1=810421&r2=810422&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java
Wed Sep  2 08:52:39 2009
@@ -33,6 +33,8 @@
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
 import org.apache.cayenne.map.DbRelationship;
+import org.apache.cayenne.map.Embeddable;
+import org.apache.cayenne.map.EmbeddableAttribute;
 import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.map.MappingNamespace;
@@ -220,6 +222,22 @@
             entity.addAttribute(attribute);
         }
     }
+    
+    
+    /**
+     * Changes the name of the embeddable attribute and all references to this embeddable
attribute.
+     */
+    public static void setEmbeddableAttributeName(EmbeddableAttribute attribute, String newName)
{
+        String oldName = attribute.getName();
+
+        attribute.setName(newName);
+        Embeddable embeddable = attribute.getEmbeddable();
+        
+        if (embeddable != null) {
+            embeddable.removeAttribute(oldName);
+            embeddable.addAttribute(attribute);
+        }
+    }
 
     /** Changes the name of the attribute in all places in DataMap. */
     public static void setRelationshipName(Entity entity, Relationship rel, String newName)
{

Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-embeddable.gif
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-embeddable.gif?rev=810422&view=auto
==============================================================================
Files cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-embeddable.gif
(added) and cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-embeddable.gif
Wed Sep  2 08:52:39 2009 differ

Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-new_embeddable.gif
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-new_embeddable.gif?rev=810422&view=auto
==============================================================================
Files cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-new_embeddable.gif
(added) and cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-new_embeddable.gif
Wed Sep  2 08:52:39 2009 differ



Mime
View raw message