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: Added style for all dialogs. Code refactoring. Added NamingDialog.
Date Wed, 07 Jan 2015 15:22:08 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-32 711dc4a9e -> 6ca0199a5


# IGNITE-32 WIP: Added style for all dialogs. Code refactoring. Added NamingDialog.


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

Branch: refs/heads/ignite-32
Commit: 6ca0199a5316fbf4428cb102356bbd8f303b48b4
Parents: 711dc4a
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Wed Jan 7 22:22:06 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Wed Jan 7 22:22:06 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/schema/ui/Controls.java   |  13 +++
 .../java/org/apache/ignite/schema/ui/Field.java | 106 +++++++++++++++++
 .../org/apache/ignite/schema/ui/MessageBox.java |   6 +-
 .../apache/ignite/schema/ui/NamingDialog.java   |  67 +++++++++++
 .../apache/ignite/schema/ui/SchemaLoadApp.java  | 113 +------------------
 5 files changed, 195 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ca0199a/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 0de9898..f5340ab 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
@@ -104,6 +104,19 @@ public class Controls {
     }
 
     /**
+     * Create pane with buttons.
+     *
+     * @param btns Buttons that will be added to pane.
+     * @return New pane instance with buttons.
+     */
+    public static Pane buttonsPane(Button ... btns) {
+        HBox hb = hBox(10, true, btns);
+        hb.setAlignment(Pos.BOTTOM_RIGHT);
+
+        return hb;
+    }
+
+    /**
      * Create checkbox.
      *
      * @param text Checkbox text.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ca0199a/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
new file mode 100644
index 0000000..d3edc9f
--- /dev/null
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/Field.java
@@ -0,0 +1,106 @@
+package org.apache.ignite.schema.ui;
+
+import javafx.beans.property.*;
+import org.gridgain.grid.cache.query.*;
+
+/**
+ * Field descriptor with properties for JavaFX GUI bindings.
+ */
+public class Field {
+    /** If this field belongs to primary key. */
+    private final BooleanProperty key;
+
+    /** Field name for POJO. */
+    private final StringProperty javaName;
+
+    /** Field name in database. */
+    private final StringProperty dbName;
+
+    /** Field type descriptor. */
+    private final GridCacheQueryTypeDescriptor desc;
+
+    /**
+     * @param key {@code true} if this field belongs to primary key.
+     * @param desc Field type descriptor.
+     */
+    public Field(boolean key, GridCacheQueryTypeDescriptor desc) {
+        this.desc = desc;
+        this.key = new SimpleBooleanProperty(key);
+        javaName = new SimpleStringProperty(desc.getJavaName());
+        dbName = new SimpleStringProperty(desc.getDbName());
+    }
+
+    /**
+     * @return {@code true} if this field belongs to primary key.
+     */
+    public boolean isKey() {
+        return key.get();
+    }
+
+    /**
+     * @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() {
+        return desc;
+    }
+
+    /**
+     * @return Boolean property support for {@code key} property.
+     */
+    public BooleanProperty keyProperty() {
+        return key;
+    }
+
+    /**
+     * @return String property support for {@code javaName} property.
+     */
+    public StringProperty javaNameProperty() {
+        return javaName;
+    }
+
+    /**
+     * @return String property support for {@code dbName} property.
+     */
+    public StringProperty dbNameProperty() {
+        return dbName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ca0199a/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 dfd48bf..a19f267 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
@@ -102,7 +102,11 @@ public class MessageBox extends Stage {
                 }
             }));
 
