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.
How/when did you get started creating Pivot?
VMware Remote Access client in Pivot
Who do you anticipate to be the target audience?
Todd. Developers of rich internet applications will benefit most from Pivot, but one of the things that's really great about Pivot is that the runtime container (browser vs. native application window) is abstracted away from the developer, meaning that the same application can be deployed in an applet or on the desktop without any code changes. As such, Pivot is a good choice for any cross-platform application developer.
How has the response been?
Todd. We just announced it this week, but so far, the response has been very positive.
Can you walk us through a very basic step-by-step "getting started" scenario?
Greg. The Pivot tutorial is probably the best place to start:
It includes the traditional "Hello World" application and is an easy way to get started using Pivot. It also includes more detailed information on how to use many of Pivot's features (note, however, that it is still a work in progress, and many sections are incomplete).
Javadoc for Pivot can be found here, but it is also a bit incomplete in some areas:
What are your personal favorite features?
Todd. The XML declarative markup, WTKX, is a personal favorite of mine. I had to prototype a medium-sized application given a handful of screen mock-ups, and in under 4 hours, I was able to get a functional prototype up and running:
I only had to write about 20 lines of Java code; the rest was all done in WTKX. It yields a great separation of code and presentation logic, which makes for a much more maintainable code base, but it's also a great prototyping tool!
Greg. Personally, I'm very happy with the whole package. All of the classes in the various libraries work really well together. That doesn't mean that they are tightly coupled, though—they can also be used independently. The entire platform is geared towards allowing developers to do what they need to do as seamlessly and efficiently as possible.
As an example, I really like the fact that I can execute a web query, have it return a List object, and set that list as the data model of a table view. We do this in the Stock Tracker application in the tutorial. This application displays a list of stock quotes retrieved from Yahoo! Finance (http://finance.yahoo.com). It's very simple and clean—the whole thing happens in just a few lines of code. However, it is not simplicity at the expense of flexibility. If you want more control over anything in Pivot, you'll probably find a hook into it. Even then, we don't sacrifice elegance for flexibility. Everything just works together very well.
Pivot Stock Tracker demo running in Safari
Where do you see Pivot going in the future and do you have some kind of timeline?
Greg. I'd like to see Pivot become a real option for Java developers who want to build rich web applications. I think that a lot of developers currently associate the term "rich internet application" with animations and video, but I think that the "richness" comes as much from the availability of more desktop-like functionality as it does from the media features. Delivering a comprehensive and functional widget set was our primary focus for version 1- we'll come back and add support for effects and transitions in a later release. It would be great if we could take advantage of some of the work that has been done for JavaFX in this area.
Todd. We'd like to see Pivot become the platform of choice for cross-platform application developers. Over the next 6 months or so, we'd like to get a number of development teams building real-world applications with Pivot so we can get feedback on what outstanding features are the highest priorities to tackle next.
Can others be involved and what would you like people to do if they want to help?
Todd. Absolutely! Pivot has been open sourced because we want to encourage others to get involved. In the immediate future, the most productive thing developers can do is to start building real applications using Pivot. This will help identify real-world issues and ferret out bugs. Along the way, developers are encouraged to submit patches to any bugs that they discover as well as build new widgets. In the longer term, we anticipate developers contributing to larger functional units in the code base; anyone interested in doing so should familiarize themselves with the code and contact us about where to they might be best utilized.
Greg. The best (and easiest) way to help is to start using Pivot. Spread the word—let other developers know about it. Interest in the platform is ultimately what is going to drive future development. Also, there are a number of features we'd like to add that didn't make the initial release. If you have the inclination, we would certainly welcome the assistance.