Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0E9DF10DEB for ; Wed, 14 Jan 2015 16:23:40 +0000 (UTC) Received: (qmail 98730 invoked by uid 500); 14 Jan 2015 16:23:41 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 98700 invoked by uid 500); 14 Jan 2015 16:23:41 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 98691 invoked by uid 99); 14 Jan 2015 16:23:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jan 2015 16:23:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 14 Jan 2015 16:23:38 +0000 Received: (qmail 98038 invoked by uid 99); 14 Jan 2015 16:23:18 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jan 2015 16:23:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 30A4FA41F5B; Wed, 14 Jan 2015 16:23:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: # IGNITE-32 WIP: Changes for GUI after review. Date: Wed, 14 Jan 2015 16:23:18 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-ignite Updated Branches: refs/heads/ignite-32 3bccbe171 -> e3ec48c64 # IGNITE-32 WIP: Changes for GUI after review. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e3ec48c6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e3ec48c6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e3ec48c6 Branch: refs/heads/ignite-32 Commit: e3ec48c64ba185240d523ac739071d98ed620b2f Parents: 3bccbe1 Author: AKuznetsov Authored: Wed Jan 14 23:23:10 2015 +0700 Committer: AKuznetsov Committed: Wed Jan 14 23:23:10 2015 +0700 ---------------------------------------------------------------------- .../ignite/schema/db/DbMetadataParser.java | 17 +- .../ignite/schema/pojo/PojoCodeGenerator.java | 17 +- .../org/apache/ignite/schema/ui/Controls.java | 27 +++- .../org/apache/ignite/schema/ui/GridPaneEx.java | 22 ++- .../org/apache/ignite/schema/ui/MessageBox.java | 23 ++- .../apache/ignite/schema/ui/ModalDialog.java | 17 +- .../apache/ignite/schema/ui/PojoDescriptor.java | 38 ++--- .../org/apache/ignite/schema/ui/PojoField.java | 17 ++ .../apache/ignite/schema/ui/SchemaLoadApp.java | 161 +++++++++++++------ .../apache/ignite/schema/util/SchemaUtils.java | 17 +- .../ignite/schema/xml/XmlTransformer.java | 17 +- .../auto/AbstractAutoCacheStoreSelfTest.java | 17 +- .../store/auto/AutoCacheStoreSelfTest.java | 17 +- .../gridgain/grid/cache/store/auto/package.html | 18 ++- 14 files changed, 339 insertions(+), 86 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/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 ecc7ef2..822d8d5 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 @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.db; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/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 e29508b..47946c6 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 @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.pojo; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/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 6e416ce..dcae5a3 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 @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.ui; @@ -35,10 +50,16 @@ public class Controls { /** * Create grid pane with default padding. * + * @param dfltPadding If {@code true} than set default padding for pane. * @return New {@code GridPaneEx} instance. */ - public static GridPaneEx paneEx() { - return new GridPaneEx(DFLT_PADDING); + public static GridPaneEx paneEx(boolean dfltPadding) { + GridPaneEx paneEx = new GridPaneEx(); + + if (dfltPadding) + paneEx.setPadding(DFLT_PADDING); + + return paneEx; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/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 00d4b58..0db92e6 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 @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.ui; @@ -18,11 +33,10 @@ public class GridPaneEx extends GridPane { private int row; /** - * @param padding Pane padding. + * Create pane. */ - public GridPaneEx(Insets padding) { + public GridPaneEx() { setAlignment(Pos.TOP_LEFT); - setPadding(padding); setHgap(5); setVgap(10); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/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 7b43050..c07287e 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 @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.ui; @@ -84,13 +99,13 @@ public class MessageBox extends ModalDialog { if (type == MessageType.CONFIRM) { res = NO_OPTION; - btns.getChildren().addAll(button("Yes", "", new EventHandler() { + btns.getChildren().addAll(button("Yes", "Approve the request", new EventHandler() { @Override public void handle(ActionEvent e) { res = YES_OPTION; close(); } - }), button("No", "", new EventHandler() { + }), button("No", "Reject the request", new EventHandler() { @Override public void handle(ActionEvent e) { res = NO_OPTION; @@ -99,7 +114,7 @@ public class MessageBox extends ModalDialog { })); } else - btns.getChildren().add(button("OK", "", new EventHandler() { + btns.getChildren().add(button("OK", "Close dialog", new EventHandler() { @Override public void handle(ActionEvent e) { close(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java index 4f04d41..6d0acb7 100644 --- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java +++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.ui; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoDescriptor.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoDescriptor.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoDescriptor.java index 13bdc20..2d6db52 100644 --- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoDescriptor.java +++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoDescriptor.java @@ -1,10 +1,18 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.ignite.schema.ui; @@ -79,19 +87,11 @@ public class PojoDescriptor { } /** - * Revert changes made by user. + * Revert changes to java names made by user. */ - public void revert() { - keyClsName = keyClsNamePrev; - valClsName = valClsNamePrev; - - for (int i = 0; i < fields.size(); i++) { - PojoField cur = fields.get(i); - PojoField prev = fieldsPrev.get(i); - - cur.key(prev.key()); - cur.javaName(prev.javaName()); - } + public void revertJavaNames() { + for (int i = 0; i < fields.size(); i++) + fields.get(i).javaName(fieldsPrev.get(i).javaName()); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoField.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoField.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoField.java index 9fa471b..c9fe987 100644 --- a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoField.java +++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/PojoField.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.apache.ignite.schema.ui; import javafx.beans.property.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/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 e3bbaa2..35dc859 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 @@ -1,4 +1,20 @@ -/* @java.file.header */ + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.ui; @@ -25,7 +41,6 @@ import java.sql.*; import java.util.*; import java.util.concurrent.*; import java.util.prefs.*; -import java.util.regex.*; import static javafx.embed.swing.SwingFXUtils.*; import static org.apache.ignite.schema.ui.Controls.*; @@ -78,7 +93,7 @@ public class SchemaLoadApp extends Application { private CheckBoxTreeItem rootItem; /** */ - private TextField ptrnTf; + private TextField regexTf; /** */ private TextField replaceTf; @@ -116,6 +131,9 @@ public class SchemaLoadApp extends Application { /** Map with schema - table - POJO descriptors. */ private Map> pojos = Collections.emptyMap(); + /** Currently selected POJO. */ + private PojoDescriptor curPojo; + /** */ private static final ObservableList NO_DATA = FXCollections.emptyObservableList(); @@ -260,6 +278,7 @@ public class SchemaLoadApp extends Application { prevBtn.setDisable(false); nextBtn.setText("Generate"); + tooltip(nextBtn, "Generate POJO and XML files"); } /** {@inheritDoc} */ @@ -440,13 +459,13 @@ public class SchemaLoadApp extends Application { * @return Panel with control buttons. */ private Pane createButtonsPane() { - prevBtn = button("Prev", "", new EventHandler() { + prevBtn = button("Prev", "Go to \"Database connection\" page", new EventHandler() { @Override public void handle(ActionEvent evt) { prev(); } }); - nextBtn = button("Next", "", new EventHandler() { + nextBtn = button("Next", "Go to \"POJO and XML generation\" page", new EventHandler() { @Override public void handle(ActionEvent evt) { next(); } @@ -484,17 +503,23 @@ public class SchemaLoadApp extends Application { prevBtn.setDisable(true); nextBtn.setText("Next"); + tooltip(nextBtn, "Go to \"POJO and XML generation\" page"); } /** * Check that text field is non empty. * * @param tf Text field to check. + * @param trim If {@code true} then * @param msg Warning message. * @return {@code true} If text field is empty. */ - private boolean checkInput(TextField tf, String msg) { - if (tf.getText().trim().isEmpty()) { + private boolean checkInput(TextField tf, boolean trim, String msg) { + String s = tf.getText(); + + s = trim ? s.trim() : s; + + if (s.isEmpty()) { tf.requestFocus(); MessageBox.warningDialog(owner, msg); @@ -510,10 +535,10 @@ public class SchemaLoadApp extends Application { */ private void next() { if (rootPane.getCenter() == connLayerPnl) { - if (checkInput(jdbcDrvJarTf, "Path to JDBC driver is not specified!") || - checkInput(jdbcDrvClsTf, "JDBC driver class name is not specified!") || - checkInput(jdbcUrlTf, "JDBC URL connection string is not specified!") || - checkInput(userTf, "User name is not specified!")) + if (checkInput(jdbcDrvJarTf, true, "Path to JDBC driver is not specified!") || + checkInput(jdbcDrvClsTf, true, "JDBC driver class name is not specified!") || + checkInput(jdbcUrlTf, true, "JDBC URL connection string is not specified!") || + checkInput(userTf, true, "User name is not specified!")) return; fill(); @@ -577,7 +602,7 @@ public class SchemaLoadApp extends Application { * Create connection pane with controls. */ private Pane createConnectionPane() { - connPnl = paneEx(); + connPnl = paneEx(true); connPnl.addColumn(); connPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS); @@ -585,7 +610,7 @@ public class SchemaLoadApp extends Application { jdbcDrvJarTf = connPnl.addLabeled("Driver JAR:", textField("Path to driver jar")); - connPnl.add(button("...", "", new EventHandler() { + connPnl.add(button("...", "Select JDBC driver jar or zip", new EventHandler() { /** {@inheritDoc} */ @Override public void handle(ActionEvent evt) { FileChooser fc = new FileChooser(); @@ -618,14 +643,14 @@ public class SchemaLoadApp extends Application { * Create generate pane with controls. */ private void createGeneratePane() { - genPnl = paneEx(); + genPnl = paneEx(true); genPnl.addColumn(); genPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS); genPnl.addColumn(35, 35, 35, Priority.NEVER); genPnl.addRow(100, 100, Double.MAX_VALUE, Priority.ALWAYS); - genPnl.addRows(6); + genPnl.addRows(9); TableColumn keyCol = tableColumn("Key", "key", "If checked then this field will be part of key object", 70, 70); @@ -757,10 +782,13 @@ public class SchemaLoadApp extends Application { @Override public void changed(ObservableValue> val, TreeItem oldItem, TreeItem newItem) { if (newItem != null && newItem.getParent() != null && newItem.isLeaf()) { - tbl.setItems(pojos.get(newItem.getParent().getValue()).get(newItem.getValue()).fields()); + curPojo = pojos.get(newItem.getParent().getValue()).get(newItem.getValue()); + + tbl.setItems(curPojo.fields()); tbl.getSelectionModel().select(0); } else { + curPojo = null; tbl.setItems(NO_DATA); upBtn.setDisable(true); @@ -773,63 +801,102 @@ public class SchemaLoadApp extends Application { genPnl.add(new Label("Replace Ignite name for selected table:"), 3); - ptrnTf = genPnl.addLabeled(" Regexp pattern:", textField("Regular expression pattern. For example: (\\w+)"), 2); - replaceTf = genPnl.addLabeled(" Replace with:", textField("Replace text. For example: $1_Suffix"), 2); + GridPaneEx regexPnl = paneEx(false); + regexPnl.addColumn(); + regexPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS); + regexPnl.addColumn(); + regexPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS); + + regexTf = regexPnl.addLabeled(" Regexp:", textField("Regular expression. For example: (\\w+)")); + replaceTf = regexPnl.addLabeled(" Replace with:", textField("Replace text. For example: $1_Suffix")); + + genPnl.add(regexPnl, 3); genPnl.add(buttonsPane(Pos.BOTTOM_RIGHT, false, - button("Rename", "Execute replace of Ignite names with provided regular expression pattern", + button("Rename", "Replace Ignite names by provided regular expression for current table", new EventHandler() { - /** {@inheritDoc} */ - @Override public void handle(ActionEvent evt) { - ObservableList fields = tbl.getItems(); + private String checkRegex(TextField tf, String msg) { + String txt = tf.getText(); - if (fields.isEmpty()) { - MessageBox.warningDialog(owner, "Please select table to rename Ignite names!"); + if (txt.isEmpty()) { + tf.requestFocus(); - return; + throw new IllegalStateException(msg); } - String ptrn = ptrnTf.getText().trim(); - - if (ptrn.isEmpty()) { - MessageBox.warningDialog(owner, "Regular expression pattern should not be empty!"); + return txt; + } - ptrnTf.requestFocus(); + /** {@inheritDoc} */ + @Override public void handle(ActionEvent evt) { + if (curPojo == null) { + MessageBox.warningDialog(owner, "Please select table to rename Ignite names!"); return; } - String replace = replaceTf.getText().trim(); + if (!checkInput(regexTf, false, "Regular expression should not be empty!")) + return; - if (replace.isEmpty()) { - MessageBox.warningDialog(owner, "Replace expression should not be empty!"); + String regex = regexTf.getText(); - replaceTf.requestFocus(); - - return; - } + String replace = replaceTf.getText(); try { - for (PojoField field : fields) - field.javaName(field.javaName().replaceAll(ptrn, replace)); + for (PojoField field : curPojo.fields()) + field.javaName(field.javaName().replaceAll(regex, replace)); } - catch (PatternSyntaxException e) { - MessageBox.errorDialog(owner, "Failed to apply regexp!", e); + catch (Exception e) { + MessageBox.errorDialog(owner, "Failed to rename Ignate names!", e); } } }), - button("Revert", "Revert all changes to Ignite name to default ones", new EventHandler() { + button("Rename All", "Replace Ignite names by provided regular expression for current table", + new EventHandler() { + /** {@inheritDoc} */ + @Override public void handle(ActionEvent evt) { + if (!checkInput(regexTf, false, "Regular expression should not be empty!")) + return; + + String regex = regexTf.getText(); + + String replace = replaceTf.getText(); + + try { + for (Map descs : pojos.values()) + for (PojoDescriptor pojo : descs.values()) + for (PojoField field : pojo.fields()) + field.javaName(field.javaName().replaceAll(regex, replace)); + } + catch (Exception e) { + MessageBox.errorDialog(owner, "Failed to rename Ignate names!", e); + } + } + }), + button("Revert", "Revert changes to Ignite names to default ones for current table", new EventHandler() { + /** {@inheritDoc} */ + @Override public void handle(ActionEvent evt) { + if (curPojo != null) + curPojo.revertJavaNames(); + else + MessageBox.warningDialog(owner, "Please select table to revert changes to Ignite names!"); + } + }), + button("Revert All", "Revert changes to Ignite names to default ones for all tables", new EventHandler() { /** {@inheritDoc} */ @Override public void handle(ActionEvent evt) { - // TODO pojo.revert(); + for (Map descs : pojos.values()) + for (PojoDescriptor pojo : descs.values()) + pojo.revertJavaNames(); } - })), 3); + }) + ), 3); pkgTf = genPnl.addLabeled("Package:", textField("Package that will be used for POJOs generation"), 2); outFolderTf = genPnl.addLabeled("Output Folder:", textField("Output folder for POJOs and XML files")); - genPnl.add(button("...", "", new EventHandler() { + genPnl.add(button("...", "Select output folder", new EventHandler() { /** {@inheritDoc} */ @Override public void handle(ActionEvent evt) { DirectoryChooser dc = new DirectoryChooser(); @@ -928,7 +995,7 @@ public class SchemaLoadApp extends Application { xmlSingleFileCh.setSelected(userPrefs.getBoolean("xml.single", true)); - ptrnTf.setText(userPrefs.get("naming.pattern", "")); + regexTf.setText(userPrefs.get("naming.pattern", "")); replaceTf.setText(userPrefs.get("naming.replace", "")); primaryStage.show(); @@ -960,7 +1027,7 @@ public class SchemaLoadApp extends Application { userPrefs.putBoolean("xml.single", xmlSingleFileCh.isSelected()); - userPrefs.put("naming.pattern", ptrnTf.getText()); + userPrefs.put("naming.pattern", regexTf.getText()); userPrefs.put("naming.replace", replaceTf.getText()); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/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 ddc053a..863c7d8 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 @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.util; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/modules/schema-load/src/main/java/org/apache/ignite/schema/xml/XmlTransformer.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/xml/XmlTransformer.java b/modules/schema-load/src/main/java/org/apache/ignite/schema/xml/XmlTransformer.java index c1b3962..7c83f71 100644 --- a/modules/schema-load/src/main/java/org/apache/ignite/schema/xml/XmlTransformer.java +++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/xml/XmlTransformer.java @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.ignite.schema.xml; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AbstractAutoCacheStoreSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AbstractAutoCacheStoreSelfTest.java b/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AbstractAutoCacheStoreSelfTest.java index 168daac..842659f 100644 --- a/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AbstractAutoCacheStoreSelfTest.java +++ b/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AbstractAutoCacheStoreSelfTest.java @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.gridgain.grid.cache.store.auto; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AutoCacheStoreSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AutoCacheStoreSelfTest.java b/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AutoCacheStoreSelfTest.java index d62ad74..71abc2f 100644 --- a/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AutoCacheStoreSelfTest.java +++ b/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/AutoCacheStoreSelfTest.java @@ -1,4 +1,19 @@ -/* @java.file.header */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.gridgain.grid.cache.store.auto; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3ec48c6/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/package.html ---------------------------------------------------------------------- diff --git a/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/package.html b/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/package.html index 7a92630..6556981 100644 --- a/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/package.html +++ b/modules/schema-load/src/test/java/org/gridgain/grid/cache/store/auto/package.html @@ -1,7 +1,21 @@ - + +