java2script

Java2Script: Bridge of RCP to RIA

Reusing Java codes and tools into JavaScript

Table of Contents

What is Java2Script Pacemaker

Java2Script (J2S) Pacemaker is an Eclipse JDT plugin that provides the Java to JavaScript compiler.

As for a whole integration for Eclipse JDT environment, Java2Script Pacemaker provides a new Object Oriented JavaScript Simulator library with some other basic libraries, such as java.lang.*, java.util.*, junit.*, org.eclipse.swt.*, AJAX related libraries and others

RCP to RIA: Reusing Java codes and tools into JavaScript

Converting Rich Client Platform (RCP) to Rich Internet Application (RIA) will have the following advances:

The architecture of Java2Script's RCP to RIA:

Architecture of Java2Script

JavaScript version of Eclipse Standard Widget Toolkit(SWT)

Eclipse Standard Widget Toolkit(SWT) is another mature UI toolkit besides the Swing. And it is platform specific. It has versions of Win32, GTK, OS X, and others. And it is sure that it can have its cross-browser version: it's Java2Script's SWT.

There are many UI toolkits for HTML with AJAX support these days. For examples, Bindows, Dojo, Backbase, ... and the latest Google Web Toolkit. All these toolkits has their own APIs, and you have to learn their APIs before you can build something. And there are lack of development tools when comparing to the Swing, SWT APIs. So the mature tools development tools for Swing, SWT won't help developing for those HTML UI toolkits.

While Java2Script providing a JavaScript version of SWT HTML UI toolkit, all existed SWT UI development tools can be reused. For example, Eclipse Visual Editor, SWT Designer, and others. Besides tools can be reused, you can also reused existed UI components, such dialogs and wizards. And if you are already familiar with SWT APIs, you won't have any extra learning time before developing HTML UI components.

As a matter of fact you must know, Java2Script' SWT library is an heavy-weight client UI library. There are no need to send events back to server. As a result, the size of the *.js files are somewhat huge, it's about 500k for 90+% support of SWT. You can reducing the bandwidth by sending *.js in gzip format and you can seperate the SWT library into small functions packages and send necessary parts. The size of *.js can be reduced to about 200k with supports of most of common SWT widgets.

Using Java2Script Pacemaker

Screenshot of J2S SWT Control Example

Using Java2Script Pacemaker won't require any extra APIs learning. All you have to do is to develop your Java applications in Eclipse as normal. Developing your application as "Java Application", you may debug into sources line by line by using Eclipse's debugging, and you may design your SWT dialogs by SWT UI designer, and you may do necessary refactoring, and you may format your codes and you may ..., you can do anything you are familiar with Eclipse JDT.

After you finishing your Java application, then you can "Enable Java2Script Compiler" to convert your RCP application into RIA. For more technical details, please read Getting Started Tutorials.

After something like "Bang!", you will get the your RIA running inside browsers.

After testing the application in standalone browser outside Eclipse platform, you can also deploy the RIA to server (Manually by coping *.js, *.css and *.html files). Then you will have both RCP and RIA!

Java2Script Features

Java2Script