I've been a zone leader with DZone since 2008, and I'm crazy about community. Every day I get to work with the best that JavaScript, HTML5, Android and iOS has to offer, creating apps that truly make at difference, as principal front-end architect at Avego. James is a DZone Zone Leader and has posted 639 posts at DZone. You can read more from them at their website. View Full User Profile

Apache Pivot: Is this the Future of Java RIA?

07.29.2010
| 13618 views |
  • submit to reddit

The Apache Software Foundation Blog recently began running a new feature entitled "The ASF Asks", intended to hep raise awareness of some of the Foundation's many projects. A couple of weeks ago, the blog highlighted the Pivot project in an entry called "The ASF Asks: Have you met Apache Pivot?".

For those who nave not met Pivot yet, it is a platform for building rich Internet applications in Java. Like Flex and Silverlight, Pivot uses an XML-based markup language (called "WTKX") to declare the structure of a user interface. It also includes a number of other features common to RIA toolkits including style support, data binding, animated effects, and web services integration. Like JavaFX, Pivot applications run in a JVM; however, unlike JavaFX, they can be built using Java or any other JVM language (e.g. Groovy or Scala) rather than being limited to JavaFX Script.

As a sort of follow-up to the "How Can Oracle Make JavaFX More Popular" entry from a couple of weeks ago, I'd like to ask the following question: if you have met Apache Pivot, are you using it? If so, why? What makes the platform compelling to you? If not, why not? What suggestions would you offer to the platform developers to make it a more compelling alternative?

Comments

Fabrizio Giudici replied on Thu, 2010/07/29 - 2:34am

As somebody pointed out during the JavaFX discussion of a few days ago, one of the still unresolved problems is the non-perfect VM deployment even in the latest Java 6 releases, at least in some contexts. This clearly affects all the VM-based technologies, including Pivot. Also, JavaFX has been criticized because of the still not smooth integration between developers and visual designers; this is an area that Pivot doesn't even address. So, if JavaFX is not reputed to be a viable alternative to Flex, I don't see how Pivot could be...

Of course, where JVM deployment and graphic designers are not a problem (this is normal for applications used in industrial contexts), Pivot could be a valid alternative for people who don't like the regular Java APIs. But in this contexts regular Java applets using Swing are perfectly fit to the problem and can deliver applications with really high complexity.

Roy Bailey replied on Thu, 2010/07/29 - 2:43am

I looked into Pivot just before it passed incubator status. It was very interesting, particularly that you could deploy a GUI in both desktop and browser form from a single codebase. The features were refreshing compared with vanilla Swing (less so when compared to SwingX and JavaBuilder type extensions).

Since I was most interested for browser deployment that's primarily why I didn't take it further. The usefulness of Java in the browser has been corroded by the lack of support from Apple's new devices and improvements in web standards (javascript, ajax etc.). JVM browser use (JavaFX, Applets, Pivot) is getting squeezed out as the persistent migration to 'everything in a browser' continues using other platform standards.

But even on the Desktop I was put off by the verbose nature of Pivots XML and the introduction of further 'scripting' tricks within this XML. I'm sure this would improve with age, but at the time the XML was not concise and I found it hard work (compared to JavaBuilders yaml) to move things around.

Would be interesting to hear from people that have adopted Pivot though.

Jacek Furmankiewicz replied on Thu, 2010/07/29 - 6:08am in response to: Roy Bailey

Thank you about your kind words about the Swing JavaBuilder. Creating a Pivot JavaBuilder was on my TODO list, maybe I'll look into after Swing JB 1.0 is out the door (next 2-3 weeks) Cheers, Jacek

Greg Brown replied on Thu, 2010/07/29 - 7:16am in response to: Fabrizio Giudici

Hi Fabrizio,

JavaFX has been criticized because of the still not smooth integration between developers and visual designers; this is an area that Pivot doesn't even address. So, if JavaFX is not reputed to be a viable alternative to Flex, I don't see how Pivot could be...

