From 90beb5ecaccc2626d4436bd5c9eb95071d2207d0 Mon Sep 17 00:00:00 2001 From: vincent Date: Fri, 22 Nov 2019 11:19:25 +0100 Subject: [PATCH 01/17] replace loginForm.fxml by BeforeYouBegin.fxml, add some traduction in english --- .../easy/installer/java/EasyInstaller.java | 25 ++----- .../controllers/MainWindowController.java | 4 +- .../BeforeYouBeginController.java | 31 ++++++++ .../subcontrollers/LoginFormController.java | 75 ------------------- src/main/resources/fxml/beforeYouBegin.fxml | 74 ++++++++++++++++++ src/main/resources/fxml/donateScene.fxml | 2 +- src/main/resources/fxml/loginForm.fxml | 25 ------- src/main/resources/fxml/mainWindow.fxml | 2 +- src/main/resources/lang/traduction.properties | 21 +++++- .../lang/traduction_en_EN.properties | 22 ++++-- 10 files changed, 147 insertions(+), 134 deletions(-) create mode 100644 src/main/java/easy/installer/java/controllers/subcontrollers/BeforeYouBeginController.java delete mode 100644 src/main/java/easy/installer/java/controllers/subcontrollers/LoginFormController.java create mode 100644 src/main/resources/fxml/beforeYouBegin.fxml delete mode 100644 src/main/resources/fxml/loginForm.fxml diff --git a/src/main/java/easy/installer/java/EasyInstaller.java b/src/main/java/easy/installer/java/EasyInstaller.java index aea13eaf..b43f2664 100644 --- a/src/main/java/easy/installer/java/EasyInstaller.java +++ b/src/main/java/easy/installer/java/EasyInstaller.java @@ -20,16 +20,13 @@ import javafx.stage.Stage; */ public class EasyInstaller extends Application { public final static String FXML_PATH ="fxml"; - final static String TRADUCTION_BUNDLE_PATH = "lang"; - private String locale_lang ="fr"; - private String locale_country ="FR"; - ResourceBundle i18n; //i18n mean "internationalization" + private String locale_lang ="en"; + private String locale_country ="EN"; + private ResourceBundle i18n; //i18n mean "internationalization" @Override public void start(Stage stage) throws Exception { - - Locale currentLocale; if(locale_lang == null || locale_country == null ){ @@ -37,31 +34,21 @@ public class EasyInstaller extends Application { } else{ currentLocale = new Locale(locale_lang, locale_country); }//else use default locale - i18n = ResourceBundle.getBundle(TRADUCTION_BUNDLE_PATH+".traduction", currentLocale); + i18n = ResourceBundle.getBundle("lang.traduction", currentLocale); - //Load elements from resources - + //Load main view FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource(FXML_PATH+"/mainWindow.fxml")); loader.setResources(i18n); Parent root = loader.load() ; //Defines some properties Scene scene = new Scene(root); - stage.setTitle(i18n.getString("appTitle")); + stage.setTitle(i18n.getString("appTitle")+"V0.2"); stage.setScene(scene); //Display UI stage.show(); } - - /** - * Load the correcte resourceBundle for internationalization - * @return ResourceBundle for traduction - */ - public ResourceBundle getResourceBundle(){ - Locale currentLocale = new Locale(""); - return ResourceBundle.getBundle(TRADUCTION_BUNDLE_PATH+"/traduction", currentLocale); - } /** * @param args the command line arguments diff --git a/src/main/java/easy/installer/java/controllers/MainWindowController.java b/src/main/java/easy/installer/java/controllers/MainWindowController.java index 8a92e0e9..b61636b7 100644 --- a/src/main/java/easy/installer/java/controllers/MainWindowController.java +++ b/src/main/java/easy/installer/java/controllers/MainWindowController.java @@ -91,11 +91,11 @@ public class MainWindowController implements Initializable, IPreparationListener System.out.println("loadSubScene("+currentSubRootId+")"); if(currentSubRootId == null || currentSubRootId.isEmpty()){ - loadSubUI("/loginForm.fxml"); + loadSubUI("/beforeYouBegin.fxml"); disableNextButton(true); }else{ switch(currentSubRootId){ - case "loginFormRoot": + case "beforeYouBeginRoot": root.getChildren().removeIf( n -> n.getId().equals(currentSubRootId)); currentSubRootId = null; loadSubUI("/selectDeviceForm.fxml"); diff --git a/src/main/java/easy/installer/java/controllers/subcontrollers/BeforeYouBeginController.java b/src/main/java/easy/installer/java/controllers/subcontrollers/BeforeYouBeginController.java new file mode 100644 index 00000000..e02012ab --- /dev/null +++ b/src/main/java/easy/installer/java/controllers/subcontrollers/BeforeYouBeginController.java @@ -0,0 +1,31 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package easy.installer.java.controllers.subcontrollers; + +import java.net.URL; +import java.util.ResourceBundle; +import javafx.fxml.FXML; +import javafx.scene.layout.AnchorPane; + + +/** + * + * @author Vincent Bourgmayer + */ +public class BeforeYouBeginController extends AbstractSubController { + + private @FXML AnchorPane beforeYouBeginRoot; + + @Override + public void initialize(URL location, ResourceBundle resources) { + System.out.println("Initialize BeforeYouBeginController"); + + + + + } + +} diff --git a/src/main/java/easy/installer/java/controllers/subcontrollers/LoginFormController.java b/src/main/java/easy/installer/java/controllers/subcontrollers/LoginFormController.java deleted file mode 100644 index 96a6a0b1..00000000 --- a/src/main/java/easy/installer/java/controllers/subcontrollers/LoginFormController.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package easy.installer.java.controllers.subcontrollers; - - - - -import com.jfoenix.controls.JFXPasswordField; -import java.io.IOException; -import java.net.URL; -import java.util.ResourceBundle; -import javafx.fxml.FXML; - -import com.jfoenix.controls.JFXTextField; -import javafx.scene.layout.Pane; - -/** - * - * @author Vincent Bourgmayer - */ -public class LoginFormController extends AbstractSubController { - - @FXML JFXTextField loginField; - @FXML JFXPasswordField pwdField; - @FXML Pane loginFormRoot; - - @Override - public void initialize(URL location, ResourceBundle resources) { - System.out.println("Initialize LoginFormControler"); - } - - /** - * Run when the user click on Login Button - */ - public void onLoginButtonClicked(){ - System.out.println("onLoginButtonClicked()"); - - String login = loginField.getText(); - String pwd = pwdField.getText(); - - System.out.println("Login: "+login); //toRemove - System.out.println("password: "+pwd); //toRemove - - //Check credentials - boolean credentialOK = true; - // if valid : - if(credentialOK){ - parentController.disableNextButton(false); - } - else - System.out.println("Not yet implemented"); - //Display error - } - - - /** - * Open the /e/ account creation's url in browser - * - * improvement: find a way to store the URL so it could be easily updated - */ - public void onCreateAccountUrlClicked(){ - System.out.println("onCreateAccountUrlClicked()"); - - try { - //Note: need to check that it works on mac & Windows! (& other linux dist) - new ProcessBuilder("x-www-browser", "https://e.foundation/e-mail-invite/").start(); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/src/main/resources/fxml/beforeYouBegin.fxml b/src/main/resources/fxml/beforeYouBegin.fxml new file mode 100644 index 00000000..2b516cd8 --- /dev/null +++ b/src/main/resources/fxml/beforeYouBegin.fxml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/donateScene.fxml b/src/main/resources/fxml/donateScene.fxml index 7069b54d..2e07ba42 100644 --- a/src/main/resources/fxml/donateScene.fxml +++ b/src/main/resources/fxml/donateScene.fxml @@ -10,7 +10,7 @@ - +