Category Archives: Sharing

Eclipse RAP 1.0 Comes

Eclipse RAP team has just released its 1.0.

The RAP project enables developers to build rich, Ajax-enabled Web applications by using the Eclipse development model, plug-ins with the well known Eclipse workbench extenstion points, JFace, and a widget toolkit with SWT API (using qooxdoo for the client-side presentation). The project has graduated from incubation and released its 1.0 release.

In fact, Eclipse RAP and Java2Script have a lot in common. Both are based on SWT API and have goals to provide ways for developers to share the same base of code for products that deploy to the web and the desktop. Here is overview of Eclipse RAP. And you can also read Java2Script’s overview for comparisons.

And you can also check out Eclipse RAP demo to get more details. It’s interesting to see that RAP and Java2Script have 2 very similar demos: RAP’s RWT Control Demo and Java2Script’s SWT Control Examples.

More discussion may be found at ajaxian.com.

Related link: InfoWorld Eclipse offers AJAX server

Posted in AJAX, Java, Sharing, SWT | 2 Comments

Java2Script Gtalk on Opera Mini 4

It’s amazing to see that Java2Script’s Google Talk get run on Opera Mini 4 inside a mobile phone.

Here is Opera Mini 4’s simulator for you to test its CSS/JavaScript/AJAX compatibilities:
http://www.operamini.com/beta/simulator/

Here are screenshots:
opera-mini-j2s-gtalk-small.png

Zoom in to get a clear look:
opera-mini-j2s-gtalk-zoom-in.png

Login and connect:
opera-mini-j2s-gtalk-connecting1.png

Now we are in:
opera-mini-j2s-gtalk-logined-small.png

Zoom in to get a clear look on friend list:
opera-mini-j2s-gtalk-friend-list.png

But Java2Script Gtalk does not get run as totally correct. It fails to maintain normal connection back to Gtalk proxy server. So after a few seconds, the proxy server closes the connection. Maybe Java2Script Gtalk may fix this problem later. And also I think Opera Mini team may improve its AJAX supports in the near future so nothing need to be modified.

Posted in JavaScript, Opera Mini, Screenshot, Sharing | 74 Comments

Reload:A Link An Application

Copy following as a link and paste in your browser address bar (A new tab or a new window, or other existed tab page[Maybe a Google search result page, not this blog page]):

javascript:if(a="$wt.examples.controlexample.ControlExample@http://demo.java2script.org/org.eclipse.swt.examples/bin/",window["ClazzLoader"]!=null)$w$(a);else{var d=document,t="onreadystatechange",x=d.createElement("SCRIPT"),f=function(){var s=this.readyState;if(s==null||s=="loaded"||s=="complete"){$w$(a);}};x.src="http://archive.java2script.org/1.0.0-v20061220/j2slib.z.js";(typeof x[t]=="undefined")?x.onload=f:x[t]=f;d.getElementsByTagName("HEAD")[0].appendChild(x);void(0);}

According to your connection speed, it may take a few seconds before some Java2Script things come up. Enjoy it.

Replace the link’s “$wt.examples.controlexample.ControlExample @ http://demo.java2script.org/org.eclipse.swt.examples/bin/” with your Java2Script application URL. It’s class’s full name + @ + the class’s *.js bin root folder. If the URL is not very long (total javascript url string length < 500), it will be OK for modern browsers to load your application.

Posted in A Link An Application, AJAX, ALAA, JavaScript, Sharing, SWT | 173 Comments

Screenshot of Java2Script Web Notepad

I spent some time to enhance a web notepad with auto-save feature. Here is screenshot:

Java2Script Web Notepad

As a matter of security fact, it is not ready for public tests, so now I am not publishing the . Maybe later I will add more strict rules to the notepad so that no malicious modifications harm the system. Or maybe I will not take such a risk.

Actually, more desktop applications can be converted into rich internet applications. I even consider converting a terminal console into Java2Script web application is possible. But maybe I won’t do so.

Posted in AJAX, Java, RPC, Screenshot, Sharing, Simple RPC, SWT | 6 Comments

ColorDialog and FontDialog

Now comes JavaScript version of SWT ColorDialog and FontDialog:

J2S SWT Color Dialog