We have generally tended to target the "Application" part of the RIA acronym vs. "Rich" ("Internet" is sort of a given). So this has historically not been a priority for us. That said, it is definitely a potential area for improvement in the future.

But in this contexts regular Java applets using Swing are perfectly fit to the problem and can deliver applications with really high complexity.

True. But I think the primary differentiator is that Pivot allows developers to build such applications more quickly and easily, in an intuitive manner that is similar to Flex or Silverlight development.

Greg

Greg Brown replied on Thu, 2010/07/29 - 7:15am in response to: Roy Bailey

Hi Roy,

I was put off by the verbose nature of Pivots XML

We have heard similar comments before and will be addressing this in Pivot 2.0. Similar to MXML and XAML, many elements now support a default property which significantly reduces the verbosity of the markup.

Greg

Jose Jeria replied on Thu, 2010/07/29 - 7:36am

The browser freezes completely while loading the demo and you get a scary security dialog that you need to agree to. Clicking cancel freezes the browser for about a minute with no possibility to close the tab.

Maybe a good solution for an intranet, but then I would personally prefer to use Ext-GWT which is much richer and does not freeze your browser.

 

Jacek Furmankiewicz replied on Thu, 2010/07/29 - 7:53am in response to: Jose Jeria

Unfortunately I have to concur...just tried them in Chromium on Ubuntu and they pretty much all failed. No error, just a blank or gray screen.

Greg Brown replied on Thu, 2010/07/29 - 8:45am in response to: Jose Jeria

The browser freezes completely while loading the demo

To some extent, this validates Fabrizio's point about VM deployment (something that is unfortunately out of our control - we don't build the plugin, just the platform).

What browser/OS/Java version are you using?

you get a scary security dialog that you need to agree to

You are scared by a dialog whose purpose is to help keep your system secure? ;-) You see this prompt because the applet wants to communicate with a server other than the one it was downloaded from. It is standard applet security. Signing your JARs allows you to do things that aren't even possible with other frameworks.

I would personally prefer to use Ext-GWT which is much richer

Could you be more specific? What in particular does Ext provide that you don't think you would be able to do with Pivot?

Greg Brown replied on Thu, 2010/07/29 - 10:03am in response to: Jacek Furmankiewicz

Hi Jacek,

I still think a Pivot Java builder is a good idea. As I have mentioned before, XML markup is only one way to create a Pivot UI. You can also do it programmatically in code (as with Swing), or via another form of markup such as YAML (provided someone is willing to write such support). ;-) A Groovy builder is another option. We recognize that there is no "one size fits all" approach to UI construction, so we have intentionally designed the platform to be flexible in this respect.

G

Fabrizio Giudici replied on Thu, 2010/07/29 - 10:03am

I don't understand how Pivot could be responsible of the freeze. As it has been said, I rather think that it's a JVM issue. The security is probably the toughest point (again, of the JVM in general, not Pivot). For sure, it would be simpler for me to leave home for my holidays without taking care of securing all the windows and doors, but I don't think is a good idea. For mobile code, so far I only see three possibilities: 1) do nothing or just a few things (so you can stay in the default box 2) ask for confirmation for things that you need to do 3) run in a completely unsecured box and wait for the disaster to happen.

Unless some genius brings an innovative approach, it's more a social than engineering problem. It's true that there are pervasive technologies that are less intrusive. For instance, Android apps don't ask for confirmations - they just declare the permissions they need. Users are supposed to double-check what permissions are going to give, but I frankly think that 90% aren't even aware of what's happening. So far no major disaster happened... but Android is young. In any case, they have the control of the distribution channel and the kill switch, so one might suppose that a large security disaster that is going to happen would be detected early and stopped. JVM applets can't do this.

Cloves Almeida replied on Thu, 2010/07/29 - 7:30pm in response to: Jacek Furmankiewicz

Jacek, Swing JavaBuilder is pretty amazing.

 

