ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # IGNITE-32 WIP: GUI - added support for changing java name. Minor fixes.
Date Mon, 12 Jan 2015 05:58:41 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-32 356d3311c -> 71dddba1e


# IGNITE-32 WIP: GUI - added support for changing java name. Minor fixes.


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

Branch: refs/heads/ignite-32
Commit: 71dddba1e93738b9abad040f8cc7a60b27ceaa74
Parents: 356d331
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Mon Jan 12 12:59:04 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Mon Jan 12 12:59:04 2015 +0700

----------------------------------------------------------------------
 .../ignite/schema/db/DbMetadataParser.java      |  4 +-
 .../ignite/schema/pojo/PojoCodeGenerator.java   |  2 +-
 .../org/apache/ignite/schema/ui/Controls.java   |  4 +-
 .../java/org/apache/ignite/schema/ui/Field.java | 41 +-------------------
 .../org/apache/ignite/schema/ui/GridPaneEx.java |  2 +-
 .../org/apache/ignite/schema/ui/MessageBox.java |  2 +
 .../apache/ignite/schema/ui/NamingDialog.java   |  2 +-
 .../apache/ignite/schema/ui/SchemaLoadApp.java  | 31 ++++++++-------
 8 files changed, 30 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/modules/schema-load/src/main/java/org/apache/ignite/schema/db/DbMetadataParser.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/db/DbMetadataParser.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/db/DbMetadataParser.java
