ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [04/50] [abbrv] incubator-ignite git commit: # IGNITE-32: Fixed renaming.
Date Thu, 05 Feb 2015 22:10:32 GMT
# IGNITE-32: Fixed renaming.


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

Branch: refs/heads/ignite-61
Commit: 616e48c1b649c164e38e5685c000c3f16487215b
Parents: b48db27
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Thu Feb 5 13:19:08 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Thu Feb 5 13:19:08 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/schema/ui/SchemaLoadApp.java  | 53 ++++++++++++++++++--
 1 file changed, 48 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/616e48c1/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 cd08f4d..44fbfd3 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
@@ -145,6 +145,12 @@ public class SchemaLoadApp extends Application {
     private TableView<PojoDescriptor> pojosTbl;
 
     /** */
+    private TableView<PojoField> fieldsTbl;
+
+    /** */
+    private Node curTbl;
+
+    /** */
     private TextField outFolderTf;
 
     /** */
@@ -289,6 +295,10 @@ public class SchemaLoadApp extends Application {
                 if (!pojos.isEmpty())
                     pojosTbl.getSelectionModel().select(pojos.get(0));
 
+                curTbl = pojosTbl;
+
+                pojosTbl.requestFocus();
+
                 unlockUI(connLayerPnl, connPnl, nextBtn);
 
                 hdrPane.setLeft(genIcon);
@@ -782,7 +792,7 @@ public class SchemaLoadApp extends Application {
         TableColumn<PojoField, String> javaTypeNameCol = customColumn("Java Type",
"javaTypeName",
             "Field java type in POJO class", JavaTypeCell.cellFactory());
 
-        final TableView<PojoField> fieldsTbl = tableView("Select table to see table
columns",
+        fieldsTbl = tableView("Select table to see table columns",
             useFldCol, keyCol, akCol, dbNameCol, dbTypeNameCol, javaNameCol, javaTypeNameCol);
 
         genPnl.add(splitPane(pojosTbl, fieldsTbl, 0.6), 3);
@@ -850,13 +860,15 @@ public class SchemaLoadApp extends Application {
 
                         String sel = replaceCb.getSelectionModel().getSelectedItem();
 
-                        boolean renFields = "Java names".equals(sel);
+                        boolean isFields = "Java names".equals(sel) && curTbl ==
fieldsTbl;
 
-                        String src = (renFields ? "fields" : "tables");
+                        String src = isFields ? "fields" : "tables";
 
                         String target = "\"" + sel + "\"";
 
-                        Collection<PojoDescriptor> selPojos = pojosTbl.getSelectionModel().getSelectedItems();
+                        Collection<PojoDescriptor> selPojos = isFields
+                            ? Collections.singleton(curPojo)
+                            : pojosTbl.getSelectionModel().getSelectedItems();
 
                         if (selPojos.isEmpty()) {
                             MessageBox.warningDialog(owner, "Please select " + src + " to
rename " + target + "!");
@@ -897,7 +909,7 @@ public class SchemaLoadApp extends Application {
 
                     boolean renFields = "Java names".equals(sel);
 
-                    String src = (renFields ? "fields" : "tables");
+                    String src = (renFields && curTbl == fieldsTbl ? "fields" : "tables");
 
                     String target = "\"" + sel + "\"";
 
@@ -949,6 +961,37 @@ public class SchemaLoadApp extends Application {
             }
         });
 
+        pojosTbl.focusedProperty().addListener(new ChangeListener<Boolean>() {
+            @Override public void changed(ObservableValue<? extends Boolean> val, Boolean
oldVal, Boolean newVal) {
+                if (newVal)
+                    curTbl = pojosTbl;
+            }
+        });
+
+        fieldsTbl.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>()
{
+            @Override public void changed(ObservableValue<? extends Number> val, Number
oldVal, Number newVal) {
+                if (curPojo != null) {
+                    TableView.TableViewSelectionModel<PojoDescriptor> selMdl = pojosTbl.getSelectionModel();
+
+                    List<Integer> idxs = new ArrayList<>(selMdl.getSelectedIndices());
+
+                    if (idxs.size() > 1) {
+                        for (Integer idx : idxs) {
+                            if (pojos.get(idx) != curPojo)
+                                selMdl.clearSelection(idx);
+                        }
+                    }
+                }
+            }
+        });
+
+        fieldsTbl.focusedProperty().addListener(new ChangeListener<Boolean>() {
+            @Override public void changed(ObservableValue<? extends Boolean> val, Boolean
oldVal, Boolean newVal) {
+                if (newVal)
+                    curTbl = fieldsTbl;
+            }
+        });
+
         genPnl.add(titledPane("Rename \"Key class name\", \"Value class name\" or  \"Java
name\" for selected tables",
             regexPnl), 3);
 


Mime
View raw message