New to JavaFX 1.3: Cells

In JavaFX 1.3 a lot of work has gone into ListView, and extracting out the base virtualization engine (the secret sauce to high performance lists) such that it is able to be used in controls such as TreeView and TableView. At the same time we wanted to make it really easy for developers to customize what is shown in each ListView row. What we’ve ended up doing is creating the concept of a cell, which at any point in time represents at most one item in your ListView, and it is through the cell that you have total freedom about how to display your data. Finally, as noted, we’ve expanded this concept to also be used in exactly the same way in TreeView (which is a preview in JavaFX 1.3), and it is likely to also underpin any future TableView control.

(more…)

Dynamic Cell Sizes

One of the really neat things about the JavaFX ListView control is the Cell API, and the ability to have dynamically variable row heights, without sacrificing performance or scalability. To accomplish this, we’ll write a custom Cell factory which will create a Cell who’s size depends on some state.

To recap briefly, to remain scalable and fast, the ListView reuses Cells for rendering each row in the ListView. Because it reuses Cells, each Cell needs to be designed so that it does the right thing no matter what row it is asked to represent — even empty rows which are used only for filling out a ListView and not for actually holding valid data. (more…)

JavaFX links of the week, April 25

Well, look at that – JavaFX 1.3 came out this week. This weeks links are obviously largely about this, as I expect it to be for some time. 1.3 is a great release, but rather than rehash my thoughts here, I’ve got a bunch of links to other posts below. Enjoy! 🙂

That’s all folks! Keep sending in the links and I’ll catch you in a weeks time.

Top 10 Changes in JavaFX 1.3

A few weeks ago we started assembling our own Top 10 change list for JavaFX 1.3. Stephen posted an excellent list of his own. Here’s our take! Over the next several weeks we will be writing about each of these topics in greater detail and link them back to this page. So without futher ado…

10. Amble Font
We’ve added some standard fonts to JavaFX which are available to all devices: desktop, mobile and tv. What this means to you is a single consistent set of fonts which look consistent on all platforms. Happiness all around!

09. Multiline Text Input
Finally(!!), JavaFX 1.3 brings support for multiline text input to the venerable TextBox. TextBox already worked for single-line single-style text input, and in 1.3 we added the ability for the TextBox to also support multiple lines of text!

08. ChoiceBox
One of the most hotly asked for new Controls was a ComboBox. ChoiceBox is a close cousin (and in our experience is used more frequently). The ChoiceBox is essentially a non-editable ComboBox. You can put any kind of data item in the ChoiceBox and let the user choose an item.

07. Layout Enhancements
A lot of work went into enhancing and simplifying the layout system in JavaFX 1.3. The majority of porting issues you will face going from 1.2 to 1.3 will be in the area of layout. It is faster, simpler, and ready for business.

06. Preview Controls
In 1.3 we have added a number of preview controls. Please try them out! They absolutely will change when they become final controls (including moving from the com.javafx.preview package in which they live), but we wanted to get them out as soon as possible so you can have a play and provide input into their continued development. In 1.3 the main preview controls are Menus (MenuItem, PopupMenu, MenuBar, etc) and TreeView. Try them out!

05. Custom List Cells
In JavaFX 1.2 we released a very lightweight ListView Control. It barely made the 1.2 release at all. In 1.3 we’ve extended it to support completely customizable cells. One of my major regrets was that ListView is still single selection in 1.3 (bummer). That being said, the ListView’s cell virtualization absolutely rocks.

04. Lazy Scenegraph
We’ve made the scenegraph lazier! What this means for you is much better performance. “Bind storms” have been eliminated from all bounds related aspects of the scenegraph, so now we don’t compute bounds unless you ask for them. We’ve seen major improvements in applications which once were limited by such bind storms.

03. JavaFX Compiler Rewrite
The JavaFX Compiler team has done it again! The JavaFX Compiler has seen some major improvements in this release, both in the type of code being generated and how those changes effect applications. The semantics of “bind” have been better defined, and all binding is now “lazy” to help quell bind storms (lazy binding means that a value is not recomputed when its inputs have changed, only when it is asked for a new value). We sometimes refer to this as “compiled bind” because in previous releases bindings were essentially interpreted whereas in 1.3 the compiler generates more bytecode for each binding which gives hotspot more to work with and, critically, reduces the dynamic footprint of a Node by 6-10x!

