From 92aa8852de7654f12d4c26d5d2aa1d7e99943b6f Mon Sep 17 00:00:00 2001 From: Karl Woditsch Date: Fri, 29 Nov 2013 19:27:54 +0100 Subject: [PATCH] Use dialogs --- BigBrother-Gui/nbproject/build-impl.xml | 14 ++++++++++++++ BigBrother-Gui/nbproject/genfiles.properties | 4 ++-- BigBrother-Gui/nbproject/project.properties | 5 ++++- BigBrother-Gui/nbproject/project.xml | 8 ++++++++ .../src/bigbrother/gui/BigBrotherGui.java | 6 ++++-- .../bigbrother/gui/BigBrotherGuiController.java | 16 ++++++++++++++++ 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/BigBrother-Gui/nbproject/build-impl.xml b/BigBrother-Gui/nbproject/build-impl.xml index 7656cbd..23f0b45 100644 --- a/BigBrother-Gui/nbproject/build-impl.xml +++ b/BigBrother-Gui/nbproject/build-impl.xml @@ -901,6 +901,13 @@ is divided into following sections: + + + + + + + @@ -1397,6 +1404,13 @@ is divided into following sections: + + + + + + + diff --git a/BigBrother-Gui/nbproject/genfiles.properties b/BigBrother-Gui/nbproject/genfiles.properties index 20139b5..213cd42 100644 --- a/BigBrother-Gui/nbproject/genfiles.properties +++ b/BigBrother-Gui/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=2c02c2d7 build.xml.stylesheet.CRC32=8064a381@1.68.1.46 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=40d27e65 -nbproject/build-impl.xml.script.CRC32=13067fac +nbproject/build-impl.xml.data.CRC32=48c3833f +nbproject/build-impl.xml.script.CRC32=6e8b5bf7 nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 diff --git a/BigBrother-Gui/nbproject/project.properties b/BigBrother-Gui/nbproject/project.properties index 3c8acee..5993fef 100644 --- a/BigBrother-Gui/nbproject/project.properties +++ b/BigBrother-Gui/nbproject/project.properties @@ -36,7 +36,8 @@ jar.compress=false javac.classpath=\ ${reference.BigBrother.jar}:\ ${reference.TreeChart.jar}:\ - ${javafx.classpath.extension} + ${javafx.classpath.extension}:\ + ${reference.JavaFX-Dialog.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false @@ -108,8 +109,10 @@ meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false platform.active=default_platform project.BigBrother=../BigBrother +project.JavaFX-Dialog=../../JavaFX-Dialog/JavaFX-Dialog project.TreeChart=../TreeChart reference.BigBrother.jar=${project.BigBrother}/dist/BigBrother.jar +reference.JavaFX-Dialog.jar=${project.JavaFX-Dialog}/dist/JavaFX-Dialog.jar reference.TreeChart.jar=${project.TreeChart}/dist/TreeChart.jar run.classpath=\ ${dist.jar}:\ diff --git a/BigBrother-Gui/nbproject/project.xml b/BigBrother-Gui/nbproject/project.xml index 1db458f..8187c3d 100644 --- a/BigBrother-Gui/nbproject/project.xml +++ b/BigBrother-Gui/nbproject/project.xml @@ -30,6 +30,14 @@ clean jar + + JavaFX-Dialog + jar + + jar + clean + jar + TreeChart jar diff --git a/BigBrother-Gui/src/bigbrother/gui/BigBrotherGui.java b/BigBrother-Gui/src/bigbrother/gui/BigBrotherGui.java index 1c4b95e..a7f1986 100644 --- a/BigBrother-Gui/src/bigbrother/gui/BigBrotherGui.java +++ b/BigBrother-Gui/src/bigbrother/gui/BigBrotherGui.java @@ -19,8 +19,10 @@ public class BigBrotherGui extends Application { @Override - public void start(Stage stage) throws Exception { - Parent root = FXMLLoader.load(getClass().getResource("BigBrotherGui.fxml")); + public void start(Stage stage) throws Exception {FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("BigBrotherGui.fxml")); + Parent root = (Parent) fxmlLoader.load(); + BigBrotherGuiController controller = fxmlLoader.getController(); + controller.setStage(stage); Scene scene = new Scene(root); diff --git a/BigBrother-Gui/src/bigbrother/gui/BigBrotherGuiController.java b/BigBrother-Gui/src/bigbrother/gui/BigBrotherGuiController.java index 5d4419f..e58e423 100644 --- a/BigBrother-Gui/src/bigbrother/gui/BigBrotherGuiController.java +++ b/BigBrother-Gui/src/bigbrother/gui/BigBrotherGuiController.java @@ -47,7 +47,9 @@ import javafx.scene.paint.Color; import javafx.stage.FileChooser; import javafx.stage.FileChooser.ExtensionFilter; +import javafx.stage.Stage; import javafx.util.Callback; +import net.kirauks.javafx.dialog.Dialog; /** * FXML Controller class @@ -109,6 +111,7 @@ public void handle(WorkerStateEvent t) { if(scanner.encouredError()){ BigBrotherGuiController.this.bottomMessage.setTextFill(Color.DARKORANGE); BigBrotherGuiController.this.bottomMessage.setText("Exploration incomplète : Certaines classes n'ont pas pu être chargées."); + new Dialog("Exploration incomplète : Certaines classes n'ont pas pu être chargées.", null, Dialog.DialogType.WARNING, Dialog.DialogOptions.OK, BigBrotherGuiController.this.getStage()).showAndWait(); } TreeViewTask accordionBuilder = new TreeViewTask(scanner.getClasses(), scanner.getJarName()); @@ -126,6 +129,7 @@ public void handle(WorkerStateEvent t) { public void handle(WorkerStateEvent t) { BigBrotherGuiController.this.bottomMessage.setTextFill(Color.DARKORANGE); BigBrotherGuiController.this.bottomMessage.setText("Erreur de construction de la liste des packages."); + new Dialog("Erreur de construction de la liste des packages.", null, Dialog.DialogType.ERROR, Dialog.DialogOptions.OK, BigBrotherGuiController.this.getStage()).showAndWait(); BigBrotherGuiController.this.progressBar.setProgress(1d); BigBrotherGuiController.this.loading.set(false); @@ -322,6 +326,9 @@ public void handle(WorkerStateEvent t) { BigBrotherGuiController.this.scrollPane.setContent(treeChart.getTreePane()); BigBrotherGuiController.this.bottomMessage.setTextFill(treeChart.getMessageColor()); BigBrotherGuiController.this.bottomMessage.setText(treeChart.getMessage()); + if(!treeChart.getMessage().isEmpty()){ + new Dialog(treeChart.getMessage(), null, Dialog.DialogType.WARNING, Dialog.DialogOptions.OK, BigBrotherGuiController.this.getStage()).showAndWait(); + } BigBrotherGuiController.this.cleanAriane(); BigBrotherGuiController.this.buildAriane(classe); @@ -335,6 +342,7 @@ public void handle(WorkerStateEvent t) { public void handle(WorkerStateEvent t) { BigBrotherGuiController.this.bottomMessage.setTextFill(Color.DARKRED); BigBrotherGuiController.this.bottomMessage.setText("Erreur de construction de l'arbre."); + new Dialog("Erreur de construction de l'arbre.", null, Dialog.DialogType.WARNING, Dialog.DialogOptions.OK, BigBrotherGuiController.this.getStage()).showAndWait(); BigBrotherGuiController.this.progressBar.setProgress(1.0d); BigBrotherGuiController.this.loading.set(false); @@ -414,4 +422,12 @@ public void unloadTreeChart(){ this.elementName.setText("Element"); this.scrollPane.setContent(new Pane()); } + + private Stage stage; + public void setStage(Stage stage){ + this.stage = stage; + } + public Stage getStage(){ + return this.stage; + } }