index 352d7f8..e43394f 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/db/DbMetadataParser.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/db/DbMetadataParser.java
@@ -19,7 +19,9 @@ import static org.apache.ignite.schema.util.SchemaUtils.*;
  */
 public class DbMetadataParser {
     /**
-     * @param type SQL data type.
+     * Convert JDBC data type to java type.
+     *
+     * @param type JDBC SQL data type.
      * @return Java data type.
      */
     private static Class<?> dataType(int type) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/modules/schema-load/src/main/java/org/apache/ignite/schema/pojo/PojoCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/pojo/PojoCodeGenerator.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/pojo/PojoCodeGenerator.java
index b98b629..0f0e4aa 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/pojo/PojoCodeGenerator.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/pojo/PojoCodeGenerator.java
@@ -236,7 +236,7 @@ public class PojoCodeGenerator {
     }
 
     /**
-     * Generate source code for type.
+     * Generate source code for type by its metadata.
      *
      * @param meta Type metadata.
      * @param outFolder Output folder.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Controls.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Controls.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Controls.java
index 864861d..4d51bdf 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Controls.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Controls.java
@@ -226,9 +226,11 @@ public class Controls {
      */
     public static Text text(String text, int wrap) {
         Text t = new Text(text);
+
         t.setFont(new Font(14));
 
-        t.setWrappingWidth(wrap);
+        if (wrap > 0)
+            t.setWrappingWidth(wrap);
 
         return t;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Field.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Field.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Field.java
index d3edc9f..2273dd3 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Field.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Field.java
@@ -38,48 +38,11 @@ public class Field {
     }
 
     /**
-     * @param pk {@code true} if this field belongs to primary key.
-     */
-    public void setKey(boolean pk) {
-        key.set(pk);
-    }
-
-    /**
-     * @return Field name of corresponding POJO.
-     */
-    public String getJavaName() {
-        return javaName.get();
-    }
-
-    /**
-     * @param name Field name of corresponding POJO.
-     */
-    public void setJavaName(String name) {
-        desc.setJavaName(name);
-
-        javaName.set(name);
-    }
-
-    /**
-     * @return Field name in database.
-     */
-    public String getDbName() {
-        return dbName.get();
-    }
-
-    /**
-     * @param name Field name in database.
-     */
-    public void setDbName(String name) {
-        desc.setDbName(name);
-
-        dbName.set(name);
-    }
-
-    /**
      * @return Type descriptor.
      */
     public GridCacheQueryTypeDescriptor descriptor() {
+        desc.setJavaName(javaName.get());
+
         return desc;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
index c57ce75..00d4b58 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
@@ -8,7 +8,7 @@ import javafx.scene.control.*;
 import javafx.scene.layout.*;
 
 /**
- * Utility extention of {@code GridPane}.
+ * Utility extension of {@code GridPane}.
  */
 public class GridPaneEx extends GridPane {
     /** Current column. */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
index a6789da..adace51 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
@@ -27,8 +27,10 @@ public class MessageBox extends Stage {
 
     /** Return value if YES is chosen. */
     public static final int YES_OPTION = 0;
+
     /** Return value if NO is chosen. */
     public static final int NO_OPTION = 1;
+
     /** Return value if CANCEL is chosen. */
     public static final int CANCEL_OPTION = 2;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/NamingDialog.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/NamingDialog.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/NamingDialog.java
index 1c94cdf..f9d6f36 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/NamingDialog.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/NamingDialog.java
@@ -10,7 +10,7 @@ import javafx.stage.*;
 import static org.apache.ignite.schema.ui.Controls.*;
 
 /**
- * Dialog with naming custom options.
+ * Dialog with custom naming options.
  */
 public class NamingDialog extends Stage {
     /** Owner window. */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71dddba1/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 16fe000..1a09191 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
@@ -9,12 +9,8 @@ import javafx.concurrent.*;
 import javafx.event.*;
 import javafx.geometry.*;
 import javafx.scene.*;
-import javafx.scene.control.Button;
 import javafx.scene.control.*;
-import javafx.scene.control.Label;
-import javafx.scene.control.TextField;
 import javafx.scene.control.cell.*;
-import javafx.scene.image.Image;
 import javafx.scene.layout.*;
 import javafx.stage.*;
 import javafx.util.*;
@@ -24,7 +20,9 @@ import org.apache.ignite.schema.xml.*;
 import org.gridgain.grid.cache.query.*;
 import org.gridgain.grid.util.typedef.internal.*;
 
-import java.awt.*;
+import java.awt.Image;
+import java.awt.Desktop;
+import java.awt.Toolkit;
 import java.io.*;
 import java.net.*;
 import java.sql.*;
@@ -205,7 +203,7 @@ public class SchemaLoadApp extends Application {
     private void fill() {
         lockUI(connLayerPnl, connPnl, nextBtn);
 
-        Task<Void> task = new Task<Void>() {
+        Runnable task = new Task<Void>() {
             /** {@inheritDoc} */
             @Override protected Void call() throws Exception {
                 long started = System.currentTimeMillis();
@@ -307,7 +305,7 @@ public class SchemaLoadApp extends Application {
 
         final File destFolder = new File(outFolder);
 
-        Task<Void> task = new Task<Void>() {
+        Runnable task = new Task<Void>() {
             private void checkEmpty(Collection<GridCacheQueryTypeDescriptor> items,
                 final TreeItem<String> treeItem, String msg) {
                 if (items.isEmpty()) {
@@ -329,10 +327,11 @@ public class SchemaLoadApp extends Application {
                 if (!destFolder.exists() && !destFolder.mkdirs())
                     throw new IOException("Failed to create output folder: " + destFolder);
 
-                List<GridCacheQueryTypeMetadata> all = new ArrayList<>();
+                Collection<GridCacheQueryTypeMetadata> all = new ArrayList<>();
 
                 boolean constructor = pojoConstructorCh.isSelected();
                 boolean include = pojoIncludeKeysCh.isSelected();
+                boolean singleXml = xmlSingleFileCh.isSelected();
 
                 // Generate POJO and XML.
                 for (TreeItem<String> schemeItem : rootItem.getChildren()) {
@@ -359,7 +358,7 @@ public class SchemaLoadApp extends Application {
                                 GridCacheQueryTypeDescriptor desc = fld.descriptor();
 
                                 if (customNaming) {
-                                    String javaName = toJavaFieldName(desc.getDbName());
+                                    String javaName = desc.getJavaName();
 
                                     if (!prefix.isEmpty())
                                         javaName = prefix + capitalizeFirst(javaName);
@@ -399,7 +398,8 @@ public class SchemaLoadApp extends Application {
 
                             all.add(meta);
 
-                            XmlTransformer.transform(pkg, meta, new File(destFolder, meta.getType()
+ ".xml"));
+                            if (!singleXml)
+                                XmlTransformer.transform(pkg, meta, new File(destFolder,
meta.getType() + ".xml"));
 
                             PojoCodeGenerator.generate(meta, outFolder, pkg, constructor);
                         }
@@ -408,7 +408,7 @@ public class SchemaLoadApp extends Application {
 
                 if (all.isEmpty())
                     throw new IllegalStateException("Nothing selected!");
-                else if (xmlSingleFileCh.isSelected())
+                else if (singleXml)
                     XmlTransformer.transform(pkg, all, new File(outFolder, "all.xml"));
 
                 perceptualDelay(started);
@@ -635,9 +635,12 @@ public class SchemaLoadApp extends Application {
         TableColumn<Field, String> dbNameCol = tableColumn("DB Name", "dbName", 0,
0);
 
         TableColumn<Field, String> javaNameCol = tableColumn("Ignite Name", "javaName",
0, 0);
+        javaNameCol.setCellFactory(TextFieldTableCell.<Field>forTableColumn());
+        javaNameCol.setEditable(true);
 
         final TableView<Field> tbl = new TableView<>();
 
+        tbl.setPlaceholder(text("Select table to see table columns", 0));
         tbl.getColumns().addAll(keyCol, dbNameCol, javaNameCol);
         tbl.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
         tbl.setEditable(true);
@@ -772,9 +775,6 @@ public class SchemaLoadApp extends Application {
 
     /** {@inheritDoc} */
     @Override public void start(Stage primaryStage) {
-        System.setProperty("prism.lcdtext", "false");
-        System.setProperty("prism.text", "t2k");
-
         owner = primaryStage;
 
         primaryStage.setTitle("Schema Load");
@@ -897,6 +897,9 @@ public class SchemaLoadApp extends Application {
      * @param args Command line arguments passed to the application.
      */
     public static void main(String[] args) {
+        System.setProperty("prism.lcdtext", "false");
+        System.setProperty("prism.text", "t2k");
+
         // Workaround for JavaFX + Mac OS dock icon.
         if (System.getProperty("os.name").toLowerCase().contains("mac os")) {
             System.setProperty("javafx.macosx.embedded", "true");


Mime
View raw message