If I may, I'd suggest a Vaadin JavaBuilder. Its API is pretty close to Swing, except that it doesn't support MigLayout. However, it fully supports CSS for styling. I wonder how hard would it be to "parse" the MigLayout DSL into CSS or HTML elements.

Jacek Furmankiewicz replied on Fri, 2010/07/30 - 4:49pm in response to: Cloves Almeida

Ha, I was just playing with Vaadin two days ago and thinking...man, this is the REAL Java RIA. What makes it more challenging though is that it's server-side, correct? (i.e. does it compile your Java code into JS like GWT does, yes?). If so, the reflection-heavy aspect of JavaBuilder would make it potentially inappropriate, due to performance overhead. I am sure I could parse at least some of the basic MigLayout DSL constructs into whatever layout mechanism Vaadin offers.

Andrew Fink replied on Mon, 2010/08/02 - 4:01am in response to: Jacek Furmankiewicz

>i.e. does it compile your Java code into JS like GWT does, yes?

 

No. It woks on server (all client components already compilled). So  JavaBuilder should work great.

Vaadin is like Swing.

You can look at this:  Declarative UI with XML

There were posts about YAML support.

 

PS: Can you look also at http://click.apache.org/

Click is component framework (better for classic web vs vaadin for desktop like RIA), so Click JavaBuilder is  good idea too.

 

 

Antonio Sorrentini replied on Tue, 2010/08/03 - 1:59pm

I think I will never be able to get the point of all these technologies like JavaFX, Pivot or even the competing SilverLight. Even for Flash and its derivatives I think they had their time but for new projects that started today I would never go with those technologies . With the increasing adoption and diffusion of things like the browser canvas, WebGL, svg, video canvas and all the related HTML 5 technologies and the continuous speed improvements in JavaScript I really think all the rest is just already anachronistic. Now, well, this is what I think if we talk about the browser. A totally different story would be for the desktop, but no one seems to care about the desktop these days, even if I think this is a very huge mistake. The browser in the end will become the desktop and leaving all the meat to browser developers (i.e. to those very few browser engines we have today) doesn't seem to me a good strategy. In the end we will have again some sort of monopoly with very few actors, maybe Google on one side, Apple on the other, both for desktop and mobile. And all this just because today no one seems interested to develop something new, non browser related, on the client side that worked well in an Internet oriented world. Very sad.

Greg Brown replied on Wed, 2010/08/04 - 7:04am in response to: Antonio Sorrentini

The web is not going to replace the desktop. HTML is a great technology for many applications, but not all. Consider the fact that both Android and iOS are not implemented in HTML - they both provide their own windowing toolkits, even though the vendors of those platforms are major proponents of HTML 5.

RIA platforms also have their place. Like HTML, they make development of certain types of applications much easier (primarily internal business applications with complex user interfaces).

Fortunately, there is no "one size fits all" approach to UI development. You have many options to choose from, and you can select the best one for the job.

Michael Allman replied on Sat, 2010/08/07 - 11:37pm

Hello,

Great discussion here. Sorry I'm late to the party. I'm using pivot to build a data-management desktop app. It's an internal app with a semi-controlled deployment environment---customer machines will have Java 6 but may be Mac/Windows/whatever. I decided Pivot was the best tool for the job for several reasons:

1. Java the platform has a large, reliable built-in API and a heap of excellent third-party libraries.

2. The JVM is fast. I'm not talking applets here, whose slow start up time continues to befuddle me. Even on the same machine, applets start two to four times slower than desktop apps. But aside from startup, JVM desktop apps are smoking fast compared to JS web apps.

3. Java the platform supports a multitude of programming languages, and I wanted to use a scripting language for certain tasks and I wanted to use Scala for everything else.

Compared to the alternatives:

1. Swing is hamstrung and in certain ways painful to use. Consider: no event bubbling, an array of custom data models for its components (like TableModel) instead of simpler adapters. Just these two really put me off. My first desktop app was a Swing app. My second was an RCP app. After that I realized how painful Swing is by comparison.

