You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2014/12/28 08:24:29 UTC
[1/2] incubator-ignite git commit: # IGNITE-32 WIP: Refactoring
message box.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-32 0d907c4e0 -> 2b0a2d130
# IGNITE-32 WIP: Refactoring message box.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5e7b9cdd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5e7b9cdd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5e7b9cdd
Branch: refs/heads/ignite-32
Commit: 5e7b9cdd0ed5869415d0c1de5b88adee7e0f73dc
Parents: 0d907c4
Author: AKuznetsov <ak...@gridgain.com>
Authored: Sun Dec 28 14:23:25 2014 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Sun Dec 28 14:23:25 2014 +0700
----------------------------------------------------------------------
.../org/apache/ignite/schema/ui/Controls.java | 72 +++++++
.../org/apache/ignite/schema/ui/MessageBox.java | 206 ++++++++++---------
2 files changed, 184 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7b9cdd/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 954bdb1..d1a1cd2 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
@@ -10,12 +10,47 @@
package org.apache.ignite.schema.ui;
import javafx.event.*;
+import javafx.geometry.*;
import javafx.scene.control.*;
+import javafx.scene.image.*;
+import javafx.scene.layout.*;
+import javafx.scene.text.*;
/**
* Utility class to create controls.
*/
public class Controls {
+ /** */
+ public static final Insets DFLT_PADDING = new Insets(10, 10, 10, 10);
+
+ /**
+ * Create new {@code HBox} with default padding.
+ *
+ * @param spacing Amount of horizontal space between each child.
+ * @return New {@code HBox} instance.
+ */
+ public static HBox hBox(int spacing) {
+ HBox hb = new HBox(spacing);
+
+ hb.setPadding(DFLT_PADDING);
+
+ return hb;
+ }
+
+ /**
+ * Create new {@code VBox} with default padding.
+ *
+ * @param spacing Amount of horizontal space between each child.
+ * @return New {@code VBox} instance.
+ */
+ public static VBox vBox(int spacing) {
+ VBox vb = new VBox(spacing);
+
+ vb.setPadding(DFLT_PADDING);
+
+ return vb;
+ }
+
/**
* Create button.
*
@@ -47,9 +82,46 @@ public class Controls {
}
/**
+ * Create text field.
+ *
* @return New text field instance.
*/
public static TextField textField() {
return new TextField();
}
+
+ /**
+ * Create static text.
+ *
+ * @param text Text to show.
+ * @param wrap Text wrapping width.
+ * @return New text instance.
+ */
+ public static Text text(String text, int wrap) {
+ Text t = new Text(text);
+
+ t.setWrappingWidth(wrap);
+
+ return t;
+ }
+
+ /**
+ * Create image view.
+ *
+ * @param imgFileName Image filename.
+ * @return New image view instance.
+ */
+ public static ImageView imageView(String imgFileName, int sz) {
+ return new ImageView(image(imgFileName, sz));
+ }
+
+ /**
+ * Gets image by its filename.
+ *
+ * @param imgFileName Image filename.
+ */
+ public static Image image(String imgFileName, int sz) {
+ return new Image(Controls.class.getClassLoader()
+ .getResourceAsStream(String.format("media/%1$s_%2$dx%2$d.png", imgFileName, sz)));
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e7b9cdd/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 359f0af..989f8e3 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
@@ -12,118 +12,136 @@ package org.apache.ignite.schema.ui;
import javafx.event.*;
import javafx.geometry.*;
import javafx.scene.*;
-import javafx.scene.control.*;
-import javafx.scene.image.*;
import javafx.scene.layout.*;
-import javafx.scene.text.*;
import javafx.stage.*;
-import static org.apache.ignite.schema.util.SchemaUtils.*;
+import static org.apache.ignite.schema.ui.Controls.*;
/**
* Message box functionality.
*/
-public class MessageBox {
- /** */
- public enum Option {NO, YES, CANCEL}
-
- private static Option result = Option.CANCEL;
-
- private static ImageView icon = new ImageView();
-
- static class Dialog extends Stage {
- public Dialog(String title, Stage owner, Scene scene, String iconFile) {
- setTitle(title);
- initStyle(StageStyle.UTILITY);
- initModality(Modality.APPLICATION_MODAL);
- initOwner(owner);
- setResizable(false);
- setScene(scene);
- icon.setImage(image(iconFile, 48));
+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;
+
+ /** Dialog result. */
+ private int res = CANCEL_OPTION;
+
+ /**
+ * Create message box.
+ *
+ * @param owner Owner window.
+ * @param title Title text.
+ * @param msg Message to show.
+ * @param iconFile Message icon.
+ * @param yesNo If {@code true} show "yes" and "no" buttons
+ * otherwise show "ok" button.
+ */
+ private MessageBox(Stage owner, String title, String msg, String iconFile, boolean yesNo) {
+ setTitle(title);
+ initStyle(StageStyle.UTILITY);
+ initModality(Modality.APPLICATION_MODAL);
+ initOwner(owner);
+ setResizable(false);
+
+ VBox vb = vBox(10);
+
+ setScene(new Scene(vb));
+
+ HBox btns = hBox(10);
+ btns.setAlignment(Pos.CENTER);
+
+ if (yesNo) {
+ res = NO_OPTION;
+
+ btns.getChildren().addAll(button("Yes", new EventHandler<ActionEvent>() {
+ @Override public void handle(ActionEvent e) {
+ res = YES_OPTION;
+
+ close();
+ }
+ }), button("No", new EventHandler<ActionEvent>() {
+ @Override public void handle(ActionEvent e) {
+ res = NO_OPTION;
+
+ close();
+ }
+ }));
}
+ else
+ btns.getChildren().add(button("OK", new EventHandler<ActionEvent>() {
+ @Override public void handle(ActionEvent e) {
+ close();
+ }
+ }));
- public void showDialog() {
- sizeToScene();
- centerOnScreen();
- showAndWait();
- }
- }
-
- static class Message extends Text {
- public Message(String msg) {
- super(msg);
- setWrappingWidth(250);
- }
- }
+ HBox hb = hBox(10);
+ hb.getChildren().addAll(imageView(iconFile, 48), text(msg, 250));
- public static Option showConfirmDialog(Stage owner, String message, String title) {
- VBox vb = newVBox(10);
-
- Scene scene = new Scene(vb);
-
- final Dialog dial = new Dialog(title, owner, scene, "question");
-
- Button yesButton = new Button("Yes");
- yesButton.setOnAction(new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent e) {
- dial.close();
- result = Option.YES;
- }
- });
-
- Button noButton = new Button("No");
- noButton.setOnAction(new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent e) {
- dial.close();
- result = Option.NO;
- }
- });
-
- BorderPane bp = new BorderPane();
- HBox buttons = new HBox();
- buttons.setAlignment(Pos.CENTER);
- buttons.setSpacing(10);
- buttons.getChildren().addAll(yesButton, noButton);
- bp.setCenter(buttons);
- HBox msg = new HBox();
- msg.setSpacing(5);
- msg.getChildren().addAll(icon, new Message(message));
- vb.getChildren().addAll(msg, bp);
- dial.showDialog();
-
- return result;
+ vb.getChildren().addAll(hb, btns);
}
+ /**
+ * Show modal dialog.
+ */
+ public void showDialog() {
+ sizeToScene();
- private static void showDialog(Stage owner, String title, String msg, String iconFile) {
- VBox vb = newVBox(10);
- Scene scene = new Scene(vb);
+ centerOnScreen();
- final Dialog dial = new Dialog(title, owner, scene, iconFile);
-
- Button okButton = new Button("OK");
- okButton.setAlignment(Pos.CENTER);
- okButton.setOnAction(new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent e) {
- dial.close();
- }
- });
-
- BorderPane bp = new BorderPane();
- bp.setCenter(okButton);
+ showAndWait();
+ }
- HBox hb = new HBox();
- hb.setSpacing(5);
- hb.getChildren().addAll(icon, new Message(msg));
- vb.getChildren().addAll(hb, bp);
+ /**
+ * Show message in modal dialog.
+ *
+ * @param owner Owner window.
+ * @param title Title text.
+ * @param msg Message to show.
+ * @param iconFile Message icon.
+ * @param yesNo If {@code true} show "yes" and "no" buttons
+ * otherwise show "ok" button.
+ * @return Option selected by the user.
+ */
+ private static int showDialog(Stage owner, String title, String msg, String iconFile, boolean yesNo) {
+ MessageBox dlg = new MessageBox(owner, title, msg, iconFile, yesNo);
+
+ dlg.showDialog();
+
+ return dlg.res;
+ }
- dial.showDialog();
+ /**
+ * Show confirmation dialog.
+ *
+ * @param owner Owner window.
+ * @param msg Message to show.
+ * @return Option selected by the user.
+ */
+ public static int confirmDialog(Stage owner, String msg) {
+ return showDialog(owner, "Confirmation", msg, "question", true);
}
- public static void showInformationDialog(Stage owner, String title, String msg) {
- showDialog(owner, title, msg, "information");
+ /**
+ * Show information dialog.
+ *
+ * @param owner Owner window.
+ * @param msg Message to show.
+ */
+ public static void informationDialog(Stage owner, String msg) {
+ showDialog(owner, "Information", msg, "information", false);
}
- public static void showErrorDialog(Stage owner, String msg) {
- showDialog(owner, "Error", msg, "error");
+ /**
+ * Show error dialog.
+ *
+ * @param owner Owner window.
+ * @param msg Message to show.
+ */
+ public static void errorDialog(Stage owner, String msg) {
+ showDialog(owner, "Error", msg, "error", false);
}
}
[2/2] incubator-ignite git commit: # IGNITE-32 WIP: Refactoring app +
started to add table with columns metadata.
Posted by sb...@apache.org.
# IGNITE-32 WIP: Refactoring app + started to add table with columns metadata.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2b0a2d13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2b0a2d13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2b0a2d13
Branch: refs/heads/ignite-32
Commit: 2b0a2d1300e6ec8e3570ebe810baa303d1d294d3
Parents: 5e7b9cd
Author: AKuznetsov <ak...@gridgain.com>
Authored: Sun Dec 28 14:24:32 2014 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Sun Dec 28 14:24:32 2014 +0700
----------------------------------------------------------------------
.../apache/ignite/schema/ui/SchemaLoadApp.java | 208 ++++++++++---------
.../apache/ignite/schema/util/SchemaUtils.java | 45 ----
2 files changed, 107 insertions(+), 146 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b0a2d13/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 e3d512e..0bffbeb 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
@@ -27,7 +27,7 @@ import java.io.*;
import java.sql.*;
import java.util.*;
-import static org.apache.ignite.schema.util.SchemaUtils.*;
+import static org.apache.ignite.schema.ui.Controls.*;
/**
* Schema load application.
@@ -88,92 +88,22 @@ public class SchemaLoadApp extends Application {
private LinkedHashMap<String, LinkedHashMap<String, GridCacheQueryTypeMetadata>> schemas;
/**
- * Create pane with controls to configure connection to database.
- */
- private Pane connectPane() {
- if (connPnl == null) {
- connPnl = new GridPaneEx(DFLT_PADDING);
-
- connPnl.addColumn();
- connPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
-
- jdbcTf = connPnl.addLabeled("JDBC Driver:", Controls.textField());
- jdbcTf.setText("org.h2.Driver");
-
- urlTf = connPnl.addLabeled("URL:", Controls.textField());
- urlTf.setText("jdbc:h2:mem:test");
-
- userTf = connPnl.addLabeled("User:", Controls.textField());
- userTf.setText("sa");
-
- pwdTf = connPnl.addLabeled("Password:", new PasswordField());
- }
-
- return connPnl;
- }
-
- /**
- * Create pane with controls used to configure XML and code generation.
- *
- * @return Pane with controls.
- */
- private Pane generatePane() {
- if (genPnl == null) {
- genPnl = new GridPaneEx(DFLT_PADDING);
-
- genPnl.addColumn();
- genPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- genPnl.addColumn(30);
-
- genPnl.addRow(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- genPnl.addRow();
- genPnl.addRow();
- genPnl.addRow();
- genPnl.addRow();
-
- rootItem = new CheckBoxTreeItem<>("Database");
- rootItem.setExpanded(true);
-
- TreeView<String> tree = new TreeView<>(rootItem);
- tree.setCellFactory(CheckBoxTreeCell.<String>forTreeView());
-
- genPnl.add(tree, 3);
-
- pkgTf = genPnl.addLabeled("Package:", Controls.textField());
- pkgTf.setText("org.apache.ignite");
-
- genPnl.wrap();
-
- outFolderTf = genPnl.addLabeled("Output Folder:", Controls.textField());
- outFolderTf.setText(PATH);
-
- genPnl.add(Controls.button("...", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent evt) {
- DirectoryChooser dc = new DirectoryChooser();
-
- File folder = dc.showDialog(owner);
-
- if (folder != null)
- outFolderTf.setText(folder.getAbsolutePath());
- }
- }));
-
- pojoConstructorCh = genPnl.add(Controls.checkBox("Generate Constructor For POJO", false), 3);
-
- xmlSingleFileCh = genPnl.add(Controls.checkBox("Write All Configurations To Single File", true), 3);
- }
-
- return genPnl;
- }
-
- /**
* Fill tree with database metadata.
*/
- private void fill() {
+ private boolean fill() {
rootItem.getChildren().clear();
try {
- Class.forName(jdbcTf.getText());
+ String driver = jdbcTf.getText();
+
+ try {
+ Class.forName(driver);
+ }
+ catch (Throwable e) {
+ MessageBox.errorDialog(owner, "Failed to load JDBC driver: " + e.getMessage());
+
+ return false;
+ }
try (Connection conn = DriverManager.getConnection(urlTf.getText(), userTf.getText(), pwdTf.getText())) {
schemas = DbMetadataParser.parse(conn);
@@ -187,9 +117,13 @@ public class SchemaLoadApp extends Application {
schemaItem.getChildren().add(new CheckBoxTreeItem<>(tbl));
}
}
+
+ return true;
}
catch (Throwable e) {
- MessageBox.showErrorDialog(owner, "Failed to get tables list: " + e.getMessage());
+ MessageBox.errorDialog(owner, "Failed to get tables list: " + e.getMessage());
+
+ return false;
}
}
@@ -223,16 +157,16 @@ public class SchemaLoadApp extends Application {
}
if (all.isEmpty())
- MessageBox.showInformationDialog(owner, "Warning", "Nothing selected");
+ MessageBox.informationDialog(owner, "Nothing selected");
else {
if (xmlSingleFileCh.isSelected())
XmlTransformer.transform(pkg, all, new File(outFolder, "all.xml"));
- MessageBox.showInformationDialog(owner, "Information", "Generation complete!");
+ MessageBox.informationDialog(owner, "Generation complete!");
}
}
catch (Throwable e) {
- MessageBox.showErrorDialog(owner, "Generation failed: " + e.getMessage());
+ MessageBox.errorDialog(owner, "Generation failed: " + e.getMessage());
}
}
@@ -240,7 +174,7 @@ public class SchemaLoadApp extends Application {
* @return Header pane with title label.
*/
private Pane createHeaderPane() {
- HBox hb = newHBox(0);
+ HBox hb = hBox(0);
titleLb = new Label("");
titleLb.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
@@ -254,19 +188,19 @@ public class SchemaLoadApp extends Application {
* @return Panel with control buttons.
*/
private Pane createButtonsPane() {
- prevBtn = Controls.button("Prev", new EventHandler<ActionEvent>() {
+ prevBtn = button("Prev", new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent evt) {
prev();
}
});
- nextBtn = Controls.button("Next", new EventHandler<ActionEvent>() {
+ nextBtn = button("Next", new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent evt) {
next();
}
});
- HBox hb = newHBox(10);
+ HBox hb = hBox(10);
hb.setAlignment(Pos.BOTTOM_RIGHT);
hb.getChildren().addAll(prevBtn, nextBtn);
@@ -279,7 +213,7 @@ public class SchemaLoadApp extends Application {
private void prev() {
titleLb.setText("Connect To Database");
- rootPane.setCenter(connectPane());
+ rootPane.setCenter(connPnl);
prevBtn.setDisable(true);
nextBtn.setText("Next");
@@ -290,14 +224,14 @@ public class SchemaLoadApp extends Application {
*/
private void next() {
if (rootPane.getCenter() == connPnl) {
- titleLb.setText("Generate XML And POJOs");
-
- rootPane.setCenter(generatePane());
+ if (fill()) {
+ titleLb.setText("Generate XML And POJOs");
- prevBtn.setDisable(false);
- nextBtn.setText("Generate");
+ rootPane.setCenter(genPnl);
- fill();
+ prevBtn.setDisable(false);
+ nextBtn.setText("Generate");
+ }
}
else
generate();
@@ -314,8 +248,82 @@ public class SchemaLoadApp extends Application {
rootPane = new BorderPane();
+ // Connection pane.
+ connPnl = new GridPaneEx(DFLT_PADDING);
+
+ connPnl.addColumn();
+ connPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
+
+ jdbcTf = connPnl.addLabeled("JDBC Driver:", textField());
+ jdbcTf.setText("org.h2.Driver");
+
+ urlTf = connPnl.addLabeled("URL:", textField());
+ urlTf.setText("jdbc:h2:mem:test");
+
+ userTf = connPnl.addLabeled("User:", textField());
+ userTf.setText("sa");
+
+ pwdTf = connPnl.addLabeled("Password:", new PasswordField());
+
+ // Generation pane.
+ genPnl = new GridPaneEx(DFLT_PADDING);
+
+ genPnl.addColumn();
+ genPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
+ genPnl.addColumn(30);
+
+ genPnl.addRow(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
+ genPnl.addRow(100, 100, 100, Priority.NEVER);
+ genPnl.addRow();
+ genPnl.addRow();
+ genPnl.addRow();
+ genPnl.addRow();
+
+ rootItem = new CheckBoxTreeItem<>("Database");
+ rootItem.setExpanded(true);
+
+ TreeView<String> tree = new TreeView<>(rootItem);
+ tree.setCellFactory(CheckBoxTreeCell.<String>forTreeView());
+
+ genPnl.add(tree, 3);
+
+ TableView<String> tbl = new TableView<>();
+
+ TableColumn<String, Boolean> keyCol = new TableColumn<>("Key");
+ TableColumn<String, String> dbNameCol = new TableColumn<>("Db Name");
+ TableColumn<String, String> javaNameCol = new TableColumn<>("Java Name");
+
+ tbl.getColumns().addAll(keyCol, dbNameCol, javaNameCol);
+
+ tbl.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
+
+ genPnl.add(tbl, 3);
+
+ pkgTf = genPnl.addLabeled("Package:", textField());
+ pkgTf.setText("org.apache.ignite");
+
+ genPnl.wrap();
+
+ outFolderTf = genPnl.addLabeled("Output Folder:", textField());
+ outFolderTf.setText(PATH);
+
+ genPnl.add(button("...", new EventHandler<ActionEvent>() {
+ @Override public void handle(ActionEvent evt) {
+ DirectoryChooser dc = new DirectoryChooser();
+
+ File folder = dc.showDialog(owner);
+
+ if (folder != null)
+ outFolderTf.setText(folder.getAbsolutePath());
+ }
+ }));
+
+ pojoConstructorCh = genPnl.add(checkBox("Generate Constructor For POJO", false), 3);
+
+ xmlSingleFileCh = genPnl.add(checkBox("Write All Configurations To Single File", true), 3);
+
rootPane.setTop(createHeaderPane());
- rootPane.setCenter(connectPane());
+ rootPane.setCenter(connPnl);
rootPane.setBottom(createButtonsPane());
primaryStage.setScene(new Scene(rootPane));
@@ -323,12 +331,10 @@ public class SchemaLoadApp extends Application {
int w = 400;
primaryStage.setWidth(w);
primaryStage.setMinWidth(w);
- primaryStage.setMaxWidth(2 * w);
- int h = 400;
+ int h = 500;
primaryStage.setHeight(h);
primaryStage.setMinHeight(h);
- primaryStage.setMaxHeight(2 * h);
prev();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b0a2d13/modules/schema-load/src/main/java/org/apache/ignite/schema/util/SchemaUtils.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/util/SchemaUtils.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/util/SchemaUtils.java
index a4e0d6a..ee1f636 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/util/SchemaUtils.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/util/SchemaUtils.java
@@ -9,17 +9,10 @@
package org.apache.ignite.schema.util;
-import javafx.geometry.*;
-import javafx.scene.image.*;
-import javafx.scene.layout.*;
-
/**
* Utility class with common functions.
*/
public class SchemaUtils {
- /** */
- public static final Insets DFLT_PADDING = new Insets(10, 10, 10, 10);
-
/**
* @param str Source string.
* @return String with each word first letters capitalized.
@@ -79,43 +72,5 @@ public class SchemaUtils {
public static String toJavaFieldName(String name) {
return uncapitalizeFirst(toJavaClassName(name));
}
-
- /**
- * Gets image by its filename.
- *
- * @param imgFileName Image filename.
- */
- public static Image image(String imgFileName, int sz) {
- return new Image(SchemaUtils.class.getClassLoader()
- .getResourceAsStream(String.format("media/%1$s_%2$dx%2$d.png", imgFileName, sz)));
- }
-
- /**
- * Create new {@code HBox} with default padding.
- *
- * @param spacing Amount of horizontal space between each child.
- * @return New {@code HBox} instance.
- */
- public static HBox newHBox(int spacing) {
- HBox hb = new HBox(spacing);
-
- hb.setPadding(DFLT_PADDING);
-
- return hb;
- }
-
- /**
- * Create new {@code VBox} with default padding.
- *
- * @param spacing Amount of horizontal space between each child.
- * @return New {@code VBox} instance.
- */
- public static VBox newVBox(int spacing) {
- VBox vb = new VBox(spacing);
-
- vb.setPadding(DFLT_PADDING);
-
- return vb;
- }
}