cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From and...@apache.org
Subject svn commit: r783690 - /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTab.java
Date Thu, 11 Jun 2009 08:32:10 GMT
Author: andrey
Date: Thu Jun 11 08:32:09 2009
New Revision: 783690

URL: http://svn.apache.org/viewvc?rev=783690&view=rev
Log:
CAY-1235 Implement qualifiers for DBEntities. Modeler support

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTab.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTab.java?rev=783690&r1=783689&r2=783690&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTab.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTab.java
Thu Jun 11 08:32:09 2009
@@ -70,6 +70,7 @@
 
     protected TextAdapter name;
     protected TextAdapter schema;
+    protected TextAdapter qualifier;
     protected JLabel schemaLabel;
 
     protected JComboBox pkGeneratorType;
@@ -112,6 +113,12 @@
                 setSchema(text);
             }
         };
+        qualifier = new TextAdapter(new JTextField()) {
+
+            protected void updateModel(String qualifier) {
+                setQualifier(qualifier);
+            }
+        };
 
         pkGeneratorType = new JComboBox();
         pkGeneratorType.setEditable(false);
@@ -134,6 +141,7 @@
         builder.appendSeparator("DbEntity Configuration");
         builder.append("DbEntity Name:", name.getComponent());
         builder.append(schemaLabel, schema.getComponent());
+        builder.append("Qualifier", qualifier.getComponent());
 
         builder.appendSeparator("Primary Key");
         builder.append("PK Generation Strategy:", pkGeneratorType);
@@ -200,6 +208,7 @@
 
         name.setText(entity.getName());
         schema.setText(entity.getSchema());
+        qualifier.setText(entity.getQualifier());
 
         String type = PK_DEFAULT_GENERATOR;
 
@@ -267,4 +276,18 @@
             mediator.fireDbEntityEvent(new EntityEvent(this, ent));
         }
     }
+    
+    void setQualifier(String qualifier) {
+
+        if (qualifier != null && qualifier.trim().length() == 0) {
+            qualifier = null;
+        }
+
+        DbEntity ent = mediator.getCurrentDbEntity();
+
+        if (ent != null && !Util.nullSafeEquals(ent.getQualifier(), qualifier)) {
+            ent.setQualifier(qualifier);
+            mediator.fireDbEntityEvent(new EntityEvent(this, ent));
+        }
+    }
 }



Mime
View raw message