2. Flex is slow, buggy, and bloated. My opinion is based on four years experience working with Flex 2 and 3, so perhaps 4 is now awesome and the way to go forever. But I kinda doubt it.

3. HTML and JS just don't seem to provide the API necessary to write fully-fledged applications. They're great for document-oriented presentation---hey, that's what HTML is. But I haven't found a platform that gives devs an elegant API and language for writing applications that look and feel like desktop apps but run inside a browser without any kind of plugin. We've all seen some great-looking web apps, but really, these web apps look and work great compared to other web stuff. Compared to, say, an iPhone app or an Apple desktop app, they're lacking in performance and presentation.

Given all of this and my particular application, I have some thoughts to share on others' comments.

Ray said,

But even on the Desktop I was put off by the verbose nature of Pivots XML and the introduction of further 'scripting' tricks within this XML. I'm sure this would improve with age, but at the time the XML was not concise and I found it hard work (compared to JavaBuilders yaml) to move things around.


I'm okay with XML. It's verbose but its grammar is much simpler than YAML's. It would be worth playing around with YAML and Pivot some day. As for scripting, I don't consider these tricks but a helpful alternative to the much more verbose Java language.

Greg said,

You are scared by a dialog whose purpose is to help keep your system secure? ;-) You see this prompt because the applet wants to communicate with a server other than the one it was downloaded from. It is standard applet security. Signing your JARs allows you to do things that aren't even possible with other frameworks.


To be fair, the JVM's applet security sandbox is ridiculously draconian, even compared to the browser's. It's very frustrating. For example, browsers are starting to allow cross-domain requests under certain safe circumstances. This is not possible with an applet without a signature.

Antonio, I pretty much agree with you 100% on all counts. Browser plugins are dying and mostly for good reason. However, I think there are technologies you are overlooking that make desktop apps more competitive with web apps for certain kinds of applications. In particular, I'm thinking of the JNLP (aka Java Webstart) and Adobe's "click-to-run-this-AIR-app" thingie (aka "Whatever it's called I don't care"). And maybe Microsoft has a similar tech for Silverlight. The basic idea is you can install and run a desktop app just by clicking a link in a browser. And to add to that genius, the installer can put a persistent launcher on the desktop or in a folder somewhere that will automagically download new versions of the app when it's launched. I really love using Webstart for deploying Java desktop apps. It makes deployment sooooooooooooooo much easier and idiot-proof for both the programmer(s) and the user(s).

Otengi Miloskov replied on Sun, 2010/08/08 - 1:44am

Im with Michael Allman, Apache Pivot rocks the house. Im still using Swing for some projects cause Swing still have its place. But I just found this little photo slide show http://insideria.com/2009/09/building-a-slide-gallery-demo.html and look how little code it needs to do a slideshow, the author said is more easy to work with Apache Pivot than Flex or Silverlight. Apache Pivot just need some more effects and it will be ready not just for RIA but for "Rich" RIA :P Now with the JDK1.6_20 and 21 and with the next JDK1.7, Java and Pivot is really fast. I tested Slideshow Pivot demo with chrome on Windows and MacOSX, Firefox on Linux and Windows and IE on Windows and it works great.

John O'connor replied on Thu, 2011/04/21 - 12:21pm

Pivot rocks my socks! As a software house that makes a living with Android, I've had a couple of Java desktop apps come across my desk. In evaluating the technology, we've written apps with both SWT and Swing, but both had shortcomings that made them very difficult to implement.

Customers expect applications to be like web pages, and it's been a long road getting there. But Pivot is the answer for Java developers.

Disclaimer: We aren't so much concerned with web deployment, although that's a nice feature. Our focus was strictly on rapid creation of GUI's for Java desktop applications.

We were able to use pivot with our already established workflows for Android, and are even working on a little library right now that allows us to convert Basalmiq mockups (http://basalmiq.com) directly to BXML.

Kudos pivot team for finally creating a Java GUI toolkit that makes sense.

Comment viewing options

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