JavaWeb-based JavaJava Studio Creator 2 Offers Across the Board Improvement

Java Studio Creator 2 Offers Across the Board Improvement

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Regular readers of Developer.com will probably notice that I have written many articles for Java Studio Creator. It is a development tool that I keep coming back to, not just for articles, but for Web UI development at work and at home.

What is Java Studio Creator?

If you are already familiar with Creator, by all means skip ahead. However, it has been my experience that Creator is still one of the best kept secrets in Java—or worse, that what it does is misunderstood.

Java Studio Creator is a Rapid Application Development environment for constructing Web-based clients around existing databases, Web services, EJBs, or other Java class libraries. At least for the present, it concentrates on the construction of Web user interfaces, not Wwing or other interface options. It also is not intended for constructing class libraries, server, or middle-tier code, and so forth. It’s not that these tasks cannot be undertaken in it, but that there is no inherent support for doing such development.

By concentrating on the task of Web UI client development, it provides an extremely streamlined and approachable IDE for beginners, and also a highly productive tool for experts who need to slap a Web-based UI together with a minimum of fuss.

Why is Java Studio Creator so important?

The Java development space is extremely well supported by development tools, so what makes Creator so important?

The thing is, there are lots of extremely good options for Java development running all the way up from creating apps and class libraries to full-on enterprise development with UML, and there are at least a dozen options that do exactly that—excellent tools that cover every conceivable level of development.

And you know what? Try putting a beginner down in front of one of these tools and telling them to write something.

The fact is these tools are excellent in the hands of an experienced developer who needs to do everything, but the beginner will be quickly overwhelmed. Java Studio Creator presents a manageable interface that has the functionality to carry out the task at hand without a developer getting lost in thousands of different options and views.

Also, by concentrating on just Web UI development, it is very good at it. Creator pushes a development approach used in the Microsoft development world for a very long time—that of component-based development. This is what made tools such as Delphi and VB so popular for client development.

Component-based development, and the graphical nature of the UI building environment, make for a very productive tool for experienced developers as well.

Of course, this means using a separate UI for client development than for the rest of the system, and again, in my opinion this is a win as well. Using separate tools means that architectural boundaries cannot be crossed, so the parts that are written to provide an API for the client portion of the application will, by necessity, be kept clean of UI concerns, whereas the UI portion of the application will similarly be kept clear of middle- and server-tier concerns.

The previous “standard” for Java Web UI development was Struts, and JSF is being positioned to take its place. Craig McClanahan, the creator of Struts, is now one of the driving forces behind JSF. JSF is supposed to fix many of the problems facing Struts development, and for the most part it does an admirable job, and Creator is based on JSF. Of course, it’s not perfect, but as an architect I gave up looking for the perfect solution a long time ago. What I seek now is something that works with the developers and resources available to get a job done within the allotted time. For that, Creator is a good fit.

What’s New?

Okay, so Creator 1.0 was a great tool, a good start down the road to easier, faster component based development in Java. What does 2.0 offer that was missing in 1.0? Why is the update noteworthy?

Components

Firstly, and most noticeably, there are the new components. 1.0 shipped with the components from the reference implementation (RI) of JSF. These were not bad components, but there were a few omissions of commonly desired components, and they were fairly basic requiring some CSS beautification in most cases.

The new 2.0 components are a far richer set. There are many more included components, and some welcome additions, such as a popup calendar, file upload, tree, and a fantastic new grid component with sortable columns, paging, and inline editing support.

There are also several composite components that provide some for some common tasks, such as alert messages, add and remove lists (the double pane selector style), and a breadcrumb trail. Previously components like this were only available by using Oracle’s ADF Faces or MyFaces.

These components are also themable, and there are four included sample themes that make for a pleasant looking selection of UIs. At present, there is no easy way to create your own themes, but I believe there are plans to make some kind of theme editor available in time. At present, altering the themes means delving into CSS files.

EJBs and custom data providers

Another big improvement is in the handling of EJBs. Some of the beta features of 1.0 have fed into the new EJB data provider, which means that binding the results of EJB methods to components in 2.0 is now as easy (as in drag-and-drop easy) as it was to bind query results to components in Creator 1.0.

