Archive for the 'RIA' Category

4-part RichFaces 3 webinar series, slides and recordings

RichFaces 3 webinar series with slides and actual webinar recordings (at the end of this post).

Read more »

Interesting writeup-on present and future of JavaFX

Interesting write-up on present and future of JavaFX by Osvaldo Pinali Doederlein. I had two posts on this topic JavaFX… does it have a future? (mentioned by Osvaldo) and JavaFX… it does have a future.

What RichFaces a4j:ajax adds on top JSF 2 f:ajax tag

JSF 2 now has basic Ajax support via f:ajax tag. RichFaces 3 has a very popular a4j:support tag (in fact, f:ajax was inspired by a4j:support). RichFaces 4 comes with a4j:ajax which is based on f:ajax but upgrades the tag with more features and advanced functionality. The table below show the attributes available in both tags and how RichFaces upgrades the core Ajax functionality in JSF 2 (I’ll cover a4j:ajax extra attributes in the future).

In addition to a4j:ajax, RichFaces upgrades JSF 2 with tags such as a4j:commandButton, a4j:commandLink, a4j:poll, a4j:jsFunction, a4j:outputPanel and more (covered in future posts).

Attribute f:ajax a4j:ajax
event Works the same Works the same
execute @all
@this
@form
@none
Id’s
EL
@all
@this
@form
@none
Id’s
EL (different behavior, id’s are resolved in current request)
@region (when a4j:region is used)
render @all
@this
@form
@none
Id’s
EL
@all
@this
@form
@none
Id’s
EL (different behavior, id’s are resolved in current request)
listener Works the same Works the same
onevent Works the same Works the same
onerror Works the same Works the same
immediate Works the same Works the same
disabled Works the same Works the same
onbegin n/a JavaScript to execute before Ajax request
onbeforedomupdate n/a JavaScript to execute after response comes back but before DOM update
oncomplete n/a JavaScript to execute after DOM update
bypassUpdates n/a Skips Update Model and Invoke Application phases, useful for form validation
limitRender n/a Skips all a4j:outputPanel ajaxRender=”true” areas. Only renders what is set in current render
status n/a Status to display during Ajax request
focus n/a Sets focus on component after Ajax request (not yet implemented)

Exadel Flamingo now supports CDI and Bean Validation for JavaFX

Exadel Flamingo now has support for CDI (JSR299) and Bean Validation (JSR303). You can try the features from a nightly build.

The following features are supported so far:

  • Calling CDI bean methods
  • Support for EL (Expression Language). Bind to values and invoke methods with EL in JavaFX
  • CDI conversations
  • Bean Validation (JSR303)

To download a nightly build, go to http://exadel.org/flamingo and click on Nightly builds on the right.

To get started with JavaFX and CDI/Bean Validation, you can look at these examples as reference. The client side code is the same, the only difference is instead of Seam components, you now use CDI beans on the server (and the appropriate annotations).

We are also planning to add CDI events. If there is anything else we should add, please let us know.

RichFaces 3 to RichFaces 4

RichFaces 4 is not only JSF 2 based, but also undergoing a major upgrade on the framework level. Many components are being rewritten to increase performance, reduce markup size, and make them consistent across the board. RichFaces 4 is a major upgrade and brings many improvements:

  • All JavaScript is now based on jQuery
  • Ajax framework improvements extending the JSF 2 specification
  • Component review for consistency, usability, and redesign following semantic HTML principles
  • Both server-side and client-side performance optimization
  • Strict code clean-up and review
  • New and easy to use CDK (Component Development Kit)

Although core Ajax concepts are staying the same, RichFaces 4 brings many new changes because it is now based on JSF 2. RichFaces 4 adds many new features on top of JSF 2 through its advanced features, tags, customization, and flexibility. If you have been using RichFaces, this 1-day training will bring your team up to speed with everything new in RichFaces 4. If you have questions, please contact me at:

RichFaces workshop in Germany

I will be presenting and teaching a RichFaces workshop in Nuremberg, Germany during Herbstcampus conference, September 12 – September 15, 2010.

