What is New with Apache Pivot?
Join the DZone community and get the full member experience.
Join For FreeIt has been a while since I have written about Pivot, so I thought I would put together a quick entry to highlight a few of the things we have been working on recently (Apache Pivot is a platform for building rich internet applications in Java. It is currently undergoing incubation at the Apache Software Foundation).
CardPane Transitions
One of the new features added in Pivot 1.2 was support for selection change transitions in the CardPane class. These allow developers to easily add some visual interest to an application's navigation. Pivot 1.2 includes support for crossfade and horizontal/vertical slide transitions, and Pivot 1.3 adds the flip transition initially implemented for the table row editor demo. This demo (from the Pivot tutorial) shows what each of the new transitions looks like (Java 6 required):
http://ixnay.biz/card_panes.html
Cool, huh? If anyone has any suggestions for other transitions you might like to see, please let us know.
Scripting
We have made some significant enhancements to WTKX scripting support for Pivot 1.3. Script code can now be embedded inline in a WTKX document (previously, it had to be stored in an external file). More importantly, it is now much simpler to declare event handlers in WTKX. It is no longer necessary to implement a listener interface and programmatically add the listener to a component's listener list - this can now be done entirely in markup. For example, the following WTKX creates a PushButton and attaches two button press listeners to it, one written in JavaScript and the other in Groovy:
<PushButton wtkx:id="pushButton" buttonData="Click Me!">
<buttonPressListeners>
<wtkx:script language="javascript">
importPackage(org.apache.pivot.wtk);
function buttonPressed(button) {
Alert.alert("Hello from JavaScript!", button.getWindow());
}
</wtkx:script>
<wtkx:script language="groovy">
buttonPressed = {
out.println("Hello from Groovy!")
}
</wtkx:script>
</buttonPressListeners>
</PushButton>
You probably wouldn't want to code the logic for your entire application this way, but it does make declaring simple event handlers a lot easier.
Charting
The JFreeChart provider for Pivot has been updated to work with the latest release of JFreeChart. A demo is here:
UI Scaling
Pivot was designed from the ground up to be resolution independent; all components are rendered using Java2D graphics primitives. However, it wasn't until Pivot 1.2 that this support became accessible to the user. Pivot 1.2 and later allows the user to interactively zoom the display scale in and out by either pressing Shift-Control and scrolling the mouse wheel or pressing the + or - keys. You can try it yourself in the Kitchen Sink demo (or any other Pivot app). While Pivot still can't claim full accessibility support, this feature should go a long way towards helping us get there.
JSON Viewer
Last week I had occasion to debug some code that relied on some rather complex JSON data. The data had been stripped of whitespace and line feeds for efficiency, which made it pretty difficult to read. I put this application together to help me navigate the data more efficiently. It allows the user to either paste JSON data from the clipboard or drag JSON files into a TreeView component:
http://ixnay.biz/json_viewer.html
Thanks to Pivot's built-in JSON support, the application was almost trivial to write. Here's the source code:
http://svn.apache.org/repos/asf/incubator/pivot/trunk/tools/src/org/apache/pivot/tools/json/
Note that the application takes advantage of Pivot's newly-added scripting features. Most of the app's code is defined in JSONViewer.java, but the drop handler is defined in json_viewer.js, and, of course, the UI structure is defined in json_viewer.wtkx. I think it's a pretty handy tool - hopefully other developers will find some value in it as well.
Logo
Finally, we're trying really hard to come up with a logo for Pivot, but thus far our efforts have been somewhat lackluster (we're software engineers, not graphic designers, after all). If anyone is artistically inclined and would like to help, we would love to hear from you! Please drop us a note on our developer mailing list.
That's all for now. I will be posting more soon as we get closer to the release of Pivot 1.3.
From: http://weblogs.java.net/blog/gkbrown/archive/2009/07/what_is_new_wit.html
Opinions expressed by DZone contributors are their own.
Trending
-
TDD vs. BDD: Choosing The Suitable Framework
-
How To Check IP Addresses for Known Threats and Tor Exit Node Servers in Java
-
Mastering Time Series Analysis: Techniques, Models, and Strategies
-
What Is Test Pyramid: Getting Started With Test Automation Pyramid
Comments