02. CSS
The biggest feature for the JavaFX UI Controls team in the 1.3 release is without a doubt the CSS support that was reengineered from the ground up, extended, and improved. It is also now available on all three platforms — desktop, mobile, and tv. We’re really excited about this support as it gives developers and designers much more freedom in how to style controls and really makes some very common use cases much, much simpler.

01. TV
Finally, in JavaFX 1.3 we have added an emulator for TV which allows you to develop JavaFX applications for the TV or TV set top boxes. This is the FX Experience #1 top change for JavaFX 1.3 as it completes the promise of having a platform targeting all three screens (desktop, mobile, tv). The TV implementation is based on the new prism 3D accelerated pipeline. We’re very excited to see where this leads and to put more heat into this and our other platforms in future releases.

If you haven’t yet, download JavaFX 1.3!

Welcome JavaFX 1.3

JavaFX 1.3 is here!

With the pushing of the bits yesterday, those of us on the JavaFX team are finally able to talk about the work we’ve been doing for nearly the past year (has it been so long?!). A tremendous amount of work from many skilled engineers has gone into making this release the fastest, richest, and most productive release of JavaFX to date. Ok, so we’re somewhat biased :-).

One of the things that has been gratifying about working on this project is that each release of JavaFX gets an order of magnitude better than the last. The compiler team has done amazing work in this release related to both raw performance and also dynamic footprint (the amount of memory used by each JavaFX object). Both the 1.2 release and the 1.3 release bring us a lot closer to the type of performance we know the Java platform is capable of.

Stephen Chin posted a great top ten list yesterday about features that have gone into 1.3. We’ll be posting our own list shortly, which ranks things a little differently but is essentially a lot of the same stuff :-). We’re also going to be posting a lot more detail about these features in the coming weeks.

In addition to all of these new features, we spent a significant chunk of time early on in this release working on “technical debt” we’d acquired prior to and including the 1.2 release. We had been on such a pace that various bits of underlying infrastructure and architecture needed some real TLC. In 1.3 we paid down that debt and are really well placed for future improvements.

A lot has been said in the past about “bindstorms” — a term coined to refer to situations where simple applications with liberal usages of bind would come to a screeching halt. Immediately after 1.2 was released we set to work planning for and making the changes necessary to quell these storms. In a future post we’ll go into detail about how this was done, and what this means to you as a programmer (summary: you pretty much get it for free).

Another area where we paid down technical debt was in the underpinnings of the scenegraph and how it was ported onto different platforms. The TV and desktop implementations of JavaFX share a tremendous amount of code which as an engineer is really great to see. For the most part, the TV team has been able to focus on the deep integration with the system and hasn’t had to worry about the scenegraph implementation at all.

The big compiler rewrite was a huge deal in this release. You can now create thousands and thousands of Nodes in your scenegraphs now without running out of heap or overly stressing the system. The new compiler implementation really puts us in a great spot going forward. There might be a few hiccups with tooling for a couple months but we’re ironing all those bits out as fast as we can.

The other major improvement in this release that really cannot be overstressed is the work that was done with CSS and being able to style all of the controls from CSS. We’ve taken standard CSS and added a couple powerful concepts (which I would love to see HTML CSS adobt back) which really make styling of controls very elegant.

The layout system was another area that got a lot of attention in this release that we are really pleased with. In previous releases there was a tension between container-based layouts and bind-based layouts. In this release, we’ve adjusted a few of the semantics such that the two different layout methodologies share the same basic semantics and behaviors. We’ll definitely be posting more about this as time goes on (I’m sure Amy has something in the works already).

Existing controls such as ListView and TextBox got significant new features. The ListView now has support for custom cells, which are capable of doing just about anything. And its fast. We actually improved the performance of this control by 50% while adding tons of new richness and functionality.

The TextBox can now be configured for either single-line or multi-line text input. It still isn’t rich text (bummer), but for basic text input this Control is now ready for business.

Lots of work went into preview controls (of these the TreeView is one of my favorites), new controls (PasswordBox, ToolTip, ScrollView, Separator, more), and improving existing controls (Slider, ProgressIndicator, more). The Skin implementations for all of the controls were completely rewritten. They are now about 20% of the size of the old skins and all the visuals are now defined in CSS — which means that you the developer or designer have tremendous leverage in giving the controls all new styles.

After all is said and done, the best thing about JavaFX is the programming experience. From the language to the APIs, things fit together well and are a joy to use. We work on this project because we love to build great technology and are committed to making each release better than the last. If you have bugs, feature requests, or optimizations please file issues in our issue tracker.

So what are you waiting for? Download JavaFX today!