« New JavaFX Book Available - from Author Ralph Steyer | Main | XML and JSON Processing in Compiled JavaFX Script »

January 08, 2008

Romain Guy's Magic InfiniteProgressPanel

I've mentioned how simple, elegant and powerful JavaFX Script is.  Here's a perfect example of these three qualities.  A few weeks ago I wanted to show a progress indicator in a multi-tier application that has a rich client developed in JavaFX Script.  Whenever the client is waiting for a response from the server, I wanted to show this progress indicator.

Infiniteprogresspanel_2

The screenshot above shows the InfiniteProgressPanel widget that I used from the JavaFX Script UI library.  It was invented by Romain Guy, a co-author of the book Filthy Rich Clients.  It is a great alternative to a progress bar due to the fact that you don't have to continually calculate what percent complete the operation is.  This is because the progress bar is circular (and therefore infinite).  In addition, it is very easy to use: You just place the InfiniteProgressPanel in the UI containment hierarchy, and bind its progress attribute to a Boolean variable that is true whenever you want the progress indicator to appear.  Here's the code for this compiled JavaFX Script example:

/*
*  CompiledInfiniteProgress.fx
*
*  Developed 2007 by James L. Weaver (jim.weaver at lat-inc.com)
*  to serve as a compiled JavaFX Script example.
*/

import javafx.ui.*;
import java.lang.System;

Frame {
  var busy = false
  title: "Infinite Progress Panel Demo"
  width: 400
  height: 400
  background: Color.WHITE
  visible: true
  onClose:
    function() {
      System.exit(0);
    }
  content:
    InfiniteProgressPanel {
      progress: bind busy
      content:
        FlowPanel {
          content: [
            Button {
              text: "Get Busy"
              action:
                function() {
                  busy = true;
                  ConfirmDialog {
                    title: "Patience is a Virtue"
                    message: "Simulating a busy condition"
                    visible:true
                    onYes:
                      function() {
                        busy = false
                      }
                  };
                }
            }
          ]
        }
    }
}

Please compile and run this example and try it out for yourself!  When you click the Get Busy button, the confirmation dialog will be displayed and the infinite progress indicator will appear.  When you dismiss the dialog by clicking the OK button, the progress indicator will disappear. 

By the way, the next several posts are going to highlight various UI widgets similar to the way this post does.  I'd like to give you an appreciation of the rich set of widgets available in JavaFX Script, and how easy they are to use.

JavaFX Script Boot Camp Announcement

As a heads-up, I will be offering a JavaFX Script 2.5 day "boot camp" on Wednesday, April 9 through Friday, April 11, 2008 (ending at noon) in Indianapolis, Indiana.  This course is designed to get you quickly up to speed in JavaFX Script application development.  A primary reference for this course is my JavaFX Script book, but the course has its own syllabus which includes material covered in the book as well as up to the minute developments in compiled JavaFX Script. Registration will open soon, and for this pilot class I am accepting 12 students.  The cost of this pilot class will be 900 USD per student. Additional students from the same organization will be 600 USD.  You'll need to bring your laptop computer with the latest versions of the JavaFX Script downloads (which I'll specify in more detail as the class date approaches).  The prerequisite for the class will be the completion of a JavaFX Script programming assignment that I'll post soon to this weblog.  I'm looking forward to teaching this class and hope that you can attend!

More details to follow,
Jim Weaver
JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications
Immediate eBook (PDF) download available at the book's Apress site

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54f133d69883400e54fc629618833

Listed below are links to weblogs that reference Romain Guy's Magic InfiniteProgressPanel:

Comments

Thanks for this info, i tried your post and it run more or less ok. But thanks anyway, it is always a pleasure to learn.

Alex,

Thanks for your kind words. As I stated in this post, I plan to show code examples of UI widgets in the next few posts. Do you feel like that is what you and many other readers of this weblog would like to see? Are there other JavaFX-related topics that you'd like me to blog about?

Thanks,
Jim Weaver

Hi Jim,
I tried again with another build compiler and it worked nicely.
Thank you for your good work.
Please Keep on the nice work
Regards,

Alex,

Please try the next build. It's working in the current compiler code base, and by now it should be in the continuous build.

Thanks,
Jim Weaver

Hi,Jim
I tried yr example for InfiniteProgressPanel,but got a msg of cannot find symbol.
symbol :variable progress
location:class targetfile.fx
error indicates that a location error.
I use build no.868 compiler
Regards,

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

My Photo

Upcoming Speaking Engagements:


  • Stephen Chin and Jim Weaver speaking about JavaFX Platform

  • Speaking on JavaFX and Java at Øredev in Malmö, Sweden on 2-6 November, 2009

Upcoming JavaFX Training:


  • Developing Secure, Rich Internet Applications Hosted on a Variety of Clients Using JavaFX Technology

Enter your email address:

Delivered by FeedBurner

Available now as early access eBook


  • Click book image above to obtain eBook

Twitter Updates

    follow me on Twitter

    Affiliations:

    DZone Links:


    July 2009

    Sun Mon Tue Wed Thu Fri Sat
          1 2 3 4
    5 6 7 8 9 10 11
    12 13 14 15 16 17 18
    19 20 21 22 23 24 25
    26 27 28 29 30 31  

    Disclaimer:

    • By reading this site, you are agreeing that under no circumstances will Veriana Networks, Inc. or its affiliates be responsible for (1) any information contained on or omitted from the site, (2) any person's reliance on any such information, whether or not the information is correct, current or complete, (3) the consequences of any action you or any other person takes or fails to take, whether or not based on information provided by or as a result of the use of the sites.