J2S SWT Font Dialog

Posted in Java2Script News, Screenshot, Sharing | 5 Comments

Java-JavaScript Compiler Discussion

Ash mentioned Java2Script in the thread of “Java-JavaScript Compiler” in GWT’s group forum. And I joined in the discussion. I was not intended to post another GWT v.s. JavaScript post there (But it seems it was a v.s. thing actually). I just wanted to share things, correct my understanding and learn new things.

In those discussion, Bruce from Google told us that GWT’s motivation is “to be as small and as efficient as possible” and its two separate goals are:
(1) Create highly optimized JS output
(2) Optionally, publish selected parts of your code with a JS-compatible API
I thought that wais a very clever design. And I admired GWT team for its “excellent 100k ~ 200k final *.js files with very good performance”.
OK, if you are interested in Java to JavaScript technology, just go to GWT’s forum and ask GWT team for more details.

By the way, it seems that Java2Script website provides no detailed documents about Java to JavaScript compiler technology. I posted some details there in the discussion. Just check it out there. Or you can check sources from SVN for more details.

Posted in Java, JavaScript, Sharing | Leave a comment

LZ77 JavaScript Compressor Reloaded

Updated: June 4, 2007, LZ77 JavaScript Compressor http://demo.java2script.org/lz77js/ is rebuilt using Java2Script Simple RPC technology.

In early of this year, I had a post “LZ77-JS-Compressor: Another way of compressing JavaScript“. It seemed that lots of people were seeking pure LZ77 JavaScript Compressor, and some of them clicked the above post. And the above link is on the top 2 position for key world “js compressor” in Google.

As mentioned in the above post, pure JavaScript decoder’s performance was very poor for large *.js file (>200k)! So I stopped focusing on further development of LZ77 JS compressor after the post. So no technical details were found there but pure LZ77 JS compressor’s poor performance was told there.

But as top 2 position link for key world “js compressor” in Google, I decide not to disappoint visitors with no discrete implementations any more. Here now, I give an implementation (Thanks for J2S 1.0.0 M3, so such a solution does not require much time and pains):

LZ77 JavaScript Compressor“: This is a J2S/SWT application, sending the raw JavaScript sources back to server to do LZ77 compressing (Java servlet). (Mentioned: the server s eems being unstable with low bandwidth.)

J2S SWT LZ77 JavaScript Compressor

If you uncheck “RegExp trimming before LZ77” option in the above application, you can compress any plain text (HTML/CSS/SVG/…) besides JavaScript sources.

This LZ77 implementation was considered as buggy. I used in J2S Clazz.

BTW: Developing the above J2S/SWT application (including wrapping the old LZ77 utilities into a servlet) took me about 2 hours.

For JS compressor, I recommend you to use Dean’s Packer.

PS: “LZ77 JavaScript Compressor” is now using LZ77-JS-Comopresser compressed JavaScript: http://bl.ognize.com/j2s-ajax-rss-reader/net.sf.j2s.lib_1.0.0.v320/j2slib/j2slib.lz77.z.js (30k) rather than earlier http://bl.ognize.com/j2s-ajax-rss-reader/net.sf.j2s.lib_1.0.0.v320/j2slib/j2slib.z.js (55k)

Posted in AJAX, JavaScript, Sharing | 5 Comments

Java2Script 1.0.0 Roadmap

Road to Java2Script 1.0.0 release:

  • 1.0.0 M3 will be released at Aug 20, 2006.
    In this release, main features include

    • Full support of Eclipse 3.2.0 beside Eclipse 3.1.*
    • No more need of extra JDT core jar enhancement
    • Dynamic JavaScript loading
    • Early Java reflection implementation
    • JUnit support
    • CTabFolder, Table, Combo, Spinner, ProgressBar, Scale improved
    • Early key navigation support
    • Lazy layout improved
    • Support more look and feels
  • 1.0.0 M4 will be released at about Oct 9, 2006. In this release, all features should be locked.
    Coming features include

    • CoolBar, ToolBar, Menu, ColorDialog, FontDialog, more custom widgets improvement
    • Look and feel manager
    • Key navigation system
    • DND system improvement
    • Windows manager
    • Extension points for RPC calls (only interfaces with a very simple reference implementation)
    • Bug-fix of M3
  • There is no 1.0.0 M5 but will be 1.0.0 RC release at Nov 11, 2006
    Works to be done include

    • Dynamic JavaScript loading performance tunning
    • Packing system tunning
    • J2SClazz core packing and zipping
    • J2S SWT performance tunning
    • J2S SWT packing tunning
    • Benchmark system for Java2Script
    • More integration tunning
  • The final release of 1.0.0 will be released in later December, 2006, about one year after Java2Script is open sourced. All thing may depend on feedback of 1.0.0 RC.
    Works to be done include

    • More tutorials
    • White paper
    • Demo projects using Java2Script
    • Documents
    • Lots of XXX v.s. J2S to tell developers about advantages and disadvantages of J2S.