This means that, by using Creator 2.0, you can drag and drop your way to a front end for databases (through JDBC rowsets), Web Services (using the WSDL wizard), and now EJBs—or any combination of the three.

Of course, it is also pretty easy to bind in any kind of class library you want to use. (Just import the library and start using it to set the values of beans; or, if it happens to provide a set of bean properties, bind them directly.) However Creator 2.0 does not stop there. Now, it also is possible to define your own data providers for legacy systems, file formats—indeed, anything you can think of (or maybe ones that you have not thought of yet).

Virtual forms

Creator 1.0 had a great feature, with a single but fairly large flaw. Validators could be attached to components to automatically check input values for various properties (length, format, and so forth). The flaw was that, when you submitted a page (in other words, clicked on a button or otherwise caused an event to fire), all validators for all input would be applied for the page and any failures would abort the submission and signal the error.

This meant that you could not use validators on pages where you wanted to section the page and provide different sections for different operations. Any action button would submit the page, and so all fields on the page would have to pass validation, not just fields in the section for that operation.

Creator 2.0 corrects this shortcoming. Virtual forms collect fields and components that fire events into partitions, meaning that a button or dropdown causing an event for a particular section of the page will only need validation to pass for the fields in that section of the page. This means validation becomes a lot more useful.

New Blood

Creator 2.0 is built on top of the NetBeans 4.1 base, rather than 4.0 as was the case with Creator 1.0. This makes a bigger difference than you might suppose. For one, Creator is now distributed with Java 5. Although developers cannot take advantage yet of the new language features like annotations, generics, and the new for loop, the difference is noticeable in speed, improved look and feel, and overall solidity of the IDE. Creator wasn’t a real problem for crashing before, but it feels better now. On Linux, in particular, the ability to turn on anti-aliasing of fonts. (Put -J-Dswing.aatext=true in the creator.conf file under /etc in the installation directory) and the fact that the new metal look and feel is a big improvement on the somewhat aging metal of Java 1.4, and the whole interface is just a lot prettier.)

NetBeans 4.1 also introduced some refactoring options as well, which are carried across to Creator 2.0. Don’t expect IntelliJ levels of refactoring here, but there is some useful refactoring included.

Other enhancements

There are many new features—some of which are not covered here and some of which I haven’t even found yet, but four more that are worthy of mention are:

Lifecycle Improvements

There are several new hooks in the page beans for different stages of the lifecycle now; some of these are very useful for calling code when a page is first hit, but not when an event fires on the page and the result stays on the same page. This means you can avoid some overhead in unnecessary data queries and lookups by hooking into the right events.

Portlet Development

JSR-168 standard portlets now can be developed using Creator 2.0 and then used in Java portals. This will either mean a great deal to you (if you use portals) or not a lot (if you don’t), but it is nice to have this ease of use for portals as well as full Web apps.

CSS Editor

Being a developer, I have picked up a fair bit of HTML over the years. In fact, although I might not be able to make a really pretty slick page, I can push out a full well-formed HTML page with some fairly extensive content from scratch without needing to refer to a book.

However, not being a Web designer, the same is not true for CSS. I can muddle my way through editing an existing CSS file, or even copying parts of another CSS file and adapting them, but I would rather avoid it.

For this reason, the CSS editor in Creator 2 is a godsend. In fact, this is another feature that was available for beta testing in 1.0, but it is still very welcome.

The CSS editor can be brought up either on the CSS file in the project, or (perhaps more commonly) by hitting the … button next to Style in the properties for a control.

HTTP Monitor

My final pick of useful new stuff is the integrated HTTP monitor. Turn this on in the server properties and it will record all traffic for a session, letting you drill down into individual posts and responses. For debugging a problematic and complex Web app, this is a really nice and welcome feature.

Cleaning Up AJAX

Okay, please forgive the terrible pun, but it does fit. Honestly.

Unless you have been living in a hole for the past 18 months, you probably will have heard of AJAX. The technology and the idea are not new, but the name and the hype are.

