From ca376ef1865e629a5a3fb3255523ff0b3f2a608e Mon Sep 17 00:00:00 2001 From: firm1 Date: Mon, 26 Dec 2016 13:46:30 +0100 Subject: [PATCH] improve major quality problem --- .../com/zestedesavoir/zestwriter/MainApp.java | 10 +- .../zestwriter/model/Constant.java | 4 + .../zestwriter/model/Container.java | 4 +- .../zestwriter/model/License.java | 3 - .../zestwriter/model/MetaAttribute.java | 2 + .../zestwriter/model/MetaContent.java | 17 +- .../zestwriter/model/MetadataContent.java | 4 +- .../zestwriter/model/Textual.java | 23 +-- .../zestwriter/utils/Configuration.java | 6 +- .../zestwriter/utils/Corrector.java | 4 +- .../zestedesavoir/zestwriter/utils/Theme.java | 8 +- .../zestwriter/view/MdConvertController.java | 38 ++-- .../zestwriter/view/MdTextController.java | 12 +- .../zestwriter/view/MenuController.java | 164 +++++++++--------- .../zestwriter/view/TableController.java | 2 +- .../zestwriter/view/com/CustomFXMLLoader.java | 2 +- .../view/com/FunctionTreeFactory.java | 22 +-- .../zestwriter/view/com/MdTreeCell.java | 92 +++++----- .../zestwriter/view/dialogs/AboutDialog.java | 2 +- .../view/dialogs/EditContentDialog.java | 40 ++--- .../view/dialogs/FindReplaceDialog.java | 6 +- .../view/dialogs/GoogleLoginDialog.java | 2 +- .../view/dialogs/ImageInputDialog.java | 12 +- .../zestwriter/view/dialogs/LoginDialog.java | 14 +- .../view/dialogs/MdCheatSheetDialog.java | 2 +- .../view/dialogs/OptionsDialog.java | 34 ++-- .../view/task/CorrectionService.java | 2 +- .../view/task/DownloadContentService.java | 6 +- .../view/task/DownloadGithubService.java | 8 +- .../view/task/DownloadZdsService.java | 6 +- .../view/task/ExportPdfService.java | 10 +- .../zestwriter/view/task/LoginService.java | 10 +- .../view/task/UploadContentService.java | 6 +- .../view/task/UploadImageService.java | 4 +- 34 files changed, 280 insertions(+), 301 deletions(-) diff --git a/src/main/java/com/zestedesavoir/zestwriter/MainApp.java b/src/main/java/com/zestedesavoir/zestwriter/MainApp.java index c47504102..abdd00b60 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/MainApp.java +++ b/src/main/java/com/zestedesavoir/zestwriter/MainApp.java @@ -165,7 +165,7 @@ public static Logger getLogger() { @Override public void start(Stage primaryStage) { setPrimaryStage(primaryStage); - getPrimaryStage().setTitle(Configuration.bundle.getString("ui.app_name.text")); + getPrimaryStage().setTitle(Configuration.getBundle().getString("ui.app_name.text")); getPrimaryStage().getIcons().add(new Image(getClass().getResourceAsStream("images/logo.png"))); getPrimaryStage().setMinWidth(400); getPrimaryStage().setMinHeight(400); @@ -270,9 +270,9 @@ public void initConnection(){ loginTask.setOnCancelled(t -> { Alert alert = new CustomAlert(Alert.AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.auth.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.auth.state.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.auth.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.state.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text")); alert.showAndWait(); menuController.getMenuDownload().setDisable(false); @@ -301,7 +301,7 @@ public void handle(KeyEvent t) { if(key.toString().equals("_CONTROL_C_L_E_M")){ // Create the custom dialog. Dialog dialog = new Dialog<>(); - dialog.setTitle(Configuration.bundle.getString("ui.menu.easteregg")); + dialog.setTitle(Configuration.getBundle().getString("ui.menu.easteregg")); dialog.setHeaderText(null); dialog.setContentText(null); diff --git a/src/main/java/com/zestedesavoir/zestwriter/model/Constant.java b/src/main/java/com/zestedesavoir/zestwriter/model/Constant.java index 4e967a609..fa09be0c8 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/model/Constant.java +++ b/src/main/java/com/zestedesavoir/zestwriter/model/Constant.java @@ -11,4 +11,8 @@ public class Constant { public static final String SET_COOKIE_HEADER = "Set-Cookie"; public static final String CSRF_ZDS_KEY = "csrfmiddlewaretoken"; public static final String CSRF_COOKIE_KEY = "csrftoken"; + + private Constant() { + throw new IllegalAccessError("Utility class"); + } } diff --git a/src/main/java/com/zestedesavoir/zestwriter/model/Container.java b/src/main/java/com/zestedesavoir/zestwriter/model/Container.java index 76897b0a8..32778ccb1 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/model/Container.java +++ b/src/main/java/com/zestedesavoir/zestwriter/model/Container.java @@ -30,8 +30,8 @@ public class Container extends MetaContent implements ContentNode { public Container(@JsonProperty("object") String object, @JsonProperty("slug") String slug, @JsonProperty("title") String title, @JsonProperty("introduction") String introduction, @JsonProperty("conclusion") String conclusion, @JsonProperty("children") List children) { super(object, slug, title); - this._introduction = new MetaAttribute(introduction, Configuration.bundle.getString("ui.model.intro")); - this._conclusion = new MetaAttribute(conclusion, Configuration.bundle.getString("ui.model.conclusion")); + this._introduction = new MetaAttribute(introduction, Configuration.getBundle().getString("ui.model.intro")); + this._conclusion = new MetaAttribute(conclusion, Configuration.getBundle().getString("ui.model.conclusion")); this._children = children; } diff --git a/src/main/java/com/zestedesavoir/zestwriter/model/License.java b/src/main/java/com/zestedesavoir/zestwriter/model/License.java index 2e63e3f0b..35f5bab17 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/model/License.java +++ b/src/main/java/com/zestedesavoir/zestwriter/model/License.java @@ -20,13 +20,10 @@ public void setCode(String code) { this.code = code; } - - public String getLabel() { return label; } - public void setLabel(String label) { this.label = label; } diff --git a/src/main/java/com/zestedesavoir/zestwriter/model/MetaAttribute.java b/src/main/java/com/zestedesavoir/zestwriter/model/MetaAttribute.java index ce370817d..e453d1f25 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/model/MetaAttribute.java +++ b/src/main/java/com/zestedesavoir/zestwriter/model/MetaAttribute.java @@ -38,6 +38,7 @@ public String getTitle() { return title; } + @Override public void setTitle(String title) { this.title = title; } @@ -54,6 +55,7 @@ public String getBasePath() { return basePath; } + @Override public void setBasePath(String basePath) { this.basePath = basePath; File base = new File(getFilePath()); diff --git a/src/main/java/com/zestedesavoir/zestwriter/model/MetaContent.java b/src/main/java/com/zestedesavoir/zestwriter/model/MetaContent.java index 7690c7463..4f00b5f65 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/model/MetaContent.java +++ b/src/main/java/com/zestedesavoir/zestwriter/model/MetaContent.java @@ -4,10 +4,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.zestedesavoir.zestwriter.MainApp; +import com.zestedesavoir.zestwriter.view.com.FunctionTreeFactory; import java.io.File; -import java.io.IOException; import java.util.Map; import java.util.function.Function; @@ -38,7 +37,7 @@ public void setRootContent(Content rootContent, String basePath) { setBasePath(basePath); this.rootContent = rootContent; if(this instanceof Container) { - Container c = ((Container) this); + Container c = (Container) this; c.getIntroduction().setRootContent(rootContent, basePath); c.getConclusion().setRootContent(rootContent, basePath); for(MetaContent meta: c.getChildren()) { @@ -87,22 +86,14 @@ public void setBasePath(String basePath) { if(! base.exists()) { base.mkdirs(); } - Container c = ((Container) this); + Container c = (Container) this; c.getIntroduction().setBasePath(basePath); c.getConclusion().setBasePath(basePath); for(MetaContent meta: c.getChildren()) { meta.setBasePath(basePath); } } else { - if(! base.exists()) { - try { - if(!base.createNewFile()) { - MainApp.getLogger().error("Problème lors de la création de "+base.getAbsolutePath()); - } - } catch (IOException e) { - MainApp.getLogger().error("Problème lors de la création de "+base.getAbsolutePath(), e); - } - } + FunctionTreeFactory.performCreateNewFile(base); } } diff --git a/src/main/java/com/zestedesavoir/zestwriter/model/MetadataContent.java b/src/main/java/com/zestedesavoir/zestwriter/model/MetadataContent.java index d59e53df0..571d3ba78 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/model/MetadataContent.java +++ b/src/main/java/com/zestedesavoir/zestwriter/model/MetadataContent.java @@ -24,9 +24,9 @@ public String getType() { return type; } - public boolean isArticle() {return type.equalsIgnoreCase("article");} + public boolean isArticle() {return "article".equalsIgnoreCase(type);} - public boolean isTutorial() {return type.equalsIgnoreCase("tutorial");} + public boolean isTutorial() {return "tutorial".equalsIgnoreCase(type);} @Override public String toString() { diff --git a/src/main/java/com/zestedesavoir/zestwriter/model/Textual.java b/src/main/java/com/zestedesavoir/zestwriter/model/Textual.java index a93f4b88b..c756e0a3b 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/model/Textual.java +++ b/src/main/java/com/zestedesavoir/zestwriter/model/Textual.java @@ -13,43 +13,24 @@ public interface Textual{ String getMarkdown(); default void save() { - BufferedWriter writer = null; - try { - writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(getFilePath()), "UTF8")); + try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(getFilePath()), "UTF8"))) { writer.append(getMarkdown()); writer.flush(); } catch (Exception e) { MainApp.getLogger().error(e.getMessage(), e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (Exception ignored) { - } } } default String readMarkdown() { Path path = Paths.get(this.getFilePath()); - Scanner scanner = null; StringBuilder bfString = new StringBuilder(); - try { - scanner = new Scanner(path, StandardCharsets.UTF_8.name()); + try(Scanner scanner = new Scanner(path, StandardCharsets.UTF_8.name())) { while (scanner.hasNextLine()) { bfString.append(scanner.nextLine()); bfString.append("\n"); } - scanner.close(); return bfString.toString(); } catch (IOException e) { MainApp.getLogger().error(e.getMessage(), e); - } finally { - try { - if (scanner != null) { - scanner.close(); - } - } catch (Exception ignored) { - } } return ""; } diff --git a/src/main/java/com/zestedesavoir/zestwriter/utils/Configuration.java b/src/main/java/com/zestedesavoir/zestwriter/utils/Configuration.java index b2b0f812b..3ef44003c 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/utils/Configuration.java +++ b/src/main/java/com/zestedesavoir/zestwriter/utils/Configuration.java @@ -29,7 +29,7 @@ public class Configuration { private StorageSaver onlineSaver; private LocalDirectoryFactory workspaceFactory; private Properties props; - public static ResourceBundle bundle; + private static ResourceBundle bundle; /** * Class constructor @@ -164,6 +164,10 @@ public LocalDirectoryFactory getWorkspaceFactory() { return workspaceFactory; } + public static ResourceBundle getBundle() { + return bundle; + } + public void loadWorkspace() { this.workspaceFactory = new LocalDirectoryFactory(getWorkspacePath()); diff --git a/src/main/java/com/zestedesavoir/zestwriter/utils/Corrector.java b/src/main/java/com/zestedesavoir/zestwriter/utils/Corrector.java index 66894edbc..5ec51c21a 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/utils/Corrector.java +++ b/src/main/java/com/zestedesavoir/zestwriter/utils/Corrector.java @@ -167,7 +167,7 @@ public String checkHtmlContent(String htmlContent) { desc = new HtmlToPlainText().getPlainText(Jsoup.parse(desc)); if (!match.getSuggestedReplacements().isEmpty()) { - desc += Configuration.bundle.getString("ui.alert.correction.tooltip.suggestion") + desc += Configuration.getBundle().getString("ui.alert.correction.tooltip.suggestion") + match.getSuggestedReplacements(); } String before = ""; @@ -199,7 +199,7 @@ public String checkHtmlContentToText(String htmlContent, String source) { bf.append("> "); bf.append(markup.getPlainText().split("[\n|\r]")[match.getLine()].replace(txt, "**" + txt + "**")); bf.append("\n"); - bf.append(Configuration.bundle.getString("ui.alert.correction.source")).append(source); + bf.append(Configuration.getBundle().getString("ui.alert.correction.source")).append(source); bf.append("\n\n"); bf.append(match.getRule().getDescription()); bf.append("\n\n"); diff --git a/src/main/java/com/zestedesavoir/zestwriter/utils/Theme.java b/src/main/java/com/zestedesavoir/zestwriter/utils/Theme.java index b619241eb..bad5df194 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/utils/Theme.java +++ b/src/main/java/com/zestedesavoir/zestwriter/utils/Theme.java @@ -13,12 +13,12 @@ public class Theme { private int endMonth=0; private static List themeAvailable = Arrays.asList( - new Theme("dark.css", Configuration.bundle.getString("ui.options.display.theme.dark")), - new Theme("light.css", Configuration.bundle.getString("ui.options.display.theme.light")), - new Theme("halloween.css", Configuration.bundle.getString("ui.options.display.theme.halloween"), 31, 10, 2, 11), + new Theme("dark.css", Configuration.getBundle().getString("ui.options.display.theme.dark")), + new Theme("light.css", Configuration.getBundle().getString("ui.options.display.theme.light")), + new Theme("halloween.css", Configuration.getBundle().getString("ui.options.display.theme.halloween"), 31, 10, 2, 11), new Theme("winxaito_light.css", "WinXaito's Light"), new Theme("winxaito_dark.css", "WinXaito's Dark"), - new Theme("christmas.css", Configuration.bundle.getString("ui.options.display.theme.christmas"), 15, 12, 27, 12)); + new Theme("christmas.css", Configuration.getBundle().getString("ui.options.display.theme.christmas"), 15, 12, 27, 12)); public Theme(String filename, String label, int startDay, int startMonth, int endDay, int endMonth) { this.filename = filename; diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/MdConvertController.java b/src/main/java/com/zestedesavoir/zestwriter/view/MdConvertController.java index 0e40f827b..28a6fb220 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/MdConvertController.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/MdConvertController.java @@ -278,7 +278,7 @@ private void handleSmartTab() { @FXML private void handleImgButtonAction(ActionEvent event) { FXMLLoader loader = new CustomFXMLLoader(MainApp.class.getResource("fxml/ImageInput.fxml")); - Stage dialogStage = new CustomStage(loader, Configuration.bundle.getString("ui.dialog.upload.img.title")); + Stage dialogStage = new CustomStage(loader, Configuration.getBundle().getString("ui.dialog.upload.img.title")); ImageInputDialog imageController = loader.getController(); if(mainApp.getContents().size() > 0) { @@ -351,9 +351,9 @@ private void handleSmartTab() { FunctionTreeFactory.addTheming(dialog.getDialogPane()); dialog.initModality(Modality.APPLICATION_MODAL); dialog.initOwner(mainApp.getPrimaryStage()); - dialog.setTitle(Configuration.bundle.getString("ui.editor.dialog.bloc.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.editor.dialog.bloc.header")); - dialog.setContentText(Configuration.bundle.getString("ui.editor.dialog.bloc.text")); + dialog.setTitle(Configuration.getBundle().getString("ui.editor.dialog.bloc.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.editor.dialog.bloc.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.editor.dialog.bloc.text")); // Traditional way to get the response value. Optional result = dialog.showAndWait(); @@ -367,7 +367,7 @@ private void handleSmartTab() { @FXML private void handleTableButtonAction(ActionEvent event) throws IOException { // Create the custom dialog. Dialog>> dialog = new CustomDialog<>(); - dialog.setTitle(Configuration.bundle.getString("ui.editor.button.table")); + dialog.setTitle(Configuration.getBundle().getString("ui.editor.button.table")); dialog.setHeaderText(""); // Set the button types. @@ -416,8 +416,8 @@ private void handleSmartTab() { // Create the custom dialog. Dialog> dialog = new CustomDialog<>(); - dialog.setTitle(Configuration.bundle.getString("ui.editor.dialog.link.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.editor.dialog.link.header")); + dialog.setTitle(Configuration.getBundle().getString("ui.editor.dialog.link.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.editor.dialog.link.header")); // Set the icon (must be included in the project). dialog.setGraphic(IconFactory.createLinkIcon()); @@ -435,9 +435,9 @@ private void handleSmartTab() { TextField tLabel = new TextField(); tLabel.setText(link); - grid.add(new Label(Configuration.bundle.getString("ui.editor.dialog.link.field.url")), 0, 0); + grid.add(new Label(Configuration.getBundle().getString("ui.editor.dialog.link.field.url")), 0, 0); grid.add(tLink, 1, 0); - grid.add(new Label(Configuration.bundle.getString("ui.editor.dialog.link.field.label")), 0, 1); + grid.add(new Label(Configuration.getBundle().getString("ui.editor.dialog.link.field.label")), 0, 1); grid.add(tLabel, 1, 1); dialog.getDialogPane().setContent(grid); @@ -472,8 +472,8 @@ private void handleSmartTab() { // Create the custom dialog. Dialog> dialog = new CustomDialog<>(); - dialog.setTitle(Configuration.bundle.getString("ui.editor.dialog.code.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.editor.dialog.code.header")); + dialog.setTitle(Configuration.getBundle().getString("ui.editor.dialog.code.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.editor.dialog.code.header")); // Set the icon (must be included in the project). dialog.setGraphic(IconFactory.createCodeIcon()); @@ -491,9 +491,9 @@ private void handleSmartTab() { TextArea tCode = new TextArea(); tCode.setText(code); - grid.add(new Label(Configuration.bundle.getString("ui.editor.dialog.code.field.lang")), 0, 0); + grid.add(new Label(Configuration.getBundle().getString("ui.editor.dialog.code.field.lang")), 0, 0); grid.add(tLangage, 1, 0); - grid.add(new Label(Configuration.bundle.getString("ui.editor.dialog.code.field.code")), 0, 1); + grid.add(new Label(Configuration.getBundle().getString("ui.editor.dialog.code.field.code")), 0, 1); grid.add(tCode, 1, 1); dialog.getDialogPane().setContent(grid); @@ -603,7 +603,7 @@ protected String call() throws Exception { @FXML private void handleExternalButtonAction(ActionEvent event){ splitPane.getItems().remove(1); - Stage stage = new CustomStage(Configuration.bundle.getString("ui.window.externalrender.title")); + Stage stage = new CustomStage(Configuration.getBundle().getString("ui.window.externalrender.title")); AnchorPane pane = new AnchorPane(renderView); AnchorPane.setTopAnchor(renderView, 0.0); AnchorPane.setLeftAnchor(renderView, 0.0); @@ -630,8 +630,8 @@ protected String call() throws Exception { public void performStats() { Readability readText = new Readability(SourceText.getText()); - countChars.setValue(Configuration.bundle.getString("ui.statusbar.stats.chars") + readText.getCharacters()); - countWords.setValue(Configuration.bundle.getString("ui.statusbar.stats.words") + readText.getWords()); + countChars.setValue(Configuration.getBundle().getString("ui.statusbar.stats.chars") + readText.getCharacters()); + countWords.setValue(Configuration.getBundle().getString("ui.statusbar.stats.words") + readText.getWords()); countTimes.setValue(FunctionTreeFactory.getNumberOfTextualReadMinutes(SourceText.getText())); } @@ -668,9 +668,9 @@ public void initStats() { public void handleGoToLineAction() { TextInputDialog dialog = new TextInputDialog(); - dialog.setTitle(Configuration.bundle.getString("ui.editor.dialog.goto.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.editor.dialog.goto.header")); - dialog.setContentText(Configuration.bundle.getString("ui.editor.dialog.goto.text")); + dialog.setTitle(Configuration.getBundle().getString("ui.editor.dialog.goto.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.editor.dialog.goto.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.editor.dialog.goto.text")); dialog.initOwner(MainApp.getPrimaryStage()); Optional result = dialog.showAndWait(); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/MdTextController.java b/src/main/java/com/zestedesavoir/zestwriter/view/MdTextController.java index 4c99e398d..edad04dea 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/MdTextController.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/MdTextController.java @@ -269,13 +269,13 @@ public void createTabExtract(Textual extract) throws IOException { tab.setOnCloseRequest(t -> { if(!controllerConvert.isSaved()) { Alert alert = new CustomAlert(AlertType.CONFIRMATION); - alert.setTitle(Configuration.bundle.getString("ui.alert.tab.close.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.alert.tab.close.header")+" : "+tab.getText().substring(1)); - alert.setContentText(Configuration.bundle.getString("ui.alert.tab.close.text")); + alert.setTitle(Configuration.getBundle().getString("ui.alert.tab.close.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.alert.tab.close.header")+" : "+tab.getText().substring(1)); + alert.setContentText(Configuration.getBundle().getString("ui.alert.tab.close.text")); - ButtonType buttonTypeYes = new ButtonType(Configuration.bundle.getString("ui.yes")); - ButtonType buttonTypeNo = new ButtonType(Configuration.bundle.getString("ui.no")); - ButtonType buttonTypeCancel = new ButtonType(Configuration.bundle.getString("ui.cancel"), ButtonData.CANCEL_CLOSE); + ButtonType buttonTypeYes = new ButtonType(Configuration.getBundle().getString("ui.yes")); + ButtonType buttonTypeNo = new ButtonType(Configuration.getBundle().getString("ui.no")); + ButtonType buttonTypeCancel = new ButtonType(Configuration.getBundle().getString("ui.cancel"), ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTypeYes, buttonTypeNo, buttonTypeCancel); alert.setResizable(true); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/MenuController.java b/src/main/java/com/zestedesavoir/zestwriter/view/MenuController.java index 395adb3c5..7fa7a97e0 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/MenuController.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/MenuController.java @@ -162,8 +162,8 @@ private void handleIndex(Function calFlesh, String title, Strin }; handleIndex(calFlesh, - Configuration.bundle.getString("ui.menu.edit.readable.flesch_index"), - Configuration.bundle.getString("ui.menu.edit.readable.flesch_index.header")); + Configuration.getBundle().getString("ui.menu.edit.readable.flesch_index"), + Configuration.getBundle().getString("ui.menu.edit.readable.flesch_index.header")); } @FXML private void handleGunningButtonAction(ActionEvent event){ @@ -178,8 +178,8 @@ private void handleIndex(Function calFlesh, String title, Strin } }; handleIndex(calGuning, - Configuration.bundle.getString("ui.menu.edit.readable.gunning_index"), - Configuration.bundle.getString("ui.menu.edit.readable.gunning_index.header")); + Configuration.getBundle().getString("ui.menu.edit.readable.gunning_index"), + Configuration.getBundle().getString("ui.menu.edit.readable.gunning_index.header")); } @FXML private void handleReportWithoutTypoButtonAction(ActionEvent event){ @@ -194,7 +194,7 @@ private void handleIndex(Function calFlesh, String title, Strin GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); - expContent.add(new Label(Configuration.bundle.getString("ui.menu.edit.correction")), 0, 0); + expContent.add(new Label(Configuration.getBundle().getString("ui.menu.edit.correction")), 0, 0); expContent.add(textArea, 0, 1); hBottomBox.getChildren().addAll(labelField); @@ -203,17 +203,17 @@ private void handleIndex(Function calFlesh, String title, Strin textArea.textProperty().bind(correctTask.valueProperty()); correctTask.setOnFailed(t -> { Alert alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.alert.correction.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.alert.correction.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.alert.correction.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.alert.correction.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.alert.correction.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.alert.correction.failed.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); }); correctTask.setOnSucceeded(t -> { Alert alert = new CustomAlert(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.alert.correction.success.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.alert.correction.success.header")); + alert.setTitle(Configuration.getBundle().getString("ui.alert.correction.success.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.alert.correction.success.header")); // Set expandable Exception into the dialog pane. alert.getDialogPane().setExpandableContent(expContent); @@ -266,7 +266,7 @@ private void handleIndex(Function calFlesh, String title, Strin @FXML private void handleOpenButtonAction(ActionEvent event){ DirectoryChooser chooser = new DirectoryChooser(); - chooser.setTitle(Configuration.bundle.getString("ui.menu.dialog.open.title")); + chooser.setTitle(Configuration.getBundle().getString("ui.menu.dialog.open.title")); File defaultDirectory; if(MainApp.getConfig().getWorkspaceFactory() == null){ @@ -299,7 +299,7 @@ public void activateButtonForOpenContent() { @FXML public Service handleLoginButtonAction(ActionEvent event){ // Button for google - Button googleAuth = new Button(Configuration.bundle.getString("ui.dialog.auth.google.title"), IconFactory.createGoogleIcon()); + Button googleAuth = new Button(Configuration.getBundle().getString("ui.dialog.auth.google.title"), IconFactory.createGoogleIcon()); LoginDialog dialog = new LoginDialog(googleAuth); googleAuth.setOnAction(t -> { GoogleLoginDialog googleDialog = new GoogleLoginDialog(dialog); @@ -328,9 +328,9 @@ private void downloadContents(){ pb.progressProperty().bind(downloadContentTask.progressProperty()); downloadContentTask.setOnSucceeded(t -> { Alert alert = new CustomAlert(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.alert.download.success.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.alert.download.success.header")); - alert.setContentText(Configuration.bundle.getString("ui.alert.download.success.text")); + alert.setTitle(Configuration.getBundle().getString("ui.alert.download.success.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.alert.download.success.header")); + alert.setContentText(Configuration.getBundle().getString("ui.alert.download.success.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); @@ -351,9 +351,9 @@ private void downloadContents(){ loginTask.setOnCancelled(t -> { hBottomBox.getChildren().clear(); Alert alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.auth.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.auth.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.auth.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text")); alert.showAndWait(); }); @@ -389,7 +389,7 @@ private void uploadContents(){ List contents = new ArrayList<>(); - contents.add(new MetadataContent(null, "---"+Configuration.bundle.getString("ui.content.new.title")+"---", null)); + contents.add(new MetadataContent(null, "---"+Configuration.getBundle().getString("ui.content.new.title")+"---", null)); List possibleContent; if(mainApp.getContents ().get (0).isArticle()) { possibleContent = MainApp.getZdsutils().getContentListOnline().stream() @@ -403,9 +403,9 @@ private void uploadContents(){ contents.addAll(possibleContent); Dialog> dialog = new CustomDialog<>(); - dialog.setTitle(Configuration.bundle.getString("ui.content.select.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.content.select.header")); - ButtonType loginButtonType = new ButtonType(Configuration.bundle.getString("ui.content.select.button.send"), ButtonData.OK_DONE); + dialog.setTitle(Configuration.getBundle().getString("ui.content.select.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.content.select.header")); + ButtonType loginButtonType = new ButtonType(Configuration.getBundle().getString("ui.content.select.button.send"), ButtonData.OK_DONE); dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); GridPane grid = new GridPane(); @@ -414,13 +414,13 @@ private void uploadContents(){ grid.setPadding(new Insets(20, 150, 10, 10)); TextArea msg = new TextArea(); - msg.setText(Configuration.bundle.getString("ui.content.select.placeholder.commit_msg")); + msg.setText(Configuration.getBundle().getString("ui.content.select.placeholder.commit_msg")); ChoiceBox contenus = new ChoiceBox<>(); contenus.setItems(FXCollections.observableArrayList(contents)); - grid.add(new Label(Configuration.bundle.getString("ui.content.select.field.slug")+" : "), 0, 0); + grid.add(new Label(Configuration.getBundle().getString("ui.content.select.field.slug")+" : "), 0, 0); grid.add(contenus, 1, 0); - grid.add(new Label(Configuration.bundle.getString("ui.content.select.field.commit_msg")+" : "), 0, 1); + grid.add(new Label(Configuration.getBundle().getString("ui.content.select.field.commit_msg")+" : "), 0, 1); grid.add(msg, 1, 1); dialog.getDialogPane().setContent(grid); @@ -436,17 +436,17 @@ private void uploadContents(){ labelField.textProperty().bind(uploadContentTask.messageProperty()); uploadContentTask.setOnSucceeded(t -> { Alert alert = new CustomAlert(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.dialog.upload.content.success.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.upload.content.success.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.upload.content.success.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.upload.content.success.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.upload.content.success.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.upload.content.success.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); }); uploadContentTask.setOnFailed(t -> { Alert alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.upload.content.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.upload.content.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.upload.content.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.upload.content.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.text")); alert.showAndWait(); }); if(result.isPresent()){ @@ -460,9 +460,9 @@ private void uploadContents(){ } else { Alert alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.upload.content.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.upload.content.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.upload.content.failed.text.nofile")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.upload.content.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.text.nofile")); alert.showAndWait(); } } @@ -474,9 +474,9 @@ private void uploadContents(){ loginTask.setOnCancelled(t -> { hBottomBox.getChildren().clear(); Alert alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.upload.content.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.upload.content.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.upload.content.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.upload.content.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.text")); alert.showAndWait(); }); @@ -495,16 +495,16 @@ private void uploadContents(){ @FXML private void handleSwitchWorkspaceAction(ActionEvent event) throws IOException{ DirectoryChooser fileChooser = new DirectoryChooser(); fileChooser.setInitialDirectory(MainApp.getDefaultHome()); - fileChooser.setTitle(Configuration.bundle.getString("ui.dialog.switchworkspace")); + fileChooser.setTitle(Configuration.getBundle().getString("ui.dialog.switchworkspace")); File selectedDirectory = fileChooser.showDialog(MainApp.getPrimaryStage()); if(selectedDirectory!=null) { MainApp.getConfig().setWorkspacePath(selectedDirectory.getAbsolutePath()); MainApp.getConfig().loadWorkspace(); Alert alert = new CustomAlert(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.options.workspace")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.workspace.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.workspace.text") + " " + MainApp.getConfig().getWorkspacePath()); + alert.setTitle(Configuration.getBundle().getString("ui.options.workspace")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.workspace.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.workspace.text") + " " + MainApp.getConfig().getWorkspacePath()); alert.setResizable(true); alert.showAndWait(); @@ -515,7 +515,7 @@ private void uploadContents(){ Content content = mainApp.getContents().get(0); DirectoryChooser fileChooser = new DirectoryChooser(); fileChooser.setInitialDirectory(MainApp.getDefaultHome()); - fileChooser.setTitle(Configuration.bundle.getString("ui.dialog.export.dir.title")); + fileChooser.setTitle(Configuration.getBundle().getString("ui.dialog.export.dir.title")); File selectedDirectory = fileChooser.showDialog(MainApp.getPrimaryStage()); File selectedFile = new File(selectedDirectory, ZdsHttp.toSlug(content.getTitle()) + ".md"); logger.debug("Tentative d'export vers le fichier " + selectedFile.getAbsolutePath()); @@ -526,9 +526,9 @@ private void uploadContents(){ logger.debug("Export réussi vers " + selectedFile.getAbsolutePath()); Alert alert = new CustomAlert(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.dialog.export.success.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.export.success.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.export.success.text")+" \"" + selectedFile.getAbsolutePath() + "\""); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.export.success.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.export.success.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.export.success.text")+" \"" + selectedFile.getAbsolutePath() + "\""); alert.setResizable(true); alert.showAndWait(); @@ -539,7 +539,7 @@ private void uploadContents(){ Content content = mainApp.getContents().get(0); DirectoryChooser fileChooser = new DirectoryChooser(); fileChooser.setInitialDirectory(MainApp.getDefaultHome()); - fileChooser.setTitle(Configuration.bundle.getString("ui.dialog.export.dir.title")); + fileChooser.setTitle(Configuration.getBundle().getString("ui.dialog.export.dir.title")); File selectedDirectory = fileChooser.showDialog(MainApp.getPrimaryStage()); File selectedFile = new File(selectedDirectory, ZdsHttp.toSlug(content.getTitle()) + ".pdf"); logger.debug("Tentative d'export vers le fichier " + selectedFile.getAbsolutePath()); @@ -554,18 +554,18 @@ private void uploadContents(){ Alert alert = new CustomAlert(AlertType.NONE); exportPdfTask.setOnFailed((WorkerStateEvent ev) -> { alert.setAlertType(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.export.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.export.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.export.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.export.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.export.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.export.failed.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); }); exportPdfTask.setOnSucceeded((WorkerStateEvent ev) -> { alert.setAlertType(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.dialog.export.success.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.export.success.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.export.success.text")+" \"" + selectedFile.getAbsolutePath() + "\""); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.export.success.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.export.success.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.export.success.text")+" \"" + selectedFile.getAbsolutePath() + "\""); alert.showAndWait(); hBottomBox.getChildren().clear(); }); @@ -576,7 +576,7 @@ private void uploadContents(){ @FXML private void handleMdCheatSheetButtonAction(ActionEvent event){ FXMLLoader loader = new CustomFXMLLoader(MainApp.class.getResource("fxml/MdCheatSheetDialog.fxml")); - Stage dialogStage = new CustomStage(loader, Configuration.bundle.getString("ui.menu.help.md_cheat_sheet")); + Stage dialogStage = new CustomStage(loader, Configuration.getBundle().getString("ui.menu.help.md_cheat_sheet")); loader.getController(); @@ -599,7 +599,7 @@ private void uploadContents(){ @FXML private void handleAboutButtonAction(ActionEvent event){ FXMLLoader loader = new CustomFXMLLoader(MainApp.class.getResource("fxml/AboutDialog.fxml")); - Stage dialogStage = new CustomStage(loader, Configuration.bundle.getString("ui.menu.help.about")); + Stage dialogStage = new CustomStage(loader, Configuration.getBundle().getString("ui.menu.help.about")); dialogStage.setResizable(false); AboutDialog aboutController = loader.getController(); @@ -611,7 +611,7 @@ private void uploadContents(){ @FXML private void handleOptionsButtonAction(ActionEvent event){ FXMLLoader loader = new CustomFXMLLoader(MainApp.class.getResource("fxml/OptionsDialog.fxml")); - Stage dialogStage = new CustomStage(loader, Configuration.bundle.getString("ui.menu.options")); + Stage dialogStage = new CustomStage(loader, Configuration.getBundle().getString("ui.menu.options")); dialogStage.setResizable(false); @@ -624,9 +624,9 @@ private void uploadContents(){ @FXML private void handleImportGithubButtonAction() { TextInputDialog dialog = new TextInputDialog("https://github.com/"); - dialog.setTitle(Configuration.bundle.getString("ui.dialog.import.github.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.dialog.import.github.header")); - dialog.setContentText(Configuration.bundle.getString("ui.dialog.import.github.text")+" :"); + dialog.setTitle(Configuration.getBundle().getString("ui.dialog.import.github.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.dialog.import.github.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.dialog.import.github.text")+" :"); dialog.getEditor().setPrefWidth(500); dialog.initOwner(MainApp.getPrimaryStage()); @@ -641,18 +641,18 @@ private void uploadContents(){ Alert alert = new CustomAlert(AlertType.NONE); downloadGithubTask.setOnFailed (t -> { alert.setAlertType(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.download.github.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.download.github.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.download.github.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.download.github.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.download.github.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.download.github.failed.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); }); downloadGithubTask.setOnSucceeded (t -> { FunctionTreeFactory.switchContent (downloadGithubTask.getValue (), mainApp.getContents ()); alert.setAlertType(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.dialog.download.github.success.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.download.github.success.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.download.github.success.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.download.github.success.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.download.github.success.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.download.github.success.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); }); @@ -665,9 +665,9 @@ private void uploadContents(){ @FXML private void handleImportZdsButtonAction() { TextInputDialog dialog = new TextInputDialog("https://zestedesavoir.com/"); - dialog.setTitle(Configuration.bundle.getString("ui.dialog.import.zds.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.dialog.import.zds.header")); - dialog.setContentText(Configuration.bundle.getString("ui.dialog.import.zds.text")+" :"); + dialog.setTitle(Configuration.getBundle().getString("ui.dialog.import.zds.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.dialog.import.zds.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.dialog.import.zds.text")+" :"); dialog.getEditor().setPrefWidth(500); dialog.initOwner(MainApp.getPrimaryStage()); @@ -682,18 +682,18 @@ private void uploadContents(){ Alert alert = new CustomAlert(AlertType.NONE); downloadZdsTask.setOnFailed (t -> { alert.setAlertType(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.download.zds.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.download.zds.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.download.zds.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.download.zds.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.download.zds.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.download.zds.failed.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); }); downloadZdsTask.setOnSucceeded (t -> { FunctionTreeFactory.switchContent (downloadZdsTask.getValue (), mainApp.getContents ()); alert.setAlertType(AlertType.INFORMATION); - alert.setTitle(Configuration.bundle.getString("ui.dialog.download.zds.success.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.download.zds.success.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.download.zds.success.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.download.zds.success.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.download.zds.success.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.download.zds.success.text")); alert.showAndWait(); hBottomBox.getChildren().clear(); }); @@ -711,7 +711,7 @@ protected Task createTask() { return new Task() { @Override protected Boolean call() throws Exception { - String current = MainApp.getConfig().getProps().getProperty("version", Configuration.bundle.getString("ui.version.label.unknown")); + String current = MainApp.getConfig().getProps().getProperty("version", Configuration.getBundle().getString("ui.version.label.unknown")); String versionOnline = Configuration.getLastRelease(); if(versionOnline == null) { throw new IOException(); @@ -733,24 +733,24 @@ protected Boolean call() throws Exception { checkService.setOnFailed(t -> { Alert alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.check_update.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.check_update.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.check_update.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.check_update.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.check_update.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.check_update.failed.text")); alert.showAndWait(); }); checkService.setOnSucceeded(t -> { Alert alert = new CustomAlert(AlertType.NONE); - alert.setTitle(Configuration.bundle.getString("ui.dialog.check_update.success.title")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.check_update.success.title")); if(!checkService.getValue()){ alert.setAlertType(AlertType.WARNING); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.check_update.warn.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.check_update.warn.text")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.check_update.warn.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.check_update.warn.text")); }else{ alert.setAlertType(AlertType.INFORMATION); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.check_update.success.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.check_update.success.text")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.check_update.success.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.check_update.success.text")); } alert.showAndWait(); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/TableController.java b/src/main/java/com/zestedesavoir/zestwriter/view/TableController.java index 3c0a65e9e..981c061a0 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/TableController.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/TableController.java @@ -96,7 +96,7 @@ public void handle(CellEditEvent t) { tc.setPrefWidth(150); TextField txf = new TextField(); txf.setPrefWidth(150); - txf.setPromptText(Configuration.bundle.getString("ui.dialog.table_editor.colon") + + txf.setPromptText(Configuration.getBundle().getString("ui.dialog.table_editor.colon") + (tableView.getColumns().size()+1)); tc.setGraphic(txf); tableView.getColumns().addAll(tc); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/com/CustomFXMLLoader.java b/src/main/java/com/zestedesavoir/zestwriter/view/com/CustomFXMLLoader.java index 038a45a60..b449b9b57 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/com/CustomFXMLLoader.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/com/CustomFXMLLoader.java @@ -11,7 +11,7 @@ public class CustomFXMLLoader extends FXMLLoader{ public CustomFXMLLoader(URL location) { super(location); - this.setResources(Configuration.bundle); + this.setResources(Configuration.getBundle()); } @Override diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/com/FunctionTreeFactory.java b/src/main/java/com/zestedesavoir/zestwriter/view/com/FunctionTreeFactory.java index 94a36859a..3f3da2a8f 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/com/FunctionTreeFactory.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/com/FunctionTreeFactory.java @@ -204,10 +204,10 @@ public static void switchContent(Content content, ObservableList conten public static void openFindReplaceDialog(StyleClassedTextArea sourceText) { FXMLLoader loader = new CustomFXMLLoader(MainApp.class.getResource("fxml/FindReplaceDialog.fxml")); - Stage dialogStage = new CustomStage(loader, Configuration.bundle.getString("ui.dialog.find.title")); + Stage dialogStage = new CustomStage(loader, Configuration.getBundle().getString("ui.dialog.find.title")); dialogStage.setAlwaysOnTop(true); dialogStage.initModality(Modality.NONE); - dialogStage.setTitle(Configuration.bundle.getString("ui.dialog.find.title")); + dialogStage.setTitle(Configuration.getBundle().getString("ui.dialog.find.title")); dialogStage.setResizable(false); FindReplaceDialog findReplaceDialog = loader.getController(); @@ -223,19 +223,19 @@ public static String getNumberOfTextualReadMinutes(String text) { StringBuilder sb = new StringBuilder(); if(mins < step) { if(step == steps[0]) { - sb.append(Configuration.bundle.getString("ui.label.lessof")); + sb.append(Configuration.getBundle().getString("ui.label.lessof")); } else if(step == steps[steps.length-1]) { - sb.append(Configuration.bundle.getString("ui.label.moreof")); + sb.append(Configuration.getBundle().getString("ui.label.moreof")); } if (step < 60) { sb.append(" ").append(step).append(" "); - sb.append(Configuration.bundle.getString("ui.label.time.minute")); + sb.append(Configuration.getBundle().getString("ui.label.time.minute")); if (step > 1) sb.append("s"); } else { int value = step / 60; sb.append(" ").append(value).append(" "); - sb.append(Configuration.bundle.getString("ui.label.time.hour")); + sb.append(Configuration.getBundle().getString("ui.label.time.hour")); if (value > 1) sb.append("s"); } return sb.toString(); @@ -245,16 +245,16 @@ public static String getNumberOfTextualReadMinutes(String text) { } public static void generateMetadataAttributes(String file) { - performGenerateMetadataAttributes(new File (file, Constant.DEFAULT_INTRODUCTION_FILENAME)); - performGenerateMetadataAttributes(new File (file, Constant.DEFAULT_CONCLUSION_FILENAME)); + performCreateNewFile(new File (file, Constant.DEFAULT_INTRODUCTION_FILENAME)); + performCreateNewFile(new File (file, Constant.DEFAULT_CONCLUSION_FILENAME)); } public static void generateMetadataAttributes(Container container) { - performGenerateMetadataAttributes(new File (container.getIntroduction().getFilePath())); - performGenerateMetadataAttributes(new File (container.getConclusion().getFilePath())); + performCreateNewFile(new File (container.getIntroduction().getFilePath())); + performCreateNewFile(new File (container.getConclusion().getFilePath())); } - public static void performGenerateMetadataAttributes(File file) { + public static void performCreateNewFile(File file) { try { if(!file.exists ()) { if(!file.createNewFile ()) { diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java b/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java index 82514d992..f9eb535c7 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java @@ -56,16 +56,16 @@ private void closeTab(Textual closedTextual) { } private void initContextMenu(ContentNode item) { - MenuItem addMenuItem1 = new MenuItem(Configuration.bundle.getString("ui.actions.add_extract.label")); - MenuItem addMenuItem2 = new MenuItem(Configuration.bundle.getString("ui.actions.add_container.label")); - MenuItem addMenuItem3 = new MenuItem(Configuration.bundle.getString("ui.actions.rename.label")); - MenuItem addMenuItem4 = new MenuItem(Configuration.bundle.getString("ui.actions.delete.label")); - MenuItem addMenuItem5 = new MenuItem(Configuration.bundle.getString("ui.actions.edit.label")); - MenuItem addMenuItem6 = new MenuItem(Configuration.bundle.getString("ui.actions.merge_extracts.label")); - Menu menuStats = new Menu(Configuration.bundle.getString("ui.actions.stats.label")); - MenuItem menuStatCountHisto = new MenuItem(Configuration.bundle.getString("ui.actions.stats.count.histo")); - MenuItem menuStatReadability = new MenuItem(Configuration.bundle.getString("ui.actions.stats.readability")); - MenuItem menuStatMistakes = new MenuItem(Configuration.bundle.getString("ui.actions.stats.mistake")); + MenuItem addMenuItem1 = new MenuItem(Configuration.getBundle().getString("ui.actions.add_extract.label")); + MenuItem addMenuItem2 = new MenuItem(Configuration.getBundle().getString("ui.actions.add_container.label")); + MenuItem addMenuItem3 = new MenuItem(Configuration.getBundle().getString("ui.actions.rename.label")); + MenuItem addMenuItem4 = new MenuItem(Configuration.getBundle().getString("ui.actions.delete.label")); + MenuItem addMenuItem5 = new MenuItem(Configuration.getBundle().getString("ui.actions.edit.label")); + MenuItem addMenuItem6 = new MenuItem(Configuration.getBundle().getString("ui.actions.merge_extracts.label")); + Menu menuStats = new Menu(Configuration.getBundle().getString("ui.actions.stats.label")); + MenuItem menuStatCountHisto = new MenuItem(Configuration.getBundle().getString("ui.actions.stats.count.histo")); + MenuItem menuStatReadability = new MenuItem(Configuration.getBundle().getString("ui.actions.stats.readability")); + MenuItem menuStatMistakes = new MenuItem(Configuration.getBundle().getString("ui.actions.stats.mistake")); menuStats.getItems().add(menuStatCountHisto); menuStats.getItems().add(menuStatReadability); menuStats.getItems().add(menuStatMistakes); @@ -116,9 +116,9 @@ private void initContextMenu(ContentNode item) { addMenuItem4.setOnAction(t -> { Alert alert = new CustomAlert(AlertType.CONFIRMATION); - alert.setTitle(Configuration.bundle.getString("ui.dialog.delete.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.delete.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.delete.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.delete.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.delete.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.delete.text")); Optional result = alert.showAndWait(); if (result.isPresent() && result.get() == ButtonType.OK) { @@ -161,11 +161,11 @@ private void initContextMenu(ContentNode item) { addMenuItem1.setOnAction(t -> { logger.debug("Tentative d'ajout d'un nouvel extrait"); - TextInputDialog dialog = new TextInputDialog(Configuration.bundle.getString("ui.dialog.add_extract")); + TextInputDialog dialog = new TextInputDialog(Configuration.getBundle().getString("ui.dialog.add_extract")); Extract extract; - dialog.setTitle(Configuration.bundle.getString("ui.dialog.add_extract.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.dialog.add_extract.header")); - dialog.setContentText(Configuration.bundle.getString("ui.dialog.add_extract.text")+" :"); + dialog.setTitle(Configuration.getBundle().getString("ui.dialog.add_extract.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.dialog.add_extract.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.dialog.add_extract.text")+" :"); Optional result = dialog.showAndWait(); if (result.isPresent()) { @@ -191,11 +191,11 @@ private void initContextMenu(ContentNode item) { addMenuItem2.setOnAction(t -> { logger.debug("Tentative d'ajout d'un nouveau conteneur"); - TextInputDialog dialog = new TextInputDialog(Configuration.bundle.getString("ui.dialog.add_container")); + TextInputDialog dialog = new TextInputDialog(Configuration.getBundle().getString("ui.dialog.add_container")); - dialog.setTitle(Configuration.bundle.getString("ui.dialog.add_container.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.dialog.add_container.header")); - dialog.setContentText(Configuration.bundle.getString("ui.dialog.add_container.text")+" :"); + dialog.setTitle(Configuration.getBundle().getString("ui.dialog.add_container.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.dialog.add_container.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.dialog.add_container.text")+" :"); Optional result = dialog.showAndWait(); if (result.isPresent()) { @@ -226,9 +226,9 @@ private void initContextMenu(ContentNode item) { logger.debug("Tentative de renommage d'un conteneur ou extrait"); TreeItem item1 = index.getSummary().getSelectionModel().getSelectedItem(); TextInputDialog dialog = new TextInputDialog(item1.getValue().getTitle()); - dialog.setTitle(Configuration.bundle.getString("ui.dialog.rename.title")+" " + item1.getValue().getTitle()); - dialog.setHeaderText(Configuration.bundle.getString("ui.dialog.rename.header")); - dialog.setContentText(Configuration.bundle.getString("ui.dialog.rename.text")+" : "); + dialog.setTitle(Configuration.getBundle().getString("ui.dialog.rename.title")+" " + item1.getValue().getTitle()); + dialog.setHeaderText(Configuration.getBundle().getString("ui.dialog.rename.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.dialog.rename.text")+" : "); Optional result = dialog.showAndWait(); if (result.isPresent()) { @@ -267,11 +267,11 @@ private void initContextMenu(ContentNode item) { addMenuItem6.setOnAction(t -> { logger.debug("Tentative de déplacement des extraits"); - TextInputDialog dialog = new TextInputDialog(Configuration.bundle.getString("ui.dialog.add_container")); + TextInputDialog dialog = new TextInputDialog(Configuration.getBundle().getString("ui.dialog.add_container")); - dialog.setTitle(Configuration.bundle.getString("ui.dialog.add_container.title")); - dialog.setHeaderText(Configuration.bundle.getString("ui.dialog.add_container.header")); - dialog.setContentText(Configuration.bundle.getString("ui.dialog.add_container.text")+" :"); + dialog.setTitle(Configuration.getBundle().getString("ui.dialog.add_container.title")); + dialog.setHeaderText(Configuration.getBundle().getString("ui.dialog.add_container.header")); + dialog.setContentText(Configuration.getBundle().getString("ui.dialog.add_container.text")+" :"); Optional result = dialog.showAndWait(); if (result.isPresent()) { @@ -326,9 +326,9 @@ private void initContextMenu(ContentNode item) { menuStatCountHisto.setOnAction(t -> { logger.debug("Tentative de calcul des statistiques de type histogramme"); - BaseDialog dialog = new BaseDialog(Configuration.bundle.getString("ui.actions.stats.label"), Configuration.bundle.getString("ui.actions.stats.header")+" "+getItem().getTitle()); + BaseDialog dialog = new BaseDialog(Configuration.getBundle().getString("ui.actions.stats.label"), Configuration.getBundle().getString("ui.actions.stats.header")+" "+getItem().getTitle()); dialog.getDialogPane().setPrefSize(800, 600); - dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.bundle.getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE)); + dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.getBundle().getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE)); // draw final CategoryAxis xAxis = new CategoryAxis(); @@ -337,11 +337,11 @@ private void initContextMenu(ContentNode item) { barChart.setCategoryGap(5); barChart.setBarGap(5); - xAxis.setLabel(Configuration.bundle.getString("ui.actions.stats.xaxis")); - yAxis.setLabel(Configuration.bundle.getString("ui.actions.stats.yaxis")); + xAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.xaxis")); + yAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.yaxis")); XYChart.Series series1 = new XYChart.Series<>(); - series1.setName(Configuration.bundle.getString("ui.actions.stats.type.histogram")); + series1.setName(Configuration.getBundle().getString("ui.actions.stats.type.histogram")); Container container = (Container) getItem(); Function performCount = (Textual ch) -> { String md = ch.readMarkdown(); @@ -365,23 +365,23 @@ private void initContextMenu(ContentNode item) { menuStatReadability.setOnAction(t -> { logger.debug("Tentative de calcul des statistiques de lisiblité"); - BaseDialog dialog = new BaseDialog(Configuration.bundle.getString("ui.actions.stats.label"), Configuration.bundle.getString("ui.actions.stats.header")+" "+getItem().getTitle()); + BaseDialog dialog = new BaseDialog(Configuration.getBundle().getString("ui.actions.stats.label"), Configuration.getBundle().getString("ui.actions.stats.header")+" "+getItem().getTitle()); dialog.getDialogPane().setPrefSize(800, 600); - dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.bundle.getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE)); + dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.getBundle().getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE)); // draw final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final LineChart lineChart = new LineChart<>(xAxis, yAxis); - lineChart.setTitle(Configuration.bundle.getString("ui.actions.stats.readability")); + lineChart.setTitle(Configuration.getBundle().getString("ui.actions.stats.readability")); - xAxis.setLabel(Configuration.bundle.getString("ui.actions.stats.xaxis")); - yAxis.setLabel(Configuration.bundle.getString("ui.actions.readable.yaxis")); + xAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.xaxis")); + yAxis.setLabel(Configuration.getBundle().getString("ui.actions.readable.yaxis")); XYChart.Series series1 = new XYChart.Series(); XYChart.Series series2 = new XYChart.Series(); - series1.setName(Configuration.bundle.getString("ui.menu.edit.readable.gunning_index")); - series2.setName(Configuration.bundle.getString("ui.menu.edit.readable.flesch_index")); + series1.setName(Configuration.getBundle().getString("ui.menu.edit.readable.gunning_index")); + series2.setName(Configuration.getBundle().getString("ui.menu.edit.readable.flesch_index")); Container container = (Container) getItem(); Function performGuning = (Textual ch) -> { String md = ch.readMarkdown(); @@ -429,21 +429,21 @@ private void initContextMenu(ContentNode item) { menuStatMistakes.setOnAction(t -> { logger.debug("Tentative de calcul du nombre de fautes"); - BaseDialog dialog = new BaseDialog(Configuration.bundle.getString("ui.actions.stats.label"), Configuration.bundle.getString("ui.actions.stats.header")+" "+getItem().getTitle()); + BaseDialog dialog = new BaseDialog(Configuration.getBundle().getString("ui.actions.stats.label"), Configuration.getBundle().getString("ui.actions.stats.header")+" "+getItem().getTitle()); dialog.getDialogPane().setPrefSize(800, 600); - dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.bundle.getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE)); + dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.getBundle().getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE)); // draw final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final LineChart lineChart = new LineChart<>(xAxis, yAxis); - lineChart.setTitle(Configuration.bundle.getString("ui.actions.stats.mistake")); + lineChart.setTitle(Configuration.getBundle().getString("ui.actions.stats.mistake")); - xAxis.setLabel(Configuration.bundle.getString("ui.actions.stats.xaxis")); - yAxis.setLabel(Configuration.bundle.getString("ui.actions.stats.mistakes.yaxis")); + xAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.xaxis")); + yAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.mistakes.yaxis")); XYChart.Series series1 = new XYChart.Series(); - series1.setName(Configuration.bundle.getString("ui.actions.stats.mistakes.yaxis")); + series1.setName(Configuration.getBundle().getString("ui.actions.stats.mistakes.yaxis")); Container container = (Container) getItem(); Corrector corrector = new Corrector(); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/AboutDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/AboutDialog.java index ff0f73d04..bcba94cbb 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/AboutDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/AboutDialog.java @@ -12,7 +12,7 @@ public class AboutDialog{ public void setMainApp(MainApp mainApp){ this.mainApp = mainApp; - version.setText(MainApp.getConfig().getProps().getProperty("version", Configuration.bundle.getString("ui.version.label.unknown"))); + version.setText(MainApp.getConfig().getProps().getProperty("version", Configuration.getBundle().getString("ui.version.label.unknown"))); } @FXML private void HandleGplHyperlinkAction(){ diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/EditContentDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/EditContentDialog.java index 6c70cccc7..65674cad8 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/EditContentDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/EditContentDialog.java @@ -29,14 +29,14 @@ public class EditContentDialog extends BaseDialog typeOptions = FXCollections.observableArrayList(new TypeContent("ARTICLE", "Article"), new TypeContent("TUTORIAL","Tutoriel")); public static ObservableList licOptions = FXCollections.observableArrayList( - new License("CC BY", Configuration.bundle.getString("ui.content.label.license.ccby")), - new License("CC BY-SA", Configuration.bundle.getString("ui.content.label.license.ccbysa")), - new License("CC BY-ND", Configuration.bundle.getString("ui.content.label.license.ccbynd")), - new License("CC BY-NC", Configuration.bundle.getString("ui.content.label.license.ccbync")), - new License("CC BY-NC-SA", Configuration.bundle.getString("ui.content.label.license.ccbyncsa")), - new License("CC BY-NC-ND", Configuration.bundle.getString("ui.content.label.license.ccbyncnd")), - new License("Tous droits réservés", Configuration.bundle.getString("ui.content.label.license.allright")), - new License("CC 0", Configuration.bundle.getString("ui.content.label.license.cc0")) + new License("CC BY", Configuration.getBundle().getString("ui.content.label.license.ccby")), + new License("CC BY-SA", Configuration.getBundle().getString("ui.content.label.license.ccbysa")), + new License("CC BY-ND", Configuration.getBundle().getString("ui.content.label.license.ccbynd")), + new License("CC BY-NC", Configuration.getBundle().getString("ui.content.label.license.ccbync")), + new License("CC BY-NC-SA", Configuration.getBundle().getString("ui.content.label.license.ccbyncsa")), + new License("CC BY-NC-ND", Configuration.getBundle().getString("ui.content.label.license.ccbyncnd")), + new License("Tous droits réservés", Configuration.getBundle().getString("ui.content.label.license.allright")), + new License("CC 0", Configuration.getBundle().getString("ui.content.label.license.cc0")) ); public static String getSlug(String input) { @@ -47,13 +47,13 @@ public static String getSlug(String input) { } public EditContentDialog(Content defaultContent) { - super(Configuration.bundle.getString("ui.content.new.title"), Configuration.bundle.getString("ui.content.new.header")); + super(Configuration.getBundle().getString("ui.content.new.title"), Configuration.getBundle().getString("ui.content.new.header")); // Set the icon (must be included in the project). this.setGraphic(IconFactory.createAddFolderIcon()); // Set the button types. - ButtonType validButtonType = new ButtonType(Configuration.bundle.getString("ui.dialog.save"), ButtonData.OK_DONE); + ButtonType validButtonType = new ButtonType(Configuration.getBundle().getString("ui.dialog.save"), ButtonData.OK_DONE); this.getDialogPane().getButtonTypes().addAll(validButtonType, ButtonType.CANCEL); // Create the username and password labels and fields. @@ -82,13 +82,13 @@ public EditContentDialog(Content defaultContent) { ComboBox license = new ComboBox<>(licOptions); license.setValue(licOptions.get(licOptions.indexOf(new License(defaultContent.getLicence(), "")))); - grid.add(new Label(Configuration.bundle.getString("ui.content.label.title")), 0, 0); + grid.add(new Label(Configuration.getBundle().getString("ui.content.label.title")), 0, 0); grid.add(title, 1, 0); - grid.add(new Label(Configuration.bundle.getString("ui.content.label.description")), 0, 1); + grid.add(new Label(Configuration.getBundle().getString("ui.content.label.description")), 0, 1); grid.add(subtitle, 1, 1); - grid.add(new Label(Configuration.bundle.getString("ui.content.label.type")), 0, 2); + grid.add(new Label(Configuration.getBundle().getString("ui.content.label.type")), 0, 2); grid.add(type, 1, 2); - grid.add(new Label(Configuration.bundle.getString("ui.content.label.license")), 0, 3); + grid.add(new Label(Configuration.getBundle().getString("ui.content.label.license")), 0, 3); grid.add(license, 1, 3); // Enable/Disable login button depending on whether a username was entered. @@ -107,9 +107,9 @@ public EditContentDialog(Content defaultContent) { map.put("licence",license.getValue().getCode()); if(map.get("title").toString().length() == 0) { CustomAlert alert = new CustomAlert(Alert.AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.content.new.error.title.limit.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.content.new.error.title.limit.header")); - alert.setContentText(Configuration.bundle.getString("ui.content.new.error.title.limit.text")); + alert.setTitle(Configuration.getBundle().getString("ui.content.new.error.title.limit.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.content.new.error.title.limit.header")); + alert.setContentText(Configuration.getBundle().getString("ui.content.new.error.title.limit.text")); alert.showAndWait(); return null; @@ -117,9 +117,9 @@ public EditContentDialog(Content defaultContent) { if(getSlug(map.get("title").toString()).equals("")) { CustomAlert alert = new CustomAlert(Alert.AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.content.new.error.title.slug.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.content.new.error.title.slug.header")); - alert.setContentText(Configuration.bundle.getString("ui.content.new.error.title.slug.text")); + alert.setTitle(Configuration.getBundle().getString("ui.content.new.error.title.slug.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.content.new.error.title.slug.header")); + alert.setContentText(Configuration.getBundle().getString("ui.content.new.error.title.slug.text")); alert.showAndWait(); return null; diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/FindReplaceDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/FindReplaceDialog.java index 019c0dbab..629c24e69 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/FindReplaceDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/FindReplaceDialog.java @@ -136,9 +136,9 @@ private List> refreshSearch() { } if(numberIterationTotal > 0){ - iterations.setText(numberIterationTotal +" "+Configuration.bundle.getString("ui.dialog.find.plural")); + iterations.setText(numberIterationTotal +" "+Configuration.getBundle().getString("ui.dialog.find.plural")); }else{ - iterations.setText(Configuration.bundle.getString("ui.dialog.find.empty")); + iterations.setText(Configuration.getBundle().getString("ui.dialog.find.empty")); } return matchers; } @@ -178,7 +178,7 @@ private void findReplace(FindReplaceAction action){ } private void resetIterationNumber(){ - iterations.setText(Configuration.bundle.getString("ui.dialog.find.empty")); + iterations.setText(Configuration.getBundle().getString("ui.dialog.find.empty")); } private void textFill(int start, int end, FindReplaceAction action){ diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/GoogleLoginDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/GoogleLoginDialog.java index 956c15d04..323d23264 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/GoogleLoginDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/GoogleLoginDialog.java @@ -19,7 +19,7 @@ public class GoogleLoginDialog extends CustomDialog> { public GoogleLoginDialog(LoginDialog parent) { super(); - this.setTitle(Configuration.bundle.getString("ui.dialog.auth.google.title")); + this.setTitle(Configuration.getBundle().getString("ui.dialog.auth.google.title")); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/ImageInputDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/ImageInputDialog.java index 7b4543a37..f43faea10 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/ImageInputDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/ImageInputDialog.java @@ -66,9 +66,9 @@ public void setStage(Stage stage) { case CANCELLED: menuManager.gethBottomBox().getChildren().clear(); alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.auth.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.auth.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.auth.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text")); alert.showAndWait(); break; @@ -91,9 +91,9 @@ private void selectAndUploadImage() { UploadImageService uploadImageTask = new UploadImageService(content, selectedFile.getAbsoluteFile()); uploadImageTask.setOnFailed( t -> { Alert alert = new CustomAlert(AlertType.ERROR); - alert.setTitle(Configuration.bundle.getString("ui.dialog.upload.img.failed.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.upload.img.failed.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.upload.img.failed.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.upload.img.failed.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.upload.img.failed.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.upload.img.failed.text")); alert.showAndWait(); }); uploadImageTask.setOnSucceeded(t -> link.setText(uploadImageTask.getValue())); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/LoginDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/LoginDialog.java index 12d54535a..3e03ba58f 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/LoginDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/LoginDialog.java @@ -14,25 +14,25 @@ public class LoginDialog extends BaseDialog> { private Configuration config; public LoginDialog(Button googleButton) { - super(Configuration.bundle.getString("ui.dialog.auth.title"), Configuration.bundle.getString("ui.dialog.auth.header")); + super(Configuration.getBundle().getString("ui.dialog.auth.title"), Configuration.getBundle().getString("ui.dialog.auth.header")); this.config = MainApp.getConfig(); this.setGraphic(IconFactory.createLoginIcon()); // Set the button types. - ButtonType loginButtonType = new ButtonType(Configuration.bundle.getString("ui.dialog.auth.button"), ButtonData.OK_DONE); + ButtonType loginButtonType = new ButtonType(Configuration.getBundle().getString("ui.dialog.auth.button"), ButtonData.OK_DONE); this.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); TextField username = new TextField(); username.setPromptText("username"); PasswordField password = new PasswordField(); password.setPromptText("password"); - CheckBox keepConnection = new CheckBox(Configuration.bundle.getString("ui.dialog.auth.stay")); + CheckBox keepConnection = new CheckBox(Configuration.getBundle().getString("ui.dialog.auth.stay")); getGridPane().add(googleButton, 0, 0, 1, 2); - getGridPane().add(new Label(Configuration.bundle.getString("ui.dialog.auth.username")+":"), 1, 0); + getGridPane().add(new Label(Configuration.getBundle().getString("ui.dialog.auth.username")+":"), 1, 0); getGridPane().add(username, 2, 0); - getGridPane().add(new Label(Configuration.bundle.getString("ui.dialog.auth.password")+":"), 1, 1); + getGridPane().add(new Label(Configuration.getBundle().getString("ui.dialog.auth.password")+":"), 1, 1); getGridPane().add(password, 2, 1); getGridPane().add(keepConnection, 2, 2); @@ -43,8 +43,8 @@ public LoginDialog(Button googleButton) { keepConnection.selectedProperty().addListener((observable, oldValue, newValue) -> { if(keepConnection.isSelected()){ Alert alert = new CustomAlert(Alert.AlertType.WARNING); - alert.setTitle(Configuration.bundle.getString("ui.dialog.warning.title")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.auth.warning")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.warning.title")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.warning")); alert.showAndWait(); } diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/MdCheatSheetDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/MdCheatSheetDialog.java index ed7d34204..7e74c672b 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/MdCheatSheetDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/MdCheatSheetDialog.java @@ -40,7 +40,7 @@ public MdCheatSheetDialog() { Matcher titleMatcher = Pattern.compile(TITLE_REGEX).matcher(cheatSheet); while (titleMatcher.find()) { - chaptersTitles.add(Configuration.bundle.getString("ui.md_cheat_sheet." + titleMatcher.group(1))); + chaptersTitles.add(Configuration.getBundle().getString("ui.md_cheat_sheet." + titleMatcher.group(1))); } String[] chaptersContents = cheatSheet.split(TITLE_REGEX); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/OptionsDialog.java b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/OptionsDialog.java index 919be2b6e..763c0f96c 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/OptionsDialog.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/dialogs/OptionsDialog.java @@ -111,9 +111,9 @@ public void setWindow(Stage window){ @FXML private void handleCancelButtonAction(){ Alert alert = new CustomAlert(Alert.AlertType.CONFIRMATION); - alert.setTitle(Configuration.bundle.getString("ui.options.cancel.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.options.cancel.header")); - alert.setContentText(Configuration.bundle.getString("ui.options.cancel.text")); + alert.setTitle(Configuration.getBundle().getString("ui.options.cancel.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.options.cancel.header")); + alert.setContentText(Configuration.getBundle().getString("ui.options.cancel.text")); alert.initOwner(optionsWindow); Optional result = alert.showAndWait(); @@ -127,10 +127,10 @@ public void setWindow(Stage window){ @FXML private void handleResetButtonAction(){ Alert alert = new CustomAlert(Alert.AlertType.CONFIRMATION); - alert.setTitle(Configuration.bundle.getString("ui.options.reset.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.options.reset.header")); - alert.setContentText(Configuration.bundle.getString("ui.options.reset.text")); - alert.getButtonTypes().setAll(new ButtonType(Configuration.bundle.getString("ui.yes"), ButtonBar.ButtonData.YES), new ButtonType(Configuration.bundle.getString("ui.no"), ButtonBar.ButtonData.NO)); + alert.setTitle(Configuration.getBundle().getString("ui.options.reset.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.options.reset.header")); + alert.setContentText(Configuration.getBundle().getString("ui.options.reset.text")); + alert.getButtonTypes().setAll(new ButtonType(Configuration.getBundle().getString("ui.yes"), ButtonBar.ButtonData.YES), new ButtonType(Configuration.getBundle().getString("ui.no"), ButtonBar.ButtonData.NO)); alert.initOwner(optionsWindow); Optional result = alert.showAndWait(); @@ -144,7 +144,7 @@ public void setWindow(Stage window){ @FXML private void handleGeneralBrowseAction(){ DirectoryChooser directoryChooser = new DirectoryChooser(); - directoryChooser.setTitle(Configuration.bundle.getString("ui.options.workspace")); + directoryChooser.setTitle(Configuration.getBundle().getString("ui.options.workspace")); directoryChooser.setInitialDirectory(mainApp.getDefaultHome()); File directory = directoryChooser.showDialog(null); @@ -244,9 +244,9 @@ private void setEditorOptions(){ optEditorRenderViewYes.selectedProperty().addListener((observable, oldValue, newValue) -> { if(optEditorRenderViewYes.isSelected()){ Alert alert = new CustomAlert(Alert.AlertType.WARNING); - alert.setTitle(Configuration.bundle.getString("ui.dialog.change_render.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.change_render.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.change_render.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.change_render.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.change_render.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.change_render.text")); alert.initOwner(optionsWindow); alert.showAndWait(); @@ -260,9 +260,9 @@ private void setDisplayOptions(){ optDisplayTheme.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { Alert alert = new CustomAlert(Alert.AlertType.WARNING); - alert.setTitle(Configuration.bundle.getString("ui.dialog.change_theme.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.change_theme.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.change_theme.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.change_theme.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.change_theme.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.change_theme.text")); alert.initOwner(optionsWindow); alert.showAndWait(); @@ -272,9 +272,9 @@ private void setDisplayOptions(){ optDisplayLang.setValue(Lang.getLangFromCode(config.getDisplayLang())); optDisplayLang.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { Alert alert = new CustomAlert(Alert.AlertType.WARNING); - alert.setTitle(Configuration.bundle.getString("ui.dialog.change_lang.title")); - alert.setHeaderText(Configuration.bundle.getString("ui.dialog.change_lang.header")); - alert.setContentText(Configuration.bundle.getString("ui.dialog.change_lang.text")); + alert.setTitle(Configuration.getBundle().getString("ui.dialog.change_lang.title")); + alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.change_lang.header")); + alert.setContentText(Configuration.getBundle().getString("ui.dialog.change_lang.text")); alert.initOwner(optionsWindow); alert.showAndWait(); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/CorrectionService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/CorrectionService.java index a439f7817..a6d93f174 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/CorrectionService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/CorrectionService.java @@ -30,7 +30,7 @@ protected Task createTask() { return new Task() { @Override protected String call(){ - updateMessage(Configuration.bundle.getString("ui.task.correction.prepare.label")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.correction.prepare.label")+" ..."); Function prepareValidationReport = (Textual ext) -> { updateMessage(ext.getTitle()); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadContentService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadContentService.java index aa890100d..ceb05609e 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadContentService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadContentService.java @@ -22,7 +22,7 @@ protected Void call() throws Exception { int iterations = 0; if (MainApp.getZdsutils().isAuthenticated()) { for (MetadataContent meta : MainApp.getZdsutils().getContentListOnline()) { - updateMessage(Configuration.bundle.getString("ui.task.download.label")+" : " + meta.getSlug()); + updateMessage(Configuration.getBundle().getString("ui.task.download.label")+" : " + meta.getSlug()); updateProgress(iterations, max); MainApp.getZdsutils().downloaDraft(meta.getId(), meta.getType()); iterations++; @@ -30,12 +30,12 @@ protected Void call() throws Exception { iterations = 0; for (MetadataContent meta : MainApp.getZdsutils().getContentListOnline()) { - updateMessage(Configuration.bundle.getString("ui.task.unzip.label")+" : " + meta.getSlug()); + updateMessage(Configuration.getBundle().getString("ui.task.unzip.label")+" : " + meta.getSlug()); updateProgress(iterations, max); MainApp.getZdsutils().unzipOnlineContent(MainApp.getZdsutils().getOnlineContentPathDir() + File.separator + meta.getSlug() + ".zip"); iterations++; } - updateMessage(Configuration.bundle.getString("ui.task.end.label")); + updateMessage(Configuration.getBundle().getString("ui.task.end.label")); updateProgress(iterations, max); } return null; diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadGithubService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadGithubService.java index 96c0b65ba..eb88321a4 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadGithubService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadGithubService.java @@ -36,9 +36,9 @@ protected Content call() throws Exception { if (elts.length > 4) { String owner = elts[3]; String repo = elts[4]; - updateMessage (Configuration.bundle.getString("ui.dialog.download.github.message.downloading")); + updateMessage (Configuration.getBundle().getString("ui.dialog.download.github.message.downloading")); String filePath = GithubHttp.getGithubZipball (owner, repo, onlineFolder); - updateMessage (Configuration.bundle.getString("ui.dialog.download.github.message.unpacking")); + updateMessage (Configuration.getBundle().getString("ui.dialog.download.github.message.unpacking")); File folder = GithubHttp.unzipOnlineContent (filePath, offlineFolder); logger.info ("Répertoire à analyser : " + folder.getAbsolutePath ()); // get folder in unzip folder @@ -47,14 +47,14 @@ protected Content call() throws Exception { if (listFolder[0].isDirectory ()) { File target = listFolder[0]; logger.info ("(GitHub import) Répertoire cible : " + target.getAbsolutePath ()); - updateMessage (Configuration.bundle.getString("ui.dialog.download.github.message.manifesting")); + updateMessage (Configuration.getBundle().getString("ui.dialog.download.github.message.manifesting")); Content c = GithubHttp.loadManifest (target.getAbsolutePath (), owner, repo); ObjectMapper mapper = new ObjectMapper (); File manifest = new File (target, "manifest.json"); logger.info ("(GitHub import) Tentative de création du fichier : " + manifest.getAbsolutePath ()); mapper.writerWithDefaultPrettyPrinter ().writeValue (manifest, c); - updateMessage (Configuration.bundle.getString("ui.dialog.download.github.message.done")); + updateMessage (Configuration.getBundle().getString("ui.dialog.download.github.message.done")); return c; } } diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadZdsService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadZdsService.java index bf921acd5..7bcc1b836 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadZdsService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/DownloadZdsService.java @@ -38,9 +38,9 @@ protected Content call() throws Exception { logger.debug ("type : " + type); logger.debug ("id : " + id); logger.debug ("slug : " + slug); - updateMessage (Configuration.bundle.getString("ui.dialog.download.zds.message.downloading")); + updateMessage (Configuration.getBundle().getString("ui.dialog.download.zds.message.downloading")); String filePath = ZdsHttp.getZdsZipball (id, slug, type, onlineFolder); - updateMessage (Configuration.bundle.getString("ui.dialog.download.zds.message.unpacking")); + updateMessage (Configuration.getBundle().getString("ui.dialog.download.zds.message.unpacking")); File folder = ZdsHttp.unzipOnlineContent (filePath, offlineFolder); // get folder in unzip folder if (folder.isDirectory()) { @@ -49,7 +49,7 @@ protected Content call() throws Exception { File manifest = new File(folder.getAbsolutePath() + File.separator + "manifest.json"); Content c = mapper.readValue(manifest, Content.class); c.setBasePath(folder.getAbsolutePath()); - updateMessage (Configuration.bundle.getString("ui.dialog.download.zds.message.done")); + updateMessage (Configuration.getBundle().getString("ui.dialog.download.zds.message.done")); return c; } } diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/ExportPdfService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/ExportPdfService.java index 7cac402cd..ba67e99f4 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/ExportPdfService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/ExportPdfService.java @@ -71,7 +71,7 @@ protected Task createTask() { public boolean downloadPdf() { logger.debug("Tentative de téléchargement du contenu au format Pdf"); try { - updateMessage(Configuration.bundle.getString("ui.task.export.prepare.label")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.export.prepare.label")+" ..."); HttpResponse response = client.execute(post); logger.debug("Début du traitement de la réponse"); if(response.getStatusLine().getStatusCode() >= 400) { @@ -83,7 +83,7 @@ public boolean downloadPdf() { long remain = 0; updateProgress(remain, max); int inByte; - updateMessage(Configuration.bundle.getString("ui.task.export.build.label")); + updateMessage(Configuration.getBundle().getString("ui.task.export.build.label")); while ((inByte = is.read()) != -1) { fos.write(inByte); remain++; @@ -106,12 +106,12 @@ public boolean downloadPdf() { @Override protected Void call() throws Exception { - updateMessage(Configuration.bundle.getString("ui.task.export.assemble.label")); + updateMessage(Configuration.getBundle().getString("ui.task.export.assemble.label")); content.saveToMarkdown(markdownFile); - updateMessage(Configuration.bundle.getString("ui.task.export.label")); + updateMessage(Configuration.getBundle().getString("ui.task.export.label")); if(!downloadPdf()) { - updateMessage(Configuration.bundle.getString("ui.task.export.error")); + updateMessage(Configuration.getBundle().getString("ui.task.export.error")); throw new IOException(); } return null; diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/LoginService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/LoginService.java index 203bb4d1f..1b482ab4f 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/LoginService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/LoginService.java @@ -47,13 +47,13 @@ protected Task createTask() { protected Void call() { if(getUsername() != null) { try { - updateMessage(Configuration.bundle.getString("ui.task.auth.prepare.label")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.auth.prepare.label")+" ..."); if(MainApp.getZdsutils().login(getUsername(), getPassword())) { - updateMessage(Configuration.bundle.getString("ui.task.auth.init_content")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.auth.init_content")+" ..."); MainApp.getZdsutils().getContentListOnline().clear(); MainApp.getZdsutils().initInfoOnlineContent("tutorial"); MainApp.getZdsutils().initInfoOnlineContent("article"); - updateMessage(Configuration.bundle.getString("ui.task.auth.success.text")); + updateMessage(Configuration.getBundle().getString("ui.task.auth.success.text")); } else { MainApp.getConfig().resetAuthentification(); cancel(); @@ -64,7 +64,7 @@ protected Void call() { } } else { if(MainApp.getZdsutils().isAuthenticated()) { - updateMessage(Configuration.bundle.getString("ui.task.auth.init_content")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.auth.init_content")+" ..."); try { MainApp.getZdsutils().getContentListOnline().clear(); MainApp.getZdsutils().initInfoOnlineContent("tutorial"); @@ -72,7 +72,7 @@ protected Void call() { } catch (IOException e) { logger.error("Echec de téléchargement des metadonnés des contenus en ligne", e); } - updateMessage(Configuration.bundle.getString("ui.task.auth.success.text")); + updateMessage(Configuration.getBundle().getString("ui.task.auth.success.text")); } else { MainApp.getConfig().resetAuthentification(); cancel(); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadContentService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadContentService.java index 0cfa1e4de..bb9aba9a0 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadContentService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadContentService.java @@ -36,9 +36,9 @@ protected Void call() throws Exception { String targetSlug = result.get().getValue().getSlug(); String pathDir = content.getFilePath (); - updateMessage(Configuration.bundle.getString("ui.task.zip.label")+" : "+targetSlug+" "+Configuration.bundle.getString("ui.task.pending.label")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.zip.label")+" : "+targetSlug+" "+Configuration.getBundle().getString("ui.task.pending.label")+" ..."); ZipUtil.pack(new File(pathDir), new File(pathDir + ".zip")); - updateMessage(Configuration.bundle.getString("ui.task.import.label")+" : "+targetSlug+" "+Configuration.bundle.getString("ui.task.pending.label")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.import.label")+" : "+targetSlug+" "+Configuration.getBundle().getString("ui.task.pending.label")+" ..."); if(result.get().getValue().getType() == null) { if(!MainApp.getZdsutils().importNewContent(pathDir+ ".zip", result.get().getKey())) { throw new IOException(); @@ -49,7 +49,7 @@ protected Void call() throws Exception { } } - updateMessage(Configuration.bundle.getString("ui.task.content.sync")+" ..."); + updateMessage(Configuration.getBundle().getString("ui.task.content.sync")+" ..."); try { MainApp.getZdsutils().getContentListOnline().clear(); MainApp.getZdsutils().initInfoOnlineContent("tutorial"); diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadImageService.java b/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadImageService.java index b0fbcd76b..139998ef6 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadImageService.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/task/UploadImageService.java @@ -42,11 +42,11 @@ protected String call() throws Exception { String targetSlug = find.getSlug(); if (MainApp.getZdsutils().getGalleryId() == null) { - updateMessage(Configuration.bundle.getString("ui.task.gallery.init")+" : "+targetSlug); + updateMessage(Configuration.getBundle().getString("ui.task.gallery.init")+" : "+targetSlug); MainApp.getZdsutils().initGalleryId(targetId, targetSlug); } - updateMessage(Configuration.bundle.getString("ui.task.gallery.send_image") + " " + imageFile.getAbsolutePath() + " " + Configuration.bundle.getString("ui.task.gallery.to") + " " + MainApp.getZdsutils().getGalleryId()); + updateMessage(Configuration.getBundle().getString("ui.task.gallery.send_image") + " " + imageFile.getAbsolutePath() + " " + Configuration.getBundle().getString("ui.task.gallery.to") + " " + MainApp.getZdsutils().getGalleryId()); return MainApp.getZdsutils().importImage(imageFile); }