Posted in Java, Java2Script News, JavaScript, Sharing | 51 Comments

SWT Snippets (Reloaded)

Not all the snippets is supported!
Enjoy finding out which J2S SWT Snippets work. J2S SWT is still under developing.

Why is called “Reloaded”?
In the early stage of Java2Script project, SWT Snippets was a showcase page. And it was also a test case page. So this page is just reloaded form former page. The first time I setuped Snippets page, it cost me some time. But as Java2Script project got much improvement. Now, it’s much easier for me to setup the whole SWT Snippets page. And with more and more improvement, I am sure that it will be more convenient to integrate Java2Script application with existed HTML applications(pages).

Posted in Java2Script News, Sharing, SWT | Leave a comment

A Link An Application

For example:

javascript:(function(){var d=document,b=%22http://java2script.ognize.com/1.0.0-m3/%22,t=%22onreadystatechange%22,x=d.createElement(%22SCRIPT%22),f=function(){var s=this.readyState;if(s==null||s==%22loaded%22||s==%22complete%22){var c=%22org.eclipse.swt.examples.controlexample.ControlExample%22;$CL1(b);$CL2(b+%22../control-examples/%22);$CL3(c,function(){eval(c+%22.main([]);%22);});}};x.src=b+%22j2slib.js%22;(typeof x[t]==%22undefined%22)?x.onload=f:x[t]=f;d.getElementsByTagName(%22HEAD%22)[0].appendChild(x);return;})();

will link to an SWT control examples. We can also call this as “A Link An Application”(ALAA).

OK, let’s see what is going on. Now load SWT control examples from java2script.ognize.com (test site only, may be slow and unstable, enjoy it) into this page.

Or, you can copy the link of SWT control examples, and then visit a new HTML page, for example, visit Google, and then paste the link to the location, and then go. You should find the SWT control examples will be loaded inside Google’s page. All you dealing with is just a link! But you alreay get an application everywhere inside your browser.
Users can also bookmark the “javascript:…” links. To bookmark a “javascript:…” link, you should first bookmark a normal HTML page, and then copy the “javascript:…” link location and paste as URL location in the bookmark’s properties dialog. Some browsers (e.g. Opera) will let you change URL when you’re bookmarking without a later modification of URL.
And whenever users want to load the application, users can click the bookmark, which will bring up the application in users’ currently visiting HTML page. For example, if you have already bookmarked the above SWT control examples application as “javascript:…” link. And if you are visiting visit W3C, and you can click the bookmark, and the application will be loaded without leaving the W3C pages.

That is the mean of “A link An Application”. A “javascript:…” link is an application, which may be hosted inside any given HTML pages. And the “javascript:…” link would be a very useful and complicated application besides those simple “javascript:history.go (-1);” or “javascript:alert(document.lastModified);”. So there are chances that you can deliver your useful and complicated web applications via generated “javascript:…” links into any other HTML paes or other web applications.

You can also considered the “javascript:…” link as plugin extensions to the browsers that needs no installations (Only bookmarking). There are plugins for Firefox or IE. Most of those plugins need installations and may also need manually updates or uninstallations. But the “javascript:…” links is free of those deployment instructions. All the application is just a “javascript:…” link. That is enough simple.

A link is an application. An application is a link.

Posted in A Link An Application, ALAA, Java, Java2Script News, JavaScript, Sharing, SWT | Comments Off on A Link An Application