With the upcoming RichFaces 4 release, the workshop will cover RichFaces version 4. This is a great opportunity to learn standard JSF 2 Ajax features and how RichFaces 4 advanced features, tags, customization and richness add on top of JSF 2. RichFaces 4 is a major upgrade. A lot of core functionality is being rewritten to make RichFaces faster and better. Many components are being rewritten to make them simpler, perform faster and consistent across board.

Discount
Get 25% discount by using this URL. Alternatively, you can use this booking code: ceHioRcpiD.

RichFaces workshop (full day)
Sunday, September 12, 2010
More info >>

I also have two general sessions.

Ajax Applications with JSF and the two New RichFaces 4
Monday, September 13, 2010
More info >>

Enterprise Applications with JavaFX and Flamingo
Tuesday, September 14, 2010
More info >>

As a reminder, we are also doing a webinar on September 8, 2010:
Ajax Applications with JSF 2 and the New RichFaces 4
Register >>

Webinar: Ajax Applications with JSF 2 and the New RichFaces 4 – Sept 8, 2010

With the upcoming release of RichFaces 4, we are doing a webinar on new RichFaces 4. Register and learn what’s new in RichFaces 4.

When:
Wednesday, September 8, 2010 | 2pm EDT (GMT-4 New York) / 18:00 GMT / 8pm CEST (GMT+2 Paris)

Abstract:
RichFaces is a JSF framework with AJAX components (over 100), skins, themes, and a component development kit. Although JSF 2 now offers basic AJAX functionality (which was, in fact, greatly inspired by RichFaces), a broader rich component library is still needed to build most real-world JSF AJAX applications. This webinar will first cover JSF 2 AJAX features and then the extra value the new RichFaces 4 adds on top of JSF 2 through its advanced features, tags, customization, and flexibility. Whether you are new to using JSF for developing AJAX applications or you can already show your JSF battle scars, this webinar has something to offer to you.

JavaFX… it does have a future

In looking back at my JavaFX… does it have a future? posting, my views have been changed by some of the comments made (here and here), in particular about JavaFX vs. Flash/Flex and Java Web Start.

JavaFX and applets

I agree that comparing JavaFX applets vs Flash/Flex is not something we should be doing. Flash applications (deployed inside the browser in a Flash virtual machine) are years ahead of Java applets. It will take years, if at all, for applets to match Flash-like deployment. According to Adobe, Flash is already installed on 99% of Internet-enabled desktops. In case it’s not available, installing Flash is a breeze (plus Google Chrome now ships with Flash player). Flash applications are installed very quickly, work, run smoothly inside the browser, and users are comfortable using such applications.

JavaFX and Java Web Start

On the other hand, deploying JavaFX applications via Java Web Start is an area where JavaFX could be successful and find a niche market.

A JavaFX application started via Java Web Starts runs in its own “Java window” outside the browser. This way the application is still running inside the powerful Java virtual machine, so you get a rich and responsive user interface that is also now browser-independent.

Launching via Java Web Start can be easily done by placing a link to a .jnlp file inside a Web page or even creating an icon on a desktop. Now we get the power of Java but outside the browser. However, the application still acts like a “Web application” since Java Web Start will check for any updates in the application and download them if necessary (like Adobe AIR). This way the user is always be running the latest version of the application.

For example, click here to launch JavaFX Seam Booking application via Java Web Start (note: the .jnlp file is generated in this case). Or click on this nice button:

Launch

It launched pretty fast, has its own window, no browser freezing, pretty nice.

Although I don’t see many consumers-facing applications deployed using Java Web Start (even thought it’s possible and some might), the target market is enterprise applications (or Internet business applications) such as customer support applications, rich interactive dashboards, scientific applications, educational applications, and other Intranet-based applications. For example, just replacing all Swing deployments in the enterprise would give JavaFX a huge potential market opportunity.

JavaFX and enterprise

Connecting JavaFX Web Start applications to a server is easily done with the Exadel Flamingo framework. This framework was designed from the ground up to make it simpler to attach rich UIs like JavaFX to back ends like Seam.

Furthermore, a growing requirement is to make Web applications available offline or when there is no Internet connection available. As the platform for JavaFX is the Java virtual machine, the offline feature can be more easily implemented than if the browser were the platform. And, if using the Flamingo framework, it already includes offline features that enable the application to run without an Internet connection and synchronize with the server once the connection is reestablished.

Future?