AJAX stands for Asynchronous JavaScript And XML, and amounts to nothing more than a clever use of client-side JavaScript code to communicate directly with the server and avoid unnecessary page refreshes and round trips. The result is a more interactive, less “webby” feel to Web applications, and the aim is to make something that approaches desktop levels of interactivity and ease of use available in Web UIs.

It has become popular in the last couple of years in part due to some high profile usage by Google (for gmail, Google maps, and Google suggest) and others. It is also very popular and garners much attention.

The big secret is that it is not very easy. It is not some magic wand you can wave to instantly make much cooler Web apps. In fact, AJAX usually requires a lot of custom JavaScript, careful design and planning (both on the JavaScript side and on the server side), and inevitably lots of debugging (Firefox with the Venkman debugger is probably the best option here) and maintenance. You also bump up against some of the classic problems in JavaScript programming—browser incompatibility and other unforeseen circumstances.

The Creator Way

So, AJAX is really hot, but a bit hard and labor intensive. This sounds like a perfect place to apply Java components.

Indeed, this is exactly what Creator is doing in version 2.0. There are four early examples of AJAX components now available from the update center in Creator. For full instructions of how to use these, see http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/ajax_samples.pdf, which describes all about how to update, install, and use the four example components.

These four components, while useful in their own right, will hopefully serve as an example for Web and AJAX developers to crystallize the idea of componentized AJAX for JSF. In particular, the Google maps component is a shining example of what AJAX component inclusion in a Web UI should be:

The really noteworthy things here are the ease with which points of interest (markers), zoom level, and center of map can be controlled by binding values in easily using the creator binding model for components. In a nutshell, this is AJAX usage without having to look at or deal with any JavaScript. Instead of learning an API to use AJAX components, just drop them on the page, resize them, and bind the required properties to values from a database, EJB, data structure, or some other source.

In truth, there is an extra step for using the Google maps component: You have to register to get an API key first. (This is a requirement Google places on the use of the map API, so is unavoidable.) The other three components (auto-complete text field, select value text field, and progress bar) are just as easy to include/bind without needing the extra step of obtaining a key.

This is the best handling of AJAX in a Web UI framework/IDE I have yet seen. It pushes all of the responsibility for creating, debugging, and testing the AJAX component onto the content creator, and then provides a component wrapper that you can pick up and use without needing to even glance at an API reference document.

In short, I think the handling of AJAX in Creator is exactly where it needs to be. I also hope that it gets AJAX library creators excited enough to start providing Creator components that can easily be included.

AJAX is a hot topic right now, and a useful technology when used well. I can see this being one of the big “tractor” technologies that get people interested in Creator 2.0 and trying it out. In the long run, though, I think it is the other technologies and the sheer speed and ease of development that will keep them using the tool.

Conclusion

Java Studio Creator 2.0 is a great update to the original 1.0 version in every way. Better components, faster more solid feeling UI, better base (NetBeans 4.1), many new features and tools, and EJB inclusion add to the overall improvement. The approach to providing AJAX components is extremely compelling, and I hope this alone is enough to generate a lot of interest in the tool.

Certainly, anyone who is thinking of jumping ship to one of the new breed of dynamic language-based Web UI creation systems—such as TurboGears, Django, or Ruby on Rails—would do well to include Java Studio Creator 2.0 in their comparison. I don’t say “use it;” I merely say “don’t overlook it.” The speed of development and ease of use are compelling, and at the same time you can leverage any Java language and library knowledge you already have, and still use a nice rich IDE with good editing, debugging, and diagnostic support.

Java Studio Creator 2.0 is free with a free Sun Developer Network registration. It is available for the Windows, Linux, Solaris, and Mac OS X platforms. Get it here: http://developers.sun.com/prodtech/javatools/jscreator/.

About the Author

Dick Wall is a Principal Systems Engineer for NewEnergy Associates, A Siemens Company based in Atlanta, GA that provides energy IT and consulting solutions for decision support and energy operations. He can be reached for comment on this and other matters at dick.wall@newenergyassoc.com. He also co-hosts The Java Posse, a podcast devoted to Java news and the Java community, which can be found at http://javaposse.com

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories