ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject incubator-ignite git commit: # ignite-32: Only key field can be affinity key .
Date Fri, 30 Jan 2015 09:45:13 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-32 5a407fcd6 -> 3791a128e


# ignite-32: Only key field can be affinity key .


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3791a128
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3791a128
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3791a128

Branch: refs/heads/ignite-32
Commit: 3791a128e1eb4b918548d8f2f92131d64807b7e2
Parents: 5a407fc
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Jan 30 16:45:15 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Jan 30 16:45:15 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/schema/model/PojoDescriptor.java   |  4 ++--
 .../org/apache/ignite/schema/model/PojoField.java    | 15 +++++++++++----
 .../org/apache/ignite/schema/ui/SchemaLoadApp.java   | 14 +++++++-------
 3 files changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3791a128/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
index 7bcb14a..59e601a 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
@@ -148,9 +148,9 @@ public class PojoDescriptor {
     }
 
     /**
-     * @return {@code true} if POJO descriptor is a table descriptor and selected in GUI.
+     * @return {@code true} if POJO descriptor is a table descriptor and checked in GUI.
      */
-    public boolean selected() {
+    public boolean checked() {
         return parent != null && use.get();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3791a128/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoField.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoField.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoField.java
index 89c0647..c7e8b07 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoField.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/model/PojoField.java
@@ -152,16 +152,16 @@ public class PojoField {
     }
 
     /**
-     * @param key {@code true} if this field belongs to primary key.
+     * @param isKey {@code true} if this field belongs to primary key.
      * @param desc Field type descriptor.
      * @param nullable {@code true} if {@code NULL} is allowed for this field in database.
      */
-    public PojoField(boolean key, CacheQueryTypeDescriptor desc, boolean nullable) {
-        keyPrev = key;
+    public PojoField(boolean isKey, CacheQueryTypeDescriptor desc, boolean nullable) {
+        keyPrev = isKey;
 
         use = new SimpleBooleanProperty(true);
 
-        this.key = new SimpleBooleanProperty(key);
+        key = new SimpleBooleanProperty(keyPrev);
 
         ak = new SimpleBooleanProperty(false);
 
@@ -185,6 +185,13 @@ public class PojoField {
 
         this.desc = desc;
 
+        key.addListener(new ChangeListener<Boolean>() {
+            @Override public void changed(ObservableValue<? extends Boolean> val, Boolean
oldVal, Boolean newVal) {
+                if (!newVal)
+                    ak.set(false);
+            }
+        });
+
         ak.addListener(new ChangeListener<Boolean>() {
             @Override public void changed(ObservableValue<? extends Boolean> val, Boolean
oldVal, Boolean newVal) {
                 if (newVal && owner != null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3791a128/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
index 58f597d..6cb38e6 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
@@ -325,7 +325,7 @@ public class SchemaLoadApp extends Application {
      * Generate XML and POJOs.
      */
     private void generate() {
-        final Collection<PojoDescriptor> selPojos = selectedItems();
+        final Collection<PojoDescriptor> selPojos = chekedPojos();
 
         if (selPojos.isEmpty()) {
             MessageBox.warningDialog(owner, "Please select tables to generate XML and POJOs
files!");
@@ -373,7 +373,7 @@ public class SchemaLoadApp extends Application {
 
                 // Generate XML and POJO.
                 for (PojoDescriptor pojo : selPojos) {
-                    if (pojo.selected()) {
+                    if (pojo.checked()) {
                         CacheQueryTypeMetadata meta = pojo.metadata(includeKeys);
 
                         checkEmpty(pojo, meta.getKeyDescriptors(), "No key fields specified
for type: ");
@@ -751,8 +751,8 @@ public class SchemaLoadApp extends Application {
             "–°heck to include this field into key object");
 
         TableColumn<PojoField, Boolean> akCol = booleanColumn("AK", "affinityKey",
-            "Check to annotate filed with @CacheAffinityKeyMapped annotation in generated
POJO class\n" +
-            "Note that a class can have only one field annotated with @CacheAffinityKeyMapped
annotation");
+            "Check to annotate key filed with @CacheAffinityKeyMapped annotation in generated
POJO class\n" +
+            "Note that a class can have only one key field annotated with @CacheAffinityKeyMapped
annotation");
 
         TableColumn<PojoField, String> dbNameCol = tableColumn("DB Name", "dbName",
"Field name in database");
 
@@ -1010,13 +1010,13 @@ public class SchemaLoadApp extends Application {
     }
 
     /**
-     * @return Selected tree view items.
+     * @return POJOs checked in table-tree-view.
      */
-    private Collection<PojoDescriptor> selectedItems() {
+    private Collection<PojoDescriptor> chekedPojos() {
         Collection<PojoDescriptor> res = new ArrayList<>();
 
         for (PojoDescriptor pojo : pojos)
-            if (pojo.selected())
+            if (pojo.checked())
                 res.add(pojo);
 
         return res;


Mime
View raw message