Jonathan Giles avatar Jonathan Giles committed 1f5d07a Merge

Merged in jfhenrard/controlsfx/Enhance WorkerProgress (pull request #146)

Permit a progress message and a fix message in showWorkerProgress

Comments (0)

Files changed (4)

controlsfx-samples/build.gradle

 }
 
 dependencies {
-    compile "org.controlsfx:fxsampler:1.0.0-SNAPSHOT"
+    compile "fxsampler:fxsampler:1.0.0-SNAPSHOT"
     compile "org.controlsfx:controlsfx:8.0.3-SNAPSHOT"
 
     try {

controlsfx-samples/src/main/java/org/controlsfx/samples/dialogs/HelloDialog.java

                     @Override protected Object call() throws Exception {
                         for (int i=0; i<100; i++) {
                             updateProgress(i, 99);
+                            updateMessage("progress: " + i);
                             System.out.println("progress: " + i);
                             Thread.sleep(100);
                         }
Add a comment to this file

src/main/docs/org/controlsfx/dialog/dialog-progress-with-progress-message.png

Added
New image

src/main/java/org/controlsfx/dialog/Dialogs.java

         Dialog dlg = buildDialog(Type.PROGRESS);
         dlg.setClosable(false);
         
-        final Label label = new Label();
-        label.textProperty().bind(worker.messageProperty());
+        final Label progressMessage = new Label();
+        progressMessage.textProperty().bind(worker.messageProperty());
+
         final WorkerProgressPane content = new WorkerProgressPane(dlg);
         content.setMaxWidth(Double.MAX_VALUE);
 
-        VBox vbox = new VBox(10, label, content);
+        VBox vbox = new VBox(10, progressMessage, content);
         vbox.setMaxWidth(Double.MAX_VALUE);
-        
         vbox.setPrefSize(300, 100);
         
+        if (message != null) {
+            vbox.getChildren().add(0, new Label(message));
+        }
         dlg.setContent(vbox);
         content.setWorker(worker);
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.