Making Application Add-On ready?

21 views
Skip to first unread message

Felix Scheinost

unread,
Dec 4, 2011, 5:16:48 PM12/4/11
to Google Web Toolkit
Hi,
i tried for hours making my application "add-on ready". In my root-
app i created some javascript functions on the $wnd variable. Next, I
want so inherit some other applications normal via the "script"-tag.
The other application now should call the javascript function and pass
it a class instance with methods defined in a interface. This
Interface is in a a jar file both projects are compiled with. But the
Destination App (the root app) can't get the parameter correctly, i
cant call my defined functions on it, although the function in the
root-app IS called.
If i try this in one single app with to different classes, first
creating my class, then save it to $wnd.myvariable in one function,
then later get it in a java variable on a second i can sucessfully get
the information out of my class-instance.
I hope you undestood.
May there is another way to dynamically load other standalone
applications who pass gwt-classes via jsni to another gwt-app who
workes with them in Java?

qwertz

unread,
Dec 10, 2011, 10:06:41 AM12/10/11
to google-we...@googlegroups.com
Hi,

a while ago I created something like this. Now I created a project @googlecode:
http://code.google.com/p/gwt-plug/

You can find a very basic example in the repository. The javadoc should help you too.

But currently there are some limitations:
- Classes can only implement one exportable interface (or only one of them is really exported)
- you can't define multiple methods with the same name in one interface because javascript doesn't support method overloading (as far as I know). But I'm working on that point.
- You can only use primitive values and JavaScriptObjects as method parameters and return values. That's because:
  1. It's not possible in hosted mode to attach java objects to javascript objects
  2. In production mode the GWT compiler transformed your code and the classes are probably not equivalent in two compiled GWT applications
  -> I'm thinking about it. Probably it's possible to serialize the java objects. But that's not my main focus.

I hope that helps you. If you have further questions, ask them :)
Reply all
Reply to author
Forward
0 new messages