-        setScene(new Scene(vBox(10, hBox(10, true, imageView(iconFile, 48), text(msg, 250)),
btns)));
+        Scene scene = new Scene(vBox(10, hBox(10, true, imageView(iconFile, 48), text(msg,
350)), btns));
+
+        scene.getStylesheets().add("media/style.css");
+
+        setScene(scene);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ca0199a/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
new file mode 100644
index 0000000..219144a
--- /dev/null
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/NamingDialog.java
@@ -0,0 +1,67 @@
+/* @java.file.header */
+
+package org.apache.ignite.schema.ui;
+
+import javafx.event.*;
+import javafx.scene.*;
+import javafx.scene.layout.*;
+import javafx.stage.*;
+
+import static org.apache.ignite.schema.ui.Controls.*;
+
+/**
+ * Dialog with naming custom options.
+ */
+public class NamingDialog extends Stage {
+    /**
+     * Create naming dialog.
+     *
+     * @param owner Owner window.
+     */
+    public NamingDialog(Stage owner) {
+        setTitle("Custom Naming");
+        initStyle(StageStyle.UTILITY);
+        initModality(Modality.APPLICATION_MODAL);
+        initOwner(owner);
+        setResizable(false);
+
+        GridPaneEx pane = paneEx();
+
+        pane.setGridLinesVisible(true);
+
+        pane.addColumn();
+        pane.addColumn(200, 200, Double.MAX_VALUE, Priority.ALWAYS);
+
+        pane.addLabeled("Prefix:", textField());
+        pane.addLabeled("Suffix:", textField());
+
+        pane.add(buttonsPane(
+            button("OK", new EventHandler<ActionEvent>() {
+                @Override public void handle(ActionEvent evt) {
+                    // TODO: CODE: implement.
+                }
+            }),
+            button("Cancel", new EventHandler<ActionEvent>() {
+                @Override public void handle(ActionEvent evt) {
+                    // TODO: CODE: implement.
+                }
+            })), 2);
+
+
+        Scene scene = new Scene(pane);
+
+        scene.getStylesheets().add("media/style.css");
+
+        setScene(scene);
+    }
+
+    /**
+     * Show modal dialog.
+     */
+    public void showDialog() {
+        sizeToScene();
+
+        centerOnScreen();
+
+        showAndWait();
+    }}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ca0199a/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 9cf3dca..179e1bf 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
@@ -3,7 +3,6 @@
 package org.apache.ignite.schema.ui;
 
 import javafx.application.*;
-import javafx.beans.property.*;
 import javafx.beans.value.*;
 import javafx.collections.*;
 import javafx.event.*;
@@ -34,109 +33,6 @@ import static org.apache.ignite.schema.ui.Controls.*;
  * Schema load application.
  */
 public class SchemaLoadApp extends Application {
-    /**
-     * Field descriptor.
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class Field {
-        /** If this field belongs to primary key. */
-        private final BooleanProperty key;
-
-        /** Field name for POJO. */
-        private final StringProperty javaName;
-
-        /** Field name in database. */
-        private final StringProperty dbName;
-
-        /** Field type descriptor. */
-        private final GridCacheQueryTypeDescriptor desc;
-
-        /**
-         * @param key {@code true} if this field belongs to primary key.
-         * @param desc Field type descriptor.
-         */
-        private Field(boolean key, GridCacheQueryTypeDescriptor desc) {
-            this.desc = desc;
-            this.key = new SimpleBooleanProperty(key);
-            javaName = new SimpleStringProperty(desc.getJavaName());
-            dbName = new SimpleStringProperty(desc.getDbName());
-        }
-
-        /**
-         * @return {@code true} if this field belongs to primary key.
-         */
-        public boolean isKey() {
-            return key.get();
-        }
-
-        /**
-         * @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() {
-            return desc;
-        }
-
-        /**
-         * @return Boolean property support for {@code key} property.
-         */
-        public BooleanProperty keyProperty() {
-            return key;
-        }
-
-        /**
-         * @return String property support for {@code javaName} property.
-         */
-        public StringProperty javaNameProperty() {
-            return javaName;
-        }
-
-        /**
-         * @return String property support for {@code dbName} property.
-         */
-        public StringProperty dbNameProperty() {
-            return dbName;
-        }
-    }
-
     /** */
     private Stage owner;
 
@@ -388,10 +284,7 @@ public class SchemaLoadApp extends Application {
             }
         });
 
-        HBox hb = hBox(10, true, prevBtn, nextBtn);
-        hb.setAlignment(Pos.BOTTOM_RIGHT);
-
-        return hb;
+        return buttonsPane(prevBtn, nextBtn);
     }
 
     /**
@@ -605,7 +498,9 @@ public class SchemaLoadApp extends Application {
         btnNaming = button("Configure Naming", new EventHandler<ActionEvent>() {
             /** {@inheritDoc} */
             @Override public void handle(ActionEvent evt) {
-                MessageBox.informationDialog(owner, "TODO: implement.");
+                NamingDialog dlg = new NamingDialog(owner);
+
+                dlg.showDialog();
             }
         });
 


Mime
View raw message