j2s-development] about javascript native
Brought to you by:
zhourenjian
|
From: Sebastian G. <sg...@mo...> - 2007-11-16 18:55:40
|
Hi all. Well, this is my first post to this forum. I'm starting to play with java2script and I think it is a very promising piece of software. (excuse me for my bad english) SWT port to js is great but (imho) is not oriented to the web (big, don't take advatage of css styles, ...). So I decided to start developing a small toolkit, with a simple visual paradigm that supports css styles, basic events and layouting and use a 100% java, free xhtml renderer (https://xhtmlrenderer.dev.java.net/ ) so applications can be tested in java and the translated to js. The thing is that i'm using @j2s* java annotations for expressing native javascript code. My problem is that from a javascript native code I want to call a java method, and this will create problems when auto refactoring the code with eclipse. So my question is if there is a java annotation for execute a code block A in javascript environment and B in a java environment. Something that translate the following code P1 if(false) /** @j2sSOMETHING */ { A } else { B } P2 to the next javascript code: P1 A P2 (in java the block A will be never executed). Well, if there isn't something like that, it would be nice because it is nice to test web applications first in a jvm, but to use the ide refactoring tools too!!) I hope you can understand my point. Congratulations again for this project and for make it opensource. p/d I had investigating about making a java to javascript translator using eclipse ' jdt, but, although jdt's ast parser is makes very easy to analize a java compile unit, it is hard to create the equivalent javascript code. So, when I saw java2script and check that the translator works well, i surrender... and now i move on using java2js. If you want, only for curiosity, i could send my eclipse plugin with this unfinnished translator (i use java annotations for javascript native code too!!) |