Geertjan is a DZone Zone Leader and has posted 459 posts at DZone. You can read more from them at their website. View Full User Profile

Interview: Greg Brown & Todd Volkert from the Pivot Framework

06.27.2008
| 17106 views |
  • submit to reddit

The Pivot Framework has been raising eyebrows over the past few weeks. In short, it is an open-source framework for building high-quality, cross-platform applications that are easily deployable both via the web and to the desktop. It began as an R&D effort at VMware and is now being made available to the community as an option for developers who want to build rich client applications in Java. Its creators, Greg and Todd, have discussed the framework in various places, such as on Javalobby recently.

Elsewhere, articles have been written around what this framework aims to bring in relation to existing offerings. For example, on Ajaxian, the question of "what defines a Rich Internet Application (RIA)" is assessed. Though many developers associate animations and video with RIA, Greg and Todd argue that RIA "comes as much from the availability of more desktop-like functionality as it does from the media features". Delivering a comprehensive widget set was their primary focus for version 1 and they plan to come back and add support for effects and transitions in a later release. Furthermore, they'd also like to take advantage of some of the work that has been done for JavaFX in this area. With this background, let's explore Pivot, guided by Greg and Todd themselves.

Could you start by saying who you are and what you do?

Todd. My name is Todd Volkert; I'm a senior UI developer at VMware, Inc.


Greg. Greg Brown, Senior developer on the UI team at VMware.

What's Pivot about, in a nutshell, i.e., what's the specific problem it tries to solve?

Greg. Really immersive "desktop-like" UIs are simply difficult to build on the web. HTML was never meant to be a GUI platform. Users have much higher expectations for web applications now than they did 10 years ago. There is a limit to how far HTML can be pushed, and I think we're getting close to it. This is why we're seeing tools like Flex and Silverlight beginning to gain traction; however, both of these require developers who are otherwise happy using Java to switch technologies. Pivot is an attempt to create a modern, rich client development platform in Java.

Todd. The web development community has been trying to solve this problem for over 10 years. Pivot is an attempt to create a best-of-breed solution from which the entire UI development community can benefit.

Demo from the Pivot tutorial, showcasing a number of Pivot widgets

Has this problem been solved in other projects, if so, how, and how does Pivot compare?

Greg. Swing is an obvious comparison. In fact, Pivot takes a number of design cues from Swing. However, Swing is 10 years old, and it hasn't significantly evolved in that time. It just isn't quite as nice or as easy to use as some of the newer toolkits. We think Pivot offers a number of advantages over Swing:

 

  • UI construction via XML markup, including CSS-like styling—This is a feature developers have come to expect thanks largely to HTML. Flex supports it, as does Silverlight. Swing doesn't, and this makes building Swing applications much more cumbersome.


  • Constrained preferred size—Swing components can provide a preferred size to assist in layout. However, this size is "atomic" - one dimension cannot vary based on the other. Pivot supports the notion of "constrained preferred size"—the Component class defines getPreferredWidth(int height) and getPreferredHeight(int width) methods in addition to getPreferredSize(); passing a value of -1 to either of these methods indicates no constraint, but any other value tells the component to return its preferred size given this constraint. This allows us to wrap text in labels, for example.

  • Common data model—All data-driven components use the interfaces in the pivot.collections package for model data. There isn't a separate TreeModel, TableModel, etc. This approach is analogous to Swing using the classes in for model data (though this isn't really possible since those classes don't fire events). The benefit is that any data that can be modeled as a collection is instantly available as a data model for a Pivot component. For example, Pivot includes a JSON serializer that deserializes JSON-encoded data into Pivot collections. This data can immediately be applied as a data model without any intermediary translation to the component's "native" data model, resulting in better application performance. The same applies to XML, CSV, or any other data you might want to read from a server.

 For example, Pivot includ

  • Data binding—This is another fairly common feature in newer UI toolkits. If it's not done right, it can become more of a nuisance than anything else, but we think that the approach we have taken in Pivot will work well for a lot of developers.


 

We've also been asked, "what about SWT?" SWT is a very well-designed toolkit, but the SWT and Pivot philosophies are quite different. SWT attempts to be (and succeeds at being) a very thin layer over the native windowing toolkit. An SWT app on Windows looks like a Windows app—on Linux, it looks like a Linux app, etc. Pivot has a cross-platform look and feel: a Pivot application (intentionally) looks the same whether it is running on Windows, Linux, or Mac OSX. There are arguments to be made in favor of both approaches, and scenarios where one is more applicable than the other.

However, a bigger issue is that, to our knowledge, SWT is still not web-deployable. In other words, I can't write an "SWT applet". Pivot applications can be run within the browser as well as offline.

Todd. Other recent projects such as Adobe Flex, Microsoft Silverlight, and GWT (the Google Widget Toolkit) have also attempted to address the problem of web usability, but they all have some limitation that makes them unattractive for one reason or another. Pivot's main advantages over these platforms are:

  • Pivot is open-source—Flex and Silverlight are not. (Correction from Todd: A reader correctly points out that Flex is open source -- Adobe announced their plans to open source Flex after we started development, and we unfortunately didn't keep up to date on its open source status.)
  • Pivot is cross-platform; Silverlight may or may not be, depending on how well Microsoft ultimately supports it.

  • Pivot applications are written in Java, a true object-oriented, compiled programming language—Flex applications are written in ActionScript, an ECMAScript variant.

  • Pivot visuals are rendered in Java2D, a modern, vector-based graphics library—GWT rendering is limited to CSS and the DOM.

  • Pivot applications may be multi-threaded to improve performance—GWT and Flex applications are always single-threaded.

  • Pivot supports an XML-based markup language that simplifies UI construction—GWT does not.

Published at DZone with permission of its author, Geertjan Wielenga.

Comments

Steven Baker replied on Mon, 2008/06/30 - 7:44pm

i like the idea of this, but i think it needs some optimisation

my computer literally slowed to a crawl when the demo applet started...

and no, my pc isnt even a peice of junk

Todd Volkert replied on Tue, 2008/07/01 - 1:17pm in response to: Steven Baker

Hi Steven,

 The slowness of the demo is due to the JAR files being served out of subversion on java.net.  When we load the applet off a plan old web server, it starts much faster.

 -Todd

Steven Baker replied on Tue, 2008/07/01 - 5:30pm

it's not so much the load time. when it's already up and running and all downloaded, the browser chokes up a bit.

are you saying the applet downloads jars at run time? or is it all delivered at the start?

Todd Volkert replied on Wed, 2008/07/02 - 10:48am in response to: Steven Baker

Curious - we've tested Pivot on a number of systems, and it has always performed well.  Question: might you be running it inside a VM?  The one time I've seen Pivot lag is when it was run inside a virtualized environment (the virtual graphics drivers tend to be very primitive).

 The applet in the demo downloads all the JARs at startup as it is set up now.

 -Todd

Greg Brown replied on Wed, 2008/07/02 - 1:09pm in response to: Steven Baker

Looks like this may actually be dependent on the Java plugin version. We see some unusually high CPU usage in Mac OSX and pre-J6u10 builds on Windows, but in J6u10 CPU usage is normal. What version of the JRE are you running?

 

Steven Baker replied on Wed, 2008/07/02 - 5:48pm

must be it... im using JRE 5

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.