Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT Java Emulation

I have some code which uses java.awt.Color. I want to translate my Java Code to GWT. So I will emulate java.awt.Color in my GWT Project.

One approach is to write a module called java.AWT.gwt.xml whose source path is awt and a class called java.awt.Color.

The other approach is to create a folder com.google.gwt.emul.java.awt and create java.awt.Color class inside that path. Eclipse will show errors. But compiler will work.

Which one is appropriate way to add java.awt.Color for GWT?

like image 209
user706071 Avatar asked Sep 23 '26 15:09

user706071


1 Answers

You'd rather create a subfolder (say 'super') in whichever module you want (probably the module for the code you want to make "translatable") and declare it as a super-source in your module's gwt.xml:

<super-source path="super" />

And you'd put your java/awt/Color.java in there.

The Eclipse errors are normal, it's not source code that should be compiled (by javac, to a *.class file), only code for the GWT compile, which works from the *.java file. So you'd want to exclude the super subfolder from your build path.

That's it!

See also the Overriding one package implementation with another subsection at http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModuleXml

like image 130
Thomas Broyer Avatar answered Sep 26 '26 05:09

Thomas Broyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!