I always believed before that running JavaFX applications inside the browser was the way to go. While it’s still possible (and easily done), I don’t believe that’s the way to go anymore. The browser is a platform; the Java virtual machine is another platform. There is no need to combine the two.

RichFaces JavaScript interactions: invoking JavaScript before and after Ajax request

One of the unique features in RichFaces is its power and flexibility. If you don’t want or need to deal with JavaScript then you use controls such a4j:support, a4j:commandButton, a4j:commandLink, a4j:poll, and a4j:jsFunction to fire and Ajax request and perform partial page updates. On the other hand, if you need more flexibility or looking for more fine-grained control over what happens before and after an Ajax request, RichFaces offers such feature. The feature is usually referred to as JavaScript interactions and allows you to tap into the Ajax request before and after the request.

There are three places where you can add or inject any custom JavaScript function:

Event Description
onsubmit, onclick On submit (just before request is fired)
onbeforedomupdate Response received, but before DOM update
oncomplete After DOM update

For following example has all three events defined (onsubmit, onbeforedomupdate, oncomplete):

<h:selectOneMenu value="#{bean.text}">
   <f:selectItem itemValue="United States" itemLabel="United States"/>
   <f:selectItem itemValue="Australia" itemLabel="Australia"/>
   <f:selectItem itemValue="United Kingdom" itemLabel="United Kingdom"/>
      <a4j:support event="onchange" reRender="text"
          onsubmit="if(!confirm('Are you sure you want change the country?')) 
		      {form.reset(); return false;};"
          oncomplete="alert('Country changed. We told you so.')"
          onbeforedomupdate="alert('Just before DOM update')"/>
</h:selectOneMenu>
 
<h:outputText value=”Current selection:”/>
<h:outputText id="text" value="#{bean.text}"/>

First you will see the message “Are you sure you want to change the country”?. You will then see “Just before DOM update”. At this point the response has come back but the DOM hasn’t been updated. Lastly, after the DOM has been updated you will see “We told you so”.

When using a4j:commandButton or a4j:commandLink, onclick attribute is used instead of onsubmit:

<a4j:commandButton value="Click" onclick="alert('hi');"/>

Complete summary of all tags and which attributes are supported:

Tag Attribute Descriptoin
a4j:commandButton, a4j:commandButton onclick:
JavaScript code to be invoked before Ajax request is sent.
a4j:support, a4j:poll onsubmit:
JavaScript code to be invoked before Ajax request is sent.
a4j:commandButton, a4j:commandLink,
a4j:support, a4j:poll, a4j:jsFunction
onbeforedomupdate:
JavaScript code to be invoked after response is received but before browser DOM update
oncomplete:
JavaScript code to be invoked after browser DOM update

This is a very powerful feature and allows you to invoke any JavaScript at three points during an Ajax request. Also, these are client-side events which means they are processed in the browser.

New Exadel Flamingo 2.2.0 is now on exadel.org

After months of promising we have finally moved Exadel Flamingo to exadel.org and released version 2.2.0. exadel.org is our community site for hosting open source projects. Flamingo is a light weight framework for connecting rich web and mobile user interfaces to enterprise back end.


Click on image to enlarge

Flamingo connects Seam, Spring, and Java EE 6 (soon via CDI/JSR299) with the following user interfaces:

  • JavaFX
  • Flash
  • iPhone/Android
  • Swing
  • JavaME

Version 2.2.0 is updated with Hessian 4 and JavaFX 1.3 support.

Server-side components, methods or services can be easily invoked from the above listed clients with minimal code. Flamingo provides the following features:

  • CRUD tools
  • Server-side integration
    • Calling server components/beans
    • Context variable binding/updating
    • Conversation support
    • Validation (Hibernate Validator)
    • EL support (Expression Language)
  • Server-side push
  • Client push (off line applications)


Click image to enlarge

As you can see from the image above, no matter what client you are using, invoking a method in your enterprise applications looks very similar which allows for great reuse.

How to get started?

  • Download Flamingo from http://exadel.org/flamingo.
  • The following are good resources to get started or learn more about Flamingo.
  • Check out the recent Enterprise JavaFX and Seam series. This series shows most server integration features in separate post and easy to follow examples.
  • We want to hear your feedback, please use project Jira or the forum to report bugs or any features you would like to see.

Next Page »