Hi,

I am trying to map existing JavaScript 'classes' in the document to
client-side Java classes. Take this example JS 'class':

Alerter = function() {
  this.alert = function(msg) {
    alert(msg);
  };
};

Mapping this to a client-side Java class currently means:

class Alerter extends JavaScriptObject {

  public static final native Alerter create() /*-{
    return { impl: new Alerter() };
  }-*/

  public final native void alert(String msg) {
    this.impl.alert(msg);
    // or for repeatability: return this.impl.alert.apply(this,
arguments);
  }

}

I feel it should be possible to do this in Java:

(...)
public static final native Alerter create() /*-{
  return new Alerter();
}-*/
public final native void alert(String msg);
(...)

This directly maps the Java declaration to the JavaScript
implementation.

I hope this example made sense. If you think my abstraction attempt is
ridiculous or I could approach this in another way or this is the
single most awesome idea ever, please respond.

Reinier

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to